Various fixes (#437)

* Fix information leaking on RoomSummaryDetails logging

* Prevent crashes when force quitting the application

* Cleanup crash detected alert presentation and exposed home screen view model actions

* Fixes #340 - Wait for logout confirmation before changing the app state

* Add changelogs

* Fix unit tests

* Add missing softLogout logout handling
This commit is contained in:
Stefan Ceriu
2023-01-11 15:10:26 +02:00
committed by GitHub
parent 99e7f76ca0
commit 357d493e5a
11 changed files with 82 additions and 52 deletions
@@ -85,6 +85,11 @@ class AppCoordinator: AppCoordinatorProtocol {
}
func start() {
guard stateMachine.state == .initial else {
MXLog.error("Received a start request when already started")
return
}
stateMachine.processEvent(userSessionStore.hasSessions ? .startWithExistingSession : .startWithAuthentication)
}
@@ -255,21 +260,27 @@ class AppCoordinator: AppCoordinatorProtocol {
deobserveUserSessionChanges()
if !isSoftLogout {
Task {
// first log out from the server
_ = await userSession.clientProxy.logout()
// regardless of the result, clear user data
userSessionStore.logout(userSession: userSession)
userSession = nil
notificationManager?.delegate = nil
notificationManager = nil
}
guard !isSoftLogout else {
stateMachine.processEvent(.completedSigningOut)
return
}
// complete logging out
stateMachine.processEvent(.completedSigningOut)
Task {
showLoadingIndicator()
// first log out from the server
_ = await userSession.clientProxy.logout()
// regardless of the result, clear user data
userSessionStore.logout(userSession: userSession)
userSession = nil
notificationManager?.delegate = nil
notificationManager = nil
stateMachine.processEvent(.completedSigningOut)
hideLoadingIndicator()
}
}
private func presentSplashScreen(isSoftLogout: Bool = false) {
@@ -61,6 +61,10 @@ class AppCoordinatorStateMachine {
private let stateMachine: StateMachine<State, Event>
var state: AppCoordinatorStateMachine.State {
stateMachine.state
}
init() {
stateMachine = StateMachine(state: .initial)
configure()