mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Create getDismissRoomPendingIntent()
This commit is contained in:
+15
-15
@@ -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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user