From a0c00273bcfc6d024de0082547060fbaec08cfa0 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 5 Jun 2019 10:47:32 +0200 Subject: [PATCH] remove window latency --- .../general/tidepool/comm/UploadChunk.kt | 22 +------------------ app/src/main/res/values/strings.xml | 2 -- app/src/main/res/xml/pref_tidepool.xml | 8 ------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt index b97b20ebf8..676bb08761 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/comm/UploadChunk.kt @@ -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() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 89a32876be..a672caee56 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1329,7 +1329,6 @@ tidepool_username tidepool_password tidepool_dev_servers - tidepool_window_latency tidepool_test_login tidepool_only_while_charging tidepool_only_while_unmetered @@ -1341,7 +1340,6 @@ Your Tidepool login password Login Password Test Tidepool Login - Data Age Mins If enabled, uploads will go to https://int-app.tidepool.org instead of the regular https://app.tidepool.org/ Use Integration (test) servers Tidepool diff --git a/app/src/main/res/xml/pref_tidepool.xml b/app/src/main/res/xml/pref_tidepool.xml index 229b0fa3c0..2718737c64 100644 --- a/app/src/main/res/xml/pref_tidepool.xml +++ b/app/src/main/res/xml/pref_tidepool.xml @@ -21,14 +21,6 @@ -