suppress warnings

This commit is contained in:
Milos Kozak 2021-10-01 23:17:24 +02:00
parent 30a70f9f25
commit 2c89dc1807
4 changed files with 8 additions and 7 deletions

View file

@ -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)

View file

@ -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"
}
}

View file

@ -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")

View file

@ -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")