theengs / app

Theengs mobile application to read BLE sensors and push data to an MQTT broker
https://app.theengs.io
GNU General Public License v3.0
37 stars 7 forks source link

Assigned locations get cleared when closing/reopening the app #58

Closed DigiH closed 1 year ago

DigiH commented 1 year ago

Assigned locations get cleared when closing/reopening the app, or when the app is being updated with a new version.

Verified on macOS and iOS

1technophile commented 1 year ago

Same on Android

emericg commented 1 year ago

I tested on 4 different devices, and I can't say that I understand that problem. Are we talking about the editable location fields with the little pen icon?

Same than the issue with the MAC addresses, it seems to be working fine (but I can imagine how that feature can produce issues). The editable location feature is years old, and I've never heard about any issue with it.

DigiH commented 1 year ago

Are we talking about the editable location fields with the little pen icon?

Yes, for me whenever I set a location there, then completely close the App - not just hide it - and open the App again all the locations are cleared. As the same closing will happen when an update is installed the location will get cleared as well - happened for me with installing a new TestFlight build.

Not sure why you are not seeing this.

How best to verify? Shall I make a video of it?

1technophile commented 1 year ago

Are we talking about the editable location fields with the little pen icon?

Yes, if I add a location, close the app and reopen it later I lose the location

DigiH commented 1 year ago

Very latest macOS build, the same happening for me on iOS

https://user-images.githubusercontent.com/17110652/217343192-18ccda45-7599-4e37-bb1d-56d889440207.mov

emericg commented 1 year ago

You could try opening the actual database (with that kind of software https://sqlitebrowser.org/) and see if the texts have been registered. It should be located in /Users/name/Library/Application Support/Theengs/Theengs/data.db

The names (and incidentally, manual MACs) are saved in the devices table and should look like this: Capture d’écran du 2023-02-07 20-23-28

(Obviously don't open or edit the db file while the app is in use, or it will lock until the one app has set a lock free's it)

You can also try to move that file somewhere else in order to fake a new app install, and see if the problem still occurs.

emericg commented 1 year ago

Also just to be sure, you should really validate inputs with enter key (or associated action on the mobile keyboards) and not with the back action button.

DigiH commented 1 year ago

Also just to be sure, you should really validate inputs with enter key (or associated action on the mobile keyboards) and not with the back action button.

Of course I tried all that before logging the issue, unfortunately not for the video ;) Any app should save active text field entries on leaving a view though, unless there is a specific Save button implemented in the view.

The names (and incidentally, manual MACs) are saved in the database's devices tables.

I also thought it could be related to the MAC issue, as they are also not being saved across restarts

https://github.com/theengs/app/issues/52

but then this is not verifiable until the unsaved/repopulated MACs are being addressed.

Not sure if this should affect the Android version though as Florian experienced.

Strangely enough the locations AND the MAC addresses are saved in the database, but neither of them do get populated when opening the App again - read permissions or re-population issue?

Screenshot 2023-02-07 at 21 36 30

Even more perplexing now.

DigiH commented 1 year ago

So both the MACs and Locations are in the database, they also do get updated when making changes in the open App, so writing to the database is, and likely always has been, fine.

Just when opening the App again they do not get read and populated into the devices.

emericg commented 1 year ago

Alright thanks a lot for researching this issue. Turns out the problem was that the loading of these data is made per device type, and wasn't triggered for most "theengs" specific devices. Now it also turns out that I have none of these devices, so I didn't see that problem, and you only have these devices, so you only saw this problem ^^

DigiH commented 1 year ago

Closing as verified with the latest build as fixed.

Opening the app immediately populates the locations, and also the previously saved MAC addresses are there for all devices. 👍