File tree Expand file tree Collapse file tree 2 files changed +11
-31
lines changed
Shrine/app/src/main/java/com/authentication/shrine Expand file tree Collapse file tree 2 files changed +11
-31
lines changed Original file line number Diff line number Diff line change @@ -442,11 +442,15 @@ class AuthRepository @Inject constructor(
442
442
suspend fun isSessionIdValid (): Boolean {
443
443
val sessionId = dataStore.read(SESSION_ID )
444
444
if (! sessionId.isNullOrBlank()) {
445
- val apiResult = authApiService.getKeys(
446
- cookie = sessionId.createCookieHeader(),
447
- )
448
- if (apiResult.isSuccessful) {
449
- return true
445
+ try {
446
+ val apiResult = authApiService.getKeys(
447
+ cookie = sessionId.createCookieHeader(),
448
+ )
449
+ if (apiResult.isSuccessful) {
450
+ return true
451
+ }
452
+ } catch (e: ApiException ) {
453
+ Log .e(TAG , " Cannot call getKeys for isSessionIdValid" )
450
454
}
451
455
}
452
456
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class SplashViewModel @Inject constructor(
43
43
init {
44
44
viewModelScope.launch {
45
45
val startDestination =
46
- if (isSessionIdValid() && (isSignedInThroughPassword() || isSignedInThroughPasskeys()) ) {
46
+ if (isSessionIdValid()) {
47
47
ShrineAppDestinations .MainMenuRoute .name
48
48
} else {
49
49
signOut()
@@ -59,30 +59,6 @@ class SplashViewModel @Inject constructor(
59
59
}
60
60
}
61
61
62
- /* *
63
- * Checks if the user is signed in using a password.
64
- *
65
- * This method checks if the user is signed in by calling the `isSignedIn()` method of the
66
- * [AuthRepository].
67
- *
68
- * @return True if the user is signed in using a password, false otherwise.
69
- */
70
- private suspend fun isSignedInThroughPassword (): Boolean {
71
- return repository.isSignedInThroughPassword()
72
- }
73
-
74
- /* *
75
- * Checks if the user is signed in using passkeys.
76
- *
77
- * This method checks if the user is signed in through passkeys by calling the
78
- * `isSignedInThroughPasskeys()` method of the [AuthRepository].
79
- *
80
- * @return True if the user is signed in using passkeys, false otherwise.
81
- */
82
- private suspend fun isSignedInThroughPasskeys (): Boolean {
83
- return repository.isSignedInThroughPasskeys()
84
- }
85
-
86
62
/* *
87
63
* Checks if the session ID is valid with the server.
88
64
*
@@ -95,7 +71,7 @@ class SplashViewModel @Inject constructor(
95
71
/* *
96
72
* Signs out the user.
97
73
*/
98
- fun signOut () {
74
+ private fun signOut () {
99
75
viewModelScope.launch {
100
76
repository.signOut()
101
77
}
You can’t perform that action at this time.
0 commit comments