Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a centralized link-classification flow (generic vs. community links) and updates multiple entry points (conversations, search, new-message flows, join/create community flows) to use a unified dialog + handling behavior across the app.
Changes:
- Added
LinkChecker/LinkRuleinfrastructure and aCommunityLinkRuleto classify/normalize URLs intoLinkType. - Introduced a new Compose
LinkAlertDialogthat renders either a generic open/copy dialog or a community join/open dialog depending onLinkType. - Updated multiple screens/viewmodels (Conversation V2/V3, Start Conversation, Global Search, Join/Create Community) to route link interactions through the new link handling.
Reviewed changes
Copilot reviewed 74 out of 74 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/test/java/org/thoughtcrime/securesms/links/LinkCheckerTest.kt | Adds unit tests for URL classification. |
| app/src/test/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModelTest.kt | Updates tests for new link handling behavior. |
| app/src/main/java/org/thoughtcrime/securesms/ui/dialog/LinkDialog.kt | New unified link dialog UI. |
| app/src/main/java/org/thoughtcrime/securesms/ui/dialog/AlertDialog.kt | Moves dialog components into ui.dialog package. |
| app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/ui/components/ExportLogsDialog.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/ui/UserProfileModal.kt | Updates dialog import + formatting. |
| app/src/main/java/org/thoughtcrime/securesms/ui/ProComponents.kt | Uses dialog components from new package. |
| app/src/main/java/org/thoughtcrime/securesms/tokenpage/TokenPage.kt | Updates OpenURLAlertDialog import path. |
| app/src/main/java/org/thoughtcrime/securesms/search/SearchRepository.kt | Expands contact search to include exact ID match. |
| app/src/main/java/org/thoughtcrime/securesms/reviews/ui/InAppReview.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/recoverypassword/RecoveryPassword.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/prosettings/ProSettingsViewModel.kt | Updates SimpleDialogData import path. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/prosettings/ProSettingsDialogs.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/prosettings/BaseProSettingsScreens.kt | Updates DialogBg import path. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/compose/PrivacySettingsPreferenceScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/compose/NotificationsPreferenceScreen.kt | Removes unused import + updates dialog imports. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppDisguiseSettings.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsViewModel.kt | Updates SimpleDialogData import path. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt | Switches QR parsing/validation to AccountId. |
| app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/onboarding/landing/Landing.kt | Updates TCPolicyDialog import path. |
| app/src/main/java/org/thoughtcrime/securesms/onboarding/OnboardingBackPressAlertDialog.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/migration/DatabaseMigrationScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/media/MediaOverviewScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/links/LinkChecker.kt | Adds link classification entry point + LinkType. |
| app/src/main/java/org/thoughtcrime/securesms/links/CommunityLinkRule.kt | Adds community URL classification rule. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/newmessage/NewMessageViewModel.kt | Adds community URL detection + join/open behavior. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/group/CreateGroupViewModel.kt | Detects community URLs in group name + dialog flow. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/group/CreateGroupScreen.kt | Displays LinkAlertDialog for URL detection. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/community/JoinCommunityViewModel.kt | Uses LinkChecker to detect already-joined communities. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/community/JoinCommunityScreen.kt | Displays LinkAlertDialog for joined-community case. |
| app/src/main/java/org/thoughtcrime/securesms/home/startconversation/StartConversationSheet.kt | Uses assisted factory VM + unified link dialog. |
| app/src/main/java/org/thoughtcrime/securesms/home/search/GlobalSearchViewModel.kt | Adds special-case handling for community URLs & account IDs. |
| app/src/main/java/org/thoughtcrime/securesms/home/search/GlobalSearchResult.kt | Adds urlDialog slot to search result model. |
| app/src/main/java/org/thoughtcrime/securesms/home/search/GlobalSearchInputLayout.kt | Removes search input length filter. |
| app/src/main/java/org/thoughtcrime/securesms/home/HomeViewModel.kt | Adds dialog + command handling for link/community flows from search. |
| app/src/main/java/org/thoughtcrime/securesms/home/HomeDialogs.kt | Uses LinkAlertDialog in Home dialogs. |
| app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt | Wires GlobalSearch UI events into HomeViewModel. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/PromoteMembersScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/ManageGroupMembersScreen.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/ManageGroupAdminsScreen.kt | Updates LoadingDialog import path. |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/InviteAccountIdScreen.kt | Switches to unified link dialog field (urlDialog). |
| app/src/main/java/org/thoughtcrime/securesms/groups/compose/Components.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/debugmenu/DebugMenu.kt | Updates dialog imports + command references. |
| app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt | Removes legacy closed-group API usage. |
| app/src/main/java/org/thoughtcrime/securesms/database/LokiAPIDatabase.kt | Removes legacy closed-group check method. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsViewModel.kt | Passes address into destinations for nav correctness. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsScreen.kt | Updates LoadingDialog import path. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsNavHost.kt | Makes destinations carry address; updates backstack handling. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsDialogs.kt | Updates dialog imports to new package. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/settings/ConversationSettingsActivity.kt | Requires address and seeds start destination with it. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/compose/message/MessageLink.kt | Routes link clicks through HandleLink. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/compose/message/CommunityInviteMessage.kt | Makes invites clickable + trims query param display. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/compose/message/BaseMessage.kt | Routes URL clicks through unified link handling. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/compose/conversation/ConversationV3Dialogs.kt | Replaces URL/community dialogs with LinkAlertDialog. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/compose/conversation/ConversationScreen.kt | Threads address through to settings navigation. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3ViewModel.kt | Adds link checker + community join/open flow in convo. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationV3NavHost.kt | Makes destinations carry address; updates VM creation. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationModels.kt | Replaces old URL/community dialog fields with LinkType. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationCommand.kt | Replaces OpenUrl/join-community commands with link commands. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v3/ConversationActivityV3.kt | Seeds navhost with address; updates switching behavior. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt | Routes URL taps through new handleLink entry point. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/LinkPreviewView.kt | Routes URL taps through new handleLink entry point. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt | Adds LinkChecker + unified dialog/join logic. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationV2Dialogs.kt | Replaces URL/community dialogs with LinkAlertDialog. |
| app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt | Renames URL dialog entry point to handleLink; fixes nav args. |
| app/src/main/java/org/thoughtcrime/securesms/InputbarViewModel.kt | Updates SimpleDialogData import path. |
| app/src/main/java/org/thoughtcrime/securesms/InputBarDialogs.kt | Updates dialog imports to new package. |
| app/src/main/java/org/session/libsignal/utilities/Validation.kt | Removes legacy PublicKeyValidation. |
| app/src/main/java/org/session/libsignal/utilities/AccountId.kt | Adds hasValidLength helper. |
| app/src/main/java/org/session/libsignal/database/LokiAPIDatabaseProtocol.kt | Removes legacy isClosedGroup API. |
| app/src/main/java/org/session/libsession/database/StorageProtocol.kt | Removes legacy isLegacyClosedGroup API. |
Comments suppressed due to low confidence (1)
app/src/main/java/org/thoughtcrime/securesms/ui/dialog/AlertDialog.kt:50
- There are several unused imports here (e.g.,
Phrase,COMMUNITY_NAME_KEY,URL_KEY,LinkType,copyURLToClipboard, andToast). Please remove them to avoid lint/ktlint failures and keep the module clean.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+81
to
+111
| var results = searchRepository.query(query).toGlobalSearchResult() | ||
|
|
||
| // Special cases | ||
| // community URL detected | ||
| val communityUrl = linkChecker.check(query) as? LinkType.CommunityLink | ||
| if(communityUrl != null){ | ||
| // if the community is joined, add it to the result, | ||
| // otherwise show a confirmation dialog | ||
| if(communityUrl.joined){ | ||
| // community is already joined: add it to the result list | ||
| val openGroup = OpenGroupUrlParser.parseUrl(communityUrl.url) | ||
| results = results.copy( | ||
| threads = results.threads + recipientRepository.getRecipientSync( | ||
| Address.Community( | ||
| serverUrl = openGroup.server, | ||
| room = openGroup.room | ||
| ) | ||
| ) | ||
| ) | ||
| } else { | ||
| // community not yet joined: show a confirmation dialog | ||
| _uiEvents.emit(UiEvent.ShowUrlDialog(communityUrl.copy(displayType = LinkType.CommunityLink.DisplayType.SEARCH))) | ||
| } | ||
| } | ||
|
|
||
| // Account ID detected, which is not a contact | ||
| val accountId = AccountId.fromStringOrNull(query) | ||
| val isStandardAccountId = accountId?.prefix == IdPrefix.STANDARD | ||
| if(isStandardAccountId && !results.contacts.any { it.address.toString() == query }){ | ||
| _uiEvents.emit(UiEvent.ShowNewConversationDialog(Address.Standard(accountId))) | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
I moved the UI events part out of that loop
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…session-foundation/session-android into feature/community-link-handling
SessionHero01
approved these changes
Mar 17, 2026
jbsession
approved these changes
Mar 17, 2026
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.
New way to handle community link throughout the application.