Show notification if the vault specified for auto upload doesn't exists
This commit is contained in:
parent
0126a4a45e
commit
5a317e8a1b
@ -12,7 +12,6 @@ import androidx.multidex.MultiDexApplication
|
|||||||
import org.cryptomator.data.cloud.crypto.Cryptors
|
import org.cryptomator.data.cloud.crypto.Cryptors
|
||||||
import org.cryptomator.data.cloud.crypto.CryptorsModule
|
import org.cryptomator.data.cloud.crypto.CryptorsModule
|
||||||
import org.cryptomator.data.repository.RepositoryModule
|
import org.cryptomator.data.repository.RepositoryModule
|
||||||
import org.cryptomator.domain.Vault
|
|
||||||
import org.cryptomator.presentation.di.HasComponent
|
import org.cryptomator.presentation.di.HasComponent
|
||||||
import org.cryptomator.presentation.di.component.ApplicationComponent
|
import org.cryptomator.presentation.di.component.ApplicationComponent
|
||||||
import org.cryptomator.presentation.di.component.DaggerApplicationComponent
|
import org.cryptomator.presentation.di.component.DaggerApplicationComponent
|
||||||
@ -124,7 +123,11 @@ class CryptomatorApp : MultiDexApplication(), HasComponent<ApplicationComponent>
|
|||||||
fun startAutoUpload() {
|
fun startAutoUpload() {
|
||||||
val sharedPreferencesHandler = SharedPreferencesHandler(applicationContext())
|
val sharedPreferencesHandler = SharedPreferencesHandler(applicationContext())
|
||||||
if (checkToStartAutoImageUpload(sharedPreferencesHandler)) {
|
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) {
|
if (vault?.isUnlocked == true) {
|
||||||
val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault)
|
val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault)
|
||||||
applicationContext().startService(AutoUploadService.startAutoUploadIntent(applicationContext(), cloud))
|
applicationContext().startService(AutoUploadService.startAutoUploadIntent(applicationContext(), cloud))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user