openmobilehub / android-omh-storage

https://www.openmobilehub.org
Apache License 2.0
4 stars 1 forks source link

OMHD-437: Google download issues #37

Closed maciekBudzinski closed 3 months ago

maciekBudzinski commented 3 months ago

Summary

In this PR, I've refactored the download method from the Google plugins. Previously, when the download failed (for any reason), the plugins tried to export the file, which led to some unexpected behaviors. Additionally, the downloadFile method took mimeType as an optional parameter, which was confusing. There was also a bug where Google Workspace files - they were downloaded without an extension.

After refactor, a new method, exportFile, has been introduced. This method is supported by the Google plugins and takes id and exportedMimeType parameters, allowing developers to decide the format to which the file will be exported.

I also had to adjust the sample application. Now, when the user clicks on a Google Workspace file, the app attempts to export it; otherwise, it performs a regular download.

Demo

GMS:

https://github.com/openmobilehub/android-omh-storage/assets/23010554/cdf3ac1d-7ad0-4757-b5f8-6f3bc1c315c2

NonGMS:

https://github.com/openmobilehub/android-omh-storage/assets/23010554/b0e3632c-83be-4e54-9fa1-e44b4528ed7f

Checklist:

Closes: OMHD-437