Fixed last change time not updating from initial

This commit is contained in:
Anthonyy232 committed 2025-08-20 11:09:33 -07:00
1 parent e7c92eae71
commit 0c2ca68dcd
2 files changed
+8 -5

No files matched your search

@@ -168,11 +168,6 @@ class WallpaperAlarmSchedulerImpl @Inject constructor(
else -> {}
}
if (firstLaunch) {
val currentTime = LocalDateTime.now()
settingsDataStore.putString(SettingsConstants.LAST_SET_TIME, currentTime.format(formatter))
}
val currentHomeNext = settingsDataStore.getString(SettingsConstants.HOME_NEXT_SET_TIME)
val currentLockNext = settingsDataStore.getString(SettingsConstants.LOCK_NEXT_SET_TIME)
val nextHomeDateTime = runCatching { LocalDateTime.parse(currentHomeNext) }.getOrNull()
@@ -14,6 +14,9 @@ import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import javax.inject.Inject
@AndroidEntryPoint
@@ -61,6 +64,11 @@ class WallpaperReceiver : BroadcastReceiver() {
val origin = intent.getIntExtra("origin", -1).takeIf { it != -1 }
Log.d(TAG, "Rescheduling next alarm from receiver with origin: $origin")
CoroutineScope(Dispatchers.IO).launch {
val formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
val currentTime = LocalDateTime.now()
settingsDataStore.putString(SettingsConstants.LAST_SET_TIME, currentTime.format(formatter))
val homeNext = settingsDataStore.getString(SettingsConstants.HOME_NEXT_SET_TIME)
val lockNext = settingsDataStore.getString(SettingsConstants.LOCK_NEXT_SET_TIME)