mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
MESSENGER-2762 Initial Merge
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright 2020 New Vector Ltd
|
||||
Copyright (c) 2021 BWI GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -86,18 +87,21 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
// MARK: - Private
|
||||
|
||||
private func setupViews() {
|
||||
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidCancel(self, showSkipAlert: true)
|
||||
}
|
||||
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
|
||||
|
||||
self.title = VectorL10n.secureKeyBackupSetupIntroTitle
|
||||
|
||||
self.informationLabel.text = VectorL10n.secureKeyBackupSetupIntroInfo
|
||||
|
||||
if let session = AppDelegate.theDelegate().mxSessions.first as? MXSession {
|
||||
if !session.homeserverWellknown.backupRequired() {
|
||||
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidCancel(self, showSkipAlert: true)
|
||||
}
|
||||
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
|
||||
}
|
||||
}
|
||||
|
||||
self.secureKeyCell.fill(title: VectorL10n.secureKeyBackupSetupIntroUseSecurityKeyTitle,
|
||||
information: VectorL10n.secureKeyBackupSetupIntroUseSecurityKeyInfo,
|
||||
image: Asset.Images.secretsSetupKey.image)
|
||||
@@ -119,6 +123,19 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
}
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidTapUsePassphrase(self)
|
||||
}
|
||||
|
||||
setupBackupMethods()
|
||||
}
|
||||
|
||||
private func setupBackupMethods() {
|
||||
// Hide setup methods that are not listed
|
||||
if !self.viewModel.wellKnown.isBackupMethodKeySupported() {
|
||||
self.secureKeyCell.isHidden = true
|
||||
}
|
||||
|
||||
if !self.viewModel.wellKnown.isBackupMethodPassphraseSupported() {
|
||||
self.securePassphraseCell.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
private func renderLoading() {
|
||||
@@ -172,27 +189,44 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
// we need to get this private key first. Ask the user to make a key backup restore to catch it
|
||||
if keyBackup.keyBackupVersion != nil && keyBackup.hasPrivateKeyInCryptoStore == false {
|
||||
|
||||
let alertController = UIAlertController(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorTitle,
|
||||
message: VectorL10n.secureKeyBackupSetupExistingBackupErrorInfo,
|
||||
preferredStyle: .alert)
|
||||
// don't show dialog if forced, already asked before in mandatory verification recover
|
||||
if BuildSettings.forceResetBackupIfLost {
|
||||
let alertController = UIAlertController(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorTitle,
|
||||
message: VectorL10n.secureKeyBackupSetupExistingBackupErrorInfo,
|
||||
preferredStyle: .alert)
|
||||
|
||||
let connectAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorUnlockIt, style: .default) { (_) in
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidTapConnectToKeyBackup(self)
|
||||
let connectAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorUnlockIt, style: .default) { (_) in
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidTapConnectToKeyBackup(self)
|
||||
}
|
||||
|
||||
let resetAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorDeleteIt, style: .destructive) { (_) in
|
||||
self.deleteKeybackup()
|
||||
}
|
||||
} else {
|
||||
|
||||
let alertContoller = UIAlertController(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorTitle,
|
||||
message: VectorL10n.secureKeyBackupSetupExistingBackupErrorInfo,
|
||||
preferredStyle: .alert)
|
||||
|
||||
let connectAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorUnlockIt, style: .default) { (_) in
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidTapConnectToKeyBackup(self)
|
||||
}
|
||||
|
||||
let resetAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorDeleteIt, style: .destructive) { (_) in
|
||||
self.deleteKeybackup()
|
||||
}
|
||||
|
||||
let cancelAction = UIAlertAction(title: VectorL10n.cancel, style: .cancel) { (_) in
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidCancel(self, showSkipAlert: false)
|
||||
}
|
||||
|
||||
alertContoller.addAction(connectAction)
|
||||
alertContoller.addAction(resetAction)
|
||||
alertContoller.addAction(cancelAction)
|
||||
|
||||
self.present(alertContoller, animated: true)
|
||||
|
||||
}
|
||||
|
||||
let resetAction = UIAlertAction(title: VectorL10n.secureKeyBackupSetupExistingBackupErrorDeleteIt, style: .destructive) { (_) in
|
||||
self.deleteKeybackup()
|
||||
}
|
||||
|
||||
let cancelAction = UIAlertAction(title: VectorL10n.cancel, style: .cancel) { (_) in
|
||||
self.delegate?.secureBackupSetupIntroViewControllerDidCancel(self, showSkipAlert: false)
|
||||
}
|
||||
|
||||
alertController.addAction(connectAction)
|
||||
alertController.addAction(resetAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
self.present(alertController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user