@@ -42,15 +42,13 @@ class SplashViewModel @Inject constructor(
42
42
43
43
init {
44
44
viewModelScope.launch {
45
- val startDestination = if (isSignedInThroughPassword()) {
46
- if (isSignedInThroughPasskeys ()) {
45
+ val startDestination =
46
+ if (isSessionIdValid ()) {
47
47
ShrineAppDestinations .MainMenuRoute .name
48
48
} else {
49
- ShrineAppDestinations .CreatePasskeyRoute .name
49
+ signOut()
50
+ ShrineAppDestinations .AuthRoute .name
50
51
}
51
- } else {
52
- ShrineAppDestinations .AuthRoute .name
53
- }
54
52
55
53
_uiState .update {
56
54
SplashScreenState (
@@ -62,27 +60,21 @@ class SplashViewModel @Inject constructor(
62
60
}
63
61
64
62
/* *
65
- * Checks if the user is signed in using a password.
66
- *
67
- * This method checks if the user is signed in by calling the `isSignedIn()` method of the
68
- * [AuthRepository].
63
+ * Checks if the session ID is valid with the server.
69
64
*
70
- * @return True if the user is signed in using a password , false otherwise.
65
+ * @return True if the session ID is valid , false otherwise.
71
66
*/
72
- private suspend fun isSignedInThroughPassword (): Boolean {
73
- return repository.isSignedInThroughPassword ()
67
+ private suspend fun isSessionIdValid (): Boolean {
68
+ return repository.isSessionIdValid ()
74
69
}
75
70
76
71
/* *
77
- * Checks if the user is signed in using passkeys.
78
- *
79
- * This method checks if the user is signed in through passkeys by calling the
80
- * `isSignedInThroughPasskeys()` method of the [AuthRepository].
81
- *
82
- * @return True if the user is signed in using passkeys, false otherwise.
72
+ * Signs out the user.
83
73
*/
84
- private suspend fun isSignedInThroughPasskeys (): Boolean {
85
- return repository.isSignedInThroughPasskeys()
74
+ private fun signOut () {
75
+ viewModelScope.launch {
76
+ repository.signOut()
77
+ }
86
78
}
87
79
}
88
80
0 commit comments