Skip to content
Snippets Groups Projects
Commit 7898d3f7 authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Implement enabled/disabled state for Crust backup

parent 27623edb
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import android.content.Context ...@@ -4,6 +4,7 @@ import android.content.Context
import android.net.ConnectivityManager import android.net.ConnectivityManager
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import io.xxlabs.messenger.backup.cloud.crust.Crust
import io.xxlabs.messenger.backup.cloud.drive.GoogleDrive import io.xxlabs.messenger.backup.cloud.drive.GoogleDrive
import io.xxlabs.messenger.backup.cloud.dropbox.Dropbox import io.xxlabs.messenger.backup.cloud.dropbox.Dropbox
import io.xxlabs.messenger.backup.cloud.sftp.transfer.Sftp import io.xxlabs.messenger.backup.cloud.sftp.transfer.Sftp
...@@ -59,6 +60,7 @@ class BackupPreferencesDelegate( ...@@ -59,6 +60,7 @@ class BackupPreferencesDelegate(
is GoogleDrive -> googleDriveEnabled(enabled) is GoogleDrive -> googleDriveEnabled(enabled)
is Dropbox -> dropboxEnabled(enabled) is Dropbox -> dropboxEnabled(enabled)
is Sftp -> sftpEnabled(enabled) is Sftp -> sftpEnabled(enabled)
is Crust -> crustEnabled(enabled)
} }
reflectChanges() reflectChanges()
if (enabled) tryBackup() if (enabled) tryBackup()
...@@ -69,6 +71,7 @@ class BackupPreferencesDelegate( ...@@ -69,6 +71,7 @@ class BackupPreferencesDelegate(
if (enabled) { if (enabled) {
preferences.isDropboxEnabled = false preferences.isDropboxEnabled = false
preferences.isSftpEnabled = false preferences.isSftpEnabled = false
preferences.isCrustEnabled = false
} }
} }
...@@ -77,6 +80,7 @@ class BackupPreferencesDelegate( ...@@ -77,6 +80,7 @@ class BackupPreferencesDelegate(
if (enabled) { if (enabled) {
preferences.isGoogleDriveEnabled = false preferences.isGoogleDriveEnabled = false
preferences.isSftpEnabled = false preferences.isSftpEnabled = false
preferences.isCrustEnabled = false
} }
} }
...@@ -85,6 +89,16 @@ class BackupPreferencesDelegate( ...@@ -85,6 +89,16 @@ class BackupPreferencesDelegate(
if (enabled) { if (enabled) {
preferences.isGoogleDriveEnabled = false preferences.isGoogleDriveEnabled = false
preferences.isDropboxEnabled = false preferences.isDropboxEnabled = false
preferences.isCrustEnabled = false
}
}
private fun crustEnabled(enabled: Boolean) {
preferences.isCrustEnabled = enabled
if (enabled) {
preferences.isGoogleDriveEnabled = false
preferences.isDropboxEnabled = false
preferences.isSftpEnabled = false
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment