This commit is contained in:
Geoffrey Hansen 2020-09-03 21:22:33 +02:00
parent ae980e12f4
commit 02f85398d7
3 changed files with 5 additions and 5 deletions

View file

@ -42,7 +42,7 @@ class OHUploadWorker(context: Context, workerParameters: WorkerParameters)
val isConnectedToWifi = wifiManager?.isWifiEnabled ?: false && wifiManager?.connectionInfo?.networkId != -1
if (!wifiOnly || (wifiOnly && isConnectedToWifi)) {
setForegroundAsync(createForegroundInfo())
openHumansUploader.uploadData().delay(12, TimeUnit.MINUTES) //TODO OH: No Delay
openHumansUploader.uploadData().delay(12, TimeUnit.MINUTES)
.andThen(Single.just(Result.success()))
.onErrorResumeNext { Single.just(Result.retry()) }
} else {

View file

@ -382,7 +382,7 @@ class OpenHumansUploader @Inject constructor(
.map { enqueueTempTarget(it); increaseCounter() }
.ignoreElements()
.doOnSubscribe {
wakeLock.acquire(TimeUnit.MINUTES.toMillis(20))
wakeLock.acquire(TimeUnit.MINUTES.toMillis(30))
showOngoingNotification()
}
.doOnComplete {
@ -595,9 +595,9 @@ class OpenHumansUploader @Inject constructor(
.setRequiredNetworkType(NetworkType.CONNECTED)
.setRequiresCharging(sp.getBoolean("key_oh_charging_only", false))
.build()
val workRequest = PeriodicWorkRequestBuilder<OHUploadWorker>(1, TimeUnit.MINUTES) // TODO OH: DAYS
val workRequest = PeriodicWorkRequestBuilder<OHUploadWorker>(1, TimeUnit.DAYS)
.setConstraints(constraints)
.setBackoffCriteria(BackoffPolicy.LINEAR, 1, TimeUnit.MINUTES) //TODO OH: HOURS
.setBackoffCriteria(BackoffPolicy.LINEAR, 20, TimeUnit.MINUTES)
.build()
WorkManager.getInstance(context).enqueueUniquePeriodicWork(WORK_NAME, if (replace) ExistingPeriodicWorkPolicy.REPLACE else ExistingPeriodicWorkPolicy.KEEP, workRequest)
}

View file

@ -1409,7 +1409,7 @@
<string name="open_humans">Open Humans</string>
<string name="finishing_open_humans_setup">Finishing Open Humans setup…</string>
<string name="this_may_take_a_while">This may take a while. Do not turn your phone off.</string>
<string name="this_may_take_a_while">This may take a while. Do not turn your phone or this plugin off.</string>
<string name="setup_finished">Setup finished</string>
<string name="your_phone_will_upload_data">Your phone will upload data to Open Humans soon.</string>
<string name="your_phone_is_upload_data">Your phone is uploading data to Open Humans now.</string>