refactor: add share-safe file provider helpers PR 1 [WPB-26687]#5033
Open
MohamadJaara wants to merge 1 commit into
Open
refactor: add share-safe file provider helpers PR 1 [WPB-26687]#5033MohamadJaara wants to merge 1 commit into
MohamadJaara wants to merge 1 commit into
Conversation
|
ohassine
reviewed
Jul 8, 2026
Comment on lines
+396
to
+404
| if (!excludeOwnComponents) return@apply | ||
| val ownShareComponents = packageManager.queryIntentActivitiesCompat(sendIntent) | ||
| .map { ComponentName(it.activityInfo.packageName, it.activityInfo.name) } | ||
| .filter { it.packageName == packageName } | ||
| .toTypedArray() | ||
| if (ownShareComponents.isNotEmpty()) { | ||
| putExtra(Intent.EXTRA_EXCLUDE_COMPONENTS, ownShareComponents) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
I think this would read a bit more naturally as:
if (excludeOwnComponents) {
...
}
instead of if (!excludeOwnComponents) return@apply
Member
Author
There was a problem hiding this comment.
this is intentional to return early avoiding nested logic
if (excludeOwnComponents) {
...
if (ownShareComponents.isNotEmpty()) {
...
}
}|
|
||
| fun getShareableTempAvatarUri(filePath: Path): Uri { | ||
| return FileProvider.getUriForFile(context, context.getProviderAuthority(), filePath.toFile()) | ||
| return context.shareableFileProviderUri(context.fileProviderSharedCacheFile(filePath.name)) |
Member
There was a problem hiding this comment.
Could you clarify this part? It looks like we're creating a new file, but I can't see where it's populated with the avatar data
Contributor
|
I think this will break Cells code from com.wire.android.feature.cells.util.FileHelper since it is not updated. Will not be able to open Cell files in external apps. |
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.



https://wearezeta.atlassian.net/browse/WPB-26687
Summary
General Idea
This stack separates “share externally” from “forward/share inside Wire” while keeping the behavior different per Android version:
flowchart TD A["User taps Share"] --> B{"Android 15+?"} B -- "Yes" --> C["Use Android share sheet"] C --> D["Enable share identity"] D --> E["Wire target can be trusted"] B -- "No" --> F{"Target action"} F -- "Share externally" --> G["Open external chooser"] G --> H["Exclude Wire targets"] F -- "Share via Wire" --> I["Create shared-cache FileProvider URI"] I --> J["Navigate directly to ImportMediaScreen"] J --> K["Validate URI is from Wire shared_files root"] K --> L["Import as pending asset"]Stack
This PR is part of a stacked series:
mo/share-forward-01-share-plumbingShare-safe FileProvider helpers and chooser behavior.
mo/share-forward-02-import-safetyIncoming share validation and trusted Wire caller handling.
mo/share-forward-03-asset-actionsUI split between “Share via Wire” and “Share externally”.
mo/share-forward-04-log-sharingShare logs as one archive, either externally or via Wire.
mo/share-forward-05-stability-baselinesGenerated stability baseline updates.