@@ -32,6 +32,7 @@ import dev.dimension.flare.data.database.cache.model.StatusContent.BlueskyNotifi
3232import dev.dimension.flare.data.database.cache.model.StatusContent.BlueskyNotification.UserList
3333import dev.dimension.flare.data.database.cache.model.UserContent
3434import dev.dimension.flare.model.AccountType
35+ import dev.dimension.flare.model.AccountType.Specific
3536import dev.dimension.flare.model.MicroBlogKey
3637import dev.dimension.flare.model.PlatformType
3738import dev.dimension.flare.model.ReferenceType
@@ -243,7 +244,7 @@ internal fun List<ListNotificationsNotification>.toDb(
243244 id = items.joinToString(" _" ) { it.uri.atUri } + idSuffix,
244245 host = accountKey.host,
245246 ),
246- accountType = AccountType . Specific (accountKey),
247+ accountType = Specific (accountKey),
247248 userKey = null ,
248249 content = content,
249250 text = null ,
@@ -287,7 +288,7 @@ internal fun List<ListNotificationsNotification>.toDb(
287288 id = items.joinToString(" _" ) { it.uri.atUri } + " _follow" ,
288289 host = accountKey.host,
289290 ),
290- accountType = AccountType . Specific (accountKey),
291+ accountType = Specific (accountKey),
291292 userKey = null ,
292293 content = content,
293294 text = null ,
@@ -327,7 +328,7 @@ internal fun List<ListNotificationsNotification>.toDb(
327328 id = it.uri.atUri,
328329 host = accountKey.host,
329330 ),
330- accountType = AccountType . Specific (accountKey),
331+ accountType = Specific (accountKey),
331332 userKey = user.userKey,
332333 content = content,
333334 text = null ,
@@ -367,7 +368,7 @@ internal fun List<ListNotificationsNotification>.toDb(
367368 id = it.uri.atUri,
368369 host = accountKey.host,
369370 ),
370- accountType = AccountType . Specific (accountKey),
371+ accountType = Specific (accountKey),
371372 userKey = user.userKey,
372373 content = content,
373374 text = null ,
@@ -406,7 +407,7 @@ internal fun List<ListNotificationsNotification>.toDb(
406407 id = it.uri.atUri,
407408 host = accountKey.host,
408409 ),
409- accountType = AccountType . Specific (accountKey),
410+ accountType = Specific (accountKey),
410411 userKey = user.userKey,
411412 content = content,
412413 text = null ,
@@ -445,7 +446,47 @@ internal fun List<ListNotificationsNotification>.toDb(
445446 id = it.uri.atUri,
446447 host = accountKey.host,
447448 ),
448- accountType = AccountType .Specific (accountKey),
449+ accountType = Specific (accountKey),
450+ userKey = user.userKey,
451+ content = content,
452+ text = null ,
453+ createdAt = it.indexedAt,
454+ ),
455+ )
456+ createDbPagingTimelineWithStatus(
457+ accountKey = accountKey,
458+ pagingKey = pagingKey,
459+ sortId = it.indexedAt.toEpochMilliseconds(),
460+ status = data,
461+ references =
462+ mapOf (
463+ ReferenceType .Notification to
464+ listOfNotNull(
465+ post.toDbStatusWithUser(
466+ accountKey,
467+ ),
468+ ),
469+ ),
470+ )
471+ }
472+ }
473+
474+ ListNotificationsNotificationReason .ContactMatch -> {
475+ items.mapNotNull {
476+ val post = references[it.uri] ? : return @mapNotNull null
477+ val content = Post (post = post)
478+ val user = post.author.toDbUser(accountKey.host)
479+ val data =
480+ DbStatusWithUser (
481+ user = user,
482+ data =
483+ DbStatus (
484+ statusKey =
485+ MicroBlogKey (
486+ id = it.uri.atUri,
487+ host = accountKey.host,
488+ ),
489+ accountType = Specific (accountKey),
449490 userKey = user.userKey,
450491 content = content,
451492 text = null ,
0 commit comments