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_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="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="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="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="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> <string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>

View file

@ -18,7 +18,6 @@ android {
dependencies { dependencies {
implementation project(':core:libraries') implementation project(':core:libraries')
implementation project(':app-wear-shared:shared') implementation project(':app-wear-shared:shared')
implementation project(':core:core-main')
implementation project(':core:interfaces') implementation project(':core:interfaces')
implementation project(':core:ui') implementation project(':core:ui')
implementation project(':core:utils') 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.MedtronicConst
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil.Companion.isSame 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.DateTimeUtil
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.notifications.Notification 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)) 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) rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.SetRealTimeClock)
if (clock.timeDifference == 0) { if (clock.timeDifference == 0) {
val notification = Notification(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60) activityNames.addNotificationValidFor(Notification.INSIGHT_DATE_TIME_UPDATED, rh.gs(R.string.pump_time_updated), Notification.INFO, 60)
rxBus.send(EventNewNotification(notification))
} }
} else { } else {
if (clock.localDeviceTime.year > 2015) { 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.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst 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
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.utils.DateTimeUtil import info.nightscout.core.utils.DateTimeUtil
import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType 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.PumpDbEntry
import info.nightscout.pump.common.sync.PumpDbEntryBolus import info.nightscout.pump.common.sync.PumpDbEntryBolus
import info.nightscout.pump.common.sync.PumpDbEntryCarbs import info.nightscout.pump.common.sync.PumpDbEntryCarbs
@ -63,10 +63,11 @@ class MedtronicHistoryData @Inject constructor(
val rxBus: RxBus, val rxBus: RxBus,
val activePlugin: ActivePlugin, val activePlugin: ActivePlugin,
val medtronicUtil: MedtronicUtil, val medtronicUtil: MedtronicUtil,
val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder, private val medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder,
val medtronicPumpStatus: MedtronicPumpStatus, val medtronicPumpStatus: MedtronicPumpStatus,
val pumpSync: PumpSync, private val pumpSync: PumpSync,
val pumpSyncStorage: PumpSyncStorage private val pumpSyncStorage: PumpSyncStorage,
private val activityNames: ActivityNames
) { ) {
val allHistory: MutableList<PumpHistoryEntry> = mutableListOf() val allHistory: MutableList<PumpHistoryEntry> = mutableListOf()
@ -653,7 +654,7 @@ class MedtronicHistoryData @Inject constructor(
"pumpSerial=${medtronicPumpStatus.serialNumber}]") "pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcessDTO.durationAsSeconds <= 0) { 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") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else { } else {
val result = pumpSync.syncTemporaryBasalWithTempId( val result = pumpSync.syncTemporaryBasalWithTempId(
@ -694,7 +695,7 @@ class MedtronicHistoryData @Inject constructor(
"duration=${tempBasalProcessDTO.durationAsSeconds} s, pumpSerial=${medtronicPumpStatus.serialNumber}]") "duration=${tempBasalProcessDTO.durationAsSeconds} s, pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcessDTO.durationAsSeconds <= 0) { 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") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else { } else {
val result = pumpSync.syncTemporaryBasalWithPumpId( val result = pumpSync.syncTemporaryBasalWithPumpId(
@ -962,7 +963,7 @@ class MedtronicHistoryData @Inject constructor(
"pumpSerial=${medtronicPumpStatus.serialNumber}]") "pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcess.durationAsSeconds <= 0) { 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") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else { } else {
val result = pumpSync.syncTemporaryBasalWithPumpId( 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.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicNotificationType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.core.events.EventNewNotification import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventDismissNotification import info.nightscout.rx.events.EventDismissNotification
@ -35,7 +34,8 @@ class MedtronicUtil @Inject constructor(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val rxBus: RxBus, private val rxBus: RxBus,
private val rileyLinkUtil: RileyLinkUtil, 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] 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) return ByteUtil.concat(input.size.toByte(), input)
} }
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, rxBus: RxBus) { fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper) {
val notification = Notification( // activityNames.addNotification(
notificationType.notificationType, // notificationType.notificationType,
rh.gs(notificationType.resourceId), // rh.gs(notificationType.resourceId),
notificationType.notificationUrgency) notificationType.notificationUrgency
rxBus.send(EventNewNotification(notification)) )
} }
fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, rxBus: RxBus, vararg parameters: Any?) { fun sendNotification(notificationType: MedtronicNotificationType, rh: ResourceHelper, vararg parameters: Any?) {
val notification = Notification( // activityNames.addNotification(
notificationType.notificationType, // notificationType.notificationType,
rh.gs(notificationType.resourceId, *parameters), // rh.gs(notificationType.resourceId, *parameters),
notificationType.notificationUrgency) notificationType.notificationUrgency
rxBus.send(EventNewNotification(notification)) )
} }
fun dismissNotification(notificationType: MedtronicNotificationType, rxBus: RxBus) { fun dismissNotification(notificationType: MedtronicNotificationType, rxBus: RxBus) {

View file

@ -125,4 +125,7 @@
<string name="riley_statistics">RL Stats</string> <string name="riley_statistics">RL Stats</string>
<string name="medtronic_history_type">Type:</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> </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.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.database.impl.serialisation.SealedClassHelper import info.nightscout.database.impl.serialisation.SealedClassHelper
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.pump.core.utils.ByteUtil
import info.nightscout.rx.TestAapsSchedulers import info.nightscout.rx.TestAapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.Mock
//import uk.org.lidalia.slf4jtest.TestLogger; //import uk.org.lidalia.slf4jtest.TestLogger;
//import uk.org.lidalia.slf4jtest.TestLoggerFactory; //import uk.org.lidalia.slf4jtest.TestLoggerFactory;
@ -25,6 +27,7 @@ import org.junit.Test
*/ */
class MedtronicHistoryDataUTest : TestBase() { class MedtronicHistoryDataUTest : TestBase() {
@Mock lateinit var activityNames: ActivityNames
//TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class); //TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
// var historyPageData = ByteUtil // var historyPageData = ByteUtil
// .createByteArrayFromString( // .createByteArrayFromString(
@ -40,11 +43,11 @@ class MedtronicHistoryDataUTest : TestBase() {
rxBus = RxBus(TestAapsSchedulers(), aapsLogger) rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
medtronicHistoryData = MedtronicHistoryData( medtronicHistoryData = MedtronicHistoryData(
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, 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.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.pump.core.utils.ByteUtil import info.nightscout.pump.core.utils.ByteUtil
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.Mock
/** /**
* Created by andy on 11/1/18. * Created by andy on 11/1/18.
@ -17,6 +19,7 @@ import org.junit.Test
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
class MedtronicPumpHistoryDecoderUTest : TestBase() { class MedtronicPumpHistoryDecoderUTest : TestBase() {
@Mock lateinit var activityNames: ActivityNames
//@Mock lateinit var injector: HasAndroidInjector //@Mock lateinit var injector: HasAndroidInjector
//@Mock lateinit var rh: ResourceHelper //@Mock lateinit var rh: ResourceHelper
// @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin // @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
@ -32,7 +35,7 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() {
medtronicPumpStatus = medtronicPumpStatus =
MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil) MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil = medtronicUtil =
MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil()) 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.data.dto.TempBasalPair
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.interfaces.ui.ActivityNames
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.Mock import org.mockito.Mock
@ -18,10 +19,11 @@ import java.lang.reflect.Type
class MedtronicHistoryDataUTest : TestBase() { class MedtronicHistoryDataUTest : TestBase() {
@Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus @Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus
@Mock lateinit var activityNames: ActivityNames
@Before @Before
fun setUp() { fun setUp() {
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus) medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, activityNames)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil) decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
} }
@ -30,7 +32,7 @@ class MedtronicHistoryDataUTest : TestBase() {
val unitToTest = MedtronicHistoryData( val unitToTest = MedtronicHistoryData(
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin, packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, activityNames
) )
val gson = Gson() val gson = Gson()
@ -73,7 +75,7 @@ class MedtronicHistoryDataUTest : TestBase() {
medtronicUtil, decoder, medtronicUtil, decoder,
medtronicPumpStatus, medtronicPumpStatus,
pumpSync, pumpSync,
pumpSyncStorage pumpSyncStorage, activityNames
) )
val gson = Gson() val gson = Gson()

View file

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