mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
updating variable casing as they're no longer const val or file level
This commit is contained in:
parent
8b9d1bb0d8
commit
9b1def3c1d
6 changed files with 28 additions and 28 deletions
|
@ -102,7 +102,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
|
||||||
|
|
||||||
// Diagnostic Push
|
// Diagnostic Push
|
||||||
if (pushData.eventId == PushersManager.TEST_EVENT_ID) {
|
if (pushData.eventId == PushersManager.TEST_EVENT_ID) {
|
||||||
val intent = Intent(actionIds.PUSH_ACTION)
|
val intent = Intent(actionIds.push)
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class LiveLocationNotificationBuilder @Inject constructor(
|
||||||
liveLocationMapViewArgs = LiveLocationMapViewArgs(roomId = roomId),
|
liveLocationMapViewArgs = LiveLocationMapViewArgs(roomId = roomId),
|
||||||
firstStartMainActivity = true
|
firstStartMainActivity = true
|
||||||
)
|
)
|
||||||
mapIntent.action = actionIds.TAP_TO_VIEW_ACTION
|
mapIntent.action = actionIds.tapToView
|
||||||
// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that
|
// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that
|
||||||
mapIntent.data = createIgnoredUri("openLiveLocationMap?$roomId")
|
mapIntent.data = createIgnoredUri("openLiveLocationMap?$roomId")
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ data class NotificationActionIds @Inject constructor(
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val JOIN_ACTION = "${buildMeta.applicationId}.NotificationActions.JOIN_ACTION"
|
val join = "${buildMeta.applicationId}.NotificationActions.JOIN_ACTION"
|
||||||
val REJECT_ACTION = "${buildMeta.applicationId}.NotificationActions.REJECT_ACTION"
|
val reject = "${buildMeta.applicationId}.NotificationActions.REJECT_ACTION"
|
||||||
val QUICK_LAUNCH_ACTION = "${buildMeta.applicationId}.NotificationActions.QUICK_LAUNCH_ACTION"
|
val quickLaunch = "${buildMeta.applicationId}.NotificationActions.QUICK_LAUNCH_ACTION"
|
||||||
val MARK_ROOM_READ_ACTION = "${buildMeta.applicationId}.NotificationActions.MARK_ROOM_READ_ACTION"
|
val markRoomRead = "${buildMeta.applicationId}.NotificationActions.MARK_ROOM_READ_ACTION"
|
||||||
val SMART_REPLY_ACTION = "${buildMeta.applicationId}.NotificationActions.SMART_REPLY_ACTION"
|
val smartReply = "${buildMeta.applicationId}.NotificationActions.SMART_REPLY_ACTION"
|
||||||
val DISMISS_SUMMARY_ACTION = "${buildMeta.applicationId}.NotificationActions.DISMISS_SUMMARY_ACTION"
|
val dismissSummary = "${buildMeta.applicationId}.NotificationActions.DISMISS_SUMMARY_ACTION"
|
||||||
val DISMISS_ROOM_NOTIF_ACTION = "${buildMeta.applicationId}.NotificationActions.DISMISS_ROOM_NOTIF_ACTION"
|
val dismissRoom = "${buildMeta.applicationId}.NotificationActions.DISMISS_ROOM_NOTIF_ACTION"
|
||||||
val TAP_TO_VIEW_ACTION = "${buildMeta.applicationId}.NotificationActions.TAP_TO_VIEW_ACTION"
|
val tapToView = "${buildMeta.applicationId}.NotificationActions.TAP_TO_VIEW_ACTION"
|
||||||
val DIAGNOSTIC_ACTION = "${buildMeta.applicationId}.NotificationActions.DIAGNOSTIC"
|
val diagnostic = "${buildMeta.applicationId}.NotificationActions.DIAGNOSTIC"
|
||||||
val PUSH_ACTION = "${buildMeta.applicationId}.PUSH"
|
val push = "${buildMeta.applicationId}.PUSH"
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,26 +54,26 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
if (intent == null || context == null) return
|
if (intent == null || context == null) return
|
||||||
Timber.v("NotificationBroadcastReceiver received : $intent")
|
Timber.v("NotificationBroadcastReceiver received : $intent")
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
actionIds.SMART_REPLY_ACTION ->
|
actionIds.smartReply ->
|
||||||
handleSmartReply(intent, context)
|
handleSmartReply(intent, context)
|
||||||
actionIds.DISMISS_ROOM_NOTIF_ACTION ->
|
actionIds.dismissRoom ->
|
||||||
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
||||||
notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) }
|
notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) }
|
||||||
}
|
}
|
||||||
actionIds.DISMISS_SUMMARY_ACTION ->
|
actionIds.dismissSummary ->
|
||||||
notificationDrawerManager.clearAllEvents()
|
notificationDrawerManager.clearAllEvents()
|
||||||
actionIds.MARK_ROOM_READ_ACTION ->
|
actionIds.markRoomRead ->
|
||||||
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
||||||
notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) }
|
notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) }
|
||||||
handleMarkAsRead(roomId)
|
handleMarkAsRead(roomId)
|
||||||
}
|
}
|
||||||
actionIds.JOIN_ACTION -> {
|
actionIds.join -> {
|
||||||
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
||||||
notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) }
|
notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) }
|
||||||
handleJoinRoom(roomId)
|
handleJoinRoom(roomId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actionIds.REJECT_ACTION -> {
|
actionIds.reject -> {
|
||||||
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
intent.getStringExtra(KEY_ROOM_ID)?.let { roomId ->
|
||||||
notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) }
|
notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) }
|
||||||
handleRejectRoom(roomId)
|
handleRejectRoom(roomId)
|
||||||
|
|
|
@ -632,7 +632,7 @@ class NotificationUtils @Inject constructor(
|
||||||
// Add actions and notification intents
|
// Add actions and notification intents
|
||||||
// Mark room as read
|
// Mark room as read
|
||||||
val markRoomReadIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val markRoomReadIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
markRoomReadIntent.action = actionIds.MARK_ROOM_READ_ACTION
|
markRoomReadIntent.action = actionIds.markRoomRead
|
||||||
markRoomReadIntent.data = createIgnoredUri(roomInfo.roomId)
|
markRoomReadIntent.data = createIgnoredUri(roomInfo.roomId)
|
||||||
markRoomReadIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
markRoomReadIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
||||||
val markRoomReadPendingIntent = PendingIntent.getBroadcast(
|
val markRoomReadPendingIntent = PendingIntent.getBroadcast(
|
||||||
|
@ -679,7 +679,7 @@ class NotificationUtils @Inject constructor(
|
||||||
|
|
||||||
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId)
|
||||||
intent.action = actionIds.DISMISS_ROOM_NOTIF_ACTION
|
intent.action = actionIds.dismissRoom
|
||||||
val pendingIntent = PendingIntent.getBroadcast(
|
val pendingIntent = PendingIntent.getBroadcast(
|
||||||
context.applicationContext,
|
context.applicationContext,
|
||||||
clock.epochMillis().toInt(),
|
clock.epochMillis().toInt(),
|
||||||
|
@ -714,7 +714,7 @@ class NotificationUtils @Inject constructor(
|
||||||
val roomId = inviteNotifiableEvent.roomId
|
val roomId = inviteNotifiableEvent.roomId
|
||||||
// offer to type a quick reject button
|
// offer to type a quick reject button
|
||||||
val rejectIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val rejectIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
rejectIntent.action = actionIds.REJECT_ACTION
|
rejectIntent.action = actionIds.reject
|
||||||
rejectIntent.data = createIgnoredUri("$roomId&$matrixId")
|
rejectIntent.data = createIgnoredUri("$roomId&$matrixId")
|
||||||
rejectIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
rejectIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
||||||
val rejectIntentPendingIntent = PendingIntent.getBroadcast(
|
val rejectIntentPendingIntent = PendingIntent.getBroadcast(
|
||||||
|
@ -732,7 +732,7 @@ class NotificationUtils @Inject constructor(
|
||||||
|
|
||||||
// offer to type a quick accept button
|
// offer to type a quick accept button
|
||||||
val joinIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val joinIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
joinIntent.action = actionIds.JOIN_ACTION
|
joinIntent.action = actionIds.join
|
||||||
joinIntent.data = createIgnoredUri("$roomId&$matrixId")
|
joinIntent.data = createIgnoredUri("$roomId&$matrixId")
|
||||||
joinIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
joinIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
||||||
val joinIntentPendingIntent = PendingIntent.getBroadcast(
|
val joinIntentPendingIntent = PendingIntent.getBroadcast(
|
||||||
|
@ -815,7 +815,7 @@ class NotificationUtils @Inject constructor(
|
||||||
|
|
||||||
private fun buildOpenRoomIntent(roomId: String): PendingIntent? {
|
private fun buildOpenRoomIntent(roomId: String): PendingIntent? {
|
||||||
val roomIntentTap = RoomDetailActivity.newIntent(context, TimelineArgs(roomId = roomId, switchToParentSpace = true), true)
|
val roomIntentTap = RoomDetailActivity.newIntent(context, TimelineArgs(roomId = roomId, switchToParentSpace = true), true)
|
||||||
roomIntentTap.action = actionIds.TAP_TO_VIEW_ACTION
|
roomIntentTap.action = actionIds.tapToView
|
||||||
// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that
|
// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that
|
||||||
roomIntentTap.data = createIgnoredUri("openRoom?$roomId")
|
roomIntentTap.data = createIgnoredUri("openRoom?$roomId")
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ class NotificationUtils @Inject constructor(
|
||||||
val intent: Intent
|
val intent: Intent
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
intent.action = actionIds.SMART_REPLY_ACTION
|
intent.action = actionIds.smartReply
|
||||||
intent.data = createIgnoredUri(roomId)
|
intent.data = createIgnoredUri(roomId)
|
||||||
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId)
|
||||||
return PendingIntent.getBroadcast(
|
return PendingIntent.getBroadcast(
|
||||||
|
@ -929,7 +929,7 @@ class NotificationUtils @Inject constructor(
|
||||||
|
|
||||||
private fun getDismissSummaryPendingIntent(): PendingIntent {
|
private fun getDismissSummaryPendingIntent(): PendingIntent {
|
||||||
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
intent.action = actionIds.DISMISS_SUMMARY_ACTION
|
intent.action = actionIds.dismissSummary
|
||||||
intent.data = createIgnoredUri("deleteSummary")
|
intent.data = createIgnoredUri("deleteSummary")
|
||||||
return PendingIntent.getBroadcast(
|
return PendingIntent.getBroadcast(
|
||||||
context.applicationContext,
|
context.applicationContext,
|
||||||
|
@ -968,7 +968,7 @@ class NotificationUtils @Inject constructor(
|
||||||
|
|
||||||
fun displayDiagnosticNotification() {
|
fun displayDiagnosticNotification() {
|
||||||
val testActionIntent = Intent(context, TestNotificationReceiver::class.java)
|
val testActionIntent = Intent(context, TestNotificationReceiver::class.java)
|
||||||
testActionIntent.action = actionIds.DIAGNOSTIC_ACTION
|
testActionIntent.action = actionIds.diagnostic
|
||||||
val testPendingIntent = PendingIntent.getBroadcast(
|
val testPendingIntent = PendingIntent.getBroadcast(
|
||||||
context,
|
context,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -152,11 +152,11 @@ class VectorSettingsNotificationsTroubleshootFragment @Inject constructor(
|
||||||
|
|
||||||
tryOrNull("Unable to register the receiver") {
|
tryOrNull("Unable to register the receiver") {
|
||||||
LocalBroadcastManager.getInstance(requireContext())
|
LocalBroadcastManager.getInstance(requireContext())
|
||||||
.registerReceiver(broadcastReceiverPush, IntentFilter(actionIds.PUSH_ACTION))
|
.registerReceiver(broadcastReceiverPush, IntentFilter(actionIds.push))
|
||||||
}
|
}
|
||||||
tryOrNull("Unable to register the receiver") {
|
tryOrNull("Unable to register the receiver") {
|
||||||
LocalBroadcastManager.getInstance(requireContext())
|
LocalBroadcastManager.getInstance(requireContext())
|
||||||
.registerReceiver(broadcastReceiverNotification, IntentFilter(actionIds.DIAGNOSTIC_ACTION))
|
.registerReceiver(broadcastReceiverNotification, IntentFilter(actionIds.diagnostic))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue