mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
Adopt StateStoreViewModelV2 in the authentication screens and some settings screens. (#4083)
* Add some tests for DeferredFulfillment with Observation. * Use StateStoreViewModelV2 in AuthenticationStartScreen. * Use StateStoreViewModelV2 in ServerConfirmationScreen. * Use StateStoreViewModelV2 in ServerSelectionScreen. * Use StateStoreViewModelV2 in SoftLogoutScreen. * Use StateStoreViewModelV2 in SettingsScreen. * Use StateStoreViewModelV2 in DeveloperOptionsScreen. * Use StateStoreViewModelV2 in AdvancedSettingsScreen.
This commit is contained in:
@@ -10,7 +10,7 @@ import SFSafeSymbols
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsScreen: View {
|
||||
@ObservedObject var context: SettingsScreenViewModel.Context
|
||||
let context: SettingsScreenViewModel.Context
|
||||
|
||||
private var shouldHideManageAccountSection: Bool {
|
||||
context.viewState.accountProfileURL == nil &&
|
||||
@@ -241,17 +241,13 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
SettingsScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.accountSessionsListURL != nil
|
||||
})
|
||||
.snapshotPreferences(expect: viewModel.context.observe(\.viewState.accountSessionsListURL).map { $0 != nil }.eraseToStream())
|
||||
.previewDisplayName("Default")
|
||||
|
||||
NavigationStack {
|
||||
SettingsScreen(context: bugReportDisabledViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: bugReportDisabledViewModel.context.$viewState.map { state in
|
||||
state.accountSessionsListURL != nil
|
||||
})
|
||||
.snapshotPreferences(expect: bugReportDisabledViewModel.context.observe(\.viewState.accountSessionsListURL).map { $0 != nil }.eraseToStream())
|
||||
.previewDisplayName("Bug report disabled")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user