Bug fix message notification not opening chat (#1662)

* added resources to run project

* bug fix for message notification not opening the conversation when the notification is clicked

* removed unnecessary changes
This commit is contained in:
pauliancu97 2021-11-10 15:35:57 +02:00 committed by GitHub
parent b77158d244
commit ed39758118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -19,7 +19,7 @@ class NotificationOpenHandler {
PushNotificationManager.QUEST_BEGUN_PUSH_NOTIFICATION_KEY -> openPartyScreen()
PushNotificationManager.QUEST_INVITE_PUSH_NOTIFICATION_KEY -> openPartyScreen()
PushNotificationManager.GUILD_INVITE_PUSH_NOTIFICATION_KEY -> openGuildDetailScreen(intent.getStringExtra("groupID"))
PushNotificationManager.RECEIVED_PRIVATE_MESSAGE_PUSH_NOTIFICATION_KEY -> openPrivateMessageScreen(intent.getStringExtra("replyTo"))
PushNotificationManager.RECEIVED_PRIVATE_MESSAGE_PUSH_NOTIFICATION_KEY -> openPrivateMessageScreen(intent.getStringExtra("replyToUUID"), intent.getStringExtra("replyToUsername"))
PushNotificationManager.CHANGE_USERNAME_PUSH_NOTIFICATION_KEY -> openSettingsScreen()
PushNotificationManager.GIFT_ONE_GET_ONE_PUSH_NOTIFICATION_KEY -> openSubscriptionScreen()
PushNotificationManager.CHAT_MENTION_NOTIFICATION_KEY -> handleChatMessage(intent.getStringExtra("type"), intent.getStringExtra("groupID"))
@ -38,9 +38,9 @@ class NotificationOpenHandler {
MainNavigationController.navigate(R.id.gemPurchaseActivity, bundleOf(Pair("openSubscription", true)))
}
private fun openPrivateMessageScreen(userID: String?) {
if (userID != null) {
MainNavigationController.navigate(R.id.inboxMessageListFragment, bundleOf("userID" to userID))
private fun openPrivateMessageScreen(userID: String?, userName: String?) {
if (userID != null && userName != null) {
MainNavigationController.navigate(R.id.inboxMessageListFragment, bundleOf("userID" to userID, "username" to userName))
} else {
MainNavigationController.navigate(R.id.inboxFragment)
}

View file

@ -50,6 +50,12 @@ class ReceivedPrivateMessageLocalNotification(context: Context, identifier: Stri
return data["senderName"].hashCode()
}
override fun configureMainIntent(intent: Intent) {
super.configureMainIntent(intent)
intent.putExtra("replyToUUID", data?.get("replyTo"))
intent.putExtra("replyToUsername", data?.get("senderName"))
}
override fun setNotificationActions(notificationId: Int, data: Map<String, String>) {
super.setNotificationActions(notificationId, data)
val senderID = data["replyTo"] ?: return