diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/SignerProvider.kt b/app/src/main/java/com/greenart7c3/nostrsigner/SignerProvider.kt index 8b0a9e96..88b07cd6 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/SignerProvider.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/SignerProvider.kt @@ -98,14 +98,16 @@ class SignerProvider : ContentProvider() { if (!isRemembered) { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - null, - TimeUtils.now(), - false, - content = message, + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + null, + TimeUtils.now(), + false, + content = message, + ), ), account.npub, ) @@ -121,14 +123,16 @@ class SignerProvider : ContentProvider() { val result = runBlocking { account.signString(message) } scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - "SIGN_MESSAGE", - null, - TimeUtils.now(), - true, - content = message, + listOf( + HistoryEntity( + 0, + packageName, + "SIGN_MESSAGE", + null, + TimeUtils.now(), + true, + content = message, + ), ), account.npub, ) @@ -187,14 +191,16 @@ class SignerProvider : ContentProvider() { else -> { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - event.kind, - TimeUtils.now(), - false, - content = event.toJson(), + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + event.kind, + TimeUtils.now(), + false, + content = event.toJson(), + ), ), account.npub, ) @@ -240,14 +246,16 @@ class SignerProvider : ContentProvider() { if (!isRemembered) { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - event.kind, - TimeUtils.now(), - false, - content = event.toJson(), + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + event.kind, + TimeUtils.now(), + false, + content = event.toJson(), + ), ), account.npub, ) @@ -265,14 +273,16 @@ class SignerProvider : ContentProvider() { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - "SIGN_EVENT", - event.kind, - TimeUtils.now(), - true, - content = signedEvent.toJson(), + listOf( + HistoryEntity( + 0, + packageName, + "SIGN_EVENT", + event.kind, + TimeUtils.now(), + true, + content = signedEvent.toJson(), + ), ), account.npub, ) @@ -387,14 +397,16 @@ class SignerProvider : ContentProvider() { if (!isRemembered) { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - null, - TimeUtils.now(), - false, - content = content, + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + null, + TimeUtils.now(), + false, + content = content, + ), ), account.npub, ) @@ -436,14 +448,16 @@ class SignerProvider : ContentProvider() { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - null, - TimeUtils.now(), - true, - content = if (!isEncrypt) finalResult else content, + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + null, + TimeUtils.now(), + true, + content = if (!isEncrypt) finalResult else content, + ), ), account.npub, ) @@ -487,13 +501,15 @@ class SignerProvider : ContentProvider() { if (!isRemembered) { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - null, - TimeUtils.now(), - false, + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + null, + TimeUtils.now(), + false, + ), ), account.npub, ) @@ -509,13 +525,15 @@ class SignerProvider : ContentProvider() { scope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - packageName, - uriString.replace("content://$appId.", ""), - null, - TimeUtils.now(), - true, + listOf( + HistoryEntity( + 0, + packageName, + uriString.replace("content://$appId.", ""), + null, + TimeUtils.now(), + true, + ), ), account.npub, ) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/service/BunkerRequestUtils.kt b/app/src/main/java/com/greenart7c3/nostrsigner/service/BunkerRequestUtils.kt index b4c61a94..0744ec26 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/service/BunkerRequestUtils.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/service/BunkerRequestUtils.kt @@ -391,21 +391,23 @@ object BunkerRequestUtils { EventNotificationConsumer(context).notificationManager().cancelAll() database.dao().insertApplicationWithPermissions(application) historyDatabase.dao().addHistory( - HistoryEntity( - 0, - key, - type.toString(), - kind, - TimeUtils.now(), - true, - content = when (type) { - SignerType.SIGN_EVENT, - SignerType.NIP04_DECRYPT, - SignerType.NIP44_DECRYPT, - SignerType.DECRYPT_ZAP_EVENT, - -> response - else -> getDataFromBunker(bunkerRequest.request) - }, + listOf( + HistoryEntity( + 0, + key, + type.toString(), + kind, + TimeUtils.now(), + true, + content = when (type) { + SignerType.SIGN_EVENT, + SignerType.NIP04_DECRYPT, + SignerType.NIP44_DECRYPT, + SignerType.DECRYPT_ZAP_EVENT, + -> response + else -> getDataFromBunker(bunkerRequest.request) + }, + ), ), account.npub, ) @@ -539,14 +541,16 @@ object BunkerRequestUtils { if (bunkerRequest.request !is BunkerRequestConnect) { Amber.instance.getDatabase(account.npub).dao().insertApplicationWithPermissions(application) Amber.instance.getHistoryDatabase(account.npub).dao().addHistory( - HistoryEntity( - 0, - key, - signerType.toString(), - null, - TimeUtils.now(), - false, - content = getDataFromBunker(bunkerRequest.request), + listOf( + HistoryEntity( + 0, + key, + signerType.toString(), + null, + TimeUtils.now(), + false, + content = getDataFromBunker(bunkerRequest.request), + ), ), account.npub, ) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt b/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt index 2e899a99..825b6101 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt @@ -277,14 +277,16 @@ class EventNotificationConsumer(private val applicationContext: Context) { Amber.instance.applicationIOScope.launch { historyDao .addHistory( - HistoryEntity( - 0, - permission.application.key, - type.toString().toLowerCase(Locale.current), - amberEvent?.kind, - TimeUtils.now(), - true, - content = amberEvent?.content ?: "", + listOf( + HistoryEntity( + 0, + permission.application.key, + type.toString().toLowerCase(Locale.current), + amberEvent?.kind, + TimeUtils.now(), + true, + content = amberEvent?.content ?: "", + ), ), acc.npub, ) @@ -409,13 +411,15 @@ class EventNotificationConsumer(private val applicationContext: Context) { if (!isRemembered) { Amber.instance.applicationIOScope.launch { historyDao.addHistory( - HistoryEntity( - 0, - event.pubKey, - "GET_PUBLIC_KEY", - null, - TimeUtils.now(), - false, + listOf( + HistoryEntity( + 0, + event.pubKey, + "GET_PUBLIC_KEY", + null, + TimeUtils.now(), + false, + ), ), acc.npub, ) @@ -433,13 +437,15 @@ class EventNotificationConsumer(private val applicationContext: Context) { } Amber.instance.applicationIOScope.launch { historyDao.addHistory( - HistoryEntity( - 0, - event.pubKey, - "GET_PUBLIC_KEY", - null, - TimeUtils.now(), - true, + listOf( + HistoryEntity( + 0, + event.pubKey, + "GET_PUBLIC_KEY", + null, + TimeUtils.now(), + true, + ), ), acc.npub, ) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/service/IntentUtils.kt b/app/src/main/java/com/greenart7c3/nostrsigner/service/IntentUtils.kt index 82b5d438..6daf2ee7 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/service/IntentUtils.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/service/IntentUtils.kt @@ -754,22 +754,24 @@ object IntentUtils { val historyDatabase = Amber.instance.getHistoryDatabase(account.npub) Amber.instance.applicationIOScope.launch { historyDatabase.dao().addHistory( - HistoryEntity( - 0, - key, - intentData.type.toString(), - kind, - TimeUtils.now(), - true, - content = when (intentData.type) { - SignerType.SIGN_EVENT -> event - SignerType.NIP04_DECRYPT, - SignerType.NIP44_DECRYPT, - SignerType.DECRYPT_ZAP_EVENT, - -> value + listOf( + HistoryEntity( + 0, + key, + intentData.type.toString(), + kind, + TimeUtils.now(), + true, + content = when (intentData.type) { + SignerType.SIGN_EVENT -> event + SignerType.NIP04_DECRYPT, + SignerType.NIP44_DECRYPT, + SignerType.DECRYPT_ZAP_EVENT, + -> value - else -> intentData.data - }, + else -> intentData.data + }, + ), ), account.npub, ) @@ -903,14 +905,16 @@ object IntentUtils { Amber.instance.getDatabase(account.npub).dao().insertApplicationWithPermissions(application) Amber.instance.getHistoryDatabase(account.npub).dao().addHistory( - HistoryEntity( - 0, - key, - intentData.type.toString(), - kind, - TimeUtils.now(), - false, - content = intentData.data, + listOf( + HistoryEntity( + 0, + key, + intentData.type.toString(), + kind, + TimeUtils.now(), + false, + content = intentData.data, + ), ), account.npub, ) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/BunkerMultiEventHomeScreen.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/BunkerMultiEventHomeScreen.kt index a2e348d8..2ee4b85b 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/BunkerMultiEventHomeScreen.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/components/BunkerMultiEventHomeScreen.kt @@ -398,14 +398,16 @@ fun BunkerMultiEventHomeScreen( database.dao().insertApplicationWithPermissions(application) historyDatabase.dao().addHistory( - entity = HistoryEntity( - id = 0, - pkKey = localKey, - type = SignerType.SIGN_EVENT.toString(), - kind = localEvent.kind, - time = TimeUtils.now(), - accepted = isChecked, - content = localEvent.toJson(), + listOf( + HistoryEntity( + id = 0, + pkKey = localKey, + type = SignerType.SIGN_EVENT.toString(), + kind = localEvent.kind, + time = TimeUtils.now(), + accepted = isChecked, + content = localEvent.toJson(), + ), ), thisAccount.npub, ) @@ -448,14 +450,16 @@ fun BunkerMultiEventHomeScreen( database.dao().insertApplicationWithPermissions(application) historyDatabase.dao().addHistory( - HistoryEntity( - 0, - localKey, - SignerType.SIGN_MESSAGE.toString(), - null, - TimeUtils.now(), - isChecked, - content = request.request.params.first(), + listOf( + HistoryEntity( + 0, + localKey, + SignerType.SIGN_MESSAGE.toString(), + null, + TimeUtils.now(), + isChecked, + content = request.request.params.first(), + ), ), thisAccount.npub, ) @@ -488,14 +492,16 @@ fun BunkerMultiEventHomeScreen( database.dao().insertApplicationWithPermissions(application) historyDatabase.dao().addHistory( - HistoryEntity( - 0, - localKey, - SignerType.CONNECT.toString(), - null, - TimeUtils.now(), - isChecked, - content = "", + listOf( + HistoryEntity( + 0, + localKey, + SignerType.CONNECT.toString(), + null, + TimeUtils.now(), + isChecked, + content = "", + ), ), thisAccount.npub, ) @@ -540,18 +546,20 @@ fun BunkerMultiEventHomeScreen( database.dao().insertApplicationWithPermissions(application) historyDatabase.dao().addHistory( - HistoryEntity( - 0, - localKey, - type.toString(), - null, - TimeUtils.now(), - isChecked, - content = if (type == SignerType.NIP04_DECRYPT || type == SignerType.NIP44_DECRYPT || type == SignerType.DECRYPT_ZAP_EVENT) { - request.encryptedData?.result ?: "" - } else { - request.request.params.getOrElse(1) { "" } - }, + listOf( + HistoryEntity( + 0, + localKey, + type.toString(), + null, + TimeUtils.now(), + isChecked, + content = if (type == SignerType.NIP04_DECRYPT || type == SignerType.NIP44_DECRYPT || type == SignerType.DECRYPT_ZAP_EVENT) { + request.encryptedData?.result ?: "" + } else { + request.request.params.getOrElse(1) { "" } + }, + ), ), thisAccount.npub, )