fix: final touches
This commit is contained in:
parent
4f12e86fe8
commit
23fb992f74
|
|
@ -182,7 +182,7 @@ class HandlerService : FirebaseMessagingService() {
|
||||||
|
|
||||||
val dbChannel = db.channelQueries.findById(channelId).executeAsOneOrNull()
|
val dbChannel = db.channelQueries.findById(channelId).executeAsOneOrNull()
|
||||||
|
|
||||||
val authorBitmap = loadBitmap(image)
|
val authorBitmap = runCatching { loadBitmap(image) }.getOrElse { generateLetterBitmap(authorName) }
|
||||||
val conversationBitmap: Bitmap = when (dbChannel?.channelType) {
|
val conversationBitmap: Bitmap = when (dbChannel?.channelType) {
|
||||||
"TextChannel", "VoiceChannel" -> {
|
"TextChannel", "VoiceChannel" -> {
|
||||||
val server =
|
val server =
|
||||||
|
|
@ -275,18 +275,24 @@ class HandlerService : FirebaseMessagingService() {
|
||||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val existingStyle = NotificationManagerCompat.from(this)
|
||||||
|
.activeNotifications
|
||||||
|
.firstOrNull { it.tag == channelId && it.id == NotificationID.NEW_MESSAGE }
|
||||||
|
?.notification
|
||||||
|
?.let { NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(it) }
|
||||||
|
|
||||||
|
val messagingStyle = (existingStyle ?: NotificationCompat.MessagingStyle(self))
|
||||||
|
.setGroupConversation(dbChannel?.channelType != "DirectMessage")
|
||||||
|
.setConversationTitle(channelName)
|
||||||
|
.addMessage(body, messageTimestamp, author)
|
||||||
|
|
||||||
val builder = NotificationCompat.Builder(this, CHANNEL_ID_GROUP_CONVERSATIONS_MESSAGES)
|
val builder = NotificationCompat.Builder(this, CHANNEL_ID_GROUP_CONVERSATIONS_MESSAGES)
|
||||||
.setSmallIcon(R.drawable.ic_stoat_24dp)
|
.setSmallIcon(R.drawable.ic_stoat_24dp)
|
||||||
.setContentTitle(authorName)
|
.setContentTitle(authorName)
|
||||||
.setContentText(body)
|
.setContentText(body)
|
||||||
.setContentIntent(contentIntent)
|
.setContentIntent(contentIntent)
|
||||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||||
.setStyle(
|
.setStyle(messagingStyle)
|
||||||
NotificationCompat.MessagingStyle(self)
|
|
||||||
.setGroupConversation(dbChannel?.channelType != "DirectMessage")
|
|
||||||
.setConversationTitle(channelName)
|
|
||||||
.addMessage(body, messageTimestamp, author)
|
|
||||||
)
|
|
||||||
.addAction(replyAction)
|
.addAction(replyAction)
|
||||||
.addAction(markAsReadAction)
|
.addAction(markAsReadAction)
|
||||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,8 @@ fun ChannelInfoSheet(channelId: String, onHideSheet: suspend () -> Unit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SheetButton(
|
// FIXME: Waiting on backend!
|
||||||
|
/*SheetButton(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.channel_info_sheet_options_notifications_manage),
|
text = stringResource(id = R.string.channel_info_sheet_options_notifications_manage),
|
||||||
|
|
@ -197,7 +198,7 @@ fun ChannelInfoSheet(channelId: String, onHideSheet: suspend () -> Unit) {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onClick = {}
|
onClick = {}
|
||||||
)
|
)*/
|
||||||
|
|
||||||
SheetButton(
|
SheetButton(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue