mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Switch callbacks to combine (#1710)
* #750 - Convert the SoftLogoutScreen to combine * #750 - Convert the UserSessionFlowCoordinator to Combine * #750 - Convert the AnalyticsPromptScreen to Combine * #750 - Convert the LoginScreen to Combine * #750 - Convert the ServerSelectionScreen to Combine * #750 - Convert the EmojiPickerScreen to Combine * #750 - Convert the HomeScreen to Combine * #750 - Convert the MediaUploadPreviewScreen to Combine * #750 - Convert the OnboardingScreen to Combine * Rename `Onboarding` to `OnboardingScreen` * #750 - Convert the ReportContentScreen to Combine * #750 - Convert the RoomDetailsSscreen to Combine * #750 - Convert the RoomMemberDetailsScreen to Combine * #750 - Convert the RoomMembersListScreen to Combine * #750 - Convert the SessionVerificationScreen to Combine * #750 - Convert the SettingsScreen to Combine * #750 - Convert the AdvancedSettingsScreen to Combine * #750 - Convert the DeveloperOptionsScreen to Combine * Fix the unit tests * Use .sink action and the same cancellables constructor everywhere * Cleanup cancellables when setting up tests
This commit is contained in:
@@ -23,7 +23,11 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
|
||||
private let userSession: UserSessionProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
var callback: ((SettingsScreenViewModelAction) -> Void)?
|
||||
private var actionsSubject: PassthroughSubject<SettingsScreenViewModelAction, Never> = .init()
|
||||
|
||||
var actions: AnyPublisher<SettingsScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(userSession: UserSessionProtocol, appSettings: AppSettings) {
|
||||
self.userSession = userSession
|
||||
@@ -74,27 +78,27 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
|
||||
override func process(viewAction: SettingsScreenViewAction) {
|
||||
switch viewAction {
|
||||
case .close:
|
||||
callback?(.close)
|
||||
actionsSubject.send(.close)
|
||||
case .accountProfile:
|
||||
callback?(.accountProfile)
|
||||
actionsSubject.send(.accountProfile)
|
||||
case .analytics:
|
||||
callback?(.analytics)
|
||||
actionsSubject.send(.analytics)
|
||||
case .reportBug:
|
||||
callback?(.reportBug)
|
||||
actionsSubject.send(.reportBug)
|
||||
case .about:
|
||||
callback?(.about)
|
||||
actionsSubject.send(.about)
|
||||
case .logout:
|
||||
callback?(.logout)
|
||||
actionsSubject.send(.logout)
|
||||
case .sessionVerification:
|
||||
callback?(.sessionVerification)
|
||||
actionsSubject.send(.sessionVerification)
|
||||
case .notifications:
|
||||
callback?(.notifications)
|
||||
actionsSubject.send(.notifications)
|
||||
case .accountSessionsList:
|
||||
callback?(.accountSessionsList)
|
||||
actionsSubject.send(.accountSessionsList)
|
||||
case .advancedSettings:
|
||||
callback?(.advancedSettings)
|
||||
actionsSubject.send(.advancedSettings)
|
||||
case .developerOptions:
|
||||
callback?(.developerOptions)
|
||||
actionsSubject.send(.developerOptions)
|
||||
|
||||
case .updateWindow(let window):
|
||||
Task {
|
||||
|
||||
Reference in New Issue
Block a user