Skip to content

Commit

Permalink
fix xqt notification crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed Sep 12, 2024
1 parent 2b33b14 commit d6c94de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ data class UiTimeline internal constructor(

data class Custom(
val message: String,
) : XQT
val id: String,
) : XQT {
override fun toString(): String = "Custom$id"
}

data object Mention : XQT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
import moe.tlaster.twitter.parser.TwitterParser
import moe.tlaster.twitter.parser.UrlToken
import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

private val twitterParser by lazy {
TwitterParser(enableNonAsciiInUrl = false)
}

@OptIn(ExperimentalUuidApi::class)
internal fun TopLevel.renderNotifications(
accountKey: MicroBlogKey,
event: StatusEvent.XQT,
Expand Down Expand Up @@ -136,7 +139,7 @@ internal fun TopLevel.renderNotifications(
icon = icon,
type =
UiTimeline.TopMessage.MessageType.XQT
.Custom(message = message.orEmpty()),
.Custom(message = message.orEmpty(), id = notification.id ?: Uuid.random().toHexString()),
onClicked = {
if (itemContent == null && url != null) {
launcher.launch(url)
Expand Down

0 comments on commit d6c94de

Please sign in to comment.