Open Discostu36 opened 2 years ago
Well the problem is that such a mechanism would require using the internal photo viewer (there needs to be some way to select and display the photo you want to delete).
Is it possible to give the external viewer permission to delete?
Is it possible to give the external viewer permission to delete?
I don't think so (IMHO the only thing you can grant is persistent read access), but I'll check.
This happens when I try to edit an image shared by Vespucci. I guess to make deletion possible you'd need to pass the image from its file system path (e.g. Downloads/Vespucci) to the image viewer as it might not be possible for it to delete a file only knowing this (private?) file path.
(Keep in mind that I have virtually no experience in Android programming yet, so this is only guesswork 😀)
Conventional *ix file operations don't work on Android outside of directories and files the app has created itself. File access happens via Uri that are specific to ContentProviders. In any case I'll check if granting FLAG_GRANT_WRITE_URI_PERMISSION will allow a file to be deleted.
Note: even if this works we need a mechanism for Vespucci to be notified that the image has been removed.
A further note after some closer inspection in your example I don't see how that could work as the image in question is indexed via the mediastore and isn't owned by the app to start with.
Two thoughts about that: 1) Yes, the example was not well-chosen. This should primarily work for photos that were taken with Vespucci 2) Can you explain to me why Vespucci needs to “own” the file for this to work? My file manager app also doesn't own the photos. But if I open a photo from it, it is opened in Gallery with all editing rights.
Since Android 11 there is a special permission for file managers and similar https://developer.android.com/about/versions/11/privacy/storage#all-files-access We could in theory naturally ask for this too, but would have to live with even more issues with google if they would even allow us to have it to start with.
At the moment, it is not possible to delete photos inside of the app when using external photo viewer. I need to switch to internal photo viewer for that. I think this should be changed, if possible.