Fix old log entries delete

This commit is contained in:
greenart7c3
2025-05-02 13:21:19 -03:00
parent 432d20da99
commit 5f415e6c35
3 changed files with 3 additions and 4 deletions
@@ -434,7 +434,6 @@ object LocalPreferences {
}
fun loadFromEncryptedStorageSync(context: Context, npub: String? = null): Account? {
Log.d("SignerProvider", "Loading from encrypted storage ${savedAccounts == null} accountCacheEmpty: ${accountCache.size()}")
if (savedAccounts == null || accountCache.size() == 0 || savedAccounts?.size != accountCache.size()) {
Log.d("SignerProvider", "accountCache is null loading accounts")
runBlocking {
@@ -55,7 +55,7 @@ class BootReceiver : BroadcastReceiver() {
LocalPreferences.allSavedAccounts(Amber.instance).forEach {
Amber.instance.getDatabase(it.npub).let { database ->
try {
val oneWeek = System.currentTimeMillis() - ONE_WEEK
val oneWeek = System.currentTimeMillis() - (ONE_WEEK * 1000L)
val oneWeekAgo = TimeUtils.oneWeekAgo()
val countHistory = database.applicationDao().countOldHistory(oneWeekAgo)
Log.d("NostrSigner", "Deleting $countHistory old history entries")
@@ -86,7 +86,7 @@ class BootReceiver : BroadcastReceiver() {
}
val countLog = database.applicationDao().countOldLog(oneWeek)
Log.d("NostrSigner", "Deleting $countLog old log entries")
Log.d("NostrSigner", "Deleting $countLog old log entries from ${com.greenart7c3.nostrsigner.models.TimeUtils.formatLongToCustomDateTimeWithSeconds(oneWeek)}")
if (countLog > 0) {
var logs = database.applicationDao().getOldLog(oneWeek)
var count = 0
@@ -274,7 +274,7 @@ fun SettingsScreen(
Amber.instance.getDatabase(it.npub).let { database ->
try {
status = context.getString(R.string.deleting_old_log_entries_from, it.npub)
val oneWeek = System.currentTimeMillis() - ONE_WEEK
val oneWeek = System.currentTimeMillis() - (ONE_WEEK * 1000L)
val oneWeekAgo = TimeUtils.oneWeekAgo()
val countHistory = database.applicationDao().countOldHistory(oneWeekAgo)
if (countHistory > 0) {