From 2c89dc1807b4e1aa78cf20881e54653038249218 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 1 Oct 2021 23:17:24 +0200 Subject: [PATCH] suppress warnings --- .../plugins/general/nsclient/NSClientAddUpdateWorker.kt | 2 +- build.gradle | 7 +++++-- .../extensions/EffectiveProfileSwitchExtension.kt | 3 +-- .../plugins/general/maintenance/PrefFileListProvider.kt | 3 +-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt index a7ee154080..3bd4bf76ca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt @@ -187,7 +187,7 @@ class NSClientAddUpdateWorker( } eventType == TherapyEvent.Type.NOTE.text && json.isEffectiveProfileSwitch() -> // replace this by new Type when available in NS if (sp.getBoolean(R.string.key_ns_receive_profile_switch, false) && buildHelper.isEngineeringMode() || config.NSCLIENT) { - effectiveProfileSwitchFromJson(json, dateUtil, activePlugin)?.let { effectiveProfileSwitch -> + effectiveProfileSwitchFromJson(json, dateUtil)?.let { effectiveProfileSwitch -> repository.runTransactionForResult(SyncNsEffectiveProfileSwitchTransaction(effectiveProfileSwitch, invalidateByNsOnly = false)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving EffectiveProfileSwitch", it) diff --git a/build.gradle b/build.gradle index 1ef448fdf1..1ef4a476aa 100644 --- a/build.gradle +++ b/build.gradle @@ -66,10 +66,13 @@ allprojects { maven { url "https://maven.google.com" } maven { url 'https://jitpack.io' } } - //Support @JvmDefault tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { - freeCompilerArgs = ['-Xjvm-default=all'] + freeCompilerArgs = [ + // Ignore warning for @ExperimentalCoroutinesApi + "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", + '-Xjvm-default=all' //Support @JvmDefault + ] jvmTarget = "1.8" } } diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/EffectiveProfileSwitchExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/EffectiveProfileSwitchExtension.kt index 98a6751798..b8f5396b13 100644 --- a/core/src/main/java/info/nightscout/androidaps/extensions/EffectiveProfileSwitchExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/extensions/EffectiveProfileSwitchExtension.kt @@ -4,7 +4,6 @@ import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.database.embedments.InterfaceIDs import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch import info.nightscout.androidaps.database.entities.TherapyEvent -import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.GlucoseUnit import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper @@ -43,7 +42,7 @@ fun EffectiveProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObjec if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId) } -fun effectiveProfileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil, activePlugin: ActivePlugin): EffectiveProfileSwitch? { +fun effectiveProfileSwitchFromJson(jsonObject: JSONObject, dateUtil: DateUtil): EffectiveProfileSwitch? { val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null val originalTimeshift = JsonHelper.safeGetLong(jsonObject, "originalTimeshift") val originalDuration = JsonHelper.safeGetLong(jsonObject, "originalDuration") diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt index d4355cbb53..92c3fc4b08 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.general.maintenance -import android.content.Context import android.os.Environment import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.core.R @@ -30,7 +29,7 @@ class PrefFileListProvider @Inject constructor( private val storage: Storage, private val versionCheckerUtils: VersionCheckerUtils ) { - + @Suppress("DEPRECATION") private val path = File(Environment.getExternalStorageDirectory().toString()) private val aapsPath = File(path, "AAPS" + File.separator + "preferences") private val exportsPath = File(path, "AAPS" + File.separator + "exports")