WhereYouGo icon indicating copy to clipboard operation
WhereYouGo copied to clipboard

WhereYouGo should use SAF

Open Lineflyer opened this issue 3 years ago • 14 comments

WhereYouGo should utilize the storage access framework (ScopedStorage) as it has some data exchange needs:

  • Selecting offline map file to use (or folder to be used). Also refer to #250
  • Selecting a cartridge to play (or folder to be used).

Lineflyer avatar Dec 06 '21 19:12 Lineflyer

currently Work In Progress, there is a lot to refactor to use SAF

sk-juroot avatar Jan 05 '22 12:01 sk-juroot

@sk-juroot Thanks for stepping into this sleeping project and getting it alive again. Highly appreciated.

If you need information or help for SAF and associated topics, you can also try to glimpse into the cgeo repository, where we have it implemented already. @eddiemuc has most experiences there.

In fact what I think is needed for WhereYouGo is:

  • Let the user select a folder of his choice, where cartridges (and savegames) are to be stored
  • Let the user select a folder for his offline maps

Besides that I guess WhereYouGo does not have any file interactions which need scoped storage.

Lineflyer avatar Jan 05 '22 12:01 Lineflyer

Thank you for referencing knowledgeable contact from c:geo team, I will get in touch when needed.

These two targets for SAF are on my list to resolve, also I have found some calls for manipulating files from OpenWIG. So I expect fun time when getting this to work 😄

sk-juroot avatar Jan 05 '22 13:01 sk-juroot

I would suggest a very minimized approach:

  • For cartridges it should be enough to only store them in the default app accessible folders and let user "import" them to there via SAF.
  • For offline maps though the user should be able to grant the app access to a folder of users choice (to allow reusing maps of other apps, such as c:geo).

Lineflyer avatar Jan 22 '22 19:01 Lineflyer

Unfortunately with Android 14 (problem most probably started with Android 13) it eventually got completely impossible to make WYG work at all, as a) cartridges can not be downloaded from within the app (gives download error, although everything is configured correctly and even login and cookie consent has been done on the website), and b) even cartridges stored on the device can not be opened (although WYG can enter the folder, it does not recognize them).

If there is any (perhaps overlooked so far) way, to make WIG work on an Android 14 device (checked the other day with a friend's Samsung S23), I would really appreciate helpful hints.

Guess the problem is SAF, thus would really be great, if this problem can be solved (before ALC completes kills the much nicer WIGs).

MagpieFourtyTwo avatar Jan 07 '24 13:01 MagpieFourtyTwo

WhereYouGo is no longer the only available Wherigo Player for Android. Unfortunately this might make it obsolete over time if it remains unmaintained

eddiemuc avatar Jan 09 '24 06:01 eddiemuc

For real? Which one would you recommend? At a first glance, I did not find something really usable in the Playstore ...

MagpieFourtyTwo avatar Jan 09 '24 08:01 MagpieFourtyTwo

You are still able to run WIG using WhereYouGo on an Android 14 system, have just cross-checked on my own mobile.

But WIG must be downloaded using WhereYouGo (by either starting it from within c:geo or by tapping on a cartridge link) - for this to work, WhereYouGo must be configured to accept WIG-links, see WhereYouGo FAQ: https://www.whereyougo.org/faq#android12_links

(Opening a cartridge from local file system will only work for the app-internal folder, due to missing SAF-support, files in public folders are no longer reachable.)

That leaves the map problem, though - offline maps cannot be accessed either, also due to missing SAF. You need to select an online map provider.

moving-bits avatar Jan 09 '24 11:01 moving-bits

You are still able to run WIG using WhereYouGo on an Android 14 system, have just cross-checked on my own mobile.

As mentioned before we were not able to enable WIG to download a cartridge from within the app. Even enabled and disabled the WYG links several times, but always just received a download error, whatever we did. Even re-installed WYG, to get a clean data basis (esp. WRT the data folder), but to no avail. Maybe we overlooked s/th, but I doubt it, as "we" was not just me and the guy to be supported, but plus a third one, who one may call a real Android nerd. ;)

MagpieFourtyTwo avatar Jan 09 '24 12:01 MagpieFourtyTwo

This is strange, as it does work here on a S22 running Android 14. IIRC we had such a thing a while ago, but back then it was some website change (which made us release a small hotfix for WhereYouGo). Do you get any error message (more specific than "download failed")? I can try to debug into it, but won't be able to do so before the weekend.

moving-bits avatar Jan 09 '24 22:01 moving-bits

Do you get any error message (more specific than "download failed")?

Most regretfully not. This was the only message we got.

Even worse: I can't test at will, as I don't have access to this nor any other A14 device. But I'm pretty sure I can do some more tests at the next event, when she's there, too (she won't mind for sure, cause she wants to do WIGs again) but it would be good to know what I can do more (or differently) then. Or if there any debug possibilities/settings in WYG (like with c:geo).

As for the "invisible" cartridges: It is correct that WYG will not see cartridges, if the storage folder has been set to e. g. Downloads, but should see them, if they were stored to the default folder? Even if they were not downloaded inline by WYG? Cause as the in-app-download did not work, we tried to download a cartridge from the website and place it in the default folder - but even then WYG did not see it. Or does the inline download s/th different?

MagpieFourtyTwo avatar Jan 10 '24 21:01 MagpieFourtyTwo

I can reproduce this behavior in the emulator meanwhile. Login in DownloadCartridgeTask.java returns a 302 http code / redirect to the error page, but without giving any hint WHY the login fails. Form names have not changed, AFAICS, and adding the "RequestVerificationToken" to the login request does not seem to suffice (I've added both the cookie and the form field, as they have different values).

Any ideas from the HTML / http wizards?

moving-bits avatar Jan 12 '24 21:01 moving-bits

@bekuno Can you update Gradle for the WhereYouGo project to make it compatible to more recent AS versions? (as time permits) I needed to downgrade to Giraffe and to change JDK to be able to compile WhereYouGo again.

Thanks.

moving-bits avatar Jan 12 '24 22:01 moving-bits

For documentation purposes with regard to the original issues here (missing SAF support), see https://github.com/cgeo/WhereYouGo/issues/73#issuecomment-1890623818

moving-bits avatar Jan 13 '24 17:01 moving-bits