mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Adopt StateStoreViewModelV2 in the remaining settings screens. (#4158)
* Move the AuthenticationStartScreen into the Authentication directory.
* Commit the updated Sentry license.
No idea why they dropped the 2024 🤷♂️
* Use StateStoreViewModelV2 in BugReportScreen.
* Use StateStoreViewModelV2 in UserDetailsEditScreen.
* Use StateStoreViewModelV2 in NotificationSettingsScreen.
* Use StateStoreViewModelV2 in NotificationSettingsEditScreen.
* Use StateStoreViewModelV2 in LegalInformationScreen.
* Use StateStoreViewModelV2 in LogViewerScreen.
* Use StateStoreViewModelV2 in AnalyticsSettingsScreen.
* Rename AdvancedSettingsScreen directory.
* Use StateStoreViewModelV2 in EncryptionResetScreen.
* Use StateStoreViewModelV2 in EncryptionResetPasswordScreen.
* Use StateStoreViewModelV2 in SecureBackup…Screens.
* Use StateStoreViewModelV2 in LoginScreen.
Seems this one was ignored waiting on the fulfillment transitionValues implementation.
* Use StateStoreViewModelV2 in DeactivateAccountScreen.
* Move DeactivateAccountScreen into the Settings directory.
This commit is contained in:
+3
-3
@@ -8,7 +8,7 @@
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
typealias SecureBackupRecoveryKeyScreenViewModelType = StateStoreViewModel<SecureBackupRecoveryKeyScreenViewState, SecureBackupRecoveryKeyScreenViewAction>
|
||||
typealias SecureBackupRecoveryKeyScreenViewModelType = StateStoreViewModelV2<SecureBackupRecoveryKeyScreenViewState, SecureBackupRecoveryKeyScreenViewAction>
|
||||
|
||||
class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewModelType, SecureBackupRecoveryKeyScreenViewModelProtocol {
|
||||
private let secureBackupController: SecureBackupControllerProtocol
|
||||
@@ -62,7 +62,7 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
|
||||
switch await secureBackupController.confirmRecoveryKey(state.bindings.confirmationRecoveryKey) {
|
||||
case .success:
|
||||
actionsSubject.send(.done(mode: context.viewState.mode))
|
||||
actionsSubject.send(.done(mode: state.mode))
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed confirming recovery key with error: \(error)")
|
||||
state.bindings.alertInfo = .init(id: .init(),
|
||||
@@ -80,7 +80,7 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
message: L10n.screenRecoveryKeySetupConfirmationDescription,
|
||||
primaryButton: .init(title: L10n.actionContinue) { [weak self] in
|
||||
guard let self else { return }
|
||||
actionsSubject.send(.done(mode: context.viewState.mode))
|
||||
actionsSubject.send(.done(mode: state.mode))
|
||||
},
|
||||
secondaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil))
|
||||
}
|
||||
|
||||
+2
-4
@@ -10,7 +10,7 @@ import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct SecureBackupRecoveryKeyScreen: View {
|
||||
@ObservedObject var context: SecureBackupRecoveryKeyScreenViewModel.Context
|
||||
@Bindable var context: SecureBackupRecoveryKeyScreenViewModel.Context
|
||||
@FocusState private var focused
|
||||
private let textFieldIdentifier = "textFieldIdentifier"
|
||||
|
||||
@@ -260,9 +260,7 @@ struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview
|
||||
NavigationStack {
|
||||
SecureBackupRecoveryKeyScreen(context: setupViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: setupViewModel.context.$viewState.map { state in
|
||||
state.recoveryKey != nil
|
||||
})
|
||||
.snapshotPreferences(expect: setupViewModel.context.observe(\.viewState.recoveryKey).map { $0 != nil }.eraseToStream())
|
||||
.previewDisplayName("Set up")
|
||||
|
||||
NavigationStack {
|
||||
|
||||
Reference in New Issue
Block a user