mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 11:28:22 +00:00
Fix old log entries delete
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user