From 286323e543dc7cc9f135f90114baaaeda749bc5a Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:08:30 -0400 Subject: [PATCH] Google Drive daily backup mobile data option (#3083) * Google Drive daily backup mobile data option * Unchecked by default * Flipped the logic (true default) * Cleanup * getBooleanDefaultTrue * Use mobile data by default * Disabled by default * Default True prefview * Removed checked from the mobile data setting --- .../dexdrip/cloud/backup/Backup.java | 3 +- .../res/layout/activity_backup_picker.xml | 28 +++++++++++++++---- app/src/main/res/values/strings.xml | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/cloud/backup/Backup.java b/app/src/main/java/com/eveningoutpost/dexdrip/cloud/backup/Backup.java index a1e2ad3cd8..e274021687 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/cloud/backup/Backup.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/cloud/backup/Backup.java @@ -62,6 +62,7 @@ public class Backup { private static final String TAG = "xDrip-Backup"; private static final String PREF_BACKUP_URI = "backup-document-uri"; public static final String PREF_AUTO_BACKUP = "backup-automatic-enabled"; + public static final String PREF_AUTO_BACKUP_MOBILE = "backup-automatic-mobile"; private static final String XDRIP_CONTENT_TYPE = "xDripBackup://"; private static final String[] dbSuffix = {"-journal", "-shm", "-wal"}; @@ -298,7 +299,7 @@ public static boolean isBackupSuitableForAutomatic() { public static void doCompleteBackupIfEnabled() { if (Pref.getBooleanDefaultFalse(PREF_AUTO_BACKUP) - && isBackupSuitableForAutomatic()) { + && isBackupSuitableForAutomatic() && ((Pref.getBoolean(PREF_AUTO_BACKUP_MOBILE, true)) || (JoH.isLANConnected()))) { UserError.Log.e(TAG, "Attempting automatic backup"); val success = doCompleteBackup(new LogStatus()); if (!success) { diff --git a/app/src/main/res/layout/activity_backup_picker.xml b/app/src/main/res/layout/activity_backup_picker.xml index 74ebb437b4..1c24536302 100644 --- a/app/src/main/res/layout/activity_backup_picker.xml +++ b/app/src/main/res/layout/activity_backup_picker.xml @@ -80,19 +80,23 @@