remove :core:main dependency

This commit is contained in:
Milos Kozak 2022-11-28 19:06:38 +01:00
parent 1a135087fc
commit 6f37d6a47c
12 changed files with 41 additions and 35 deletions

View file

@ -356,8 +356,6 @@
<string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string>
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string>
<string name="sms" comment="26 characters max for translation">SMS</string>
<string name="clicked_refresh" comment="26 characters max for translation">Clicked refresh</string>
<string name="scheduled_status_refresh" comment="26 characters max for translation">Scheduled Status Refresh</string>
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>

View file

@ -18,7 +18,6 @@ android {
dependencies {
implementation project(':core:libraries')
implementation project(':app-wear-shared:shared')
implementation project(':core:core-main')
implementation project(':core:interfaces')
implementation project(':core:ui')
implementation project(':core:utils')

View file

@ -37,7 +37,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtro
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil.Companion.isSame
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.notifications.Notification
@ -578,8 +577,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, String.format(Locale.ENGLISH, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is %d s. Set time on pump.", timeDiff))
rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetRealTimeClock)
if (clock.timeDifference == 0) {
val notification = Notification(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60)
rxBus.send(EventNewNotification(notification))
activityNames.addNotificationValidFor(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60)
}
} else {
if (clock.localDeviceTime.year > 2015) {

View file

@ -20,13 +20,13 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpBolusType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.common.sync.PumpDbEntry
import info.nightscout.pump.common.sync.PumpDbEntryBolus
import info.nightscout.pump.common.sync.PumpDbEntryCarbs
@ -63,10 +63,11 @@ class MedtronicHistoryData @Inject constructor(
val rxBus: RxBus,
val activePlugin: ActivePlugin,
val medtronicUtil: MedtronicUtil,
val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder,
private val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder,
val medtronicPumpStatus: MedtronicPumpStatus,
val pumpSync: PumpSync,
val pumpSyncStorage: PumpSyncStorage
private val pumpSync: PumpSync,
private val pumpSyncStorage: PumpSyncStorage,
private val activityNames: ActivityNames
) {
val allHistory: MutableList<PumpHistoryEntry> = mutableListOf()
@ -653,7 +654,7 @@ class MedtronicHistoryData @Inject constructor(
"pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcessDTO.durationAsSeconds <= 0) {
rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else {
val result = pumpSync.syncTemporaryBasalWithTempId(
@ -694,7 +695,7 @@ class MedtronicHistoryData @Inject constructor(
"duration=${tempBasalProcessDTO.durationAsSeconds} s, pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcessDTO.durationAsSeconds <= 0) {
rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else {
val result = pumpSync.syncTemporaryBasalWithPumpId(
@ -962,7 +963,7 @@ class MedtronicHistoryData @Inject constructor(
"pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcess.durationAsSeconds <= 0) {
rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
activityNames.addNotification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else {
val result = pumpSync.syncTemporaryBasalWithPumpId(

View file

@ -11,8 +11,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicCommandTy
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.core.events.EventNewNotification
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventDismissNotification
@ -35,7 +34,8 @@ class MedtronicUtil @Inject constructor(
private val aapsLogger: AAPSLogger,
private val rxBus: RxBus,
private val rileyLinkUtil: RileyLinkUtil,
private val medtronicPumpStatus: MedtronicPumpStatus
private val medtronicPumpStatus: MedtronicPumpStatus,
private val activityNames: ActivityNames
) {
private val ENVELOPE_SIZE = 4 // 0xA7 S1 S2 S3 CMD PARAM_COUNT [PARAMS]
@ -93,20 +93,20 @@ class MedtronicUtil @Inject constructor(
return ByteUtil.concat(input.size.toByte(), input)
}
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, rxBus: RxBus) {
val notification = Notification( //
notificationType.notificationType, //
rh.gs(notificationType.resourceId), //
notificationType.notificationUrgency)
rxBus.send(EventNewNotification(notification))
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper) {
activityNames.addNotification(
notificationType.notificationType,
rh.gs(notificationType.resourceId),
notificationType.notificationUrgency
)
}
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, rxBus: RxBus, vararg parameters: Any?) {
val notification = Notification( //
notificationType.notificationType, //
rh.gs(notificationType.resourceId, *parameters), //
notificationType.notificationUrgency)
rxBus.send(EventNewNotification(notification))
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, vararg parameters: Any?) {
activityNames.addNotification(
notificationType.notificationType,
rh.gs(notificationType.resourceId, *parameters),
notificationType.notificationUrgency
)
}
fun dismissNotification(notificationType: MedtronicNotificationType, rxBus: RxBus) {

View file

@ -125,4 +125,7 @@
<string name="riley_statistics">RL Stats</string>
<string name="medtronic_history_type">Type:</string>
<string name="clicked_refresh" comment="26 characters max for translation">Clicked refresh</string>
<string name="scheduled_status_refresh" comment="26 characters max for translation">Scheduled Status Refresh</string>
</resources>

View file

@ -12,11 +12,13 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceTyp
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.database.impl.serialisation.SealedClassHelper
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.TestAapsSchedulers
import info.nightscout.rx.bus.RxBus
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
//import uk.org.lidalia.slf4jtest.TestLogger;
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
@ -25,6 +27,7 @@ import org.junit.Test
*/
class MedtronicHistoryDataUTest : TestBase() {
@Mock lateinit var activityNames: ActivityNames
//TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
// var historyPageData = ByteUtil
// .createByteArrayFromString(
@ -40,11 +43,11 @@ class MedtronicHistoryDataUTest : TestBase() {
rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
medtronicHistoryData = MedtronicHistoryData(
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, activityNames
)

View file

@ -6,10 +6,12 @@ import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistory
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.core.utils.ByteUtil
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
/**
* Created by andy on 11/1/18.
@ -17,6 +19,7 @@ import org.junit.Test
@Suppress("SpellCheckingInspection")
class MedtronicPumpHistoryDecoderUTest : TestBase() {
@Mock lateinit var activityNames: ActivityNames
//@Mock lateinit var injector: HasAndroidInjector
//@Mock lateinit var rh: ResourceHelper
// @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
@ -32,7 +35,7 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() {
medtronicPumpStatus =
MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil =
MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil())
}

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpH
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalPair
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.interfaces.ui.ActivityNames
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
@ -18,10 +19,11 @@ import java.lang.reflect.Type
class MedtronicHistoryDataUTest : TestBase() {
@Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus
@Mock lateinit var activityNames: ActivityNames
@Before
fun setUp() {
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus)
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
}
@ -30,7 +32,7 @@ class MedtronicHistoryDataUTest : TestBase() {
val unitToTest = MedtronicHistoryData(
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, activityNames
)
val gson = Gson()
@ -73,7 +75,7 @@ class MedtronicHistoryDataUTest : TestBase() {
medtronicUtil, decoder,
medtronicPumpStatus,
pumpSync,
pumpSyncStorage
pumpSyncStorage, activityNames
)
val gson = Gson()

View file

@ -17,7 +17,6 @@ android {
dependencies {
implementation project(':app-wear-shared:shared')
implementation project(':core:core-main')
implementation project(':core:interfaces')
implementation project(':core:ui')
implementation project(':pump:pump-common')