diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/dao/NostrNip17Dao.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/dao/NostrNip17Dao.kt index 76794a76..2b19b07c 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/dao/NostrNip17Dao.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/dao/NostrNip17Dao.kt @@ -79,7 +79,6 @@ abstract class NostrNip17Dao( giftWrapEvent: GiftWrapEvent, receiverPublicKey: PTag ) { - val nostrEvent = NostrEvent( id = giftWrapEvent.id, content = giftWrapEvent.content, @@ -89,6 +88,7 @@ abstract class NostrNip17Dao( tags = giftWrapEvent.tags, kind = giftWrapEvent.kind ) + logger.d("NostrEvent: $nostrEvent") database.nostrEventDao().insert(nostrEvent) @@ -120,17 +120,18 @@ abstract class NostrNip17Dao( ) ) - val giftWrapSeal = GiftWrapSeal( - id = sealedRumorEvent.id, - publicKey = sealedRumorEvent.pubKey, - content = sealedRumorEvent.content, - kind = sealedRumorEvent.kind, - tags = sealedRumorEvent.tags, - signature = sealedRumorEvent.sig, - giftWrapMessageId = giftWrapEvent.id + database.giftWrapSealDao().upsert( + GiftWrapSeal( + id = sealedRumorEvent.id, + publicKey = sealedRumorEvent.pubKey, + content = sealedRumorEvent.content, + kind = sealedRumorEvent.kind, + tags = sealedRumorEvent.tags, + signature = sealedRumorEvent.sig, + giftWrapMessageId = giftWrapEvent.id + ) ) - - database.giftWrapSealDao().upsert(giftWrapSeal) + logger.d("persistAndBroadcastGiftWrap done") } companion object { diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/repository/DatabaseChatRepository.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/repository/DatabaseChatRepository.kt index 4b426d1e..0a955381 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/repository/DatabaseChatRepository.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/repository/DatabaseChatRepository.kt @@ -107,8 +107,10 @@ class DatabaseChatRepository( tags = giftWrapPayload.tags, content = giftWrapPayload.content ) + logger.d("GiftWrap Payload Event: ${giftWrapPayloadEvent.toJson()}") giftWrapPayload.tags.taggedUsers().forEachIndexed { index, receiverPublicKey -> + logger.d("Seal to $receiverPublicKey") val payload = giftWrapPayloadEvent.toJson() val sealedRumorEvent = nostrSignerSync.signNormal( @@ -120,6 +122,7 @@ class DatabaseChatRepository( toPublicKey = receiverPublicKey.pubKey ) ) + logger.d("SealedRumorEvent: ${sealedRumorEvent.toJson()}") val giftWrapEvent = nostrSignerSync.signNormal( createdAt = TimeUtils.randomWithTwoDays(), @@ -132,6 +135,7 @@ class DatabaseChatRepository( toPublicKey = receiverPublicKey.pubKey ) ) + logger.d("giftWrapEvent: ${giftWrapEvent.toJson()}") database.nostrNip17Dao().persistAndBroadcastGiftWrap( sealedRumorEvent = sealedRumorEvent, @@ -146,6 +150,7 @@ class DatabaseChatRepository( giftWrapSealId = sealedRumorEvent.id ) ) + logger.d("GiftWrap now sealed: ${giftWrapPayload.id}") } } }