gradle:8.1.0
This commit is contained in:
parent
a86774e51e
commit
870aaa2032
3 changed files with 15 additions and 22 deletions
build.gradle
pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/viewmodel
|
@ -57,7 +57,7 @@ buildscript {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
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.gms:google-services:4.3.15'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.7'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.7'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
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.R
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPreferenceManager
|
||||||
|
@ -83,7 +83,7 @@ class EopatchOverviewViewModel @Inject constructor(
|
||||||
private var mBasalRateDisposable: Disposable? = null
|
private var mBasalRateDisposable: Disposable? = null
|
||||||
|
|
||||||
val patchRemainingInsulin: LiveData<String>
|
val patchRemainingInsulin: LiveData<String>
|
||||||
get() = Transformations.map(_patchRemainingInsulin) { insulin ->
|
get() = _patchRemainingInsulin.map { insulin ->
|
||||||
when {
|
when {
|
||||||
insulin > 50f -> "50+ U"
|
insulin > 50f -> "50+ U"
|
||||||
insulin < 1f -> "0 U"
|
insulin < 1f -> "0 U"
|
||||||
|
@ -217,7 +217,7 @@ class EopatchOverviewViewModel @Inject constructor(
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
.subscribe({ response ->
|
.subscribe({ response ->
|
||||||
if (response.isSuccess) {
|
if (response.isSuccess) {
|
||||||
var result = pumpSync.syncTemporaryBasalWithPumpId(
|
val result = pumpSync.syncTemporaryBasalWithPumpId(
|
||||||
timestamp = dateUtil.now(),
|
timestamp = dateUtil.now(),
|
||||||
rate = 0.0,
|
rate = 0.0,
|
||||||
duration = T.mins((pauseDurationHour * 60).toLong()).msecs(),
|
duration = T.mins((pauseDurationHour * 60).toLong()).msecs(),
|
||||||
|
@ -251,7 +251,7 @@ class EopatchOverviewViewModel @Inject constructor(
|
||||||
pumpType = PumpType.EOFLOW_EOPATCH2,
|
pumpType = PumpType.EOFLOW_EOPATCH2,
|
||||||
pumpSerial = patchManager.patchConfig.patchSerialNumber
|
pumpSerial = patchManager.patchConfig.patchSerialNumber
|
||||||
)
|
)
|
||||||
UIEvent(EventType.RESUME_BASAL_SUCCESS).let { _eventHandler.postValue(it) }
|
UIEvent(EventType.RESUME_BASAL_SUCCESS).let { event -> _eventHandler.postValue(event) }
|
||||||
stopPauseTimeUpdate()
|
stopPauseTimeUpdate()
|
||||||
} else {
|
} else {
|
||||||
_eventHandler.postValue(UIEvent(EventType.RESUME_BASAL_FAILED))
|
_eventHandler.postValue(UIEvent(EventType.RESUME_BASAL_FAILED))
|
||||||
|
|
|
@ -4,8 +4,7 @@ import android.content.res.Resources
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.map
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.CommonUtils
|
import info.nightscout.androidaps.plugins.pump.eopatch.CommonUtils
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.R
|
import info.nightscout.androidaps.plugins.pump.eopatch.R
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.RxAction
|
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.AapsSchedulers
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.core.Maybe
|
import io.reactivex.rxjava3.core.Maybe
|
||||||
import io.reactivex.rxjava3.core.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
|
@ -77,7 +77,7 @@ class EopatchViewModel @Inject constructor(
|
||||||
var isInAlarmHandling = false
|
var isInAlarmHandling = false
|
||||||
var connectionTryCnt = 0
|
var connectionTryCnt = 0
|
||||||
|
|
||||||
val patchConfig: PatchConfig = patchManager.patchConfig
|
private val patchConfig: PatchConfig = patchManager.patchConfig
|
||||||
val patchState: PatchState = patchManager.patchState
|
val patchState: PatchState = patchManager.patchState
|
||||||
|
|
||||||
private val _isActivated = MutableLiveData(patchConfig.isActivated)
|
private val _isActivated = MutableLiveData(patchConfig.isActivated)
|
||||||
|
@ -93,7 +93,7 @@ class EopatchViewModel @Inject constructor(
|
||||||
val isConnected = patchManager.patchConnectionState.isConnected
|
val isConnected = patchManager.patchConnectionState.isConnected
|
||||||
|
|
||||||
val patchRemainedInsulin: LiveData<Int>
|
val patchRemainedInsulin: LiveData<Int>
|
||||||
get() = Transformations.map(_isActivated) {
|
get() = _isActivated.map {
|
||||||
it.takeOne(patchManager.patchState.remainedInsulin.let { insulin ->
|
it.takeOne(patchManager.patchState.remainedInsulin.let { insulin ->
|
||||||
when {
|
when {
|
||||||
insulin > 50f -> 51
|
insulin > 50f -> 51
|
||||||
|
@ -106,12 +106,12 @@ class EopatchViewModel @Inject constructor(
|
||||||
private val _patchExpirationTimestamp = MutableLiveData(patchManager.patchExpiredTime)
|
private val _patchExpirationTimestamp = MutableLiveData(patchManager.patchExpiredTime)
|
||||||
|
|
||||||
val patchRemainedDays: LiveData<Int>
|
val patchRemainedDays: LiveData<Int>
|
||||||
get() = Transformations.map(_patchExpirationTimestamp) {
|
get() = _patchExpirationTimestamp.map {
|
||||||
it.getDiffDays().toInt()
|
it.getDiffDays().toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
val patchRemainedTime: LiveData<String>
|
val patchRemainedTime: LiveData<String>
|
||||||
get() = Transformations.map(_patchExpirationTimestamp) {
|
get() = _patchExpirationTimestamp.map {
|
||||||
it.diffTime(MAX_ELAPSED_MILLIS_AFTER_EXPIRATION)
|
it.diffTime(MAX_ELAPSED_MILLIS_AFTER_EXPIRATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class EopatchViewModel @Inject constructor(
|
||||||
get() = !patchConfig.lifecycleEvent.isShutdown
|
get() = !patchConfig.lifecycleEvent.isShutdown
|
||||||
|
|
||||||
val commCheckCancelLabel: LiveData<String>
|
val commCheckCancelLabel: LiveData<String>
|
||||||
get() = Transformations.map(patchStep) {
|
get() = patchStep.map {
|
||||||
rh.gs(when (it) {
|
rh.gs(when (it) {
|
||||||
PatchStep.CONNECT_NEW -> {
|
PatchStep.CONNECT_NEW -> {
|
||||||
isBonded.takeOne(R.string.cancel, R.string.patch_cancel_pairing)
|
isBonded.takeOne(R.string.cancel, R.string.patch_cancel_pairing)
|
||||||
|
@ -512,12 +512,12 @@ class EopatchViewModel @Inject constructor(
|
||||||
PatchStep.COMPLETE, PatchStep.BASAL_SCHEDULE -> {
|
PatchStep.COMPLETE, PatchStep.BASAL_SCHEDULE -> {
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
val expireTimeStamp = patchConfig.expireTimestamp
|
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)
|
Maybe.just(AlarmCode.B012)
|
||||||
.flatMap { alarmRegistry.remove(it) }
|
.flatMap { alarmRegistry.remove(it) }
|
||||||
.flatMap { alarmRegistry.remove(AlarmCode.A020) }
|
.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.B005, expireTimeStamp - now) }
|
||||||
.flatMap { alarmRegistry.add(AlarmCode.B006, expireTimeStamp - now + IPatchConstant.SERVICE_TIME_MILLI - TimeUnit.HOURS.toMillis(1)) }
|
.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) }
|
.flatMap { alarmRegistry.add(AlarmCode.A003, expireTimeStamp - now + IPatchConstant.SERVICE_TIME_MILLI) }
|
||||||
|
@ -622,13 +622,6 @@ class EopatchViewModel @Inject constructor(
|
||||||
.addTo()
|
.addTo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deactivateInDisconnected() {
|
|
||||||
mOnCommCheckSuccessListener = {
|
|
||||||
deactivate(false) { moveStep((PatchStep.DISCARDED_FOR_CHANGE)) }
|
|
||||||
}
|
|
||||||
showPatchCommCheckDialog(true, R.string.string_discard_patch)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun retryScan() {
|
fun retryScan() {
|
||||||
if (mRetryCount <= mMaxRetryCount) {
|
if (mRetryCount <= mMaxRetryCount) {
|
||||||
|
@ -660,7 +653,7 @@ class EopatchViewModel @Inject constructor(
|
||||||
.onErrorReturnItem("")
|
.onErrorReturnItem("")
|
||||||
.doOnSubscribe { updateSetupStep(SCAN_STARTED) }
|
.doOnSubscribe { updateSetupStep(SCAN_STARTED) }
|
||||||
.subscribeDefault(aapsLogger) {
|
.subscribeDefault(aapsLogger) {
|
||||||
if (!it.isNullOrEmpty()) {
|
if (it.isNotEmpty()) {
|
||||||
startBond(it)
|
startBond(it)
|
||||||
} else {
|
} else {
|
||||||
updateSetupStep(SCAN_FAILED)
|
updateSetupStep(SCAN_FAILED)
|
||||||
|
|
Loading…
Add table
Reference in a new issue