Skip to content

fix: Ensure proper user synchronization on deeplink redirect#2018

Merged
FabianDevel merged 9 commits into
mainfrom
fix-avatar-sync
May 11, 2026
Merged

fix: Ensure proper user synchronization on deeplink redirect#2018
FabianDevel merged 9 commits into
mainfrom
fix-avatar-sync

Conversation

@aymericmariaux
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 5, 2026 12:42
@aymericmariaux aymericmariaux changed the title Implement user object flow to ensure avatar synchronization fix: Implement user object flow to ensure avatar synchronization May 5, 2026
@aymericmariaux aymericmariaux changed the base branch from main to support-redirect-deeplink May 5, 2026 12:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors deeplink handling into a typed DeeplinkType flow, routes supported links through LaunchActivity/MainActivity, and adds reactive user observation so avatar updates propagate into the UI.

Changes:

  • Introduces a new typed deeplink model/parser/handler pipeline and wires it into launch/navigation flows.
  • Adds deeplink navigation arguments to multiple destinations so favorites, recents, shares, trash, and file previews can be opened directly.
  • Observes the current user as a flow to refresh avatar/name UI when the stored user object changes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Show a summary per file
File Description
app/src/test/kotlin/com/infomaniak/drive/data/models/deeplink/DeeplinkParserTest.kt Adds parser unit tests for many deeplink formats.
app/src/main/res/navigation/select_folder_navigation.xml Extends select-folder destinations with preview/external deeplink args.
app/src/main/res/navigation/main_navigation.xml Adds deeplink-related nav args across main destinations and updates main activity args.
app/src/main/java/com/infomaniak/drive/utils/Extensions.kt Adds a generic instanceOf helper.
app/src/main/java/com/infomaniak/drive/utils/AccountUtils.kt Exposes currentUserFlow from stored current-user state.
app/src/main/java/com/infomaniak/drive/ui/menu/SharedWithMeFragment.kt Supports shared-with-me deeplink preview/open behavior.
app/src/main/java/com/infomaniak/drive/ui/menu/settings/SettingsFragment.kt Switches WebViewActivity import package.
app/src/main/java/com/infomaniak/drive/ui/menu/RecentChangesFragment.kt Adds preview-file deeplink argument handling.
app/src/main/java/com/infomaniak/drive/ui/menu/MySharesFragment.kt Adds preview-file deeplink argument handling.
app/src/main/java/com/infomaniak/drive/ui/menu/MenuFragment.kt Observes current user updates to refresh menu header/avatar.
app/src/main/java/com/infomaniak/drive/ui/MainViewModel.kt Adds deeplink navigation state flow.
app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt Replaces old destination-file logic with deeplink handling and avatar observation.
app/src/main/java/com/infomaniak/drive/ui/LaunchArgsType.kt Introduces typed launch-source discrimination (notification/shortcut/deeplink).
app/src/main/java/com/infomaniak/drive/ui/LaunchActivity.kt Refactors launch processing around typed deeplinks and redirects.
app/src/main/java/com/infomaniak/drive/ui/home/RootFilesFragment.kt Consumes deeplink navigation flow and routes to destination fragments.
app/src/main/java/com/infomaniak/drive/ui/fileList/FileListFragment.kt Adds generic preview-file deeplink support for file lists.
app/src/main/java/com/infomaniak/drive/ui/fileList/FavoritesFragment.kt Adds preview-file deeplink argument handling.
app/src/main/java/com/infomaniak/drive/ui/DeeplinkParser.kt Adds centralized URI-to-deeplink parsing.
app/src/main/java/com/infomaniak/drive/ui/deeplink/DeeplinkHandler.kt Adds runtime handling for supported/unsupported deeplink types.
app/src/main/java/com/infomaniak/drive/data/models/file/SpecialFolder.kt Makes special folders parcelable and exposes constructor properties.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/RoleFolder.kt Adds typed role-folder model for drive deeplinks.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/MatchResultExt.kt Adds regex match parsing helpers.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/InvalidFormatting.kt Replaces old deep link model with formatting exception in new package.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/FolderType.kt Maps folder path types to typed role folders.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/FileType.kt Models regular-drive deeplink file targets.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/ExternalFileType.kt Models shared/external deeplink file targets.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/DeeplinkType.kt Defines top-level deeplink model and access checks.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/DeeplinkRegexAlias.kt Centralizes deeplink regex fragments/constants.
app/src/main/java/com/infomaniak/drive/data/models/deeplink/ActionType.kt Maps action segments to typed deeplink actions.
app/src/main/java/com/infomaniak/drive/data/cache/FileController.kt Adds cached-file existence helper for deeplink access checks.
app/src/main/AndroidManifest.xml Broadens app-link matching and changes LaunchActivity launch mode.
app/build.gradle.kts Adds webview and Android MockK dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/com/infomaniak/drive/utils/AccountUtils.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/ui/menu/MenuFragment.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/ui/menu/MenuFragment.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
@aymericmariaux aymericmariaux changed the title fix: Implement user object flow to ensure avatar synchronization fix: Correct user synchronisation for redirect deeplinks May 8, 2026
@aymericmariaux aymericmariaux changed the title fix: Correct user synchronisation for redirect deeplinks fix: Ensure proper user synchronization on deeplink redirect May 8, 2026
@aymericmariaux aymericmariaux requested a review from Copilot May 8, 2026 12:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

app/src/main/java/com/infomaniak/drive/ui/menu/MenuFragment.kt:75

  • This fragment now observes currentConnectedUserFlow to update the displayed user, but it still captures val user = AccountUtils.currentUser once and then uses that snapshot for user-dependent UI/actions (e.g., single-drive check, logout dialog text, and the logout(user) call). If the current user changes while the fragment’s view is alive (deeplink-driven user switch), these actions can target the wrong account or show inconsistent info. Consider driving all user-dependent UI and listeners from the observed user (or keeping a mutable currentUser field updated by the observer).
        observeCurrentUser()

        val user = AccountUtils.currentUser ?: return@with

        if (DriveInfosController.hasSingleDrive(user.id)) {
            driveIcon.isGone = true
        } else {
            driveSwitchContainer.setOnClickListener { safelyNavigate(R.id.switchDriveDialog) }
        }

Comment thread app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
@benjaminVadon benjaminVadon force-pushed the support-redirect-deeplink branch from 25c1a6f to 33ca26d Compare May 11, 2026 06:10
@benjaminVadon benjaminVadon force-pushed the support-redirect-deeplink branch from 33ca26d to b7e4bb1 Compare May 11, 2026 06:39
@FabianDevel FabianDevel force-pushed the support-redirect-deeplink branch from b7e4bb1 to 5d8a49b Compare May 11, 2026 07:10
Base automatically changed from support-redirect-deeplink to main May 11, 2026 07:22
Comment thread app/src/main/java/com/infomaniak/drive/data/models/deeplink/DeeplinkType.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
@sonarqubecloud
Copy link
Copy Markdown

@FabianDevel FabianDevel merged commit a7d691a into main May 11, 2026
7 checks passed
@FabianDevel FabianDevel deleted the fix-avatar-sync branch May 11, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants