-
Notifications
You must be signed in to change notification settings - Fork 98
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
Implemented Auto Refresh for WebView #77
Commits on May 25, 2020
-
Updated Libs using refreshVersions
Updated Libs and changed strings in implementations to variables in Libs object
Configuration menu - View commit details
-
Copy full SHA for fdb7e5a - Browse repository at this point
Copy the full SHA fdb7e5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for fabe47e - Browse repository at this point
Copy the full SHA fabe47eView commit details -
Added Kotlin Coroutines Dependency
Updated Kotlin Version to v1.3.71 since Kotlin Coroutines v1.3.7 are only supported with Kotlin v1.3.7+
Configuration menu - View commit details
-
Copy full SHA for a60775e - Browse repository at this point
Copy the full SHA a60775eView commit details -
Enabled MutliDex for DEV Android App
Added multidex following android docs, https://developer.android.com/studio/build/multidex
Configuration menu - View commit details
-
Copy full SHA for a517dea - Browse repository at this point
Copy the full SHA a517deaView commit details -
Added NetworkStatusEvent and NetworkStatus for EventBus
NetworkStatusEvent will be used with EventBus, it will carry the NetworkStatus to Listeners or Subscribers to that Event Once the NetworkStatusEvent is received, certain actions will be taken, depending on if the device is online or offline.
Configuration menu - View commit details
-
Copy full SHA for 17c592c - Browse repository at this point
Copy the full SHA 17c592cView commit details -
Added NetworkUtils to Check if Device is Online/Offline
Checking if user is online is done through opening a socket with 8.8.8.8 (google dns). This online check is according to the stackoverflow answer linked below. It is faster than other options. https://stackoverflow.com/a/27312494/5512292
Configuration menu - View commit details
-
Copy full SHA for e54fc7f - Browse repository at this point
Copy the full SHA e54fc7fView commit details -
Added NetworkWatcher BroadcastReceiver to Know When Device is Back On…
…line This is used in order to check if the device is back online. Once the device's connectivity changes, ie is connected to internet after being offline, it posts an Event indicating the device is back online.
Configuration menu - View commit details
-
Copy full SHA for 57d8a38 - Browse repository at this point
Copy the full SHA 57d8a38View commit details -
Implemented WebView Auto Refresh using Network Observer
A coroutine scope is started in the main activity, in oder to prevent work leaks. onDestroy, all coroutines are cancelled. The webview client takes the coroutine scope, again to avoid work leaks, and utilizes it to check if the user is offline when the webview client receives an error Once the webview client receives an error, an Event indicating the user is offline is posted. The webview client is subscribed to the NetworkStatusEvent in order to know the network status. Once the device is offline, the network watcher is started (a broadcast receiver waits until the device is back online). Once the device is back online, the network watcher is stopped and the webview is refreshed It is important to note that the webview client is not automatically registered to the Event. This is because we want to avoid leaks. Therefore, whenever it is manually registered, it should be manually unregistered.
Configuration menu - View commit details
-
Copy full SHA for edbf645 - Browse repository at this point
Copy the full SHA edbf645View commit details -
Changed Online Check Hostname to dev.to
Uses hostname instead of url, so created BuildConfig.baseHostname instead of trimming the 'https://' and '/' segments of the BuildConfig.baseUrl. This gives for easier changes later on in the future. Also, @fdoxyz requested that change in order to reconnect to the website once it is up again, if it was down. Mentioned in pull request #77.
Configuration menu - View commit details
-
Copy full SHA for 442002a - Browse repository at this point
Copy the full SHA 442002aView commit details -
Cleared Network Watcher Variable to Null on Unregistration in WebView…
…Client Previously, an exception was being thrown due to unregistering a network watcher and then trying to unregister it again later on. Now, since it is being cleared back to null, it is no longer being unregistered again if it was previously unregistered
Configuration menu - View commit details
-
Copy full SHA for 036f977 - Browse repository at this point
Copy the full SHA 036f977View commit details
Commits on May 26, 2020
-
Fixed Multiple Re-Registrations for Network Watcher
onReceiveError was being called multiple times, this was resulting in multiple events being posted indicating that the device is offline. Accordingly, it was important to stop re-registering the networkWatcher again and again whenever the events were captured. However, it was previously done in case the coroutineScope did change. However, if the coroutineScope changes, the activity has probably died and been recreated. Therefore, the webview would have already been destroyed and recreated with the new scope. Thus, there is no need to re-register a network watcher if it has already been registered
Configuration menu - View commit details
-
Copy full SHA for 1cc26c7 - Browse repository at this point
Copy the full SHA 1cc26c7View commit details
Commits on May 27, 2020
-
Merge branch 'master' of github.com:thepracticaldev/DEV-Android into …
…bug/auto-refresh # Conflicts: # app/build.gradle.kts
Configuration menu - View commit details
-
Copy full SHA for b4f1a59 - Browse repository at this point
Copy the full SHA b4f1a59View commit details