···284 )
285 }
286000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000287 fun fromPost(
288 parent: Pair<Cid, AtUri>,
289 post: Post,
···530531sealed class Notification {
532 data class RawLike(
533- val post: Post,
0534 val author: ProfileView,
535 val createdAt: Instant,
536 val new: Boolean
···538 Notification()
539540 data class RawRepost(
541- val post: Post,
0542 val author: ProfileView,
543 val createdAt: Instant,
544 val new: Boolean
···609}
610611612-enum class RepeatableNotification(val u: Unit) {
613- Like(Unit),
614- Repost(Unit)
615}
616617data class RepeatedNotification(
618 val kind: RepeatableNotification,
619- val post: Post,
620 var authors: List<RepeatedAuthor>,
621 var timestamp: Instant,
622 val new: Boolean,
···284 )
285 }
286287+ fun fromPost(parent: Pair<Cid, AtUri>, post: Post, author: ProfileViewBasic): SkeetData {
288+ return SkeetData(
289+ cid = parent.first,
290+ uri = parent.second,
291+ authorAvatarURL = author.avatar?.uri,
292+ authorName = author.displayName,
293+ authorHandle = author.handle,
294+ authorLabels = author.labels,
295+ content = post.text,
296+ embed = when (post.embed) {
297+ is PostEmbedUnion.External -> {
298+ val c = (post.embed as PostEmbedUnion.External)
299+ PostViewEmbedUnion.ExternalView(
300+ ExternalView(
301+ ExternalViewExternal(
302+ uri = c.value.external.uri,
303+ title = c.value.external.title,
304+ description = c.value.external.description,
305+ thumb = cdnBlobURL(
306+ author.did,
307+ c.value.external.thumb,
308+ CDNImageSize.Thumb
309+ )
310+ )
311+ )
312+ )
313+ }
314+315+ is PostEmbedUnion.Images -> {
316+ val c = (post.embed as PostEmbedUnion.Images)
317+ PostViewEmbedUnion.ImagesView(
318+ ImagesView(c.value.images.map {
319+ ImagesViewImage(
320+ fullsize = cdnBlobURL(
321+ author.did,
322+ it.image,
323+ CDNImageSize.Full
324+ )!!,
325+ thumb = cdnBlobURL(
326+ author.did,
327+ it.image,
328+ CDNImageSize.Thumb
329+ )!!,
330+ alt = it.alt,
331+ aspectRatio = it.aspectRatio,
332+ )
333+ })
334+ )
335+ }
336+337+ // Record need to be hydrated before being rendered!
338+339+// is PostEmbedUnion.Record -> {
340+// val c = (post.embed as PostEmbedUnion.Record).value
341+//
342+// PostViewEmbedUnion.RecordView(
343+// RecordView(post.embed.value.record)
344+// )
345+// }
346+//
347+// is PostEmbedUnion.RecordWithMedia -> PostViewEmbedUnion.RecordWithMediaView(
348+// RecordWithMediaView(
349+// post.embed.value.record,
350+// post.embed.value.media
351+// )
352+// )
353+//
354+// is PostEmbedUnion.Unknown -> PostViewEmbedUnion.Unknown(post.embed.value)
355+ is PostEmbedUnion.Video -> {
356+ val c = (post.embed as PostEmbedUnion.Video).value
357+ PostViewEmbedUnion.VideoView(
358+ VideoView(
359+ playlist = cdnVideoPlaylist(author.did, c.video)!!,
360+ thumbnail = cdnVideoThumb(author.did, c.video),
361+ alt = c.alt,
362+ aspectRatio = c.aspectRatio,
363+ cid = parent.first
364+ )
365+ )
366+ }
367+368+ null -> null
369+ else -> null
370+ },
371+ // TODO: fix embeds
372+ createdAt = post.createdAt.toStdlibInstant(),
373+ facets = post.facets,
374+ )
375+ }
376+377 fun fromPost(
378 parent: Pair<Cid, AtUri>,
379 post: Post,
···620621sealed class Notification {
622 data class RawLike(
623+ val subject: StrongRef,
624+ val post: SkeetData,
625 val author: ProfileView,
626 val createdAt: Instant,
627 val new: Boolean
···629 Notification()
630631 data class RawRepost(
632+ val subject: StrongRef,
633+ val post: SkeetData,
634 val author: ProfileView,
635 val createdAt: Instant,
636 val new: Boolean
···701}
702703704+enum class RepeatableNotification() {
705+ Like,
706+ Repost
707}
708709data class RepeatedNotification(
710 val kind: RepeatableNotification,
711+ val post: SkeetData,
712 var authors: List<RepeatedAuthor>,
713 var timestamp: Instant,
714 val new: Boolean,