Notification refactoring - Part 2#2031
Open
SessionHero01 wants to merge 64 commits intorefactor-notificationfrom
Open
Notification refactoring - Part 2#2031SessionHero01 wants to merge 64 commits intorefactor-notificationfrom
SessionHero01 wants to merge 64 commits intorefactor-notificationfrom
Conversation
# Conflicts: # app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt # app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java
# Conflicts: # app/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt # app/src/main/java/org/session/libsession/utilities/recipients/RecipientData.kt # app/src/main/java/org/thoughtcrime/securesms/auth/AuthAwareComponents.kt # app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt # app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt # app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationLoader.kt # app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt # app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java # app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabase.java # app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt # app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java # app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java # app/src/main/java/org/thoughtcrime/securesms/dependencies/OnAppStartupComponents.kt # app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadProcessor.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt # app/src/main/java/org/thoughtcrime/securesms/service/ExpiringMessageManager.kt
# Conflicts: # app/src/main/java/org/session/libsession/database/StorageProtocol.kt # app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java # app/src/main/java/org/thoughtcrime/securesms/webrtc/CallManager.kt # app/src/main/java/org/thoughtcrime/securesms/webrtc/WebRtcCallBridge.kt
# Conflicts: # app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt # app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3NavHost.kt # app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt
…ty and efficiency
…prove code organization
# Conflicts: # app/src/main/java/org/session/libsession/database/StorageProtocol.kt # app/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageProcessor.kt # app/src/main/java/org/thoughtcrime/securesms/auth/AuthAwareComponents.kt # app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt # app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java # app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabaseExt.kt # app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabaseExt.kt # app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt # app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java # app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabaseExt.kt # app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt # app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoHeardReceiver.java # app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/DeleteNotificationReceiver.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadProcessor.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt # app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.kt
Contributor
There was a problem hiding this comment.
Pull request overview
Continues the notification refactor by centralizing message-notification behavior into a new reactive NotificationProcessor, migrating notification settings/storage to the new preference system, and tightening APIs to use Address.Conversable where a conversation thread is required.
Changes:
- Introduces
NotificationProcessor+NotificationActionReceiverand removes the legacy notifier/builders/receivers. - Refactors avatar notification rendering via
OffscreenAvatarRendererand updatesAvatarUIElement’s data model. - Migrates various notification IDs and notification preferences to shared, typed constants (
NotificationId,NotificationPreferences) andPreferenceStorage.
Reviewed changes
Copilot reviewed 86 out of 86 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/java/org/thoughtcrime/securesms/webrtc/CallNotificationBuilder.kt | Switches to centralized notification ID constant. |
| app/src/main/java/org/thoughtcrime/securesms/util/AvatarUtils.kt | Updates avatar UI model (fallback/content split). |
| app/src/main/java/org/thoughtcrime/securesms/ui/components/OffscreenAvatarRenderer.kt | Adds non-Compose avatar-to-bitmap renderer for notifications. |
| app/src/main/java/org/thoughtcrime/securesms/ui/components/Avatar.kt | Adapts Compose avatar rendering to new avatar UI model. |
| app/src/main/java/org/thoughtcrime/securesms/tokenpage/TokenDropNotificationWorker.kt | Switches to centralized notification ID constant. |
| app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java | Removes legacy notifier calls; uses shared notification ID. |
| app/src/main/java/org/thoughtcrime/securesms/repository/DefaultConversationRepository.kt | Uses Address.Conversable where thread addresses are expected. |
| app/src/main/java/org/thoughtcrime/securesms/repository/ConversationRepository.kt | Updates repository API to accept Address.Conversable for invites. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/compose/NotificationsPreferenceViewModel.kt | Migrates notification prefs to PreferenceStorage + injected NotificationChannels. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/PreferenceKey.kt | Renames factory method int → integer. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsScreen.kt | Updates preview/test data to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/AppPreferences.kt | Adds typed app-level preference key(s). |
| app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java | Deletes legacy single-thread notification builder. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/ReplyMethod.java | Deletes legacy reply-method enum. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/RemoteReplyReceiver.kt | Deletes legacy wearable reply receiver. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/PushReceiver.kt | Switches to centralized notification ID constant. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/OptimizedMessageNotifier.java | Deletes legacy notifier wrapper. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationState.java | Deletes legacy notification state container. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationProcessor.kt | Adds new reactive message-notification processor. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationPreferences.kt | Adds typed preference keys for notification settings. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationItem.java | Deletes legacy notification item model. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationId.kt | Adds centralized notification ID constants. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationChannels.java | Converts channels management to injected singleton using PreferenceStorage. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationActionReceiver.kt | Adds unified receiver for mark-read + inline reply actions. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadReceiver.kt | Deletes legacy mark-read receiver. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/MarkReadProcessor.kt | Updates read-receipt logic to new DB extension APIs. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/LocaleChangedReceiver.java | Recreates channels on locale change via injected NotificationChannels. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/GroupSummaryNotificationBuilder.kt | Deletes legacy group summary notification builder. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/DeleteNotificationReceiver.kt | Deletes legacy delete-notification receiver. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/DefaultMessageNotifier.kt | Deletes legacy poll-based message notifier implementation. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoReplyReceiver.kt | Deletes legacy Android Auto reply receiver. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/AndroidAutoHeardReceiver.java | Deletes legacy Android Auto heard receiver. |
| app/src/main/java/org/thoughtcrime/securesms/notifications/AbstractNotificationBuilder.java | Deletes legacy notification builder base. |
| app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewViewModel.kt | Switches to Address.Conversable and updated thread id access patterns. |
| app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewActivity.kt | Updates intent extra type to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/group/CreateGroupViewModel.kt | Uses toConversableAddress() for group member addresses. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/group/CreateGroupScreen.kt | Updates previews/test data to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/home/HomeViewModel.kt | Migrates “hidden message requests” to typed PreferenceStorage key. |
| app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt | Removes legacy notifier visibility hooks; migrates hidden-MR pref; adds injected renderer. |
| app/src/main/java/org/thoughtcrime/securesms/home/ConversationOptionsBottomSheet.kt | Minor assignment cleanup. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/InviteContactsScreen.kt | Updates previews and types to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/Components.kt | Updates contact selection APIs to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/groups/SelectContactsViewModel.kt | Refactors selection/contacts to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/groups/InviteMembersViewModel.kt | Updates assisted params/commands to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/dependencies/AppModule.kt | Removes DI binding for the deleted legacy notifier. |
| app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenuViewModel.kt | Migrates hidden-MR pref to typed PreferenceStorage key. |
| app/src/main/java/org/thoughtcrime/securesms/database/loaders/PagingMediaLoader.java | Injects DB dependencies and uses new ThreadDatabase extension APIs. |
| app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabaseExt.kt | Moves/expands thread ops into Kotlin extensions and updates notifications on changes. |
| app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java | Removes legacy thread APIs; adds address-update flow + updated notify signature. |
| app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt | Removes legacy notifier coupling; updates thread/address APIs; trims via DB extension. |
| app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabaseExt.kt | Adds helper to fetch thread id for a message; formatting cleanup. |
| app/src/main/java/org/thoughtcrime/securesms/database/ReactionDatabase.kt | Adds query to fetch reactions for a thread since a timestamp. |
| app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabaseExt.kt | Replaces findIncomingMessages with getIncomingMessages; adds helpers (thread id, trim). |
| app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java | Removes legacy notification queries; exposes DB lazies and updates thread id lookup. |
| app/src/main/java/org/thoughtcrime/securesms/database/MmsDatabase.kt | Makes getThreadIdForMessage nullable. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsViewModel.kt | Updates invite API to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsNavHost.kt | Updates routes/args mapping to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/MessageTextFormatter.kt | Adapts to mentions parser returning CharSequence. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3ViewModel.kt | Refactors last-seen derivation to new thread DB extension API. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3NavHost.kt | Updates routes/args mapping to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt | Optimizes mention substitution and changes parsed text type to CharSequence. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt | Updates APIs to require Address.Conversable for thread address. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/MessageFormatter.kt | Extracts MMS placeholder composition and reuses it for notifications/snippets. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/components/AlbumThumbnailView.kt | Narrows thread address parameter type to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/MessageDetailsViewModel.kt | Updates thread address retrieval to new ThreadDatabase API. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationReactionOverlay.kt | Updates thread address retrieval to new ThreadDatabase API. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt | Removes legacy notifier visibility hooks; exposes ADDRESS extra key. |
| app/src/main/java/org/thoughtcrime/securesms/configs/ConfigToDatabaseSync.kt | Uses new ThreadDatabase extension ops; removes legacy notifier coupling. |
| app/src/main/java/org/thoughtcrime/securesms/components/TypingStatusSender.java | Uses new ThreadDatabase address lookup extension. |
| app/src/main/java/org/thoughtcrime/securesms/auth/AuthAwareComponents.kt | Adds NotificationProcessor to logged-in auth-aware component set. |
| app/src/main/java/org/thoughtcrime/securesms/MediaPreviewArgs.kt | Narrows conversation address to Address.Conversable. |
| app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.kt | Injects DB dependencies for media loader; narrows address extra type. |
| app/src/main/java/org/thoughtcrime/securesms/DatabaseUpgradeActivity.java | Removes legacy notifier update invocation. |
| app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.kt | Removes legacy notifier injection and explicit channels creation call. |
| app/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt | Removes notification-related methods/keys migrated to new pref system. |
| app/src/main/java/org/session/libsession/utilities/ServiceUtil.java | Removes NotificationManager accessor. |
| app/src/main/java/org/session/libsession/utilities/Address.kt | Adds String.toConversableAddress() helper. |
| app/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageProcessor.kt | Removes legacy notifier coupling; uses new thread-id creation API. |
| app/src/main/java/org/session/libsession/messaging/sending_receiving/MessageRequestResponseHandler.kt | Uses new ThreadDatabase extension APIs for thread migration/lookup. |
| app/src/main/java/org/session/libsession/messaging/messages/Message.kt | Adds overload to apply expiry mode from a Recipient. |
| app/src/main/java/org/session/libsession/messaging/jobs/TrimThreadJob.kt | Updates thread address lookup to new ThreadDatabase API. |
| app/src/main/java/org/session/libsession/messaging/jobs/OpenGroupDeleteJob.kt | Updates thread address lookup to new ThreadDatabase API. |
| app/src/main/java/org/session/libsession/messaging/jobs/AttachmentUploadJob.kt | Updates thread address lookup to new ThreadDatabase API. |
| app/src/main/java/org/session/libsession/database/StorageProtocol.kt | Removes thread-creation-date API. |
| app/src/main/AndroidManifest.xml | Replaces legacy notification receivers with NotificationActionReceiver. |
Comments suppressed due to low confidence (1)
app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationChannels.java:119
updateMessageVibrate()takes aContextparameter but doesn’t use it (the class already has an injectedcontext). This is confusing and makes call-sites ambiguous; consider removing the parameter and keeping the instance method signature consistent withupdateMessageRingtone(...).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationActionReceiver.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationActionReceiver.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/ui/components/OffscreenAvatarRenderer.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabaseExt.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabaseExt.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationActionReceiver.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3ViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/notifications/NotificationProcessor.kt
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabaseExt.kt
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this part of notification refactoring:
ThreadDatabaseso now it notifies both thread ID and address. Moved most of the logic into the Kotlin counterpart.NotificationProcessorto centrally manage the notification logic.AddresswithAddress.Conversablein places where a thread is expectedWork to be done in next part: