Skip to content

Commit

Permalink
Trigger connection update in MainActivity.onStart()
Browse files Browse the repository at this point in the history
If the local server wasn't available (detection attempts timed out) last
time the app was in foreground, without a connection update it will make
no attempts to use the local connection when it's brought to foreground
again, even though the local server might be available now.

Signed-off-by: Danny Baumann <[email protected]>
  • Loading branch information
maniac103 committed Aug 22, 2024
1 parent 9296e74 commit f6c36fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mobile/src/main/java/org/openhab/habdroid/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ class MainActivity : AbstractBaseActivity(), ConnectionFactory.UpdateListener {

updateDrawerServerEntries()
onActiveConnectionChanged()
// Make sure the connection to be used is up-to-data. There can be scenarios where the current connection
// is e.g. a remote one just because the local server lookup timed out for whatever reason when we were last
// started, and the user might have done changes to fix those timeouts since that time.
ConnectionFactory.restartNetworkCheck()

if (connection != null && serverProperties == null) {
controller.clearServerCommunicationFailure()
Expand Down

0 comments on commit f6c36fa

Please sign in to comment.