From 9c7103ee0ff57197ad1c0daad22ce5be2a077550 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 5 Mar 2019 15:35:39 +0100 Subject: [PATCH 1/3] Do not present key backup banner on HomeVIewController if there are no keys to backup --- Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m index 68b492874..8f17b3f77 100644 --- a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m +++ b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m @@ -175,8 +175,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou - (BOOL)updateKeyBackupBanner { KeyBackupBanner keyBackupBanner = KeyBackupBannerNone; - - if (self.recentsDataSourceMode == RecentsDataSourceModeHome) + + if (self.recentsDataSourceMode == RecentsDataSourceModeHome && self.mxSession.crypto.backup.hasKeysToBackup) { KeyBackupBannerPreferences *keyBackupBannersPreferences = KeyBackupBannerPreferences.shared; From 2a80a2ee04cce105f1ad559d0df9469ca6278486 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 5 Mar 2019 15:53:58 +0100 Subject: [PATCH 2/3] Do not mention key backup on sign out when there is no keys to backup --- Riot/Modules/Settings/SettingsViewController.m | 13 +++++++------ .../Settings/SignOut/SignOutAlertPresenter.swift | 12 +++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 3ea8338fe..194d91243 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2711,12 +2711,13 @@ SignOutAlertPresenterDelegate> { self.signOutButton = (UIButton*)sender; - MXKeyBackupState backupState = self.mainSession.crypto.backup.state; - [self.signOutAlertPresenter - presentFor:backupState - from:self - sourceView:self.signOutButton - animated:YES]; + MXKeyBackup *keyBackup = self.mainSession.crypto.backup; + + [self.signOutAlertPresenter presentFor:keyBackup.state + areThereKeysToBackup:keyBackup.hasKeysToBackup + from:self + sourceView:self.signOutButton + animated:YES]; } - (void)onRemove3PID:(NSIndexPath*)path diff --git a/Riot/Modules/Settings/SignOut/SignOutAlertPresenter.swift b/Riot/Modules/Settings/SignOut/SignOutAlertPresenter.swift index a29a8bc5a..83bfa03f2 100644 --- a/Riot/Modules/Settings/SignOut/SignOutAlertPresenter.swift +++ b/Riot/Modules/Settings/SignOut/SignOutAlertPresenter.swift @@ -37,9 +37,19 @@ final class SignOutAlertPresenter: NSObject { // MARK: - Public - func present(for keyBackupState: MXKeyBackupState, from viewController: UIViewController, sourceView: UIView?, animated: Bool) { + func present(for keyBackupState: MXKeyBackupState, + areThereKeysToBackup: Bool, + from viewController: UIViewController, + sourceView: UIView?, + animated: Bool) { self.sourceView = sourceView self.presentingViewController = viewController + + guard areThereKeysToBackup else { + // If there is no keys to backup do not mention key backup and present same alert as if we had an existing backup. + self.presentExistingBackupAlert(animated: animated) + return + } switch keyBackupState { case MXKeyBackupStateUnknown, MXKeyBackupStateDisabled, MXKeyBackupStateCheckingBackUpOnHomeserver: From c84eafb1a4010656493af7a4c924fff4786db5c5 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 5 Mar 2019 15:55:39 +0100 Subject: [PATCH 3/3] Update changes --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index dea92c4e5..506e629fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,6 +18,7 @@ Bug fix: * Reskin: HomeVC: use notices colors for badges background in section headers (#2292). * Crash in Settings in 0.8.1 (#2295). * Quickly tapping on a URL in a message highlights the message rather than opening the URL (#728). + * Do not display key backup UI if the user has no e2e rooms (#2304). Changes in 0.8.1 (2019-02-19) ===============================================