FF for QR code login + Login with qr code button (#2643)

This commit is contained in:
Mauro
2024-04-04 10:37:42 +02:00
committed by GitHub
parent 3fea635d67
commit df242e3f1c
14 changed files with 70 additions and 25 deletions
@@ -20,20 +20,27 @@ import SwiftUI
typealias AuthenticationStartScreenViewModelType = StateStoreViewModel<AuthenticationStartScreenViewState, AuthenticationStartScreenViewAction>
class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType, AuthenticationStartScreenViewModelProtocol {
private let appSettings: AppSettings
private var actionsSubject: PassthroughSubject<AuthenticationStartScreenViewModelAction, Never> = .init()
var actions: AnyPublisher<AuthenticationStartScreenViewModelAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
init() {
init(appSettings: AppSettings) {
self.appSettings = appSettings
super.init(initialViewState: AuthenticationStartScreenViewState())
appSettings.$qrCodeLoginEnabled
.weakAssign(to: \.state.isQRCodeLoginEnabled, on: self)
.store(in: &cancellables)
}
override func process(viewAction: AuthenticationStartScreenViewAction) {
switch viewAction {
case .login:
actionsSubject.send(.login)
case .loginManually:
actionsSubject.send(.loginManually)
case .loginWithQR:
actionsSubject.send(.loginWithQR)
case .reportProblem:
actionsSubject.send(.reportProblem)
}