jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348034 )

Change subject: Don't prevent SavedPageSyncService from running when offline
......................................................................


Don't prevent SavedPageSyncService from running when offline

Currently we stop the SavedPageSyncService from running when the device
is offline.  With the new caching setup, this is no longer always what we
want; it may well be the case that the content the user wants to save is
in the net cache and available for persisting in the save cache.  So, this
removes the check for online status.

This also allows the service to perform deletes while offline, which were
also prevented while offline before as a side effect of the check.

Hygiene: Removes the now-unused DeviceUtil.isOnline() method.

Bug: T162270
Change-Id: If98f58fe08324c195aec890d5f3cb976d08870a3
---
M app/src/main/java/org/wikipedia/savedpages/SavedPageSyncService.java
M app/src/main/java/org/wikipedia/util/DeviceUtil.java
2 files changed, 0 insertions(+), 15 deletions(-)

Approvals:
  Niedzielski: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/app/src/main/java/org/wikipedia/savedpages/SavedPageSyncService.java 
b/app/src/main/java/org/wikipedia/savedpages/SavedPageSyncService.java
index 9f29075..48f1162 100644
--- a/app/src/main/java/org/wikipedia/savedpages/SavedPageSyncService.java
+++ b/app/src/main/java/org/wikipedia/savedpages/SavedPageSyncService.java
@@ -20,7 +20,6 @@
 import org.wikipedia.readinglist.page.ReadingListPageRow;
 import org.wikipedia.readinglist.page.database.ReadingListPageDao;
 import org.wikipedia.readinglist.page.database.disk.ReadingListPageDiskRow;
-import org.wikipedia.util.DeviceUtil;
 import org.wikipedia.util.DimenUtil;
 import org.wikipedia.util.UriUtil;
 import org.wikipedia.util.log.L;
@@ -49,12 +48,6 @@
     }
 
     @Override protected void onHandleIntent(@Nullable Intent intent) {
-        // todo: allow deletes while offline
-        if (!DeviceUtil.isOnline(this)) {
-            L.i("Device is offline; aborting sync service");
-            return;
-        }
-
         List<ReadingListPageDiskRow> queue = new ArrayList<>();
         Collection<ReadingListPageDiskRow> rows = dao.startDiskTransaction();
 
diff --git a/app/src/main/java/org/wikipedia/util/DeviceUtil.java 
b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
index 6134bee..9401979 100644
--- a/app/src/main/java/org/wikipedia/util/DeviceUtil.java
+++ b/app/src/main/java/org/wikipedia/util/DeviceUtil.java
@@ -77,14 +77,6 @@
                 (ConnectivityManager) 
context.getSystemService(Context.CONNECTIVITY_SERVICE));
     }
 
-    public static boolean isOnline(Context context) {
-        ConnectivityManager connManager = (ConnectivityManager) 
context.getSystemService(Context.CONNECTIVITY_SERVICE);
-        return ((connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) 
!= null
-                && 
connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected())
-                || (connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) 
!= null
-                && 
connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()));
-    }
-
     public static boolean isLocationServiceEnabled(@NonNull Context context) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             int locationMode = Settings.Secure.LOCATION_MODE_OFF;

-- 
To view, visit https://gerrit.wikimedia.org/r/348034
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If98f58fe08324c195aec890d5f3cb976d08870a3
Gerrit-PatchSet: 3
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to