summaryrefslogtreecommitdiff
path: root/client/fsm.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-05-02 13:06:50 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commitd0f4303ee5ccecc876fdfae1ce858369e3a323b7 (patch)
tree64bda3971398aa56f0672bab49a63a077bf6ae7c /client/fsm.go
parentdc7425beb85ea7d35e860a5df2bc0d8ddda8c28a (diff)
Client + FSM: Check transitions and add SetState
Also make sure GotConfig can be used to go back to
Diffstat (limited to 'client/fsm.go')
-rw-r--r--client/fsm.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/client/fsm.go b/client/fsm.go
index 038e6cf..9c83b9b 100644
--- a/client/fsm.go
+++ b/client/fsm.go
@@ -98,12 +98,14 @@ func newFSM(
Transitions: []FSMTransition{
{To: StateChosenLocation, Description: "Location chosen"},
{To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateChosenLocation: FSMState{
Transitions: []FSMTransition{
{To: StateChosenServer, Description: "Server has been chosen"},
{To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateLoadingServer: FSMState{
@@ -114,45 +116,54 @@ func newFSM(
Description: "User chooses a Secure Internet server but no location is configured",
},
{To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateChosenServer: FSMState{
Transitions: []FSMTransition{
{To: StateAuthorized, Description: "Found tokens in config"},
{To: StateOAuthStarted, Description: "No tokens found in config"},
+ {To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateOAuthStarted: FSMState{
Transitions: []FSMTransition{
{To: StateAuthorized, Description: "User authorizes with browser"},
{To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateAuthorized: FSMState{
Transitions: []FSMTransition{
{To: StateOAuthStarted, Description: "Re-authorize with OAuth"},
{To: StateRequestConfig, Description: "Client requests a config"},
- {To: StateNoServer, Description: "Client wants to go back to the main screen"},
+ {To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateRequestConfig: FSMState{
Transitions: []FSMTransition{
{To: StateAskProfile, Description: "Multiple profiles found and no profile chosen"},
{To: StateChosenProfile, Description: "Only one profile or profile already chosen"},
- {To: StateNoServer, Description: "Cancel or Error"},
{To: StateOAuthStarted, Description: "Re-authorize"},
+ {To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateAskProfile: FSMState{
Transitions: []FSMTransition{
{To: StateNoServer, Description: "Cancel or Error"},
{To: StateChosenProfile, Description: "Profile has been chosen"},
+ {To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateChosenProfile: FSMState{
Transitions: []FSMTransition{
- {To: StateNoServer, Description: "Cancel or Error"},
{To: StateGotConfig, Description: "Config has been obtained"},
+ {To: StateNoServer, Description: "Go back or Error"},
+ {To: StateGotConfig, Description: "Go back or Error"},
},
},
StateGotConfig: FSMState{