Skip to content

Commit cef94d0

Browse files
committed
fix: isTimeOutOver init validation
1 parent a46450c commit cef94d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/HomeViewModel.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ class HomeViewModel @Inject constructor(
155155
val totalOnChainSats = walletRepo.balanceState.value.totalSats
156156
val balanceUsd = satsToUsd(totalOnChainSats) ?: return@launch
157157
val thresholdReached = balanceUsd > BigDecimal(BALANCE_THRESHOLD_USD)
158-
val isTimeOutOver = settings.lastTimeAskedBalanceWarningMillis - ASK_INTERVAL_MILLIS > ASK_INTERVAL_MILLIS
158+
val isTimeOutOver = if (settings.lastTimeAskedBalanceWarningMillis == 0L) {
159+
true
160+
} else {
161+
settings.lastTimeAskedBalanceWarningMillis - ASK_INTERVAL_MILLIS > ASK_INTERVAL_MILLIS
162+
}
159163
val belowMaxWarnings = settings.balanceWarningTimes < MAX_WARNINGS
160164

161165
if (thresholdReached && isTimeOutOver && belowMaxWarnings && !_uiState.value.highBalanceSheetVisible) {

0 commit comments

Comments
 (0)