mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Secrets recovery: Update recovery with passphrase and recovery with key screens.
This commit is contained in:
@@ -33,9 +33,9 @@ final class SecretsRecoveryWithKeyCoordinator: SecretsRecoveryWithKeyCoordinator
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(recoveryService: MXRecoveryService) {
|
||||
init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal) {
|
||||
|
||||
let secretsRecoveryWithKeyViewModel = SecretsRecoveryWithKeyViewModel(recoveryService: recoveryService)
|
||||
let secretsRecoveryWithKeyViewModel = SecretsRecoveryWithKeyViewModel(recoveryService: recoveryService, recoveryGoal: recoveryGoal)
|
||||
let secretsRecoveryWithKeyViewController = SecretsRecoveryWithKeyViewController.instantiate(with: secretsRecoveryWithKeyViewModel)
|
||||
self.secretsRecoveryWithKeyViewController = secretsRecoveryWithKeyViewController
|
||||
self.secretsRecoveryWithKeyViewModel = secretsRecoveryWithKeyViewModel
|
||||
|
||||
+19
-18
@@ -22,26 +22,26 @@
|
||||
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="byL-eq-NOk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="381"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="377"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lYT-Tl-Mah">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="381"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="377"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="key_backup_logo" translatesAutoresizingMaskIntoConstraints="NO" id="eS4-VO-THO">
|
||||
<rect key="frame" x="166" y="35" width="43" height="52"/>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="secrets_recovery_key" translatesAutoresizingMaskIntoConstraints="NO" id="eS4-VO-THO">
|
||||
<rect key="frame" x="165.5" y="35" width="44" height="48"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="43" id="1xY-5q-ziZ"/>
|
||||
<constraint firstAttribute="height" constant="52" id="k5n-aQ-HHu"/>
|
||||
<constraint firstAttribute="width" constant="44" id="1xY-5q-ziZ"/>
|
||||
<constraint firstAttribute="height" constant="48" id="k5n-aQ-HHu"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Access your secure message history and your cross-signing identity for verifying other sessions by entering your recovery key." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nE7-cw-Z30">
|
||||
<rect key="frame" x="20" y="117" width="335" height="54"/>
|
||||
<rect key="frame" x="20" y="113" width="335" height="54"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v8b-un-B61">
|
||||
<rect key="frame" x="0.0" y="211" width="375" height="50"/>
|
||||
<rect key="frame" x="0.0" y="207" width="375" height="50"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="enter" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UdR-PC-WoG">
|
||||
<rect key="frame" x="20" y="10" width="38" height="30"/>
|
||||
@@ -90,16 +90,16 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xo4-pw-QbA">
|
||||
<rect key="frame" x="0.0" y="311" width="375" height="50"/>
|
||||
<rect key="frame" x="0.0" y="307" width="375" height="50"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HrF-Jh-mlh">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HrF-Jh-mlh" customClass="RoundedButton" customModule="Riot" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="0.0" width="335" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="PEw-6U-ojN"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<inset key="contentEdgeInsets" minX="10" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="Recover Secrets">
|
||||
<inset key="contentEdgeInsets" minX="20" minY="0.0" maxX="20" maxY="0.0"/>
|
||||
<state key="normal" title="Validate">
|
||||
<color key="titleColor" red="0.47843137250000001" green="0.78823529410000004" blue="0.63137254899999995" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<state key="disabled">
|
||||
@@ -110,11 +110,13 @@
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="HrF-Jh-mlh" secondAttribute="trailing" id="HUg-pF-aeX"/>
|
||||
<constraint firstItem="HrF-Jh-mlh" firstAttribute="leading" secondItem="xo4-pw-QbA" secondAttribute="leading" id="L0R-Jy-qhk"/>
|
||||
<constraint firstItem="HrF-Jh-mlh" firstAttribute="width" secondItem="xo4-pw-QbA" secondAttribute="width" priority="750" id="2Sm-mc-KDj"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="HrF-Jh-mlh" secondAttribute="trailing" constant="20" id="HUg-pF-aeX"/>
|
||||
<constraint firstItem="HrF-Jh-mlh" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="xo4-pw-QbA" secondAttribute="leading" constant="20" id="L0R-Jy-qhk"/>
|
||||
<constraint firstAttribute="bottom" secondItem="HrF-Jh-mlh" secondAttribute="bottom" id="Qhj-tm-6gQ"/>
|
||||
<constraint firstItem="HrF-Jh-mlh" firstAttribute="centerX" secondItem="xo4-pw-QbA" secondAttribute="centerX" id="af4-rf-Plh"/>
|
||||
<constraint firstItem="HrF-Jh-mlh" firstAttribute="top" secondItem="xo4-pw-QbA" secondAttribute="top" id="dr9-B3-nAt"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -169,7 +171,6 @@
|
||||
<outlet property="importFileButton" destination="5nP-Tq-Idd" id="4Ln-F9-CRr"/>
|
||||
<outlet property="informationLabel" destination="nE7-cw-Z30" id="hue-l8-iKj"/>
|
||||
<outlet property="recoverButton" destination="HrF-Jh-mlh" id="t9E-gY-qL1"/>
|
||||
<outlet property="recoverButtonBackgroundView" destination="xo4-pw-QbA" id="7MX-fj-8bz"/>
|
||||
<outlet property="recoveryKeyTextField" destination="e79-U2-RHY" id="xEP-LQ-rKR"/>
|
||||
<outlet property="recoveryKeyTextFieldBackgroundView" destination="v8b-un-B61" id="YIA-Sn-A22"/>
|
||||
<outlet property="recoveryKeyTitleLabel" destination="UdR-PC-WoG" id="R8h-o0-2tR"/>
|
||||
@@ -184,6 +185,6 @@
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="import_files_button" width="48" height="48"/>
|
||||
<image name="key_backup_logo" width="48" height="46"/>
|
||||
<image name="secrets_recovery_key" width="44" height="48"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
+15
-9
@@ -35,8 +35,7 @@ final class SecretsRecoveryWithKeyViewController: UIViewController {
|
||||
|
||||
@IBOutlet private weak var importFileButton: UIButton!
|
||||
|
||||
@IBOutlet private weak var recoverButtonBackgroundView: UIView!
|
||||
@IBOutlet private weak var recoverButton: UIButton!
|
||||
@IBOutlet private weak var recoverButton: RoundedButton!
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -90,14 +89,23 @@ final class SecretsRecoveryWithKeyViewController: UIViewController {
|
||||
}
|
||||
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
|
||||
|
||||
self.title = VectorL10n.secretsRecoveryTitle
|
||||
self.title = VectorL10n.secretsRecoveryWithKeyTitle
|
||||
|
||||
self.scrollView.keyboardDismissMode = .interactive
|
||||
|
||||
let shieldImage = Asset.Images.keyBackupLogo.image.withRenderingMode(.alwaysTemplate)
|
||||
let shieldImage = Asset.Images.secretsRecoveryKey.image.withRenderingMode(.alwaysTemplate)
|
||||
self.shieldImageView.image = shieldImage
|
||||
|
||||
self.informationLabel.text = VectorL10n.secretsRecoveryWithKeyInformation
|
||||
let informationText: String
|
||||
|
||||
switch self.viewModel.recoveryGoal {
|
||||
case .default:
|
||||
informationText = VectorL10n.secretsRecoveryWithKeyInformationDefault
|
||||
case .verifyDevice:
|
||||
informationText = VectorL10n.secretsRecoveryWithKeyInformationVerifyDevice
|
||||
}
|
||||
|
||||
self.informationLabel.text = informationText
|
||||
|
||||
self.recoveryKeyTitleLabel.text = VectorL10n.secretsRecoveryWithKeyRecoveryKeyTitle
|
||||
self.recoveryKeyTextField.addTarget(self, action: #selector(recoveryKeyTextFieldDidChange(_:)), for: .editingChanged)
|
||||
@@ -129,11 +137,9 @@ final class SecretsRecoveryWithKeyViewController: UIViewController {
|
||||
theme.applyStyle(onTextField: self.recoveryKeyTextField)
|
||||
self.recoveryKeyTextField.attributedPlaceholder = NSAttributedString(string: VectorL10n.secretsRecoveryWithKeyRecoveryKeyPlaceholder,
|
||||
attributes: [.foregroundColor: theme.placeholderTextColor])
|
||||
theme.applyStyle(onButton: self.importFileButton)
|
||||
|
||||
theme.applyStyle(onButton: self.importFileButton)
|
||||
|
||||
self.recoverButtonBackgroundView.backgroundColor = theme.backgroundColor
|
||||
theme.applyStyle(onButton: self.recoverButton)
|
||||
self.recoverButton.update(theme: theme)
|
||||
}
|
||||
|
||||
private func registerThemeServiceDidChangeThemeNotification() {
|
||||
|
||||
@@ -26,6 +26,8 @@ final class SecretsRecoveryWithKeyViewModel: SecretsRecoveryWithKeyViewModelType
|
||||
|
||||
// MARK: Public
|
||||
|
||||
let recoveryGoal: SecretsRecoveryGoal
|
||||
|
||||
var recoveryKey: String?
|
||||
|
||||
var isFormValid: Bool {
|
||||
@@ -37,8 +39,9 @@ final class SecretsRecoveryWithKeyViewModel: SecretsRecoveryWithKeyViewModelType
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(recoveryService: MXRecoveryService) {
|
||||
init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal) {
|
||||
self.recoveryService = recoveryService
|
||||
self.recoveryGoal = recoveryGoal
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -30,6 +30,7 @@ protocol SecretsRecoveryWithKeyViewModelType {
|
||||
|
||||
var recoveryKey: String? { get set }
|
||||
var isFormValid: Bool { get }
|
||||
var recoveryGoal: SecretsRecoveryGoal { get }
|
||||
|
||||
var viewDelegate: SecretsRecoveryWithKeyViewModelViewDelegate? { get set }
|
||||
var coordinatorDelegate: SecretsRecoveryWithKeyViewModelCoordinatorDelegate? { get set }
|
||||
|
||||
Reference in New Issue
Block a user