android icon indicating copy to clipboard operation
android copied to clipboard

Waypoints import (.OTRW) reports "import failed"

Open jpmens opened this issue 3 years ago • 6 comments

  • App build number: 2.4.10 (20410033)
  • Android version: 9
  • Device: Samsung S8
  • Installation source: Google Play

As reported in https://github.com/owntracks/android/issues/1282, the import of an .otrw file containing waypoints fails with the diagnostic Import failed: message is not a valid configuration message

This is the JSON:

{
	"_type": "waypoints",
	"waypoints": [
		{
			"_type": "waypoint",
			"desc": "Chez Jane à Paris",
			"lat": 48.856826,
			"lon": 2.292713,
			"rad": 450,
			"tst": 1598451372
		},
		{
			"_type": "waypoint",
			"desc": "Lestari Indonesisch restaurant",
			"lat": 51.978743,
			"lon": 5.905338,
			"rad": 100,
			"tst": 1598453157
		}
	]
}

As far as I can tell, this worked in August 2020 which was when I last tested this import.

jpmens avatar Sep 04 '22 08:09 jpmens

Hm. I don't remember being able to import a waypoint list JSON file via the configuration import ever worked. Is that a thing that should work? Would having the option of importing via the "Regions" activity not be more intuitive?

That error is coming from this bit of code, which is definitely only considering _type=configuration to be a valid configuration to import:

https://github.com/owntracks/android/blob/d373b8ebd5a6f235859485c57e50803f935c6b4c/project/app/src/main/java/org/owntracks/android/ui/preferences/load/LoadViewModel.java#L62-L79

growse avatar Sep 04 '22 11:09 growse

I would have sworn it worked but have been wrong before, and if the code isn't there, then I'm definitely wrong!

importing via the "Regions" activity

Will you educate me? What is that?

jpmens avatar Sep 04 '22 11:09 jpmens

This one: image

growse avatar Sep 04 '22 12:09 growse

Ah, you speak of a possible future; being able to import regions there.

Our iOS app permits import of waypoints as specified above via import (association with the app) of *.otrw (the w is for waypoints) files. I think we decided that several years ago, and the intention was to have this equivalent in both Android and iOS. It seems https://github.com/owntracks/android/issues/14 actually led to an implementation in https://github.com/owntracks/android/issues/596 (at least it says 'fixed'), but I don't see code for it ...

jpmens avatar Sep 04 '22 15:09 jpmens

All futures are possible! 😄

Ok, so if this doesn't work today, is it better to spend time making it work on the configuration import screen, or is it better to actually implement it in the regions screen (which is arguably where it belongs)?

growse avatar Sep 07 '22 09:09 growse

In iOS, the import is not a function of the app, but the filetype .otrw is opened with the app automatically. From this point of view, I don't have a preference for the screen.

Does the import of waypoints via cmd work in Android as in #596? https://owntracks.org/booklet/tech/json/#_typecmd

ckrey avatar Sep 07 '22 09:09 ckrey

Does the import of waypoints via cmd work in Android as in https://github.com/owntracks/android/issues/596? https://owntracks.org/booklet/tech/json/#_typecmd

Yes, this works.

growse avatar Jan 30 '23 16:01 growse