Skip to content

Commit

Permalink
Integrations: Fix terms consent display when they are required
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Nov 7, 2019
1 parent ea5e5e2 commit 394aedb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Bug fix:
* RoomVC: Fix crash occurring when tap on an unsent media with retrieved event equal to nil.
* Emoji Picker: Background color is not white (#2630).
* Device Verification: Selecting 'start verification' from a keyshare request wedges you in an entirely blank verification screen (#2504).
* Integrations: Fix terms consent display when they are required

Changes in 0.10.0 (2019-10-11)
===============================================
Expand Down
31 changes: 14 additions & 17 deletions Riot/Managers/Widgets/WidgetManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -619,28 +619,25 @@ - (MXHTTPOperation *)validateScalarToken:(NSString*)scalarToken forMXSession:(MX

NSLog(@"[WidgetManager] validateScalarToken. Error in modular/account request. statusCode: %@", @(urlResponse.statusCode));

if (urlResponse && urlResponse.statusCode / 100 != 2)
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 if (urlResponse && urlResponse.statusCode / 100 != 2)
{
complete(NO);
}
else if (failure)
{
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);
}
failure(error);
}
}];
}
Expand Down

0 comments on commit 394aedb

Please sign in to comment.