Commit 9b491524 authored by Maurice Kraus's avatar Maurice Kraus
Browse files

feat(viewmodel): this adds a password change input and output

parent 1c84f8e1
Pipeline #1897 passed with stages
in 14 minutes and 10 seconds
......@@ -18,11 +18,13 @@ public struct ProfileViewModel: ProfileViewModelType {
private let logoutSubject: PublishSubject<Void>
private let subjectSelectionSubject: PublishRelay<Void>
private let titleSelectionSubject: PublishRelay<Void>
private let passwordChangeSelectionSubject: PublishRelay<Void>
private let userSessionRepository: UserSessionRepository
public let didLogout: Observable<Void>
public let didSelectPoolSelection: Observable<Void>
public let didSelectTitleSelection: Observable<Void>
public let didSelectPasswordChange: Observable<Void>
public let username: Driver<String>
public let level: Driver<String>
public let exp: Driver<String>
......@@ -58,6 +60,9 @@ public struct ProfileViewModel: ProfileViewModelType {
titleSelectionSubject = PublishRelay()
didSelectTitleSelection = titleSelectionSubject.asObservable()
passwordChangeSelectionSubject = PublishRelay()
didSelectPasswordChange = passwordChangeSelectionSubject.asObservable()
poolsString = poolRepository.getPools().asDriver(onErrorJustReturn: []).map {
$0.filter { $0.selected }.reduce("") { (resultString, pool) -> String in
......@@ -97,4 +102,11 @@ public struct ProfileViewModel: ProfileViewModelType {
return .empty()
}
}(self.titleSelectionSubject)
public lazy var onPasswordChangeSelection: CocoaAction = { subject in
Action {
subject.accept(())
return .empty()
}
}(self.passwordChangeSelectionSubject)
}
......@@ -22,10 +22,12 @@ public protocol ProfileViewModelType {
var onLogout: CocoaAction { mutating get }
var onSubjectSelection: CocoaAction { mutating get }
var onTitleSelection: CocoaAction { mutating get }
var onPasswordChangeSelection: CocoaAction { mutating get }
// Output
var didSelectPoolSelection: Observable<Void> { get }
var didSelectTitleSelection: Observable<Void> { get }
var didSelectPasswordChange: Observable<Void> { get }
var didLogout: Observable<Void> { get }
var username: Driver<String> { get }
var level: Driver<String> { get }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment