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

Save button in settings is unresponsive #44

Open
Adito5393 opened this issue Apr 25, 2022 · 9 comments
Open

Save button in settings is unresponsive #44

Adito5393 opened this issue Apr 25, 2022 · 9 comments
Labels
needs info This issue did not provide enough information to reproduce

Comments

@Adito5393
Copy link

I have tried older versions of your app and I could simply config the server info via the Garmin Connect IQ. Now, when I plug in all the info & I try to press save... nothing happens. I try to go back, but the popup shows up that I will discard the changes...

Did you change anything in the UI on the latest releases?

What I tried already:

  1. Instead of copy & paste the info... manually type it via a mouse and keyboard attached to the phone. Strange that the tooltip shows share when I hold the mouse on the Save button:
    photo5996810798590179804

  2. Different API keys from Nextcloud

  3. Both API options: Subsonic and Ampache

  4. Uninstall app & reboot Garmin watch & try it again

Any idea how to debug the issue? Can you reproduce the issue? Just try to change your settings and save them.

Software info

SubMusic Updated: March 30, 2022 && Version: 0.1.24-yankee
My phone info: S10e Android 10 One UI 2.5
Garmin watch: 745
Garmin Connect IQ version: 2.15
Nextcloud version 22.2.6

@memen45
Copy link
Owner

memen45 commented Apr 27, 2022

Cannot reproduce, I can change and save settings without issue. Connect IQ on Android 11, version 2.15. SubMusic v0.1.24-yankee.

  • are you connected with the watch? (Green 'my device' tab)
  • maybe try to remove cache/storage of both Garmin Connect apps?
  • is the device completely synced with your phone?

@memen45 memen45 added the needs info This issue did not provide enough information to reproduce label Apr 27, 2022
@Adito5393
Copy link
Author

Adito5393 commented Apr 30, 2022

  • are you connected with the watch? (Green 'my device' tab)

Yes

  • maybe try to remove cache/storage of both Garmin Connect apps?

Good idea. It does not work. I cleared cached, allowed the app all permissions (incl. storage), force stop & start..

  • is the device completely synced with your phone?

Yes, from both apps: Garmin connect and the IQ app.

Can I modify these settings via a file located on the phone or the watch? Can you tell me the path to hack my way into it 😄

Thanks for maintaining the app!

@Adito5393
Copy link
Author

Adito5393 commented May 1, 2022

Without thinking much, I had a look at the reviews on the google app play store of the connect IQ app. Look what I found:
connect-iq-feedback

It means that the issue is upstream and it would be nice if you can label this issue as known issue or something and I can keep track of it and let you know once it's fixed.

Since we both have version 2.15, I think the difference lies in the Android version which I have 10. Version 11 brings some changes to the storage permissions. Check this Garmin thread also.

@Adito5393
Copy link
Author

@memen45 Meanwhile, if it's not too much work it would be great if we can put the server settings within a file on the watch storage and the app would check if the file exists and load those settings.

I could work on a PR if you are willing to guide me and accept my work. Depending on how fast I can set up the environment to program and test the code 😄 , since I have limited time available.

@memen45
Copy link
Owner

memen45 commented May 1, 2022

Connect IQ watch apps do not have access to the USB mass storage directly. Each app has its own encrypted storage that can only ever be used by that app. There is an exception for sideloaded apps. When an app is sideloaded, there will be a settings file in the watch storage that can be modified. Note that this file is binary, so it is a bit tricky to edit the strings, but it is possible.

Theoretically, I see three possibilities for updating the settings:

  • through Connect IQ app settings
  • on the watch UI
  • in the watch app retrieving the settings from some external server

The problem with the second option is, it is quite difficult and unintuitive to input text on a watch.
The problem with the latter option is security. It would require central (temporal) storage on e.g. a SubMusic server (which does not exist) and some secure way for the watch to retrieve the settings from the server. I can imagine a secure implementation of such a server:

  • user goes to SubMusic webapp,
  • fills in the desired settings
  • fills in a random number generated by the watch app
  • send to server to store for e.g. 10 minutes,
  • receives the temporary unique identification number (like a TOTP) from the server
  • fills in the unique number on the watch
  • the watch requests the settings json file from the server using the unique number + the generated random number

There should be some protection against spam inputs. If the unique/random numbers are sufficiently large, I think the limited time between receiving the TOTP and the watch request would be sufficiently small for a brute force to be infeasible (would require more requests per second than a ddos).

In total though, this would be quite a project to build I think, but let me know your thoughts or ideas.

@memen45
Copy link
Owner

memen45 commented May 1, 2022

Check this Garmin thread also.

Found this thread too, did you try to install the older versions of Connect and Connect IQ apps?

@Adito5393
Copy link
Author

Adito5393 commented May 1, 2022

I like the external SubMusic server idea because I know java programming and my work is around writing and maintaining java backend API servers (full DevOps: developing and deploying, hosting). However, I have little knowledge about frontend frameworks. Do we even need a client-based frontend?

We could use a framework to generate our source code for the frontend and backend based on our architecture. I read the docs of JHipster some months ago and I look forward to trying it out in a real-world application.

Regarding the implementation:

  • user goes to SubMusic webapp,

The webapp should allow users to register with an email & support login via 3rd party apps, e.g.: Github
There are open-source projects that only handle that. E.g. keycloak

  • fills in the desired settings
  • fills in a random number generated by the watch app
  • send to server to store for e.g. 10 minutes,
  • receives the temporary unique identification number (like a TOTP) from the server
  • fills in the unique number on the watch

Indeed, each user should add a device -> pairing device to the account flow

  • the watch requests the settings json file from the server using the unique number + the generated random number

This would be the sync/update flow of the settings from the server webapp to the watch app.

This indeed is a whole project that could be up and running super fast if we use a framework to autogenerate all the source code. As long as we make sure that the server extra feature will never break the basic watch app functionally, this would be an awesome optional UI.

Found this thread too, did you try to install the older versions of Connect and Connect IQ apps?

I am using Connect app for other devices, e.g. bike computer, and I will not even try that to avoid future problems. My bike computer recently got a firmware update 😕

What do you think about JHipster? Have you ever heard of it?

I worked with Quarkus and I would love to try their blueprint (docs), instead of using Spring.

@memen45
Copy link
Owner

memen45 commented May 2, 2022

Thanks for your comments! I really like the idea for adding account logins and storing the data on the server. I do not know JHipster and could not quickly determine the benefit it provides (visualisation + generation of database schemas?). Keycloak seems to be a very useful solution, but again, never used it, and for minimum viable product maybe not yet necessary.

In order to keep it simple (and deliver a minimum viable product) I think the server can be simplified to a

  • POST request - send json body with settings. Server responds with a unique time based id.
  • GET request - request json body by id. Example: domain.com/api/settings&id=0123456789
  • GET request - returns the html form page that can do the POST request and shows the id to fill in on the watch

The server can simply remove the data after x minutes, or after the watch requested it.

For the account login solution:
I now remember that the watch can also use OAuth to connect to a server. I have not managed to get that working yet (I was planning on doing OAuth on the music server). This OAuth feature could also be used to login on a SubMusic server through your phone. That would eliminate the exposure of the device id.
The server should thus provide

  • OAuth endpoint
  • keycloak login options
  • same requests as above, but now secured behind account login
  • no auto-remove, as data endpoints are now secured

I also thought of yet another solution: the android Garmin SDK can be used in a simple android app. The user can fill in the settings, then send it over Bluetooth to the watch. This requires the watch to be connected to the phone.

Currently, I would be inclined to the MVP solution. The server could be very lightweight (either generated, or C++, or e.g. expressjs). The webapp could be something simple in Vue + Bootstrap, quite easy to do for MVP at least.
Considering time, contributor friendliness and required hosting resources, what would be your preferred solution + technology choices?

@Adito5393
Copy link
Author

Indeed, JHipster would provide source code for the backend + the frontend based on our design diagram. In theory, it's great, but there are many things that can go wrong & we would be stuck with that generated architecture. -> I'm okey with skipping it :)

API design: (maybe we can draft it with endpoints & specs)
I don't fully understand the user flow in connection to the 3 HTTP methods. Is there a type of diagram or user case flow that could help me better visualize the API?

Do you think it will be too much work if we try to draft the API in some tool? e.g. postman? Or if you are familiar with something else, I currently don't have a preference.

GET request - returns the html form page that can do the POST request and shows the id to fill in on the watch

Does this mean the user needs to fill in an id on the watch? Even though there is no keyboard input? Maybe just an confirmation would be enough from the watch side?

I have more experience with MVC (from java background), however, I can learn MVP if you think it will be faster to implement.

I could deliver the backend written in Java & hosted on heroku as a docker container. We don't need persistant storage because it can obtain the current settings from the watch storage.

Do you already own a domain for this project? Or should we look into a free option? (e.g. duck DNS?)

I would love to spend more time on the API design and in the end, offer it via the OpenAPI specs (auto-generated) HTML (check the swagger pet store example).

Upcoming 2 weeks I will be on holiday. Afterwards, I would have limited time available during weekends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info This issue did not provide enough information to reproduce
Projects
None yet
Development

No branches or pull requests

2 participants