0xf104a / NextcloudServices

Android app to send notifications from Nextcloud without using GCM(Google cloud messaging)
GNU General Public License v3.0
63 stars 11 forks source link

Websocket connection crashes when no network is available #81

Closed freeflyk closed 4 months ago

freeflyk commented 4 months ago

Hi 0x50f13. First of all, thank you for implementing the websocket functionality! I found a few sittuation when the application will either run into errors, show wrong status messages or even fail to reconnect until the app is started again or a user setting is changed. I also implemented a fix and will create a pull request. I would be happy to get suggestions from you if this fix goes along with your implementation of the websocket.

Scenario 1: When websocket is enabled and any of the settings is changed, the application will run into the exception "Can not get websocket URL". Dispite the exception, the application will successfully reconnect seconds later.

Scenario 2: When the websocket is enabled, then all connections are disabled and then a preference in the app is changed, the app will log the same exception as in scenario 1 but also show a wrong status suggesting that the login credentials might be wrong or the notify push service is not installed.

Scenario 3: Create Scenario 2, but then re-enable the connection. The app will stay disconnected with the same status message until restarted or any preference in the app is changed.

0xf104a commented 4 months ago

Thankyou for such extended desription of issue! I'm closing the issue as corresponding PR is merged