fix(android): correct long term access directory picker response#823
Merged
vonovak merged 3 commits intoreact-native-documents:mainfrom May 5, 2025
Merged
Conversation
- Updated the key from "status" to "bookmarkStatus" in Android to ensure consistency across platforms. - According to the type definitions, "bookmarkStatus" was the expected key, and this change aligns the implementation accordingly. - This update standardizes the key across implementations, reducing potential confusion for developers and improving cross-platform compatibility. No functional changes beyond renaming the key.
🦋 Changeset detectedLatest commit: 6b030f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
vonovak
reviewed
May 5, 2025
...ocument-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt
Outdated
Show resolved
Hide resolved
...ocument-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt
Outdated
Show resolved
Hide resolved
Member
|
Thank you for the PR! |
Contributor
Author
|
You're welcome! Glad to contribute. Let me know if there's anything else I can help with.
|
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.
PR: Rename 'status' key to 'bookmarkStatus' in Android directory picker response
Description
This PR standardizes the response format for directory picking on Android by renaming the
statuskey tobookmarkStatuswhenrequestLongTermAccessis set totrue. This change ensures consistency across platforms and aligns with the expected type definitions.Changes Made
processDirectoryPickerResult()method inRNDocumentPickerModule.ktto usebookmarkStatusinstead ofstatusin the response object when handling long-term directory access permissionsreleaseLongTermAccess()method to also usebookmarkStatusinstead ofstatusin the response for consistencyTechnical Details
The changes were made in two specific locations in
packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt:In the
processDirectoryPickerResult()method (~line 392-399):In the
releaseLongTermAccess()method (~line 352-358):Example Usage
When using
pickDirectory()with long-term access:Previous Response Format (Incorrect)
{ "bookmark": "Y29udGVudDovL2NvbS5hbmRyb2lkLmV4dGVybmFsc3RvcmFnZS5kb2N1bWVudHMvdHJlZS9wcmltYXJ5JTNBRG93bmxvYWQlMkZRdWljayUyMFNoYXJl", "status": "success", "uri": "content://com.android.externalstorage.documents/tree/primary%3ADownload%2FQuick%20Share" }Fixed Response Format (Correct)
{ "bookmark": "Y29udGVudDovL2NvbS5hbmRyb2lkLmV4dGVybmFsc3RvcmFnZS5kb2N1bWVudHMvdHJlZS9wcmltYXJ5JTNBRG93bmxvYWQlMkZRdWljayUyMFNoYXJl", "bookmarkStatus": "success", "uri": "content://com.android.externalstorage.documents/tree/primary%3ADownload%2FQuick%20Share" }Testing
bookmarkStatusinstead ofstatuswhenrequestLongTermAccessis trueImpact
This change ensures consistent naming conventions, improving maintainability and cross-platform compatibility by aligning the Android implementation with the expected type definitions used across the library.