Skip to content

Commit

Permalink
Message content on notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiebe committed Apr 14, 2024
1 parent 3d7a5a4 commit a09b77e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.text.HtmlCompat
import androidx.work.*
import com.google.common.util.concurrent.Futures
import com.google.common.util.concurrent.ListenableFuture
Expand Down Expand Up @@ -187,7 +188,7 @@ fun sendNotificationAndroid(context: Context, title: String, message: String) {
.setColor(Color(nl.tiebe.otarium.Data.customDarkTheme.primary).toArgb())

if (message != "") {
builder.setContentText(message)
builder.setContentText(HtmlCompat.fromHtml(message, HtmlCompat.FROM_HTML_MODE_LEGACY).toString())
}

if (ActivityCompat.checkSelfPermission(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ suspend fun MagisterAccount.refreshMessages(notification: (String, String) -> Un
updated.add(message)

if (message.hasBeenRead) continue@newMessages
val content = MessageFlow.getMessageData(Url(tenantUrl), tokens.accessToken, message.links.self?.href ?: continue@newMessages)

notification(
"Nieuw bericht van ${message.sender?.name?.trim()}: ${message.subject.trim()}", ""
"Nieuw bericht van ${message.sender?.name?.trim()}: ${message.subject.trim()}", content.content
)
}

Expand Down

0 comments on commit a09b77e

Please sign in to comment.