Skip to content

Commit 92cec88

Browse files
committed
Fix a wrong time calculation
1 parent d85b5c2 commit 92cec88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flavor-google/src/main/java/xyz/aprildown/timer/flavor/google/FlavorUiInjectorImpl.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ class FlavorUiInjectorImpl @Inject constructor(
116116

117117
val now = System.currentTimeMillis()
118118

119-
val requestTime = preferencesRepository.getLong(requestTimeKey, now)
119+
if (!preferencesRepository.contains(requestTimeKey)) {
120+
preferencesRepository.setLong(requestTimeKey, now)
121+
}
122+
val requestTime = preferencesRepository.getLong(requestTimeKey, 0L)
120123
val launchTimes = preferencesRepository.getInt(launchTimesKey, 0) + 1
121124
preferencesRepository.setInt(launchTimesKey, launchTimes)
122125

0 commit comments

Comments
 (0)