Skip to content

Commit fe1ae5d

Browse files
author
Jeff Yanta
committed
Merge branch 'develop'
2 parents 67285a5 + ea4810d commit fe1ae5d

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

api/src/main/java/com/getcode/model/notifications/NotificationParser.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ fun RemoteMessage.parse(): CodeNotification? {
2929
return null
3030
}
3131

32+
if (!type.isNotifiable()) return CodeNotification(type, "", MessageContent.Localized(""))
33+
3234
val chatTitle = data[NOTIFICATION_TITLE_KEY].let {
3335
if (it == null) {
3436
Timber.e("$NOTIFICATION_TITLE_KEY unspecified")

app/src/main/java/com/getcode/notifications/CodePushMessagingService.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ class CodePushMessagingService : FirebaseMessagingService(),
9191

9292
if (notification != null) {
9393
val (type, titleKey, messageContent) = notification
94-
val title = titleKey.localizedStringByKey(resources) ?: titleKey
95-
val body = messageContent.localizedText(title, resources, currencyUtils)
96-
notify(type, title, body)
94+
if (type.isNotifiable()) {
95+
val title = titleKey.localizedStringByKey(resources) ?: titleKey
96+
val body = messageContent.localizedText(title, resources, currencyUtils)
97+
notify(type, title, body)
98+
}
9799

98100
when (type) {
99101
NotificationType.ChatMessage -> {
@@ -139,8 +141,6 @@ class CodePushMessagingService : FirebaseMessagingService(),
139141
title: String,
140142
content: String,
141143
) {
142-
if (!type.isNotifiable()) return
143-
144144
val notificationManager =
145145
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
146146

0 commit comments

Comments
 (0)