-
Notifications
You must be signed in to change notification settings - Fork 20
[Feat] custom save location #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mardous
wants to merge
18
commits into
master
Choose a base branch
from
feat-custom-save-location
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
# Conflicts: # app/src/main/java/com/simplified/wsstatussaver/model/WaDirectory.kt # app/src/main/java/com/simplified/wsstatussaver/repository/StatusesRepository.kt
The previous implementation used `uri?.let { ... }` which is not necessary. This change removes the unnecessary let and directly handles the null check for the `uri`.
This change modifies the `setCustomDirectory` function to accept a nullable Uri. Passing `null` to this function will remove the stored custom directory preference for the specified status type.
The change refactors the `getCustomDirectory` function to check if the application has full access (read and write permissions) for the persisted URI when retrieving a custom directory. This ensures that the application can both read from and write to the specified custom directory. A helper extension function `hasFullAccess` is introduced for this check.
This change refactors the `toUriLocation` function in `WaSavedContentStorage` to accept a `WaDirectoryUri` object instead of just a `Uri`. This change provides more context about the directory when creating a new document using `createDocument`, making the file saving logic more robust.
The `toMediaStore`, `toFileLocation`, and `toCustomDirectory` methods in `WaSavedContentStorage` have been made private as they are only intended for internal use within the class.
This change refactors the content saving logic in `WaSavedContentStorage` to use `DocumentFile` and `FileOutputStream` for better handling within scoped storage. This replaces the previous approach using `DocumentsContract.createDocument` and `openOutputStream`, which was less robust for writing content. Additionally, the method for getting the custom directory name now also utilizes `DocumentFile`.
# Conflicts: # app/src/main/java/com/simplified/wsstatussaver/extensions/PermissionExt.kt
# Conflicts: # app/build.gradle.kts # gradle/libs.versions.toml
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.
No description provided.