Revert "Upload instantly when auto upload enabled and vault unlocked (#181)"
This reverts commit 8ebee7bfc250bab850be4aa026dc4befb76dfd63.
This commit is contained in:
parent
396ee964e2
commit
38b208b20c
@ -120,17 +120,6 @@ class CryptomatorApp : MultiDexApplication(), HasComponent<ApplicationComponent>
|
|||||||
}, BIND_AUTO_CREATE)
|
}, BIND_AUTO_CREATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startAutoUpload() {
|
|
||||||
val sharedPreferencesHandler = SharedPreferencesHandler(applicationContext())
|
|
||||||
if(sharedPreferencesHandler.usePhotoUpload()) {
|
|
||||||
val vault = applicationComponent.vaultRepository().load(sharedPreferencesHandler.photoUploadVault())
|
|
||||||
if(vault.isUnlocked) {
|
|
||||||
val cloud = applicationComponent.cloudRepository().decryptedViewOf(vault)
|
|
||||||
applicationContext().startService(AutoUploadService.startAutoUploadIntent(applicationContext(), cloud))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupLogging() {
|
private fun setupLogging() {
|
||||||
setupLoggingFramework()
|
setupLoggingFramework()
|
||||||
setup()
|
setup()
|
||||||
|
@ -212,7 +212,7 @@ public class AutoUploadService extends Service {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Timber.tag("AutoUploadService").d("created");
|
Timber.tag("AutoUploadService").d("created");
|
||||||
notification = new AutoUploadNotification(this, 0);
|
notification = new AutoUploadNotification(this, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,7 +13,6 @@ import android.net.Uri
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import org.cryptomator.domain.exception.FatalBackendException
|
import org.cryptomator.domain.exception.FatalBackendException
|
||||||
import org.cryptomator.presentation.CryptomatorApp
|
|
||||||
import org.cryptomator.presentation.R
|
import org.cryptomator.presentation.R
|
||||||
import org.cryptomator.presentation.util.FileUtil
|
import org.cryptomator.presentation.util.FileUtil
|
||||||
import org.cryptomator.presentation.util.ResourceHelper
|
import org.cryptomator.presentation.util.ResourceHelper
|
||||||
@ -39,8 +38,6 @@ class PhotoContentJob : JobService() {
|
|||||||
|
|
||||||
runningParams = params
|
runningParams = params
|
||||||
|
|
||||||
var filesCaptured = false
|
|
||||||
|
|
||||||
params.triggeredContentAuthorities?.let {
|
params.triggeredContentAuthorities?.let {
|
||||||
if (params.triggeredContentUris != null) {
|
if (params.triggeredContentUris != null) {
|
||||||
val ids = getIds(params)
|
val ids = getIds(params)
|
||||||
@ -52,8 +49,6 @@ class PhotoContentJob : JobService() {
|
|||||||
fileUtil.addImageToAutoUploads(dir)
|
fileUtil.addImageToAutoUploads(dir)
|
||||||
Timber.tag("PhotoContentJob").i("Added file to UploadList")
|
Timber.tag("PhotoContentJob").i("Added file to UploadList")
|
||||||
Timber.tag("PhotoContentJob").d(String.format("Added file to UploadList %s", dir))
|
Timber.tag("PhotoContentJob").d(String.format("Added file to UploadList %s", dir))
|
||||||
|
|
||||||
filesCaptured = true
|
|
||||||
} catch (e: FatalBackendException) {
|
} catch (e: FatalBackendException) {
|
||||||
Timber.tag("PhotoContentJob").e(e, "Failed to add image to auto upload list")
|
Timber.tag("PhotoContentJob").e(e, "Failed to add image to auto upload list")
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
@ -70,10 +65,6 @@ class PhotoContentJob : JobService() {
|
|||||||
}
|
}
|
||||||
} ?: Timber.tag("PhotoContentJob").w("No photos content")
|
} ?: Timber.tag("PhotoContentJob").w("No photos content")
|
||||||
|
|
||||||
if(filesCaptured && SharedPreferencesHandler(applicationContext).usePhotoUploadInstant()) {
|
|
||||||
(application as CryptomatorApp).startAutoUpload()
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post(worker)
|
handler.post(worker)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -244,8 +244,6 @@
|
|||||||
<string name="screen_settings_section_auto_photo_upload_vault">Choose vault for upload</string>
|
<string name="screen_settings_section_auto_photo_upload_vault">Choose vault for upload</string>
|
||||||
<string name="screen_settings_section_auto_photo_upload_toggle">Activate</string>
|
<string name="screen_settings_section_auto_photo_upload_toggle">Activate</string>
|
||||||
<string name="screen_settings_section_auto_photo_upload_toggle_summary">Capture images in the background and once the selected vault is unlocked, start upload</string>
|
<string name="screen_settings_section_auto_photo_upload_toggle_summary">Capture images in the background and once the selected vault is unlocked, start upload</string>
|
||||||
<string name="screen_settings_section_auto_photo_upload_toggle_instant_upload">Upload instant</string>
|
|
||||||
<string name="screen_settings_section_auto_photo_upload_toggle_instant_upload_summary">Upload directly if the vault is unlocked</string>
|
|
||||||
<string name="screen_settings_section_auto_photo_upload_only_wifi_toggle">Upload only using WIFI</string>
|
<string name="screen_settings_section_auto_photo_upload_only_wifi_toggle">Upload only using WIFI</string>
|
||||||
<string name="screen_settings_section_auto_photo_upload_including_videos">Upload videos</string>
|
<string name="screen_settings_section_auto_photo_upload_including_videos">Upload videos</string>
|
||||||
|
|
||||||
|
@ -105,12 +105,6 @@
|
|||||||
android:summary="@string/screen_settings_section_auto_photo_upload_toggle_summary"
|
android:summary="@string/screen_settings_section_auto_photo_upload_toggle_summary"
|
||||||
android:title="@string/screen_settings_section_auto_photo_upload_toggle" />
|
android:title="@string/screen_settings_section_auto_photo_upload_toggle" />
|
||||||
|
|
||||||
<androidx.preference.SwitchPreferenceCompat
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="photoUploadInstant"
|
|
||||||
android:summary="@string/screen_settings_section_auto_photo_upload_toggle_instant_upload_summary"
|
|
||||||
android:title="@string/screen_settings_section_auto_photo_upload_toggle_instant_upload" />
|
|
||||||
|
|
||||||
<androidx.preference.SwitchPreferenceCompat
|
<androidx.preference.SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="photoUploadOnlyUsingWifi"
|
android:key="photoUploadOnlyUsingWifi"
|
||||||
|
@ -129,18 +129,14 @@ constructor(context: Context) : SharedPreferences.OnSharedPreferenceChangeListen
|
|||||||
defaultSharedPreferences.clear()
|
defaultSharedPreferences.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun usePhotoUpload(): Boolean {
|
|
||||||
return defaultSharedPreferences.getValue(PHOTO_UPLOAD, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun usePhotoUploadInstant(): Boolean {
|
|
||||||
return defaultSharedPreferences.getValue(PHOTO_UPLOAD_INSTANT, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun autoPhotoUploadOnlyUsingWifi(): Boolean {
|
fun autoPhotoUploadOnlyUsingWifi(): Boolean {
|
||||||
return defaultSharedPreferences.getValue(PHOTO_UPLOAD_ONLY_USING_WIFI)
|
return defaultSharedPreferences.getValue(PHOTO_UPLOAD_ONLY_USING_WIFI)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun usePhotoUpload(): Boolean {
|
||||||
|
return defaultSharedPreferences.getValue(PHOTO_UPLOAD, false)
|
||||||
|
}
|
||||||
|
|
||||||
fun photoUploadVault(): Long {
|
fun photoUploadVault(): Long {
|
||||||
return defaultSharedPreferences.getValue(PHOTO_UPLOAD_VAULT, 0)
|
return defaultSharedPreferences.getValue(PHOTO_UPLOAD_VAULT, 0)
|
||||||
}
|
}
|
||||||
@ -253,7 +249,6 @@ constructor(context: Context) : SharedPreferences.OnSharedPreferenceChangeListen
|
|||||||
const val SECURE_SCREEN = "secureScreen"
|
const val SECURE_SCREEN = "secureScreen"
|
||||||
const val SCREEN_STYLE_MODE = "screenStyleMode"
|
const val SCREEN_STYLE_MODE = "screenStyleMode"
|
||||||
const val PHOTO_UPLOAD = "photoUpload"
|
const val PHOTO_UPLOAD = "photoUpload"
|
||||||
const val PHOTO_UPLOAD_INSTANT = "photoUploadInstant"
|
|
||||||
const val PHOTO_UPLOAD_ONLY_USING_WIFI = "photoUploadOnlyUsingWifi"
|
const val PHOTO_UPLOAD_ONLY_USING_WIFI = "photoUploadOnlyUsingWifi"
|
||||||
const val PHOTO_UPLOAD_VAULT = "photoUploadVault"
|
const val PHOTO_UPLOAD_VAULT = "photoUploadVault"
|
||||||
const val PHOTO_UPLOAD_FOLDER = "photoUploadFolder"
|
const val PHOTO_UPLOAD_FOLDER = "photoUploadFolder"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user