Skip to content
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

Implement opening GWC files from local storage and other apps #40

Closed
wants to merge 1 commit into from

Conversation

jakedot
Copy link
Contributor

@jakedot jakedot commented Feb 19, 2020

I unfortunately don't know if this is enough to work instantly but this is what I guess needs to be changed.

Attempt to fix #39

@cgeo-bot
Copy link

Can one of the admins verify this patch?

@jakedot
Copy link
Contributor Author

jakedot commented Feb 19, 2020

Can I set up my build somehow so that I get a APK from github directly, or do I need to setup an AndroidStudio?

https://github.com/jakedot/WhereYouGo/runs/456358708

@bekuno
Copy link
Member

bekuno commented Feb 20, 2020

@jakedot
You can use the build apk from the CI job for WhereYouGo PRs at
https://ci.cgeo.org/view/All%20jobs/job/whereyougo%20(PR)/

but first after you are allowd to submit

@bekuno
Copy link
Member

bekuno commented Feb 20, 2020

Can one of the admins verify this patch?

@Lineflyer can you do it ? (I don't know how)
(also for the PR of @kurly1)

@Lineflyer
Copy link
Member

OK to test

@bekuno This trigger sentence should do the trick

@cgeo-bot
Copy link

Build finished.

@jakedot
Copy link
Contributor Author

jakedot commented Feb 20, 2020

I can't install the built apks. Hope it's not my changes responsible 😳

Do I need to do something else first perhaps?

@kumy
Copy link
Member

kumy commented Feb 20, 2020

@jakedot which kind of error did you get? I suspect it's a problem of apk signature which is different from the one coming from GPlay. Did you tried to uninstall your current version before installing the one from PR builds?

@jakedot
Copy link
Contributor Author

jakedot commented Feb 20, 2020

That did the trick, thanks.

@jakedot
Copy link
Contributor Author

jakedot commented Feb 20, 2020

Unfortunately, my changes did not properly implement the desired functionality. Will see if I can look into it later this week.

@kumy
Copy link
Member

kumy commented Feb 20, 2020

@jakedot
Copy link
Contributor Author

jakedot commented Feb 22, 2020

retest this please

was the trigger for a rebuild right?

@cgeo-bot
Copy link

Build finished.

@jakedot
Copy link
Contributor Author

jakedot commented Feb 22, 2020

hm, doesn't change anything as far as i can see. But opening the cartridges from the wherigo.com website must do something different, we're storing the credentials and so opening the link must have some code setting up authentication? I guess it will not work with file links immediately.

@SimonHeimberg
Copy link

SimonHeimberg commented Feb 23, 2020

according to my comment in biylda/WhereYouGo#36 (comment)
we have to adapt onCreate() in [src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java].(https://github.com/cgeo/WhereYouGo/blob/7c48432/src/main/java/menion/android/whereyougo/gui/activity/MainActivity.java#L348)
My guess is it needs a new case (also matching Intent.ACTION_VIEW.equals(getIntent().getAction())) with similar code as in else (but not with cguid and findfile()).

@jakedot
Copy link
Contributor Author

jakedot commented Feb 23, 2020

Seems to me that GWZ isn't supported so far at all, but it should be possible to support it as well, e.g. webwigo.net can open both GWC and GWZ - and GWZ is about the same as GWC after the decompilation stage I'd guess...

@kumy
Copy link
Member

kumy commented Feb 24, 2020

retest this please

@jakedot
Copy link
Contributor Author

jakedot commented Feb 26, 2020

In the near future I won't have time to look into the code mentioned by @SimonHeimberg - so I'm closing this PR in the meantime. Thanks for your help so far!

@bekuno
Copy link
Member

bekuno commented Mar 10, 2020

I set the label "WIP" because you only reopend your work.
You can also name the PR with WIP to show that this is not ready to merge.
Fell free to remove the label when it is ready.

@jakedot jakedot force-pushed the patch-1 branch 3 times, most recently from d99664d to c11fb54 Compare March 12, 2020 01:30
@jakedot jakedot changed the title Update AndroidManifest.xml for opening GWC and GWZ files from local storage Update AndroidManifest.xml for opening GWC files from local storage Mar 12, 2020
@jakedot
Copy link
Contributor Author

jakedot commented Mar 12, 2020

This is just a preview of how it could look like. Actually storing cartridges is not yet finished.

@bekuno I would appreciate an early review if you have time for it.

@jakedot
Copy link
Contributor Author

jakedot commented Mar 14, 2020

@bekuno

* Wherigo website with FF, open app (Android icon on top): ok

This would be the old behaviour, though? It should start the "Downloading" activity, as it is based on the unchanged http URI.

* Wherigo website with FF, download cartridge, click download finished: no WYG start available

That is strange. You mean, that WhereYouGo is just not selectable for opening the download with? Maybe Firefox sets some strange mimetype / filename combination, I'll have a look locally.

* Wherigo website with FF, download cartridge, open from FF download, click WYG: no WYG start

Probably the same as above...

* use OI Dateimanager, go to download folder, open cartridge, click WYG: ok

The standard file manager in the emulator did work as well. The standard file manager from Samsung too. I will test with TotalCommander as well.

* use X-plore, go to download folder, open cartridge, use as _/_, click WYG: no WYG start

I will try to find out why this is the case. Maybe I need to add a mimetype intent-filter too. Unfortunately the GWC files don't have a registered mimetype we could filter on reliably - it's none at all, */* or application/octet-stream, depending on the caller.

@jakedot
Copy link
Contributor Author

jakedot commented Mar 16, 2020

rebased on current master with #83.

@jakedot
Copy link
Contributor Author

jakedot commented Mar 16, 2020

Will start to look for described problems and continue development now.

OpenLocalActivity: implement saving the cartridge from a local source (like a content: or file: URI) into the app files directory.
Copy link
Collaborator

Codacy Here is an overview of what got changed by this pull request:

Issues
======
- Added 9
           

Complexity increasing per file
==============================
- src/main/java/menion/android/whereyougo/network/activity/OpenLocalActivity.java  5
         

See the complete overview on Codacy

public class Progress {
final DownloadCartridgeTask.State state;
long total;
long completed;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public class Progress {
final DownloadCartridgeTask.State state;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> {
final ProgressDialog progressDialog;
final String name;
final Long size;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


public class Progress {
final DownloadCartridgeTask.State state;
long total;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final DownloadCartridgeTask.State state;
long total;
long completed;
String message;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tvName.setText(R.string.import_cartridge);

TextView tvDescription = (TextView) findViewById(R.id.layoutDetailsTextViewDescription);
TextView tvState = (TextView) findViewById(R.id.layoutDetailsTextViewState);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> {
final ProgressDialog progressDialog;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> {
final ProgressDialog progressDialog;
final String name;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return true;
}
});
Button buttonDownload = (Button) findViewById(R.id.button_positive);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakedot
Copy link
Contributor Author

jakedot commented Apr 28, 2020

As @moving-bits found in cgeo#7663, distinguishing files by name/extension properly isn't possible with the Android Intent-Filter system. So, this PR will probably be useful in a revisited form. I'll close it until I have time to look into it properly.

@jakedot jakedot closed this Apr 28, 2020
@moving-bits
Copy link
Member

Maybe a simple addition to cgeo/cgeo#8180 can resolve that problem: We already have a check for file content there, and this can be extended by a check for map files and routing the user to WhereYouGo. But let's tests the c:geo side first (which is scheduled for after the next release).

@moving-bits
Copy link
Member

@jakedot
I got pointed to this old issue by @hughcoleman via cgeo/cgeo#7663 (comment)

Seeing this issue being closed without a merge, I'm not sure about the current state of WhereYouGo being able to read gwc files or not - can you enlighten me?

If it is not yet able to work with gwc files - do you plan to implement it?
Or if it is able to work with it - can you provide me with one or two test files, so that I can try to adapt the binary contents check in c:geo to forward gwc files to WhereYouGo. How does the intent have to look like for forwarding gwc files to WhereYouGo?

Thanks.

@jakedot
Copy link
Contributor Author

jakedot commented May 7, 2021

As far as i know, the current WherYouGo code does not have the capability to read from gwc files. My OpenLocalActivity in this PR did implement it, but I don't know how/if it can work with newer Android versions, I guess it would be better to start fresh.

I don't know how to implement a Intent for sending a file from another app, I guess we would need to declare and use a new mimetype like application/gwc?

@jakedot jakedot restored the patch-1 branch May 7, 2021 11:10
@jakedot
Copy link
Contributor Author

jakedot commented Feb 20, 2024

has anything changed regarding this functionality in WhereYouGo?

@moving-bits
Copy link
Member

I don't think so - there's nearly no dev activity around WhereYouGo lately, the two most pressing blocker being missing "storage access framework" support (to open file stored locally) and support for newer Mapsforge versions (or even VTM). Both is not happening to WhereYouGo anymore, very likely.
BUT: We do have a first draft of a Wherigo/WhereYouGo integration in c:geo (which gives SAF and Mapsforge/VTM support "for free" and has a very active dev team), so the solution for GWC might be to wait just a tiny bit, and then implement the solution you had in mind directly in c:geo...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do not merge / WIP Not for merging and/or work still in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow opening cartridges from system file browser / apps like WhatsApp
8 participants