Add developer option for clearing the application cache (#852)

* Add developer option for clearing the application cache

* Tweaks following code review
This commit is contained in:
Stefan Ceriu
2023-05-05 19:41:21 +03:00
committed by GitHub
parent 25f29bbd26
commit 54c812c140
10 changed files with 93 additions and 7 deletions

View File

@@ -52,6 +52,9 @@ class AppCoordinatorStateMachine {
case signOut(isSoft: Bool)
/// Signing out completed
case completedSigningOut(isSoft: Bool)
/// Request cache clearing
case clearCache
}
private let stateMachine: StateMachine<State, Event>
@@ -71,6 +74,8 @@ class AppCoordinatorStateMachine {
stateMachine.addRoutes(event: .startWithExistingSession, transitions: [.initial => .restoringSession])
stateMachine.addRoutes(event: .createdUserSession, transitions: [.restoringSession => .signedIn])
stateMachine.addRoutes(event: .failedRestoringSession, transitions: [.restoringSession => .signedOut])
stateMachine.addRoutes(event: .clearCache, transitions: [.signedIn => .initial])
// Transitions with associated values need to be handled through `addRouteMapping`
stateMachine.addRouteMapping { event, fromState, _ in