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
Use storage access framework to write files #2844
Comments
So, is your idea basically to do an |
Yes. However, that's only available on API 19+. So there needs to be some fallback code for older versions. Preferably, we'd display a UI to select a folder and filename similar to what the system UI looks like on newer Android versions. |
That sounds reasonable. May I give it a try? |
I'd wait until we switch to using AppCompat for Material Design. Otherwise half of the fallback UI might have to be rewritten. |
The approach was to make it so that any K9Activity can easily request whatever permission in the future. The Contacts permission is now requested in two locations: 1. When a list of Messages is displayed 2. When a new message is first started to be composed. The permission request is displayed ONCE per onCreate(). Any more than this and it got really annoying. A typical user who reads or writes emails WILL see the request, trust me. Once they see the message 2x, they also have the option to block the requests from appearing. If they DECLINE the request (or decline + DENY any further attempts), the app should continues to work, albeit without incorporating contact data (thumbnails, autocomplete, etc.). Contacts may still be added to the Contacts app, as this uses an Intent and does not require any permission. Once the Read Contacts permission is enabled, the app immediately begins to use it. To add other permissions in the future (such as External Storage access), the request can be made in a similar way and the permission request result handled appropriately by just adding it to K9Activity (or overriding in a particular Activity). I did *not* implement this for external storage access, as 1. there is a PR waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework is a much better way to approach that as suggested in Issue thunderbird#2844. I noticed there are 3 additional custom permissions in the manifest having to do with other apps controlling K9, but I don't think they're required by k9 itself. If so, they can be requested from any K9Activity.
I think you'd probably want to use Intent.ACTION_OPEN_DOCUMENT_TREE, supported starting in Lollipop, to select the target directory, yeah? |
The approach was to make it so that any K9Activity can easily request whatever permission in the future. The Contacts permission is now requested in two locations: 1. When a list of Messages is displayed 2. When a new message is first started to be composed. The permission request is displayed ONCE per onCreate(). Any more than this and it got really annoying. A typical user who reads or writes emails WILL see the request, trust me. Once they see the message 2x, they also have the option to block the requests from appearing. If they DECLINE the request (or decline + DENY any further attempts), the app should continues to work, albeit without incorporating contact data (thumbnails, autocomplete, etc.). Contacts may still be added to the Contacts app, as this uses an Intent and does not require any permission. Once the Read Contacts permission is enabled, the app immediately begins to use it. To add other permissions in the future (such as External Storage access), the request can be made in a similar way and the permission request result handled appropriately by just adding it to K9Activity (or overriding in a particular Activity). I did *not* implement this for external storage access, as 1. there is a PR waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework is a much better way to approach that as suggested in Issue thunderbird#2844. I noticed there are 3 additional custom permissions in the manifest having to do with other apps controlling K9, but I don't think they're required by k9 itself. If so, they can be requested from any K9Activity.
The approach was to make it so that any K9Activity can easily request whatever permission in the future. The Contacts permission is now requested in two locations: 1. When a list of Messages is displayed 2. When a new message is first started to be composed. The permission request is displayed ONCE per onCreate(). Any more than this and it got really annoying. A typical user who reads or writes emails WILL see the request, trust me. Once they see the message 2x, they also have the option to block the requests from appearing. If they DECLINE the request (or decline + DENY any further attempts), the app should continues to work, albeit without incorporating contact data (thumbnails, autocomplete, etc.). Contacts may still be added to the Contacts app, as this uses an Intent and does not require any permission. Once the Read Contacts permission is enabled, the app immediately begins to use it. To add other permissions in the future (such as External Storage access), the request can be made in a similar way and the permission request result handled appropriately by just adding it to K9Activity (or overriding in a particular Activity). I did *not* implement this for external storage access, as 1. there is a PR waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework is a much better way to approach that as suggested in Issue thunderbird#2844. I noticed there are 3 additional custom permissions in the manifest having to do with other apps controlling K9, but I don't think they're required by k9 itself. If so, they can be requested from any K9Activity.
The approach was to make it so that any K9Activity can easily request whatever permission in the future. The Contacts permission is now requested in two locations: 1. When a list of Messages is displayed 2. When a new message is first started to be composed. The permission request is displayed ONCE per onCreate(). Any more than this and it got really annoying. A typical user who reads or writes emails WILL see the request, trust me. Once they see the message 2x, they also have the option to block the requests from appearing. If they DECLINE the request (or decline + DENY any further attempts), the app should continues to work, albeit without incorporating contact data (thumbnails, autocomplete, etc.). Contacts may still be added to the Contacts app, as this uses an Intent and does not require any permission. Once the Read Contacts permission is enabled, the app immediately begins to use it. To add other permissions in the future (such as External Storage access), the request can be made in a similar way and the permission request result handled appropriately by just adding it to K9Activity (or overriding in a particular Activity). I did *not* implement this for external storage access, as 1. there is a PR waiting (thunderbird#3118) and 2. I think that using the Storage Access Framework is a much better way to approach that as suggested in Issue thunderbird#2844. I noticed there are 3 additional custom permissions in the manifest having to do with other apps controlling K9, but I don't think they're required by k9 itself. If so, they can be requested from any K9Activity.
This comment has been minimized.
This comment has been minimized.
- Legacy save on old devices - SAF single file save on 4.4 or on long press - SAF tree save on >5.0 Matches beahviour in thunderbird#2844 better
- Legacy save on old devices - SAF single file save on 4.4 or on long press - SAF tree save on >5.0 Matches beahviour in thunderbird#2844 better
Using the storage access framework we will be able to support all kinds of removable storage supported by Android (e.g. secondary external storage like an SD card). Additionally users can save files to supported cloud storage providers without us having to add special support for them ourselves.
This will also allow us to drop the permission to write to external storage (once we drop support for moving the message database to external storage).
Requesting access to a directory and persistable permissions aren't that well supported. But I don't mind getting rid of the default path to save attachments to and prompt the user every time.
The text was updated successfully, but these errors were encountered: