chore: remind me next time

This commit is contained in:
hstyi
2025-02-28 12:38:38 +08:00
committed by hstyi
parent eba85e6348
commit 9915c373b7

View File

@@ -47,6 +47,7 @@ class AppUpdateAction private constructor() : AnAction(
} }
private val updaterManager get() = UpdaterManager.getInstance() private val updaterManager get() = UpdaterManager.getInstance()
private var isRemindMeNextTime = false
init { init {
isEnabled = false isEnabled = false
@@ -65,9 +66,11 @@ class AppUpdateAction private constructor() : AnAction(
initialDelay = 3.minutes.inWholeMilliseconds, initialDelay = 3.minutes.inWholeMilliseconds,
period = 5.hours.inWholeMilliseconds, daemon = true period = 5.hours.inWholeMilliseconds, daemon = true
) { ) {
if (!isRemindMeNextTime) {
GlobalScope.launch(Dispatchers.IO) { supervisorScope { launch { checkUpdate() } } } GlobalScope.launch(Dispatchers.IO) { supervisorScope { launch { checkUpdate() } } }
} }
} }
}
private suspend fun checkUpdate() { private suspend fun checkUpdate() {
@@ -190,6 +193,7 @@ class AppUpdateAction private constructor() : AnAction(
return return
} else if (option == JOptionPane.NO_OPTION) { } else if (option == JOptionPane.NO_OPTION) {
isEnabled = false isEnabled = false
isRemindMeNextTime = true
} else if (option == JOptionPane.YES_OPTION) { } else if (option == JOptionPane.YES_OPTION) {
updateSelf(lastVersion) updateSelf(lastVersion)
} }