diff --git a/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.storyboard b/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.storyboard index cde9fb81e..8cf1b867c 100644 --- a/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.storyboard +++ b/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.storyboard @@ -1,6 +1,10 @@ + + + + @@ -9,74 +13,126 @@ - + - + - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - - - - - - - - - - + - - - - - - + + + + + - + - - - - - - - - - + + + + + + + @@ -84,7 +140,10 @@ - + + + + diff --git a/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.swift b/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.swift index f4424e0cd..7f2d0616b 100644 --- a/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.swift +++ b/Riot/Modules/KeyBackup/Setup/Intro/KeyBackupSetupIntroViewController.swift @@ -27,6 +27,7 @@ final class KeyBackupSetupIntroViewController: UIViewController { // MARK: Outlets + @IBOutlet private weak var keyBackupLogoImageView: UIImageView! @IBOutlet private weak var titleLabel: UILabel! @IBOutlet private weak var informationLabel: UILabel! @@ -36,6 +37,7 @@ final class KeyBackupSetupIntroViewController: UIViewController { // MARK: Private private var theme: Theme! + private var isABackupAlreadyExists: Bool = false // MARK: Public @@ -43,9 +45,10 @@ final class KeyBackupSetupIntroViewController: UIViewController { // MARK: - Setup - class func instantiate() -> KeyBackupSetupIntroViewController { + class func instantiate(isABackupAlreadyExists: Bool) -> KeyBackupSetupIntroViewController { let viewController = StoryboardScene.KeyBackupSetupIntroViewController.initialScene.instantiate() viewController.theme = ThemeService.shared().theme + viewController.isABackupAlreadyExists = isABackupAlreadyExists return viewController } @@ -71,16 +74,20 @@ final class KeyBackupSetupIntroViewController: UIViewController { // MARK: - Private private func setupViews() { - let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.keyBackupSetupSkipAction, style: .plain) { [weak self] in - if let sself = self { - sself.delegate?.keyBackupSetupIntroViewControllerDidCancel(sself) - } + let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in + self?.showSkipAlert() } self.navigationItem.rightBarButtonItem = cancelBarButtonItem + let keybackupLogoImage = Asset.Images.keyBackupLogo.image.withRenderingMode(.alwaysTemplate) + self.keyBackupLogoImageView.image = keybackupLogoImage + self.titleLabel.text = VectorL10n.keyBackupSetupIntroTitle self.informationLabel.text = VectorL10n.keyBackupSetupIntroInfo - self.setUpButton.setTitle(VectorL10n.keyBackupSetupIntroSetupAction, for: .normal) + + let setupTitle = self.isABackupAlreadyExists ? VectorL10n.keyBackupSetupIntroSetupActionWithExistingBackup : VectorL10n.keyBackupSetupIntroSetupActionWithoutExistingBackup + + self.setUpButton.setTitle(setupTitle, for: .normal) } private func update(theme: Theme) { @@ -92,6 +99,8 @@ final class KeyBackupSetupIntroViewController: UIViewController { theme.applyStyle(onNavigationBar: navigationBar) } + self.keyBackupLogoImageView.tintColor = theme.textPrimaryColor + self.titleLabel.textColor = theme.textPrimaryColor self.informationLabel.textColor = theme.textPrimaryColor @@ -103,6 +112,21 @@ final class KeyBackupSetupIntroViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil) } + private func showSkipAlert() { + let alertController = UIAlertController(title: VectorL10n.keyBackupSetupSkipAlertTitle, + message: VectorL10n.keyBackupSetupSkipAlertMessage, + preferredStyle:.alert) + + alertController.addAction(UIAlertAction(title: VectorL10n.continue, style: .cancel, handler: { action in + })) + + alertController.addAction(UIAlertAction(title: VectorL10n.keyBackupSetupSkipAlertSkipAction , style: .default, handler: { action in + self.delegate?.keyBackupSetupIntroViewControllerDidCancel(self) + })) + + self.present(alertController, animated: true, completion: nil) + } + // MARK: - Actions @objc private func themeDidChange() {