Skip to content

Commit

Permalink
Google Drive daily backup mobile data option
Browse files Browse the repository at this point in the history
  • Loading branch information
Navid200 committed Sep 12, 2023
1 parent f9346ab commit 1c0952f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"};

Expand Down Expand Up @@ -298,7 +299,7 @@ public static boolean isBackupSuitableForAutomatic() {

public static void doCompleteBackupIfEnabled() {
if (Pref.getBooleanDefaultFalse(PREF_AUTO_BACKUP)
&& isBackupSuitableForAutomatic()) {
&& isBackupSuitableForAutomatic() && ((Pref.getBooleanDefaultFalse(PREF_AUTO_BACKUP_MOBILE)) || (JoH.isLANConnected()))) {
UserError.Log.e(TAG, "Attempting automatic backup");
val success = doCompleteBackup(new LogStatus());
if (!success) {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/layout/activity_backup_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@
app:checked="@={prefs[`backup-automatic-enabled`]}"
app:showIfTrueAnimatedFastOff="@{vm.showAuto}" />

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:dependency="backup-automatic-enabled"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="@string/use_mobile_data"
app:checked="@={prefs[`backup-automatic-mobile`]}"
app:showIfTrueAnimatedFastOff="@{vm.showAuto}" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit 1c0952f

Please sign in to comment.