Create getDismissRoomPendingIntent()
This commit is contained in:
parent
cb8d206ed4
commit
a9881341f1
1 changed files with 15 additions and 15 deletions
|
|
@ -300,26 +300,13 @@ class NotificationUtils @Inject constructor(
|
||||||
if (!roomInfo.hasSmartReplyError) {
|
if (!roomInfo.hasSmartReplyError) {
|
||||||
addAction(quickReplyActionFactory.create(roomInfo, threadId))
|
addAction(quickReplyActionFactory.create(roomInfo, threadId))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openIntent != null) {
|
if (openIntent != null) {
|
||||||
setContentIntent(openIntent)
|
setContentIntent(openIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (largeIcon != null) {
|
if (largeIcon != null) {
|
||||||
setLargeIcon(largeIcon)
|
setLargeIcon(largeIcon)
|
||||||
}
|
}
|
||||||
|
setDeleteIntent(getDismissRoomPendingIntent(roomInfo))
|
||||||
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
|
||||||
intent.action = actionIds.dismissRoom
|
|
||||||
intent.putExtra(NotificationBroadcastReceiver.KEY_SESSION_ID, roomInfo.sessionId)
|
|
||||||
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
|
||||||
val pendingIntent = PendingIntent.getBroadcast(
|
|
||||||
context.applicationContext,
|
|
||||||
clock.epochMillis().toInt(),
|
|
||||||
intent,
|
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
||||||
)
|
|
||||||
setDeleteIntent(pendingIntent)
|
|
||||||
}
|
}
|
||||||
.setTicker(tickerText)
|
.setTicker(tickerText)
|
||||||
.build()
|
.build()
|
||||||
|
|
@ -487,13 +474,26 @@ class NotificationUtils @Inject constructor(
|
||||||
intent.data = createIgnoredUri("deleteSummary?$sessionId")
|
intent.data = createIgnoredUri("deleteSummary?$sessionId")
|
||||||
intent.putExtra(NotificationBroadcastReceiver.KEY_SESSION_ID, sessionId)
|
intent.putExtra(NotificationBroadcastReceiver.KEY_SESSION_ID, sessionId)
|
||||||
return PendingIntent.getBroadcast(
|
return PendingIntent.getBroadcast(
|
||||||
context.applicationContext,
|
context,
|
||||||
0,
|
0,
|
||||||
intent,
|
intent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getDismissRoomPendingIntent(roomInfo: RoomEventGroupInfo): PendingIntent {
|
||||||
|
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
|
intent.action = actionIds.dismissRoom
|
||||||
|
intent.putExtra(NotificationBroadcastReceiver.KEY_SESSION_ID, roomInfo.sessionId)
|
||||||
|
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
||||||
|
return PendingIntent.getBroadcast(
|
||||||
|
context,
|
||||||
|
clock.epochMillis().toInt(),
|
||||||
|
intent,
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the foreground notification service.
|
* Cancel the foreground notification service.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue