Updated on 2026-08-14

This commit is contained in:
Tangem 2023-01-18 18:05:18 +08:00
parent e98780ff93
commit 479d142807
283 changed files with 2338 additions and 2730 deletions

View file

@ -14,7 +14,7 @@ class CardBalanceStateAdapter {
return when (json) {
AnalyticsParam.CardBalanceState.Empty.value -> AnalyticsParam.CardBalanceState.Empty
AnalyticsParam.CardBalanceState.Full.value -> AnalyticsParam.CardBalanceState.Full
else -> throw IllegalArgumentException()
else -> error("CardBalanceState not found")
}
}
}

View file

@ -101,11 +101,7 @@ class AppRatingLaunchObserver(
private val preferences: SharedPreferences,
private val launchCounts: Int,
) {
private val K_SHOW_RATING_AT_LAUNCH_COUNT = "showRatingDialogAtLaunchCount"
private val K_FUNDS_FOUND_DATE = "fundsFoundDate"
private val K_USER_WAS_INTERACT_WITH_RATING = "userWasInteractWithRating"
private val FUNDS_FOUND_DATE_UNDEFINED = -1L
private val deferShowing = 20
private val firstShowing = 3
private var fundsFoundDate: Calendar? = null
@ -127,6 +123,7 @@ class AppRatingLaunchObserver(
}
}
@Suppress("MagicNumber")
fun isReadyToShow(): Boolean {
val fundsDate = fundsFoundDate ?: return false
@ -144,6 +141,7 @@ class AppRatingLaunchObserver(
updateNextShowing(launchCounts + deferShowing)
}
@Suppress("MagicNumber")
fun setNeverToShow() {
updateNextShowing(999999999)
}
@ -155,6 +153,16 @@ class AppRatingLaunchObserver(
editor.apply()
}
private fun userWasInteractWithRating(): Boolean = preferences.getBoolean(K_USER_WAS_INTERACT_WITH_RATING, false)
private fun getCounterOfNextShowing(): Int = preferences.getInt(K_SHOW_RATING_AT_LAUNCH_COUNT, firstShowing)
private fun userWasInteractWithRating(): Boolean =
preferences.getBoolean(K_USER_WAS_INTERACT_WITH_RATING, false)
private fun getCounterOfNextShowing(): Int =
preferences.getInt(K_SHOW_RATING_AT_LAUNCH_COUNT, firstShowing)
companion object {
private const val K_SHOW_RATING_AT_LAUNCH_COUNT = "showRatingDialogAtLaunchCount"
private const val K_FUNDS_FOUND_DATE = "fundsFoundDate"
private const val K_USER_WAS_INTERACT_WITH_RATING = "userWasInteractWithRating"
private const val FUNDS_FOUND_DATE_UNDEFINED = -1L
}
}