amake / orgro

An Org Mode app for iOS and Android
https://orgro.org
GNU General Public License v3.0
478 stars 22 forks source link

Cannot open files in Google Drive #50

Open PavelNikov opened 2 years ago

PavelNikov commented 2 years ago

(iPadOS 15.0.2, Orgro v1.21.1)

Expected behavior: When clicking on „Open File“ the files app opens and I can click on the .org file I want to open. The file then opens in orgro.

Current behavior: Upon clicking on the button „Open File“ the files app opens as expected but all .org files are grayed and don‘t react to clicks.

amake commented 2 years ago

All I can say without more information is that it works for me (iOS 15.0.2, Orgro 1.21.1).

One thing that comes to mind is: where are your files stored? In other words, are they stored locally on your device, or are you accessing them through a third-party app?

It would probably help to see a screenshot of the file picker view (the one that appears when you click the Open File button).

PavelNikov commented 2 years ago

The files are stored on google drive. I'm trying to access them through the iOS files app into which I have integrated my google drive. The files are not accessible when offline. I might have to add that I'm trying this on an iPad, so technically I'm not on iOS but on iPadOS. Will change the title of the issue.

The screenshot below shows the screen I'm greeted with when clicking "Open File". As you can see, the file "HS21.org" is grayed out.

Btw: I can open files using the google drive app by choosing the "Open with" option when clicking on a file, which is absolutely a viable work around. So if I'm the only one with this issue chances are it's me who's messing up. So feel free to ignore the issue and I will post an update once I was able to resolve it. Thank you for work and have a great day!

20211020-084351

amake commented 2 years ago

Thanks for clarifying that you're using Google Drive.

The files are not accessible when offline

If the data isn't cached locally, for instance by having opened the file at least once before, then you will need to be online in order to open the file.

I might have to add that I'm trying this on an iPad, so technically I'm not on iOS but on iPadOS

I have yet to see an issue that only affected iOS or iPadOS but not both :)

As you can see, the file "HS21.org" is grayed out.

Actually I can reproduce with some of the files in my own Google Drive.

Unfortunately it seems like Google Drive's file access API integration is just very buggy. Only some of my .org files are grayed out, but there doesn't seem to be any rhyme or reason to which are and which aren't. If I duplicate a grayed out file foo.org on my Mac, the copy foo copy.org will be openable in Files on my iPhone. But if I delete foo.org and rename foo copy.org to foo.org then the result is still grayed out on my iPhone.

You can try moving your entire org file tree to a subfolder and see if the items become selectable. That worked for one of my files. However even when the item is selectable, opening it does not work because there is no local copy. Someone (not sure if it's the Files app or Google Drive) is supposed to fetch a local copy before opening the file in the target application, but it doesn't happen for Google Drive files. It does happen for iCloud Drive files. In this case a workaround is to press and hold on the file in the Files app and choose Get Info. This forces the file to be loaded locally. After this you can successfully open the file from the Files app or from the picker in Orgro.

I am not sure what to do about any of this. In #18 I noted several reports of people complaining of bugs in the iOS Google Drive app; those reports have no responses and are long since locked. So I'm not sure there is a good solution or ever will be a good solution, other than using a file provider that isn't so buggy :(

PavelNikov commented 2 years ago

Got it, thank you very much for taking the time to look into this! For me it's no hassle to take the route involving the google drive app and then using the "Open With" option so I will stick with that.