fix: connectivity service impl
- [x] Tests written, or not not needed
Fixes: https://github.com/nextcloud/android/issues/14681
Deduplicates isNetworkAndServerAvailable logic
Removes c.isWifi() && !c.isMetered() from internet walled logic since isConnected already covers local internet and internet access
Implements ConnectivityManager.NetworkCallback for better network state listening
Removes deprecated logics
Adds better documentation
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15820.apk
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
Codacy
SpotBugs
| Category | Base | New |
|---|---|---|
| Bad practice | 43 | 43 |
| Correctness | 74 | 76 |
| Dodgy code | 260 | 259 |
| Experimental | 1 | 1 |
| Internationalization | 7 | 7 |
| Malicious code vulnerability | 3 | 3 |
| Multithreaded correctness | 34 | 34 |
| Performance | 48 | 48 |
| Security | 18 | 18 |
| Total | 488 | 489 |
SpotBugs increased!
test-Unit test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/15820-Unit-test-07-46
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.