mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
merged element 1.8.10
This commit is contained in:
@@ -40,6 +40,7 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
// MARK: Private
|
||||
|
||||
private var viewModel: SecureBackupSetupIntroViewModelType!
|
||||
private var cancellable: Bool!
|
||||
private var theme: Theme!
|
||||
|
||||
private var activityIndicatorPresenter: ActivityIndicatorPresenter!
|
||||
@@ -51,9 +52,10 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
class func instantiate(with viewModel: SecureBackupSetupIntroViewModelType) -> SecureBackupSetupIntroViewController {
|
||||
class func instantiate(with viewModel: SecureBackupSetupIntroViewModelType, cancellable: Bool) -> SecureBackupSetupIntroViewController {
|
||||
let viewController = StoryboardScene.SecureBackupSetupIntroViewController.initialScene.instantiate()
|
||||
viewController.viewModel = viewModel
|
||||
viewController.cancellable = cancellable
|
||||
viewController.theme = ThemeService.shared().theme
|
||||
return viewController
|
||||
}
|
||||
@@ -87,6 +89,16 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
// MARK: - Private
|
||||
|
||||
private func setupViews() {
|
||||
if self.cancellable {
|
||||
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
|
||||
|
||||
@@ -126,14 +138,16 @@ final class SecureBackupSetupIntroViewController: UIViewController {
|
||||
|
||||
setupBackupMethods()
|
||||
}
|
||||
|
||||
|
||||
private func setupBackupMethods() {
|
||||
let secureBackupSetupMethods = self.viewModel.homeserverEncryptionConfiguration.secureBackupSetupMethods
|
||||
|
||||
// Hide setup methods that are not listed
|
||||
if !self.viewModel.wellKnown.isBackupMethodKeySupported() {
|
||||
if !secureBackupSetupMethods.contains(.key) {
|
||||
self.secureKeyCell.isHidden = true
|
||||
}
|
||||
|
||||
if !self.viewModel.wellKnown.isBackupMethodPassphraseSupported() {
|
||||
|
||||
if !secureBackupSetupMethods.contains(.passphrase) {
|
||||
self.securePassphraseCell.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ final class SecureBackupSetupIntroViewModel: SecureBackupSetupIntroViewModelType
|
||||
// TODO: Make these properties private
|
||||
let keyBackup: MXKeyBackup?
|
||||
let checkKeyBackup: Bool
|
||||
let wellKnown: MXWellKnown
|
||||
let homeserverEncryptionConfiguration: HomeserverEncryptionConfiguration
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(keyBackup: MXKeyBackup?, checkKeyBackup: Bool, wellKnown: MXWellKnown) {
|
||||
init(keyBackup: MXKeyBackup?, checkKeyBackup: Bool, homeserverEncryptionConfiguration: HomeserverEncryptionConfiguration) {
|
||||
self.keyBackup = keyBackup
|
||||
self.checkKeyBackup = checkKeyBackup
|
||||
self.wellKnown = wellKnown
|
||||
}
|
||||
self.homeserverEncryptionConfiguration = homeserverEncryptionConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ protocol SecureBackupSetupIntroViewModelType {
|
||||
// TODO: Hide these properties from interface and use same behavior as other view models
|
||||
var keyBackup: MXKeyBackup? { get }
|
||||
var checkKeyBackup: Bool { get }
|
||||
var wellKnown: MXWellKnown { get }
|
||||
var homeserverEncryptionConfiguration: HomeserverEncryptionConfiguration { get }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user