diff --git a/app/src/main/java/com/stevesoltys/seedvault/plugins/StoragePluginManager.kt b/app/src/main/java/com/stevesoltys/seedvault/plugins/StoragePluginManager.kt index 67c6d573..784ed882 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/plugins/StoragePluginManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/plugins/StoragePluginManager.kt @@ -23,26 +23,26 @@ class StoragePluginManager( webDavFactory: WebDavFactory, ) { - private var _appPlugin: StoragePlugin<*>? - private var _filesPlugin: org.calyxos.backup.storage.api.StoragePlugin? - private var _storageProperties: StorageProperties<*>? + private var mAppPlugin: StoragePlugin<*>? + private var mFilesPlugin: org.calyxos.backup.storage.api.StoragePlugin? + private var mStorageProperties: StorageProperties<*>? val appPlugin: StoragePlugin<*> @Synchronized get() { - return _appPlugin ?: error("App plugin was loaded, but still null") + return mAppPlugin ?: error("App plugin was loaded, but still null") } val filesPlugin: org.calyxos.backup.storage.api.StoragePlugin @Synchronized get() { - return _filesPlugin ?: error("Files plugin was loaded, but still null") + return mFilesPlugin ?: error("Files plugin was loaded, but still null") } val storageProperties: StorageProperties<*>? @Synchronized get() { - return _storageProperties + return mStorageProperties } val isOnRemovableDrive: Boolean get() = storageProperties?.isUsb == true @@ -51,30 +51,30 @@ class StoragePluginManager( StoragePluginEnum.SAF -> { val safStorage = settingsManager.getSafStorage() ?: error("No SAF storage saved") val documentsStorage = DocumentsStorage(context, settingsManager, safStorage) - _appPlugin = safFactory.createAppStoragePlugin(safStorage, documentsStorage) - _filesPlugin = safFactory.createFilesStoragePlugin(safStorage, documentsStorage) - _storageProperties = safStorage + mAppPlugin = safFactory.createAppStoragePlugin(safStorage, documentsStorage) + mFilesPlugin = safFactory.createFilesStoragePlugin(safStorage, documentsStorage) + mStorageProperties = safStorage } StoragePluginEnum.WEB_DAV -> { val webDavProperties = settingsManager.webDavProperties ?: error("No WebDAV config saved") - _appPlugin = webDavFactory.createAppStoragePlugin(webDavProperties.config) - _filesPlugin = webDavFactory.createFilesStoragePlugin(webDavProperties.config) - _storageProperties = webDavProperties + mAppPlugin = webDavFactory.createAppStoragePlugin(webDavProperties.config) + mFilesPlugin = webDavFactory.createFilesStoragePlugin(webDavProperties.config) + mStorageProperties = webDavProperties } null -> { - _appPlugin = null - _filesPlugin = null - _storageProperties = null + mAppPlugin = null + mFilesPlugin = null + mStorageProperties = null } } } fun isValidAppPluginSet(): Boolean { - if (_appPlugin == null || _filesPlugin == null) return false - if (_appPlugin is DocumentsProviderStoragePlugin) { + if (mAppPlugin == null || mFilesPlugin == null) return false + if (mAppPlugin is DocumentsProviderStoragePlugin) { val storage = settingsManager.getSafStorage() ?: return false if (storage.isUsb) return true return permitDiskReads { @@ -96,9 +96,9 @@ class StoragePluginManager( filesPlugin: org.calyxos.backup.storage.api.StoragePlugin, ) { settingsManager.setStoragePlugin(appPlugin) - _storageProperties = storageProperties - _appPlugin = appPlugin - _filesPlugin = filesPlugin + mStorageProperties = storageProperties + mAppPlugin = appPlugin + mFilesPlugin = filesPlugin } /** diff --git a/app/src/main/java/com/stevesoltys/seedvault/plugins/webdav/WebDavHandler.kt b/app/src/main/java/com/stevesoltys/seedvault/plugins/webdav/WebDavHandler.kt index 371cf70b..667b7568 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/plugins/webdav/WebDavHandler.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/plugins/webdav/WebDavHandler.kt @@ -46,27 +46,27 @@ internal class WebDavHandler( } } - private val _configState = MutableStateFlow(WebDavConfigState.Empty) - val configState = _configState.asStateFlow() + private val mConfigState = MutableStateFlow(WebDavConfigState.Empty) + val configState = mConfigState.asStateFlow() suspend fun onConfigReceived(config: WebDavConfig) { - _configState.value = WebDavConfigState.Checking + mConfigState.value = WebDavConfigState.Checking val plugin = webDavFactory.createAppStoragePlugin(config) as WebDavStoragePlugin try { if (plugin.test()) { val properties = createWebDavProperties(context, config) - _configState.value = WebDavConfigState.Success(properties, plugin) + mConfigState.value = WebDavConfigState.Success(properties, plugin) } else { - _configState.value = WebDavConfigState.Error(null) + mConfigState.value = WebDavConfigState.Error(null) } } catch (e: Exception) { Log.e(TAG, "Error testing WebDAV config at ${config.url}", e) - _configState.value = WebDavConfigState.Error(e) + mConfigState.value = WebDavConfigState.Error(e) } } fun resetConfigState() { - _configState.value = WebDavConfigState.Empty + mConfigState.value = WebDavConfigState.Empty } /** diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt index 7c1969bf..072a0675 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt @@ -99,11 +99,11 @@ internal class SettingsViewModel( private val mAppEditMode = MutableLiveData() internal val appEditMode: LiveData = mAppEditMode - private val _filesSummary = MutableLiveData() - internal val filesSummary: LiveData = _filesSummary + private val mFilesSummary = MutableLiveData() + internal val filesSummary: LiveData = mFilesSummary - private val _initEvent = MutableLiveEvent() - val initEvent: LiveEvent = _initEvent + private val mInitEvent = MutableLiveEvent() + val initEvent: LiveEvent = mInitEvent private val storageObserver = object : ContentObserver(null) { override fun onChange(selfChange: Boolean, uris: MutableCollection, flags: Int) { @@ -252,7 +252,7 @@ internal class SettingsViewModel( @UiThread fun loadFilesSummary() = viewModelScope.launch { val uriSummary = storageBackup.getUriSummaryString() - _filesSummary.value = uriSummary.ifEmpty { + mFilesSummary.value = uriSummary.ifEmpty { app.getString(R.string.settings_backup_files_summary) } } @@ -268,10 +268,10 @@ internal class SettingsViewModel( } viewModelScope.launch(Dispatchers.IO) { backupInitializer.initialize(onError) { - _initEvent.postEvent(false) + mInitEvent.postEvent(false) scheduleAppBackup(CANCEL_AND_REENQUEUE) } - _initEvent.postEvent(true) + mInitEvent.postEvent(true) } } // enable call log backups for existing installs (added end of 2020) diff --git a/app/src/main/java/com/stevesoltys/seedvault/storage/Services.kt b/app/src/main/java/com/stevesoltys/seedvault/storage/Services.kt index 3acd8e77..7a2c36af 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/storage/Services.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/storage/Services.kt @@ -33,8 +33,8 @@ internal class StorageBackupService : BackupService() { companion object { internal const val EXTRA_START_APP_BACKUP = "startAppBackup" - private val _isRunning = MutableStateFlow(false) - val isRunning = _isRunning.asStateFlow() + private val mIsRunning = MutableStateFlow(false) + val isRunning = mIsRunning.asStateFlow() } override val storageBackup: StorageBackup by inject() @@ -47,12 +47,12 @@ internal class StorageBackupService : BackupService() { override fun onCreate() { super.onCreate() - _isRunning.value = true + mIsRunning.value = true } override fun onDestroy() { super.onDestroy() - _isRunning.value = false + mIsRunning.value = false } override fun onBackupFinished(intent: Intent, success: Boolean) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt index 581468d6..d564aea8 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt @@ -21,8 +21,8 @@ private val TAG = ConfigurableBackupTransportService::class.java.simpleName class ConfigurableBackupTransportService : Service(), KoinComponent { companion object { - private val _isRunning = MutableStateFlow(false) - val isRunning = _isRunning.asStateFlow() + private val mIsRunning = MutableStateFlow(false) + val isRunning = mIsRunning.asStateFlow() } private var transport: ConfigurableBackupTransport? = null @@ -34,7 +34,7 @@ class ConfigurableBackupTransportService : Service(), KoinComponent { override fun onCreate() { super.onCreate() transport = ConfigurableBackupTransport(applicationContext) - _isRunning.value = true + mIsRunning.value = true Log.d(TAG, "Service created.") } @@ -55,7 +55,7 @@ class ConfigurableBackupTransportService : Service(), KoinComponent { super.onDestroy() notificationManager.onServiceDestroyed() transport = null - _isRunning.value = false + mIsRunning.value = false Log.d(TAG, "Service destroyed.") }