Repository navigation
fix(android): import presets picked through the system file picker - #2217
Open
Floral-Overcast wants to merge 1 commit into
Open
Floral-Overcast wants to merge 1 commit into
Floral-Overcast wants to merge 1 commit into
Conversation
The Android file picker returns content:// URIs. Preset import read them with std::fs and detected the format from the URI string, so every import failed, and the failure was only logged to the console. - read preset files through ContentResolver on Android and take the extension from the resolved display name (content sniff as fallback) - pass no picker filters on Android, like the LUT and image pickers - show a toast for each file that fails to import Fixes CyberTimon#1856 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
6 of 17 tasks
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.
Description
On Android, importing presets from the Presets panel does nothing (#1856). The system file picker returns
content://URIs. The import command read them withstd::fsand took the file type from the URI string, so every file failed, and the failures were only written to the console.This PR reads the picked files through the existing
read_android_content_urihelper and takes the extension fromresolve_android_content_uri_name, the same way LUT import already does.Fixes #1856
Type of Change
Changes Made
src-tauri/src/library/presets.rsparse_preset_filereads content URIs through the ContentResolver on Android and decides between.rrpresetand legacy.xmp/.lrtemplatefrom the resolved display name. If a document provider reports a name without one of those extensions, it falls back to checking whether the content starts with{.preset_file_display_nameresolves content URIs, so failure messages show the real file name.src/components/panel/right/PresetsPanel.tsxeditor.presets.toasts.importFailedin all 17 locales. The non-English strings are machine translated.Screenshots/Videos
Not included.
Testing
What was tested:
tauri android build --target aarch64) compiles with no new warnings;cargo fmt --check,cargo clippy --all-targets --all-features -- -D warningsandnpm run typecheckpass;format:check,lintandi18n:checkreport the same results as main.Not tested: legacy
.xmp/.lrtemplateimport on Android, and the desktop app was not run. On desktopparse_preset_filenow reads the file once up front; the format decision is the same for the three extensions the desktop dialog allows.Test Configuration:
Checklist
Additional Notes
From reading the code, preset export on Android looks affected in the same way (
handle_export_presets_to_filepasses the save dialog's content URI tostd::fs::write). A change for that exists but has not been run on a device yet, so it is not part of this PR.AI Disclaimer:
Please state the involvement of AI in this PR:
The code and this description were written by Claude (an AI agent) working for the account owner, who uses the patched build on the phone above and did the on-device import.