Show notification if the vault specified for auto upload doesn't exists

This commit is contained in:
Julian Raufelder 2021-11-16 12:56:14 +01:00
parent 0126a4a45e
commit 5a317e8a1b
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D

View File

@ -12,7 +12,6 @@ import androidx.multidex.MultiDexApplication
import org.cryptomator.data.cloud.crypto.Cryptors
import org.cryptomator.data.cloud.crypto.CryptorsModule
import org.cryptomator.data.repository.RepositoryModule
import org.cryptomator.domain.Vault
import org.cryptomator.presentation.di.HasComponent
import org.cryptomator.presentation.di.component.ApplicationComponent
import org.cryptomator.presentation.di.component.DaggerApplicationComponent
@ -124,7 +123,11 @@ class CryptomatorApp : MultiDexApplication(), HasComponent<ApplicationComponent>
fun startAutoUpload() {
val sharedPreferencesHandler = SharedPreferencesHandler(applicationContext())
if (checkToStartAutoImageUpload(sharedPreferencesHandler)) {
val vault: Vault? = applicationComponent.vaultRepository().load(sharedPreferencesHandler.photoUploadVault())
val vault = try {
applicationComponent.vaultRepository().load(sharedPreferencesHandler.photoUploadVault())
} catch (e: NullPointerException) {
null
}
if (vault?.isUnlocked == true) {
val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault)
applicationContext().startService(AutoUploadService.startAutoUploadIntent(applicationContext(), cloud))