mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
WidgetUpdater: Remove rate limit
This commit is contained in:
@@ -43,8 +43,6 @@ class WidgetUpdater
|
|||||||
private val intentScheduler: IntentScheduler
|
private val intentScheduler: IntentScheduler
|
||||||
) : CommandRunner.Listener {
|
) : CommandRunner.Listener {
|
||||||
|
|
||||||
private var lastUpdated = 0L
|
|
||||||
|
|
||||||
override fun onCommandExecuted(command: Command?, refreshKey: Long?) {
|
override fun onCommandExecuted(command: Command?, refreshKey: Long?) {
|
||||||
updateWidgets(refreshKey)
|
updateWidgets(refreshKey)
|
||||||
}
|
}
|
||||||
@@ -72,10 +70,6 @@ class WidgetUpdater
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateWidgets(modifiedHabitId: Long?) {
|
fun updateWidgets(modifiedHabitId: Long?) {
|
||||||
val now = DateUtils.getLocalTime()
|
|
||||||
if (abs(now - lastUpdated) < 60_000) return
|
|
||||||
lastUpdated = now
|
|
||||||
|
|
||||||
taskRunner.execute {
|
taskRunner.execute {
|
||||||
updateWidgets(modifiedHabitId, CheckmarkWidgetProvider::class.java)
|
updateWidgets(modifiedHabitId, CheckmarkWidgetProvider::class.java)
|
||||||
updateWidgets(modifiedHabitId, HistoryWidgetProvider::class.java)
|
updateWidgets(modifiedHabitId, HistoryWidgetProvider::class.java)
|
||||||
|
|||||||
Reference in New Issue
Block a user