Skip to content

Commit

Permalink
Show notification if the vault specified for auto upload doesn't exists
Browse files Browse the repository at this point in the history
  • Loading branch information
SailReal committed Nov 16, 2021
1 parent 0126a4a commit 5a317e8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 5a317e8

Please sign in to comment.