mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 20:59:00 +00:00
Improve push notification display fallback. Fixes #1222
This commit is contained in:
parent
82af9d4635
commit
00d978109b
2 changed files with 7 additions and 4 deletions
|
|
@ -805,6 +805,7 @@
|
|||
<string name="app_theme">App Theme</string>
|
||||
<string name="sent_card">You sent a %s</string>
|
||||
<string name="inbox_messages_title">You received %d messages from %s</string>
|
||||
<string name="inbox_messages_title_nosender">You received %d messages</string>
|
||||
<string name="remove">Remove</string>
|
||||
<string name="transfer_ownership">Transfer Ownership</string>
|
||||
<string name="remove_member">Remove Member</string>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ import com.habitrpg.android.habitica.receivers.LocalNotificationActionReceiver
|
|||
import net.pherth.android.emoji_library.EmojiParser
|
||||
|
||||
|
||||
/**
|
||||
* Created by keithholliday on 7/1/16.
|
||||
*/
|
||||
class ReceivedPrivateMessageLocalNotification(context: Context, identifier: String) : HabiticaLocalNotification(context, identifier) {
|
||||
override fun configureNotificationBuilder(data: MutableMap<String, String>): NotificationCompat.Builder {
|
||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager
|
||||
|
|
@ -33,8 +30,13 @@ class ReceivedPrivateMessageLocalNotification(context: Context, identifier: Stri
|
|||
var notification = super.configureNotificationBuilder(data)
|
||||
.setExtras(bundleOf(Pair("messages", oldMessages)))
|
||||
if (oldMessages.size > 1) {
|
||||
val notificationTitle = if (data["senderName"] != null) {
|
||||
context.getString(R.string.inbox_messages_title, oldMessages.size, data["senderName"])
|
||||
} else {
|
||||
context.getString(R.string.inbox_messages_title_nosender, oldMessages.size)
|
||||
}
|
||||
notification = notification
|
||||
.setContentTitle(context.getString(R.string.inbox_messages_title, oldMessages.size, data["senderName"]))
|
||||
.setContentTitle(notificationTitle)
|
||||
.setStyle(style)
|
||||
title = null
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue