Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-01 22:26:21 +05:00
parent c509046a8b
commit adb8c50ae2
13 changed files with 448 additions and 1 deletions

View file

@ -0,0 +1,24 @@
package com.tangem.domain.settings
import kotlinx.coroutines.flow.StateFlow
import kotlin.time.Duration.Companion.days
/**
* Manages the lifetime (TTL) of the Usedesk support-chat token.
*
* The token is reused while the time since the last chat interaction is below this TTL;
* once it expires the SDK obtains a fresh token on the next chat init.
*
* In production the TTL is fixed to [DEFAULT_TTL_MILLIS]. Debug builds let testers override it
* via the Tester Menu (e.g. shorten it to a few minutes to verify token-refresh behaviour).
*/
interface UsedeskTokenTtlManager {
fun getTokenTtlMillis(): StateFlow<Long>
fun getTokenTtlMillisSync(): Long
suspend fun setTokenTtlMillis(millis: Long)
companion object {
val DEFAULT_TTL_MILLIS: Long = 7.days.inWholeMilliseconds
}
}