@@ -38,7 +38,6 @@ import dev.dimension.flare.model.ReferenceType
3838import dev.dimension.flare.ui.model.mapper.parseBlueskyJson
3939import kotlinx.collections.immutable.ImmutableMap
4040import kotlinx.coroutines.flow.firstOrNull
41- import kotlinx.datetime.toStdlibInstant
4241import sh.christian.ozone.api.AtUri
4342
4443internal object Bluesky {
@@ -85,7 +84,7 @@ internal object Bluesky {
8584 database : CacheDatabase ,
8685 data : List <PostView >,
8786 sortIdProvider : (PostView ) -> Long = {
88- it.indexedAt.toStdlibInstant(). toEpochMilliseconds()
87+ it.indexedAt.toEpochMilliseconds()
8988 },
9089 ) {
9190 save(database, data.toDb(accountKey, pagingKey, sortIdProvider))
@@ -156,7 +155,7 @@ internal suspend fun List<BookmarkView>.toDb(
156155 accountKey : MicroBlogKey ,
157156 pagingKey : String ,
158157 sortIdProvider : suspend (BookmarkView ) -> Long = {
159- it.createdAt?.toStdlibInstant()?. toEpochMilliseconds() ? : SnowflakeIdGenerator .nextId()
158+ it.createdAt?.toEpochMilliseconds() ? : SnowflakeIdGenerator .nextId()
160159 },
161160): List <DbPagingTimelineWithStatus > =
162161 this .mapNotNull {
@@ -174,7 +173,7 @@ internal suspend fun List<BookmarkView>.toDb(
174173internal fun List<PostView>.toDb (
175174 accountKey : MicroBlogKey ,
176175 pagingKey : String ,
177- sortIdProvider : (PostView ) -> Long = { it.indexedAt.toStdlibInstant(). toEpochMilliseconds() },
176+ sortIdProvider : (PostView ) -> Long = { it.indexedAt.toEpochMilliseconds() },
178177): List <DbPagingTimelineWithStatus > =
179178 this .map {
180179 createDbPagingTimelineWithStatus(
@@ -204,7 +203,7 @@ internal fun List<ListNotificationsNotification>.toDb(
204203 createDbPagingTimelineWithStatus(
205204 accountKey = accountKey,
206205 pagingKey = pagingKey,
207- sortId = it.indexedAt.toStdlibInstant(). toEpochMilliseconds(),
206+ sortId = it.indexedAt.toEpochMilliseconds(),
208207 status = it.toDbStatusWithUser(accountKey),
209208 references = mapOf (),
210209 )
@@ -250,7 +249,7 @@ internal fun List<ListNotificationsNotification>.toDb(
250249 userKey = null ,
251250 content = content,
252251 text = null ,
253- createdAt = items.first().indexedAt.toStdlibInstant() ,
252+ createdAt = items.first().indexedAt,
254253 ),
255254 )
256255 listOf (
@@ -261,7 +260,6 @@ internal fun List<ListNotificationsNotification>.toDb(
261260 items
262261 .first()
263262 .indexedAt
264- .toStdlibInstant()
265263 .toEpochMilliseconds(),
266264 status = data,
267265 references =
@@ -295,7 +293,7 @@ internal fun List<ListNotificationsNotification>.toDb(
295293 userKey = null ,
296294 content = content,
297295 text = null ,
298- createdAt = items.first().indexedAt.toStdlibInstant() ,
296+ createdAt = items.first().indexedAt,
299297 ),
300298 )
301299 listOfNotNull(
@@ -306,7 +304,6 @@ internal fun List<ListNotificationsNotification>.toDb(
306304 items
307305 .first()
308306 .indexedAt
309- .toStdlibInstant()
310307 .toEpochMilliseconds(),
311308 status = data,
312309 references = mapOf (),
@@ -336,13 +333,13 @@ internal fun List<ListNotificationsNotification>.toDb(
336333 userKey = user.userKey,
337334 content = content,
338335 text = null ,
339- createdAt = it.indexedAt.toStdlibInstant() ,
336+ createdAt = it.indexedAt,
340337 ),
341338 )
342339 createDbPagingTimelineWithStatus(
343340 accountKey = accountKey,
344341 pagingKey = pagingKey,
345- sortId = it.indexedAt.toStdlibInstant(). toEpochMilliseconds(),
342+ sortId = it.indexedAt.toEpochMilliseconds(),
346343 status = data,
347344 references =
348345 mapOf (
@@ -376,13 +373,13 @@ internal fun List<ListNotificationsNotification>.toDb(
376373 userKey = user.userKey,
377374 content = content,
378375 text = null ,
379- createdAt = it.indexedAt.toStdlibInstant() ,
376+ createdAt = it.indexedAt,
380377 ),
381378 )
382379 createDbPagingTimelineWithStatus(
383380 accountKey = accountKey,
384381 pagingKey = pagingKey,
385- sortId = it.indexedAt.toStdlibInstant(). toEpochMilliseconds(),
382+ sortId = it.indexedAt.toEpochMilliseconds(),
386383 status = data,
387384 references =
388385 mapOf (
@@ -415,13 +412,13 @@ internal fun List<ListNotificationsNotification>.toDb(
415412 userKey = user.userKey,
416413 content = content,
417414 text = null ,
418- createdAt = it.indexedAt.toStdlibInstant() ,
415+ createdAt = it.indexedAt,
419416 ),
420417 )
421418 createDbPagingTimelineWithStatus(
422419 accountKey = accountKey,
423420 pagingKey = pagingKey,
424- sortId = it.indexedAt.toStdlibInstant(). toEpochMilliseconds(),
421+ sortId = it.indexedAt.toEpochMilliseconds(),
425422 status = data,
426423 references =
427424 mapOf (
@@ -454,13 +451,13 @@ internal fun List<ListNotificationsNotification>.toDb(
454451 userKey = user.userKey,
455452 content = content,
456453 text = null ,
457- createdAt = it.indexedAt.toStdlibInstant() ,
454+ createdAt = it.indexedAt,
458455 ),
459456 )
460457 createDbPagingTimelineWithStatus(
461458 accountKey = accountKey,
462459 pagingKey = pagingKey,
463- sortId = it.indexedAt.toStdlibInstant(). toEpochMilliseconds(),
460+ sortId = it.indexedAt.toEpochMilliseconds(),
464461 status = data,
465462 references =
466463 mapOf (
@@ -507,7 +504,7 @@ private fun ListNotificationsNotification.toDbStatus(accountKey: MicroBlogKey):
507504 content = StatusContent .BlueskyNotification .Normal (this ),
508505 accountType = AccountType .Specific (accountKey),
509506 text = null ,
510- createdAt = indexedAt.toStdlibInstant() ,
507+ createdAt = indexedAt,
511508 )
512509}
513510
@@ -518,7 +515,7 @@ internal suspend fun List<FeedViewPost>.toDbPagingTimeline(
518515 when (val reason = it.reason) {
519516// is FeedViewPostReasonUnion.ReasonRepost -> {
520517// reason.value.indexedAt
521- // .toStdlibInstant()
518+ //
522519// .toEpochMilliseconds()
523520// }
524521
@@ -529,7 +526,7 @@ internal suspend fun List<FeedViewPost>.toDbPagingTimeline(
529526 else -> {
530527 -SnowflakeIdGenerator .nextId()
531528// it.post.indexedAt
532- // .toStdlibInstant()
529+ //
533530// .toEpochMilliseconds()
534531 }
535532 }
@@ -568,7 +565,7 @@ internal suspend fun List<FeedViewPost>.toDbPagingTimeline(
568565 content = StatusContent .BlueskyReason (data),
569566 accountType = AccountType .Specific (accountKey),
570567 text = null ,
571- createdAt = it.post.indexedAt.toStdlibInstant() ,
568+ createdAt = it.post.indexedAt,
572569 ),
573570 )
574571 }
@@ -588,7 +585,7 @@ internal suspend fun List<FeedViewPost>.toDbPagingTimeline(
588585 content = StatusContent .BlueskyReason (data),
589586 accountType = AccountType .Specific (accountKey),
590587 text = status.data.text,
591- createdAt = it.post.indexedAt.toStdlibInstant() ,
588+ createdAt = it.post.indexedAt,
592589 ),
593590 )
594591 }
@@ -644,7 +641,7 @@ private fun PostView.toDbStatusWithUser(accountKey: MicroBlogKey): DbStatusWithU
644641 userKey = user.userKey,
645642 accountType = AccountType .Specific (accountKey),
646643 text = parseBlueskyJson(record, accountKey).raw,
647- createdAt = indexedAt.toStdlibInstant() ,
644+ createdAt = indexedAt,
648645 )
649646 return DbStatusWithUser (
650647 data = status,
@@ -784,7 +781,7 @@ private fun MessageView.toDbMessageItem(roomKey: MicroBlogKey) =
784781 messageKey = MicroBlogKey (id = id, host = roomKey.host),
785782 roomKey = roomKey,
786783 userKey = MicroBlogKey (id = sender.did.did, host = roomKey.host),
787- timestamp = sentAt.toStdlibInstant(). toEpochMilliseconds(),
784+ timestamp = sentAt.toEpochMilliseconds(),
788785 content = MessageContent .Bluesky .Message (this ),
789786 showSender = false ,
790787 )
@@ -797,7 +794,7 @@ private fun ConvoViewLastMessageUnion.DeletedMessageView.toDbMessageItem(roomKey
797794 messageKey = MicroBlogKey (id = id, host = roomKey.host),
798795 roomKey = roomKey,
799796 userKey = MicroBlogKey (id = sender.did.did, host = roomKey.host),
800- timestamp = sentAt.toStdlibInstant(). toEpochMilliseconds(),
797+ timestamp = sentAt.toEpochMilliseconds(),
801798 content = MessageContent .Bluesky .Deleted (this ),
802799 showSender = false ,
803800 )
0 commit comments