From 9b1def3c1d29dd847632c32ab6a78dd8635bec0a Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 11 Jul 2022 17:00:51 +0100 Subject: [PATCH] updating variable casing as they're no longer const val or file level --- .../core/pushers/VectorMessagingReceiver.kt | 2 +- .../LiveLocationNotificationBuilder.kt | 2 +- .../notifications/NotificationActionIds.kt | 20 +++++++++---------- .../NotificationBroadcastReceiver.kt | 12 +++++------ .../notifications/NotificationUtils.kt | 16 +++++++-------- ...ttingsNotificationsTroubleshootFragment.kt | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt b/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt index bff8a0ebe7..8e88e44627 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt @@ -102,7 +102,7 @@ class VectorMessagingReceiver : MessagingReceiver() { // Diagnostic Push if (pushData.eventId == PushersManager.TEST_EVENT_ID) { - val intent = Intent(actionIds.PUSH_ACTION) + val intent = Intent(actionIds.push) LocalBroadcastManager.getInstance(context).sendBroadcast(intent) return } diff --git a/vector/src/main/java/im/vector/app/features/location/live/tracking/LiveLocationNotificationBuilder.kt b/vector/src/main/java/im/vector/app/features/location/live/tracking/LiveLocationNotificationBuilder.kt index 5aa9cd0971..5bc730f3d7 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/tracking/LiveLocationNotificationBuilder.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/tracking/LiveLocationNotificationBuilder.kt @@ -68,7 +68,7 @@ class LiveLocationNotificationBuilder @Inject constructor( liveLocationMapViewArgs = LiveLocationMapViewArgs(roomId = roomId), 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 mapIntent.data = createIgnoredUri("openLiveLocationMap?$roomId") diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationActionIds.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationActionIds.kt index c83a1f2f4a..3bd7a635ae 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationActionIds.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationActionIds.kt @@ -28,14 +28,14 @@ data class NotificationActionIds @Inject constructor( private val buildMeta: BuildMeta, ) { - val JOIN_ACTION = "${buildMeta.applicationId}.NotificationActions.JOIN_ACTION" - val REJECT_ACTION = "${buildMeta.applicationId}.NotificationActions.REJECT_ACTION" - val QUICK_LAUNCH_ACTION = "${buildMeta.applicationId}.NotificationActions.QUICK_LAUNCH_ACTION" - val MARK_ROOM_READ_ACTION = "${buildMeta.applicationId}.NotificationActions.MARK_ROOM_READ_ACTION" - val SMART_REPLY_ACTION = "${buildMeta.applicationId}.NotificationActions.SMART_REPLY_ACTION" - val DISMISS_SUMMARY_ACTION = "${buildMeta.applicationId}.NotificationActions.DISMISS_SUMMARY_ACTION" - val DISMISS_ROOM_NOTIF_ACTION = "${buildMeta.applicationId}.NotificationActions.DISMISS_ROOM_NOTIF_ACTION" - val TAP_TO_VIEW_ACTION = "${buildMeta.applicationId}.NotificationActions.TAP_TO_VIEW_ACTION" - val DIAGNOSTIC_ACTION = "${buildMeta.applicationId}.NotificationActions.DIAGNOSTIC" - val PUSH_ACTION = "${buildMeta.applicationId}.PUSH" + val join = "${buildMeta.applicationId}.NotificationActions.JOIN_ACTION" + val reject = "${buildMeta.applicationId}.NotificationActions.REJECT_ACTION" + val quickLaunch = "${buildMeta.applicationId}.NotificationActions.QUICK_LAUNCH_ACTION" + val markRoomRead = "${buildMeta.applicationId}.NotificationActions.MARK_ROOM_READ_ACTION" + val smartReply = "${buildMeta.applicationId}.NotificationActions.SMART_REPLY_ACTION" + val dismissSummary = "${buildMeta.applicationId}.NotificationActions.DISMISS_SUMMARY_ACTION" + val dismissRoom = "${buildMeta.applicationId}.NotificationActions.DISMISS_ROOM_NOTIF_ACTION" + val tapToView = "${buildMeta.applicationId}.NotificationActions.TAP_TO_VIEW_ACTION" + val diagnostic = "${buildMeta.applicationId}.NotificationActions.DIAGNOSTIC" + val push = "${buildMeta.applicationId}.PUSH" } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt index 9e87b4d325..3fe0898eb4 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt @@ -54,26 +54,26 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { if (intent == null || context == null) return Timber.v("NotificationBroadcastReceiver received : $intent") when (intent.action) { - actionIds.SMART_REPLY_ACTION -> + actionIds.smartReply -> handleSmartReply(intent, context) - actionIds.DISMISS_ROOM_NOTIF_ACTION -> + actionIds.dismissRoom -> intent.getStringExtra(KEY_ROOM_ID)?.let { roomId -> notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) } } - actionIds.DISMISS_SUMMARY_ACTION -> + actionIds.dismissSummary -> notificationDrawerManager.clearAllEvents() - actionIds.MARK_ROOM_READ_ACTION -> + actionIds.markRoomRead -> intent.getStringExtra(KEY_ROOM_ID)?.let { roomId -> notificationDrawerManager.updateEvents { it.clearMessagesForRoom(roomId) } handleMarkAsRead(roomId) } - actionIds.JOIN_ACTION -> { + actionIds.join -> { intent.getStringExtra(KEY_ROOM_ID)?.let { roomId -> notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) } handleJoinRoom(roomId) } } - actionIds.REJECT_ACTION -> { + actionIds.reject -> { intent.getStringExtra(KEY_ROOM_ID)?.let { roomId -> notificationDrawerManager.updateEvents { it.clearMemberShipNotificationForRoom(roomId) } handleRejectRoom(roomId) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index 2fdba3b524..8f05819fc4 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -632,7 +632,7 @@ class NotificationUtils @Inject constructor( // Add actions and notification intents // Mark room as read val markRoomReadIntent = Intent(context, NotificationBroadcastReceiver::class.java) - markRoomReadIntent.action = actionIds.MARK_ROOM_READ_ACTION + markRoomReadIntent.action = actionIds.markRoomRead markRoomReadIntent.data = createIgnoredUri(roomInfo.roomId) markRoomReadIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId) val markRoomReadPendingIntent = PendingIntent.getBroadcast( @@ -679,7 +679,7 @@ class NotificationUtils @Inject constructor( val intent = Intent(context, NotificationBroadcastReceiver::class.java) intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomInfo.roomId) - intent.action = actionIds.DISMISS_ROOM_NOTIF_ACTION + intent.action = actionIds.dismissRoom val pendingIntent = PendingIntent.getBroadcast( context.applicationContext, clock.epochMillis().toInt(), @@ -714,7 +714,7 @@ class NotificationUtils @Inject constructor( val roomId = inviteNotifiableEvent.roomId // offer to type a quick reject button val rejectIntent = Intent(context, NotificationBroadcastReceiver::class.java) - rejectIntent.action = actionIds.REJECT_ACTION + rejectIntent.action = actionIds.reject rejectIntent.data = createIgnoredUri("$roomId&$matrixId") rejectIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId) val rejectIntentPendingIntent = PendingIntent.getBroadcast( @@ -732,7 +732,7 @@ class NotificationUtils @Inject constructor( // offer to type a quick accept button val joinIntent = Intent(context, NotificationBroadcastReceiver::class.java) - joinIntent.action = actionIds.JOIN_ACTION + joinIntent.action = actionIds.join joinIntent.data = createIgnoredUri("$roomId&$matrixId") joinIntent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId) val joinIntentPendingIntent = PendingIntent.getBroadcast( @@ -815,7 +815,7 @@ class NotificationUtils @Inject constructor( private fun buildOpenRoomIntent(roomId: String): PendingIntent? { 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 roomIntentTap.data = createIgnoredUri("openRoom?$roomId") @@ -853,7 +853,7 @@ class NotificationUtils @Inject constructor( val intent: Intent if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent = Intent(context, NotificationBroadcastReceiver::class.java) - intent.action = actionIds.SMART_REPLY_ACTION + intent.action = actionIds.smartReply intent.data = createIgnoredUri(roomId) intent.putExtra(NotificationBroadcastReceiver.KEY_ROOM_ID, roomId) return PendingIntent.getBroadcast( @@ -929,7 +929,7 @@ class NotificationUtils @Inject constructor( private fun getDismissSummaryPendingIntent(): PendingIntent { val intent = Intent(context, NotificationBroadcastReceiver::class.java) - intent.action = actionIds.DISMISS_SUMMARY_ACTION + intent.action = actionIds.dismissSummary intent.data = createIgnoredUri("deleteSummary") return PendingIntent.getBroadcast( context.applicationContext, @@ -968,7 +968,7 @@ class NotificationUtils @Inject constructor( fun displayDiagnosticNotification() { val testActionIntent = Intent(context, TestNotificationReceiver::class.java) - testActionIntent.action = actionIds.DIAGNOSTIC_ACTION + testActionIntent.action = actionIds.diagnostic val testPendingIntent = PendingIntent.getBroadcast( context, 0, diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt index a063208da9..8a3407b428 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsNotificationsTroubleshootFragment.kt @@ -152,11 +152,11 @@ class VectorSettingsNotificationsTroubleshootFragment @Inject constructor( tryOrNull("Unable to register the receiver") { LocalBroadcastManager.getInstance(requireContext()) - .registerReceiver(broadcastReceiverPush, IntentFilter(actionIds.PUSH_ACTION)) + .registerReceiver(broadcastReceiverPush, IntentFilter(actionIds.push)) } tryOrNull("Unable to register the receiver") { LocalBroadcastManager.getInstance(requireContext()) - .registerReceiver(broadcastReceiverNotification, IntentFilter(actionIds.DIAGNOSTIC_ACTION)) + .registerReceiver(broadcastReceiverNotification, IntentFilter(actionIds.diagnostic)) } }