From 6cf1dff8b973a1e6514f0c0234c3267b3c6afe21 Mon Sep 17 00:00:00 2001 From: DatLag Date: Fri, 19 Apr 2024 14:58:14 +0200 Subject: [PATCH] make sure the token can be refreshed --- .../kotlin/dev/datlag/aniflow/other/TokenRefreshHandler.kt | 2 +- .../ui/navigation/screen/medium/MediumScreenComponent.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/TokenRefreshHandler.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/TokenRefreshHandler.kt index 76f3778..f2f4426 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/TokenRefreshHandler.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/other/TokenRefreshHandler.kt @@ -52,7 +52,7 @@ class TokenRefreshHandler( access = newTokens.access_token, refresh = newTokens.refresh_token, id = newTokens.id_token, - expires = (newTokens.expires_in ?: newTokens.refresh_token_expires_in)?.let { + expires = (newTokens.refresh_token_expires_in ?: newTokens.expires_in)?.let { Clock.System.now().epochSeconds + it }?.toInt() ) diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt index 771d6fe..92458de 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/medium/MediumScreenComponent.kt @@ -332,7 +332,7 @@ class MediumScreenComponent( access = it.access_token, refresh = it.refresh_token, id = it.id_token, - expires = (it.expires_in ?: it.refresh_token_expires_in)?.let { time -> + expires = (it.refresh_token_expires_in ?: it.expires_in)?.let { time -> Clock.System.now().epochSeconds + time }?.toInt() )