diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/converters/Converters.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/converters/Converters.kt index 87ebf447..f17ad46a 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/converters/Converters.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/converters/Converters.kt @@ -13,12 +13,12 @@ class AuxConverters { @TypeConverter fun fromTimestamp(value: Long?): Instant? { - return value?.let { Instant.fromEpochMilliseconds(it) } + return value?.let { Instant.fromEpochSeconds(it) } } @TypeConverter fun instantToTimestamp(instant: Instant?): Long? { - return instant?.toEpochMilliseconds() + return instant?.epochSeconds } @TypeConverter diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/model/NostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/model/NostrEvent.kt index 2a4b40f3..56afa52e 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/model/NostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/model/NostrEvent.kt @@ -86,7 +86,7 @@ data class NostrEvent( val textNote = EventFactory.create( id = id, pubKey = pubKey, - createdAt = createdAt.toEpochMilliseconds(), + createdAt = createdAt.epochSeconds, kind = kind, tags = tags, content = content, @@ -101,8 +101,8 @@ data class NostrEvent( nostrEventId = id, replyToId = textNote.replyingTo(), profilePublicKey = textNote.pubKey, - createdAt = Instant.fromEpochMilliseconds(textNote.createdAt), - updatedAt = Instant.fromEpochMilliseconds(textNote.createdAt), + createdAt = Instant.fromEpochSeconds(textNote.createdAt), + updatedAt = Instant.fromEpochSeconds(textNote.createdAt), ) } return null @@ -116,7 +116,7 @@ data class NostrEvent( val metadataEvent = EventFactory.create( id = id, pubKey = pubKey, - createdAt = createdAt.toEpochMilliseconds(), + createdAt = createdAt.epochSeconds, kind = kind, tags = tags, content = content, @@ -128,8 +128,8 @@ data class NostrEvent( publicKey = pubKey, nostrEventId = id, - createdAt = Instant.fromEpochMilliseconds(metadataEvent.createdAt), - updatedAt = Instant.fromEpochMilliseconds(metadataEvent.createdAt), + createdAt = Instant.fromEpochSeconds(metadataEvent.createdAt), + updatedAt = Instant.fromEpochSeconds(metadataEvent.createdAt), userName = userMetadata.name, displayName = userMetadata.displayName, @@ -158,7 +158,7 @@ data class NostrEvent( val reactionEvent = EventFactory.create( id = id, pubKey = pubKey, - createdAt = createdAt.toEpochMilliseconds(), + createdAt = createdAt.epochSeconds, kind = kind, tags = tags, content = content, @@ -174,8 +174,8 @@ data class NostrEvent( replyToId = reactedTo, profilePublicKey = reactionEvent.pubKey, - createdAt = Instant.fromEpochMilliseconds(reactionEvent.createdAt), - updatedAt = Instant.fromEpochMilliseconds(reactionEvent.createdAt), + createdAt = Instant.fromEpochSeconds(reactionEvent.createdAt), + updatedAt = Instant.fromEpochSeconds(reactionEvent.createdAt), ) } } @@ -190,7 +190,7 @@ data class NostrEvent( val repostEvent = EventFactory.create( id = id, pubKey = pubKey, - createdAt = createdAt.toEpochMilliseconds(), + createdAt = createdAt.epochSeconds, kind = kind, tags = tags, content = content, @@ -206,8 +206,8 @@ data class NostrEvent( nostrEventId = id, profilePublicKey = repostEvent.pubKey, - createdAt = Instant.fromEpochMilliseconds(repostEvent.createdAt), - updatedAt = Instant.fromEpochMilliseconds(repostEvent.createdAt), + createdAt = Instant.fromEpochSeconds(repostEvent.createdAt), + updatedAt = Instant.fromEpochSeconds(repostEvent.createdAt), ) } } @@ -223,7 +223,7 @@ data class NostrEvent( val zapEvent = EventFactory.create( id = id, pubKey = pubKey, - createdAt = createdAt.toEpochMilliseconds(), + createdAt = createdAt.epochSeconds, kind = kind, tags = tags, content = content, diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt index a300f83a..7ae90a0b 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt @@ -68,7 +68,7 @@ class DatabaseNostrRepository( UnsignedNostrEvent( pubKey = publicKey, kind = profileEventTemplate.kind, - createdAt = Instant.fromEpochMilliseconds(profileEventTemplate.createdAt), + createdAt = Instant.fromEpochSeconds(profileEventTemplate.createdAt), tags = profileEventTemplate.tags, content = profileEventTemplate.content, signedAt = signedAt // This will keep us from trying to sign this event... but we should automatically sync the npub profile @@ -111,7 +111,7 @@ class DatabaseNostrRepository( UnsignedNostrEvent( pubKey = publicKey, kind = textNote.kind, - createdAt = Instant.fromEpochMilliseconds(textNote.createdAt), + createdAt = Instant.fromEpochSeconds(textNote.createdAt), tags = textNote.tags, content = textNote.content ) diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/network/NostrEventBroadcaster.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/network/NostrEventBroadcaster.kt index 8052d1fc..e18ea647 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/network/NostrEventBroadcaster.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/network/NostrEventBroadcaster.kt @@ -53,7 +53,7 @@ class NostrEventBroadcaster( content = nostrEvent.content, tags = nostrEvent.tags, sig = nostrEvent.sig, - createdAt = nostrEvent.createdAt.toEpochMilliseconds() + createdAt = nostrEvent.createdAt.epochSeconds ) } diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/UnsignedProfileScreen.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/UnsignedProfileScreen.kt index 23771757..15e35244 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/UnsignedProfileScreen.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/UnsignedProfileScreen.kt @@ -51,7 +51,7 @@ fun UnsignedProfileScreen( val metadataEvent = MetadataEvent( id = unsignedNostrEvent.id.toString(), pubKey = unsignedNostrEvent.pubKey, - createdAt = unsignedNostrEvent.createdAt.toEpochMilliseconds(), + createdAt = unsignedNostrEvent.createdAt.epochSeconds, tags = unsignedNostrEvent.tags, content = unsignedNostrEvent.content, sig = "" diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/NavigationViewModel.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/NavigationViewModel.kt index 8a7ff6a2..ad2cb523 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/NavigationViewModel.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/view/model/NavigationViewModel.kt @@ -108,7 +108,7 @@ class NavigationViewModel( unsignedNostrEventOrNull?.let { unsignedNostrEvent -> logger.d("Unsigned") val event = tempSigner.signNormal( - createdAt = unsignedNostrEvent.createdAt.toEpochMilliseconds(), + createdAt = unsignedNostrEvent.createdAt.epochSeconds, kind = unsignedNostrEvent.kind, tags = unsignedNostrEvent.tags, content = unsignedNostrEvent.content @@ -122,7 +122,7 @@ class NavigationViewModel( kind = event.kind, tags = event.tags, content = event.content, - createdAt = Instant.fromEpochMilliseconds(event.createdAt), + createdAt = Instant.fromEpochSeconds(event.createdAt), sig = event.sig, unsignedNostrEventId = unsignedNostrEvent.id ), @@ -151,8 +151,8 @@ class NavigationViewModel( ids = synchronizeNostrEventRequest.eventIds?.map { eventId -> eventId }, authors = synchronizeNostrEventRequest.authorPublicKeys?.map { authorPublicKey -> authorPublicKey }, kinds = synchronizeNostrEventRequest.kinds?.map { kind -> kind }, - since = synchronizeNostrEventRequest.since?.toEpochMilliseconds(), - until = synchronizeNostrEventRequest.until?.toEpochMilliseconds(), + since = synchronizeNostrEventRequest.since?.epochSeconds, + until = synchronizeNostrEventRequest.until?.epochSeconds, limit = synchronizeNostrEventRequest.limit, search = synchronizeNostrEventRequest.search ) @@ -200,7 +200,7 @@ class NavigationViewModel( kind = event.kind, content = event.content, tags = event.tags, - createdAt = Instant.fromEpochMilliseconds(event.createdAt), + createdAt = Instant.fromEpochSeconds(event.createdAt), unsignedNostrEventId = synchronizeNostrEventRequest.unsignedNostrEventId, sig = event.sig )