-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fdbcf6
commit 952078b
Showing
8 changed files
with
73 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ package com.bff.wespot.model.auth.response | |
|
||
data class Consents( | ||
val marketing: Boolean, | ||
) | ||
) |
3 changes: 1 addition & 2 deletions
3
core/model/src/main/kotlin/com/bff/wespot/model/auth/response/SignUpToken.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.bff.wespot.model.auth.response | ||
|
||
|
||
data class SignUpToken( | ||
val signUpToken: String, | ||
) | ||
) |
25 changes: 25 additions & 0 deletions
25
domain/src/main/kotlin/com/bff/wespot/domain/usecase/AutoLoginUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.bff.wespot.domain.usecase | ||
|
||
import com.bff.wespot.domain.repository.DataStoreRepository | ||
import com.bff.wespot.domain.util.DataStoreKey | ||
import com.bff.wespot.model.constants.LoginState | ||
import kotlinx.coroutines.flow.first | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
import javax.inject.Inject | ||
|
||
class AutoLoginUseCase @Inject constructor( | ||
private val dataStoreRepository: DataStoreRepository, | ||
) { | ||
suspend operator fun invoke(): LoginState = | ||
dataStoreRepository.getString(DataStoreKey.REFRESH_TOKEN_EXPIRED_AT).first().let { | ||
val dateTime = LocalDateTime.parse(it, DateTimeFormatter.ISO_DATE_TIME) | ||
val now = LocalDateTime.now() | ||
|
||
return if (it.isEmpty() || dateTime.isBefore(now)) { | ||
LoginState.LOGIN_FAILURE | ||
} else { | ||
LoginState.LOGIN_SUCCESS | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters