mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 01:52:44 +02:00
IM: Detect not signed terms error
(cherry picked from commit 80877eabafc2184ef55c279d2a8f2db10d9735e3)
This commit is contained in:
@@ -513,6 +513,8 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||
MXHTTPOperation *operation;
|
||||
NSString *userId = mxSession.myUser.userId;
|
||||
|
||||
NSLog(@"[WidgetManager] registerForScalarToken");
|
||||
|
||||
WidgetManagerConfig *config = [self configForUser:userId];
|
||||
if (!config.hasUrls)
|
||||
{
|
||||
@@ -539,6 +541,10 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||
MXJSONModelSetString(scalarToken, JSONResponse[@"scalar_token"])
|
||||
config.scalarToken = scalarToken;
|
||||
|
||||
// Validate it (this mostly checks to see if the IM needs us to agree to some terms)
|
||||
// TODO
|
||||
// return this._checkToken(tokenObject);
|
||||
|
||||
self->configs[userId] = config;
|
||||
[self saveConfigs];
|
||||
|
||||
@@ -622,7 +628,22 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||
}
|
||||
else if (failure)
|
||||
{
|
||||
failure(error);
|
||||
MXError *mxError = [[MXError alloc] initWithNSError:error];
|
||||
if ([mxError.errcode isEqualToString:kMXErrCodeStringTermsNotSigned])
|
||||
{
|
||||
NSLog(@"[WidgetManager] validateScalarToke. Error: Need to accept terms");
|
||||
NSError *termsNotSignedError = [NSError errorWithDomain:WidgetManagerErrorDomain
|
||||
code:WidgetManagerErrorCodeTermsNotSigned
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey:error.userInfo[NSLocalizedDescriptionKey]
|
||||
}];
|
||||
|
||||
failure(termsNotSignedError);
|
||||
}
|
||||
else
|
||||
{
|
||||
failure(error);
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user