From 12f7ca94ab445a6908b3b97b144b2cd313b9af75 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 5 Sep 2019 12:16:31 +0200 Subject: [PATCH 1/2] Do not use anymore MXRestClient.credentials.identityServer --- Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m | 2 +- Riot/Modules/Settings/SettingsViewController.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m b/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m index 56b3ed8a5..e45d67397 100644 --- a/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m +++ b/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m @@ -417,7 +417,7 @@ NSLog(@"[ForgotPasswordInputsView] checkIdentityServerRequirement: %@", matrixVersions.doesServerRequireIdentityServerParam ? @"YES": @"NO"); if (matrixVersions.doesServerRequireIdentityServerParam - && !mxRestClient.credentials.identityServer) + && !mxRestClient.identityServer) { failure([NSError errorWithDomain:MXKAuthErrorDomain code:0 diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 1833eb093..605b0bbde 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -3775,7 +3775,7 @@ SingleImagePickerPresenterDelegate> NSLog(@"[SettingsViewController] checkIdentityServerRequirement: %@", matrixVersions.doesServerRequireIdentityServerParam ? @"YES": @"NO"); if (matrixVersions.doesServerRequireIdentityServerParam - && !mxRestClient.credentials.identityServer) + && !mxRestClient.identityServer) { NSString *message; if ([medium isEqualToString:kMX3PIDMediumMSISDN]) From 3e4b1a68e3f964b680b7d113cc2c11a480c7f644 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 5 Sep 2019 12:22:18 +0200 Subject: [PATCH 2/2] Settings: Update the screen if IS is changed from another device #2665 --- Riot/Modules/Settings/SettingsViewController.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 605b0bbde..9d356a4d9 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -322,6 +322,8 @@ SingleImagePickerPresenterDelegate> [self refreshSettings]; }]; + + [self registerAccountDataDidChangeIdentityServerNotification]; // Add each matrix session, to update the view controller appearance according to mx sessions state NSArray *sessions = [AppDelegate theDelegate].mxSessions; @@ -4537,4 +4539,17 @@ SingleImagePickerPresenterDelegate> [self.tableView reloadData]; } + +#pragma mark - Identity Server updates + +- (void)registerAccountDataDidChangeIdentityServerNotification +{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAccountDataDidChangeIdentityServerNotification:) name:kMXSessionAccountDataDidChangeIdentityServerNotification object:nil]; +} + +- (void)handleAccountDataDidChangeIdentityServerNotification:(NSNotification*)notification +{ + [self refreshSettings]; +} + @end