Merge pull request #2310 from vector-im/riot_2304

BF: Do not display key backup UI if the user has no e2e rooms
This commit is contained in:
SBiOSoftWhare 2019-03-05 16:10:50 +01:00 committed by GitHub
commit 4a8a4de078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 9 deletions

View file

@ -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)
===============================================

View file

@ -176,7 +176,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
KeyBackupBanner keyBackupBanner = KeyBackupBannerNone;
if (self.recentsDataSourceMode == RecentsDataSourceModeHome)
if (self.recentsDataSourceMode == RecentsDataSourceModeHome && self.mxSession.crypto.backup.hasKeysToBackup)
{
KeyBackupBannerPreferences *keyBackupBannersPreferences = KeyBackupBannerPreferences.shared;

View file

@ -2711,9 +2711,10 @@ SignOutAlertPresenterDelegate>
{
self.signOutButton = (UIButton*)sender;
MXKeyBackupState backupState = self.mainSession.crypto.backup.state;
[self.signOutAlertPresenter
presentFor:backupState
MXKeyBackup *keyBackup = self.mainSession.crypto.backup;
[self.signOutAlertPresenter presentFor:keyBackup.state
areThereKeysToBackup:keyBackup.hasKeysToBackup
from:self
sourceView:self.signOutButton
animated:YES];

View file

@ -37,10 +37,20 @@ 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:
self.presentNonExistingBackupAlert(animated: animated)