diff --git a/CHANGES.rst b/CHANGES.rst index 43b39fc40..36acf43d1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,7 @@ Bug fix: * 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). * 3D touching a link can lock the app (#1818). + * Do not display key backup UI if the user has no e2e rooms (#2304). Changes in 0.8.1 (2019-02-19) =============================================== 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; 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: