mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Remove expired applications check from ConnectivityService
Moved to ClearLogsWorker; no need to run it in the timer loop. https://claude.ai/code/session_014Zqb1AEPPF2RrzmEyPnmei
This commit is contained in:
@@ -12,9 +12,6 @@ import android.util.Log
|
||||
import androidx.core.app.ServiceCompat
|
||||
import com.greenart7c3.nostrsigner.Amber
|
||||
import com.greenart7c3.nostrsigner.BuildFlavorChecker
|
||||
import com.greenart7c3.nostrsigner.LocalPreferences
|
||||
import com.greenart7c3.nostrsigner.database.LogEntity
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -117,25 +114,6 @@ class ConnectivityService : Service() {
|
||||
timer.schedule(
|
||||
object : TimerTask() {
|
||||
override fun run() {
|
||||
scope.launch {
|
||||
LocalPreferences.allSavedAccounts(Amber.instance).forEach { accountInfo ->
|
||||
val now = System.currentTimeMillis() / 1000
|
||||
Amber.instance.getDatabase(accountInfo.npub).dao().updateExpiredPermissions(TimeUtils.now())
|
||||
val deleted = Amber.instance.getDatabase(accountInfo.npub).dao().deleteOldApplications(now)
|
||||
if (deleted > 0) {
|
||||
Amber.instance.getLogDatabase(accountInfo.npub).dao().insertLog(
|
||||
LogEntity(
|
||||
id = 0,
|
||||
url = "",
|
||||
type = "deleteApplications",
|
||||
message = "Deleted $deleted expired applications",
|
||||
time = System.currentTimeMillis(),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (BuildFlavorChecker.isOfflineFlavor()) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user