gradle:8.1.0

This commit is contained in:
Milos Kozak 2023-07-31 10:21:06 +02:00
parent a86774e51e
commit 870aaa2032
3 changed files with 15 additions and 22 deletions

View file

@ -57,7 +57,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.7'

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import info.nightscout.androidaps.plugins.pump.eopatch.R
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
@ -83,7 +83,7 @@ class EopatchOverviewViewModel @Inject constructor(
private var mBasalRateDisposable: Disposable? = null
val patchRemainingInsulin: LiveData<String>
get() = Transformations.map(_patchRemainingInsulin) { insulin ->
get() = _patchRemainingInsulin.map { insulin ->
when {
insulin > 50f -> "50+ U"
insulin < 1f -> "0 U"
@ -217,7 +217,7 @@ class EopatchOverviewViewModel @Inject constructor(
.observeOn(aapsSchedulers.main)
.subscribe({ response ->
if (response.isSuccess) {
var result = pumpSync.syncTemporaryBasalWithPumpId(
val result = pumpSync.syncTemporaryBasalWithPumpId(
timestamp = dateUtil.now(),
rate = 0.0,
duration = T.mins((pauseDurationHour * 60).toLong()).msecs(),
@ -251,7 +251,7 @@ class EopatchOverviewViewModel @Inject constructor(
pumpType = PumpType.EOFLOW_EOPATCH2,
pumpSerial = patchManager.patchConfig.patchSerialNumber
)
UIEvent(EventType.RESUME_BASAL_SUCCESS).let { _eventHandler.postValue(it) }
UIEvent(EventType.RESUME_BASAL_SUCCESS).let { event -> _eventHandler.postValue(event) }
stopPauseTimeUpdate()
} else {
_eventHandler.postValue(UIEvent(EventType.RESUME_BASAL_FAILED))

View file

@ -4,8 +4,7 @@ import android.content.res.Resources
import androidx.annotation.StringRes
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import info.nightscout.shared.interfaces.ResourceHelper
import androidx.lifecycle.map
import info.nightscout.androidaps.plugins.pump.eopatch.CommonUtils
import info.nightscout.androidaps.plugins.pump.eopatch.R
import info.nightscout.androidaps.plugins.pump.eopatch.RxAction
@ -49,6 +48,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Observable
@ -77,7 +77,7 @@ class EopatchViewModel @Inject constructor(
var isInAlarmHandling = false
var connectionTryCnt = 0
val patchConfig: PatchConfig = patchManager.patchConfig
private val patchConfig: PatchConfig = patchManager.patchConfig
val patchState: PatchState = patchManager.patchState
private val _isActivated = MutableLiveData(patchConfig.isActivated)
@ -93,7 +93,7 @@ class EopatchViewModel @Inject constructor(
val isConnected = patchManager.patchConnectionState.isConnected
val patchRemainedInsulin: LiveData<Int>
get() = Transformations.map(_isActivated) {
get() = _isActivated.map {
it.takeOne(patchManager.patchState.remainedInsulin.let { insulin ->
when {
insulin > 50f -> 51
@ -106,12 +106,12 @@ class EopatchViewModel @Inject constructor(
private val _patchExpirationTimestamp = MutableLiveData(patchManager.patchExpiredTime)
val patchRemainedDays: LiveData<Int>
get() = Transformations.map(_patchExpirationTimestamp) {
get() = _patchExpirationTimestamp.map {
it.getDiffDays().toInt()
}
val patchRemainedTime: LiveData<String>
get() = Transformations.map(_patchExpirationTimestamp) {
get() = _patchExpirationTimestamp.map {
it.diffTime(MAX_ELAPSED_MILLIS_AFTER_EXPIRATION)
}
@ -131,7 +131,7 @@ class EopatchViewModel @Inject constructor(
get() = !patchConfig.lifecycleEvent.isShutdown
val commCheckCancelLabel: LiveData<String>
get() = Transformations.map(patchStep) {
get() = patchStep.map {
rh.gs(when (it) {
PatchStep.CONNECT_NEW -> {
isBonded.takeOne(R.string.cancel, R.string.patch_cancel_pairing)
@ -512,12 +512,12 @@ class EopatchViewModel @Inject constructor(
PatchStep.COMPLETE, PatchStep.BASAL_SCHEDULE -> {
val now = System.currentTimeMillis()
val expireTimeStamp = patchConfig.expireTimestamp
val milllisBeforeExpiration = TimeUnit.HOURS.toMillis(sp.getInt(EXPIRATION_REMINDERS, 0).toLong())
val millisBeforeExpiration = TimeUnit.HOURS.toMillis(sp.getInt(EXPIRATION_REMINDERS, 0).toLong())
Maybe.just(AlarmCode.B012)
.flatMap { alarmRegistry.remove(it) }
.flatMap { alarmRegistry.remove(AlarmCode.A020) }
.flatMap { alarmRegistry.add(AlarmCode.B000, expireTimeStamp - now - milllisBeforeExpiration) }
.flatMap { alarmRegistry.add(AlarmCode.B000, expireTimeStamp - now - millisBeforeExpiration) }
.flatMap { alarmRegistry.add(AlarmCode.B005, expireTimeStamp - now) }
.flatMap { alarmRegistry.add(AlarmCode.B006, expireTimeStamp - now + IPatchConstant.SERVICE_TIME_MILLI - TimeUnit.HOURS.toMillis(1)) }
.flatMap { alarmRegistry.add(AlarmCode.A003, expireTimeStamp - now + IPatchConstant.SERVICE_TIME_MILLI) }
@ -622,13 +622,6 @@ class EopatchViewModel @Inject constructor(
.addTo()
}
fun deactivateInDisconnected() {
mOnCommCheckSuccessListener = {
deactivate(false) { moveStep((PatchStep.DISCARDED_FOR_CHANGE)) }
}
showPatchCommCheckDialog(true, R.string.string_discard_patch)
}
@Synchronized
fun retryScan() {
if (mRetryCount <= mMaxRetryCount) {
@ -660,7 +653,7 @@ class EopatchViewModel @Inject constructor(
.onErrorReturnItem("")
.doOnSubscribe { updateSetupStep(SCAN_STARTED) }
.subscribeDefault(aapsLogger) {
if (!it.isNullOrEmpty()) {
if (it.isNotEmpty()) {
startBond(it)
} else {
updateSetupStep(SCAN_FAILED)