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

Waypoints import (.OTRW) reports "import failed" #1284

Closed
jpmens opened this issue Sep 4, 2022 · 7 comments
Closed

Waypoints import (.OTRW) reports "import failed" #1284

jpmens opened this issue Sep 4, 2022 · 7 comments
Labels

Comments

@jpmens
Copy link
Member

jpmens commented Sep 4, 2022

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

As reported in #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 jpmens added the bug label Sep 4, 2022
@growse
Copy link
Collaborator

growse commented Sep 4, 2022

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:

private void setConfiguration(String json) throws IOException, Parser.EncryptionException {
MessageBase message = parser.fromJson(json.getBytes());
if (message instanceof MessageConfiguration) {
this.configuration = (MessageConfiguration) parser.fromJson(json.getBytes());
String prettyConfiguration;
try {
prettyConfiguration = parser.toUnencryptedJsonPretty(this.configuration);
} catch (IOException e) {
Timber.e(e);
prettyConfiguration = "Unable to parse configuration";
}
displayedConfiguration = prettyConfiguration;
importStatus = ImportStatus.SUCCESS;
notifyChange();
} else {
throw new IOException("Message is not a valid configuration message");
}
}

@jpmens
Copy link
Member Author

jpmens commented Sep 4, 2022

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 jpmens removed the bug label Sep 4, 2022
@growse
Copy link
Collaborator

growse commented Sep 4, 2022

This one: image

@jpmens
Copy link
Member Author

jpmens commented Sep 4, 2022

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 #14 actually led to an implementation in #596 (at least it says 'fixed'), but I don't see code for it ...

@growse
Copy link
Collaborator

growse commented Sep 7, 2022

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 growse added the bug label Sep 7, 2022
@ckrey
Copy link
Member

ckrey commented Sep 7, 2022

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

@growse
Copy link
Collaborator

growse commented Jan 30, 2023

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

Yes, this works.

@growse growse closed this as completed in 398d688 Feb 8, 2023
@growse growse closed this as completed Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants