remove window latency
This commit is contained in:
parent
8ea5968f4d
commit
a0c00273bc
3 changed files with 1 additions and 31 deletions
|
@ -19,7 +19,6 @@ object UploadChunk {
|
|||
private val TAG = "TidepoolUploadChunk"
|
||||
|
||||
private val MAX_UPLOAD_SIZE = T.days(7).msecs() // don't change this
|
||||
private val DEFAULT_WINDOW_OFFSET = T.mins(15).msecs()
|
||||
private val MAX_LATENCY_THRESHOLD_MINUTES: Long = 1440 // minutes per day
|
||||
|
||||
private val log = LoggerFactory.getLogger(L.TIDEPOOL)
|
||||
|
@ -58,20 +57,8 @@ object UploadChunk {
|
|||
return GsonInstance.defaultGsonInstance().toJson(records)
|
||||
}
|
||||
|
||||
private fun getWindowSizePreference(): Long {
|
||||
try {
|
||||
val value = getLatencySliderValue(SP.getInt(R.string.key_tidepool_window_latency, 0)).toLong()
|
||||
return Math.max(T.mins(value).msecs(), DEFAULT_WINDOW_OFFSET)
|
||||
} catch (e: Exception) {
|
||||
if (L.isEnabled(L.TIDEPOOL)) log.debug("Reverting to default of 15 minutes due to Window Size exception: $e")
|
||||
return DEFAULT_WINDOW_OFFSET // default
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun maxWindow(last_end: Long): Long {
|
||||
//Log.d(TAG, "Max window is: " + getWindowSizePreference());
|
||||
return Math.min(last_end + MAX_UPLOAD_SIZE, DateUtil.now() - getWindowSizePreference())
|
||||
return Math.min(last_end + MAX_UPLOAD_SIZE, DateUtil.now())
|
||||
}
|
||||
|
||||
fun getLastEnd(): Long {
|
||||
|
@ -160,13 +147,6 @@ object UploadChunk {
|
|||
|
||||
}
|
||||
|
||||
fun interpolate(name: String, position: Int): Int {
|
||||
when (name) {
|
||||
"latency" -> return getLatencySliderValue(position)
|
||||
}
|
||||
throw RuntimeException("name not matched in interpolate")
|
||||
}
|
||||
|
||||
private fun getLatencySliderValue(position: Int): Int {
|
||||
return LogSlider.calc(0, 300, 15.0, MAX_LATENCY_THRESHOLD_MINUTES.toDouble(), position).toInt()
|
||||
}
|
||||
|
|
|
@ -1329,7 +1329,6 @@
|
|||
<string name="key_tidepool_username" translatable="false">tidepool_username</string>
|
||||
<string name="key_tidepool_password" translatable="false">tidepool_password</string>
|
||||
<string name="key_tidepool_dev_servers" translatable="false">tidepool_dev_servers</string>
|
||||
<string name="key_tidepool_window_latency" translatable="false">tidepool_window_latency</string>
|
||||
<string name="key_tidepool_test_login" translatable="false">tidepool_test_login</string>
|
||||
<string name="key_tidepool_only_while_charging" translatable="false">tidepool_only_while_charging</string>
|
||||
<string name="key_tidepool_only_while_unmetered" translatable="false">tidepool_only_while_unmetered</string>
|
||||
|
@ -1341,7 +1340,6 @@
|
|||
<string name="summary_tidepool_password">Your Tidepool login password</string>
|
||||
<string name="title_tidepool_password">Login Password</string>
|
||||
<string name="title_tidepool_test_login">Test Tidepool Login</string>
|
||||
<string name="title_tidepool_window_latency">Data Age Mins</string>
|
||||
<string name="summary_tidepool_dev_servers">If enabled, uploads will go to https://int-app.tidepool.org instead of the regular https://app.tidepool.org/</string>
|
||||
<string name="title_tidepool_dev_servers">Use Integration (test) servers</string>
|
||||
<string name="tidepool">Tidepool</string>
|
||||
|
|
|
@ -21,14 +21,6 @@
|
|||
<Preference
|
||||
android:key="@string/key_tidepool_test_login"
|
||||
android:title="@string/title_tidepool_test_login" />
|
||||
<SeekBarPreference
|
||||
android:defaultValue="0"
|
||||
android:dependency="cloud_storage_tidepool_enable"
|
||||
android:key="@string/key_tidepool_window_latency"
|
||||
android:max="300"
|
||||
android:min="0"
|
||||
android:summary=""
|
||||
android:title="@string/title_tidepool_window_latency" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:enabled="false"
|
||||
|
|
Loading…
Reference in a new issue