Refactoring secure backup references.

This commit is contained in:
SBiOSoftWhare
2020-06-26 14:01:33 +02:00
parent 17c5cdf06e
commit 2559ba727e
10 changed files with 87 additions and 87 deletions
@@ -17,7 +17,7 @@
import UIKit
import Reusable
final class SecureKeyBackupSetupIntroCell: UIView, NibOwnerLoadable, Themable {
final class SecureBackupSetupIntroCell: UIView, NibOwnerLoadable, Themable {
// MARK: - Constants
@@ -10,7 +10,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SecureKeyBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SecureBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<connections>
<outlet property="accessoryImageView" destination="N76-Fa-onz" id="nYX-r6-t7R"/>
<outlet property="backgroundView" destination="WrK-Wq-nzz" id="kgB-Zb-g9N"/>
@@ -10,10 +10,10 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Secure Key Backup Setup Intro View Controller-->
<!--Secure Backup Setup Intro View Controller-->
<scene sceneID="srP-wo-sRp">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="LSX-Vb-DIu" customClass="SecureKeyBackupSetupIntroViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<viewController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="LSX-Vb-DIu" customClass="SecureBackupSetupIntroViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="pmD-eJ-G3m">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -27,7 +27,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="79w-lw-B8z">
<rect key="frame" x="0.0" y="0.0" width="414" height="391"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Safe guard against losing access to encrypted messages &amp; data by backing up encryption keys on your server." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DZf-di-JcI">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Safeguard against losing access to encrypted messages &amp; data by backing up encryption keys on your server." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DZf-di-JcI">
<rect key="frame" x="20" y="30" width="374" height="54"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
@@ -46,14 +46,14 @@
<constraint firstAttribute="height" constant="1" id="Gwq-JQ-4Zj"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RQF-pm-g37" customClass="SecureKeyBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RQF-pm-g37" customClass="SecureBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="1" width="414" height="128"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="128" placeholder="YES" id="dOF-Du-P3S"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yps-bc-ruH" customClass="SecureKeyBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yps-bc-ruH" customClass="SecureBackupSetupIntroCell" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="129" width="414" height="128"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
@@ -16,14 +16,14 @@
import UIKit
protocol SecureKeyBackupSetupIntroViewControllerDelegate: class {
func secureKeyBackupSetupIntroViewControllerDidTapUseKey(_ secureKeyBackupSetupIntroViewController: SecureKeyBackupSetupIntroViewController)
func secureKeyBackupSetupIntroViewControllerDidTapUsePassphrase(_ secureKeyBackupSetupIntroViewController: SecureKeyBackupSetupIntroViewController)
func secureKeyBackupSetupIntroViewControllerDidCancel(_ secureKeyBackupSetupIntroViewController: SecureKeyBackupSetupIntroViewController)
protocol SecureBackupSetupIntroViewControllerDelegate: class {
func secureBackupSetupIntroViewControllerDidTapUseKey(_ secureBackupSetupIntroViewController: SecureBackupSetupIntroViewController)
func secureBackupSetupIntroViewControllerDidTapUsePassphrase(_ secureBackupSetupIntroViewController: SecureBackupSetupIntroViewController)
func secureBackupSetupIntroViewControllerDidCancel(_ secureBackupSetupIntroViewController: SecureBackupSetupIntroViewController)
}
@objcMembers
final class SecureKeyBackupSetupIntroViewController: UIViewController {
final class SecureBackupSetupIntroViewController: UIViewController {
// MARK: - Properties
@@ -32,8 +32,8 @@ final class SecureKeyBackupSetupIntroViewController: UIViewController {
@IBOutlet private weak var informationLabel: UILabel!
@IBOutlet private weak var topSeparatorView: UIView!
@IBOutlet private weak var secureKeyCell: SecureKeyBackupSetupIntroCell!
@IBOutlet private weak var securePassphraseCell: SecureKeyBackupSetupIntroCell!
@IBOutlet private weak var secureKeyCell: SecureBackupSetupIntroCell!
@IBOutlet private weak var securePassphraseCell: SecureBackupSetupIntroCell!
// MARK: Private
@@ -41,12 +41,12 @@ final class SecureKeyBackupSetupIntroViewController: UIViewController {
// MARK: Public
weak var delegate: SecureKeyBackupSetupIntroViewControllerDelegate?
weak var delegate: SecureBackupSetupIntroViewControllerDelegate?
// MARK: - Setup
class func instantiate() -> SecureKeyBackupSetupIntroViewController {
let viewController = StoryboardScene.SecureKeyBackupSetupIntroViewController.initialScene.instantiate()
class func instantiate() -> SecureBackupSetupIntroViewController {
let viewController = StoryboardScene.SecureBackupSetupIntroViewController.initialScene.instantiate()
viewController.theme = ThemeService.shared().theme
return viewController
}
@@ -76,7 +76,7 @@ final class SecureKeyBackupSetupIntroViewController: UIViewController {
guard let self = self else {
return
}
self.delegate?.secureKeyBackupSetupIntroViewControllerDidCancel(self)
self.delegate?.secureBackupSetupIntroViewControllerDidCancel(self)
}
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
@@ -92,7 +92,7 @@ final class SecureKeyBackupSetupIntroViewController: UIViewController {
guard let self = self else {
return
}
self.delegate?.secureKeyBackupSetupIntroViewControllerDidTapUseKey(self)
self.delegate?.secureBackupSetupIntroViewControllerDidTapUseKey(self)
}
self.securePassphraseCell.fill(title: VectorL10n.secureKeyBackupSetupIntroUseSecurityPassphraseTitle,
@@ -103,7 +103,7 @@ final class SecureKeyBackupSetupIntroViewController: UIViewController {
guard let self = self else {
return
}
self.delegate?.secureKeyBackupSetupIntroViewControllerDidTapUsePassphrase(self)
self.delegate?.secureBackupSetupIntroViewControllerDidTapUsePassphrase(self)
}
}
@@ -19,7 +19,7 @@
import UIKit
@objcMembers
final class SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupCoordinatorType {
final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
// MARK: - Properties
@@ -33,7 +33,7 @@ final class SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupCoordinatorType
// Must be used only internally
var childCoordinators: [Coordinator] = []
weak var delegate: SecureKeyBackupSetupCoordinatorDelegate?
weak var delegate: SecureBackupSetupCoordinatorDelegate?
// MARK: - Setup
@@ -103,7 +103,7 @@ final class SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupCoordinatorType
}))
alertController.addAction(UIAlertAction(title: VectorL10n.keyBackupSetupSkipAlertSkipAction, style: .default, handler: { action in
self.delegate?.secureKeyBackupSetupCoordinatorDidCancel(self)
self.delegate?.secureBackupSetupCoordinatorDidCancel(self)
}))
self.navigationRouter.present(alertController, animated: true)
@@ -113,17 +113,17 @@ final class SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupCoordinatorType
if showSkipAlert {
self.showCancelAlert()
} else {
self.delegate?.secureKeyBackupSetupCoordinatorDidCancel(self)
self.delegate?.secureBackupSetupCoordinatorDidCancel(self)
}
}
private func didComplete() {
self.delegate?.secureKeyBackupSetupCoordinatorDidComplete(self)
self.delegate?.secureBackupSetupCoordinatorDidComplete(self)
}
}
// MARK: - SecureKeyBackupSetupIntroViewControllerDelegate
extension SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupIntroViewControllerDelegate {
extension SecureBackupSetupCoordinator: SecureKeyBackupSetupIntroViewControllerDelegate {
func secureKeyBackupSetupIntroViewControllerDidTapUseKey(_ secureKeyBackupSetupIntroViewController: SecureKeyBackupSetupIntroViewController) {
self.showSetupKey()
@@ -139,7 +139,7 @@ extension SecureKeyBackupSetupCoordinator: SecureKeyBackupSetupIntroViewControll
}
// MARK: - SecretsSetupRecoveryKeyCoordinatorDelegate
extension SecureKeyBackupSetupCoordinator: SecretsSetupRecoveryKeyCoordinatorDelegate {
extension SecureBackupSetupCoordinator: SecretsSetupRecoveryKeyCoordinatorDelegate {
func secretsSetupRecoveryKeyCoordinatorDidComplete(_ coordinator: SecretsSetupRecoveryKeyCoordinatorType) {
self.didComplete()
@@ -155,7 +155,7 @@ extension SecureKeyBackupSetupCoordinator: SecretsSetupRecoveryKeyCoordinatorDel
}
// MARK: - SecretsSetupRecoveryPassphraseCoordinatorDelegate
extension SecureKeyBackupSetupCoordinator: SecretsSetupRecoveryPassphraseCoordinatorDelegate {
extension SecureBackupSetupCoordinator: SecretsSetupRecoveryPassphraseCoordinatorDelegate {
func secretsSetupRecoveryPassphraseCoordinator(_ coordinator: SecretsSetupRecoveryPassphraseCoordinatorType, didEnterNewPassphrase passphrase: String) {
self.showSetupPassphraseConfirmation(with: passphrase)
@@ -18,26 +18,26 @@
import Foundation
@objc protocol SecureKeyBackupSetupCoordinatorBridgePresenterDelegate {
func secureKeyBackupSetupCoordinatorBridgePresenterDelegateDidComplete(_ coordinatorBridgePresenter: SecureKeyBackupSetupCoordinatorBridgePresenter)
func secureKeyBackupSetupCoordinatorBridgePresenterDelegateDidCancel(_ coordinatorBridgePresenter: SecureKeyBackupSetupCoordinatorBridgePresenter)
@objc protocol SecureBackupSetupCoordinatorBridgePresenterDelegate {
func secureBackupSetupCoordinatorBridgePresenterDelegateDidComplete(_ coordinatorBridgePresenter: SecureBackupSetupCoordinatorBridgePresenter)
func secureKeyBackupSetupCoordinatorBridgePresenterDelegateDidCancel(_ coordinatorBridgePresenter: SecureBackupSetupCoordinatorBridgePresenter)
}
/// SecureKeyBackupSetupCoordinatorBridgePresenter enables to start SecureKeyBackupSetupCoordinator from a view controller.
/// This bridge is used while waiting for global usage of coordinator pattern.
@objcMembers
final class SecureKeyBackupSetupCoordinatorBridgePresenter: NSObject {
final class SecureBackupSetupCoordinatorBridgePresenter: NSObject {
// MARK: - Properties
// MARK: Private
private let session: MXSession
private var coordinator: SecureKeyBackupSetupCoordinator?
private var coordinator: SecureBackupSetupCoordinator?
// MARK: Public
weak var delegate: SecureKeyBackupSetupCoordinatorBridgePresenterDelegate?
weak var delegate: SecureBackupSetupCoordinatorBridgePresenterDelegate?
// MARK: - Setup
@@ -54,7 +54,7 @@ final class SecureKeyBackupSetupCoordinatorBridgePresenter: NSObject {
// }
func present(from viewController: UIViewController, animated: Bool) {
let secureKeyBackupSetupCoordinator = SecureKeyBackupSetupCoordinator(session: self.session)
let secureKeyBackupSetupCoordinator = SecureBackupSetupCoordinator(session: self.session)
secureKeyBackupSetupCoordinator.delegate = self
viewController.present(secureKeyBackupSetupCoordinator.toPresentable(), animated: animated, completion: nil)
secureKeyBackupSetupCoordinator.start()
@@ -77,12 +77,12 @@ final class SecureKeyBackupSetupCoordinatorBridgePresenter: NSObject {
}
// MARK: - SecureKeyBackupSetupCoordinatorDelegate
extension SecureKeyBackupSetupCoordinatorBridgePresenter: SecureKeyBackupSetupCoordinatorDelegate {
func secureKeyBackupSetupCoordinatorDidComplete(_ coordinator: SecureKeyBackupSetupCoordinatorType) {
self.delegate?.secureKeyBackupSetupCoordinatorBridgePresenterDelegateDidComplete(self)
extension SecureBackupSetupCoordinatorBridgePresenter: SecureBackupSetupCoordinatorDelegate {
func secureBackupSetupCoordinatorDidComplete(_ coordinator: SecureBackupSetupCoordinatorType) {
self.delegate?.secureBackupSetupCoordinatorBridgePresenterDelegateDidComplete(self)
}
func secureKeyBackupSetupCoordinatorDidCancel(_ coordinator: SecureKeyBackupSetupCoordinatorType) {
func secureBackupSetupCoordinatorDidCancel(_ coordinator: SecureBackupSetupCoordinatorType) {
self.delegate?.secureKeyBackupSetupCoordinatorBridgePresenterDelegateDidCancel(self)
}
}
@@ -18,12 +18,12 @@
import Foundation
protocol SecureKeyBackupSetupCoordinatorDelegate: class {
func secureKeyBackupSetupCoordinatorDidComplete(_ coordinator: SecureKeyBackupSetupCoordinatorType)
func secureKeyBackupSetupCoordinatorDidCancel(_ coordinator: SecureKeyBackupSetupCoordinatorType)
protocol SecureBackupSetupCoordinatorDelegate: class {
func secureBackupSetupCoordinatorDidComplete(_ coordinator: SecureBackupSetupCoordinatorType)
func secureBackupSetupCoordinatorDidCancel(_ coordinator: SecureBackupSetupCoordinatorType)
}
/// `SecureKeyBackupSetupCoordinatorType` is a protocol describing a Coordinator that handle keybackup setup navigation flow.
protocol SecureKeyBackupSetupCoordinatorType: Coordinator, Presentable {
var delegate: SecureKeyBackupSetupCoordinatorDelegate? { get }
/// `SecureBackupSetupCoordinatorType` is a protocol describing a Coordinator that handle keybackup setup navigation flow.
protocol SecureBackupSetupCoordinatorType: Coordinator, Presentable {
var delegate: SecureBackupSetupCoordinatorDelegate? { get }
}