mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Automatically sign out when toggling the SSS feature flag. (#3071)
This commit is contained in:
+4
@@ -19,6 +19,8 @@ import SwiftUI
|
||||
|
||||
enum DeveloperOptionsScreenCoordinatorAction {
|
||||
case clearCache
|
||||
/// Logout without a confirmation to avoid losing keys when trying SSS.
|
||||
case forceLogout
|
||||
}
|
||||
|
||||
final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol {
|
||||
@@ -42,6 +44,8 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol {
|
||||
switch action {
|
||||
case .clearCache:
|
||||
actionsSubject.send(.clearCache)
|
||||
case .forceLogout:
|
||||
actionsSubject.send(.forceLogout)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
+2
@@ -18,6 +18,8 @@ import Foundation
|
||||
|
||||
enum DeveloperOptionsScreenViewModelAction {
|
||||
case clearCache
|
||||
/// Logout without a confirmation to avoid losing keys when trying SSS.
|
||||
case forceLogout
|
||||
}
|
||||
|
||||
struct DeveloperOptionsScreenViewState: BindableState {
|
||||
|
||||
+10
@@ -31,6 +31,16 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
||||
let state = DeveloperOptionsScreenViewState(elementCallBaseURL: elementCallBaseURL, bindings: bindings)
|
||||
|
||||
super.init(initialViewState: state)
|
||||
|
||||
context.$viewState
|
||||
.map(\.bindings.simplifiedSlidingSyncEnabled)
|
||||
.removeDuplicates()
|
||||
.dropFirst() // Ignore the initial value received when opening the screen.
|
||||
.sink { [weak self] isEnabled in
|
||||
MXLog.error("Toggled simplifiedSlidingSyncEnabled: \(isEnabled). Signing out.")
|
||||
self?.actionsSubject.send(.forceLogout)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
override func process(viewAction: DeveloperOptionsScreenViewAction) {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ struct DeveloperOptionsScreen: View {
|
||||
Section("Sliding Sync") {
|
||||
Toggle(isOn: $context.simplifiedSlidingSyncEnabled) {
|
||||
Text("Simplified Sliding Sync")
|
||||
Text("Requires app reboot")
|
||||
Text("When toggled you'll be logged out of the app and will need to log in again.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user