Show an activity indicator whilst preparing the identity service. Show an alert when there's an error.

This commit is contained in:
Doug
2021-09-13 14:25:54 +01:00
parent c1ad2e9ece
commit 806c6d3677
4 changed files with 51 additions and 3 deletions
+25 -2
View File
@@ -3123,19 +3123,40 @@ TableViewSectionsDelegate>
{
MXWeakify(self);
// The preparation can take some time so indicate this to the user
[self startActivityIndicator];
[session prepareIdentityServiceForTermsWithDefault:RiotSettings.shared.identityServerUrlString
completion:^(MXSession *session, NSString *baseURL, NSString *accessToken) {
success:^(MXSession *session, NSString *baseURL, NSString *accessToken) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
// Present the terms of the identity server.
[self presentIdentityServerTermsWithSession:session baseURL:baseURL andAccessToken:accessToken];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"contacts_access_identity_service_error", @"Vector", nil)
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"]
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
[MXKAppSettings standardAppSettings].syncLocalContacts = NO;
[self updateSections];
}];
}
}
else
{
[MXKAppSettings standardAppSettings].syncLocalContacts = NO;
[self updateSections];
}
}
@@ -4547,11 +4568,13 @@ TableViewSectionsDelegate>
[coordinatorBridgePresenter dismissWithAnimated:YES completion:^{
}];
[self updateSections];
self.serviceTermsModalCoordinatorBridgePresenter = nil;
}
- (void)serviceTermsModalCoordinatorBridgePresenterDelegateDidClose:(ServiceTermsModalCoordinatorBridgePresenter * _Nonnull)coordinatorBridgePresenter
{
[self updateSections];
self.serviceTermsModalCoordinatorBridgePresenter = nil;
}