diff --git a/app/build.gradle b/app/build.gradle index e843863b82..401db3a2b4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -117,6 +117,7 @@ android { flavorDimensions = ["standard"] productFlavors { full { + getIsDefault().set(true) applicationId "info.nightscout.androidaps" dimension "standard" resValue "string", "app_name", "AAPS" diff --git a/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt b/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt index 774c88d9c0..5672ea7650 100644 --- a/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt +++ b/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt @@ -14,6 +14,7 @@ import app.aaps.activities.PreferencesActivity import app.aaps.core.interfaces.notifications.Notification import app.aaps.core.interfaces.nsclient.NSAlarm import app.aaps.core.interfaces.rx.bus.RxBus +import app.aaps.core.interfaces.rx.events.EventDismissNotification import app.aaps.core.interfaces.ui.UiInteraction import app.aaps.core.main.events.EventNewNotification import app.aaps.core.ui.toast.ToastUtils @@ -169,6 +170,10 @@ class UiInteractionImpl @Inject constructor( } } + override fun dismissNotification(id: Int) { + rxBus.send(EventDismissNotification(id)) + } + override fun addNotification(id: Int, text: String, level: Int) { rxBus.send(EventNewNotification(Notification(id, text, level))) } diff --git a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/ui/UiInteraction.kt b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/ui/UiInteraction.kt index f19feb9894..e56d83adce 100644 --- a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/ui/UiInteraction.kt +++ b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/ui/UiInteraction.kt @@ -68,6 +68,7 @@ interface UiInteraction { fun runCareDialog(fragmentManager: FragmentManager, options: EventType, @StringRes event: Int) + fun dismissNotification(id: Int) fun addNotification(id: Int, text: String, level: Int) fun addNotificationValidFor(id: Int, text: String, level: Int, validMinutes: Int) fun addNotificationWithSound(id: Int, text: String, level: Int, @RawRes soundId: Int?) diff --git a/core/main/android_module_dependencies.gradle b/core/main/android_module_dependencies.gradle index d8717e8cae..8ccf62d869 100644 --- a/core/main/android_module_dependencies.gradle +++ b/core/main/android_module_dependencies.gradle @@ -3,6 +3,7 @@ android { flavorDimensions = ["standard"] productFlavors { full { + getIsDefault().set(true) dimension "standard" } pumpcontrol { diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt index 9488c200ad..078faf90ac 100644 --- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt +++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/nsclient/data/NSDeviceStatusHandler.kt @@ -2,13 +2,18 @@ package app.aaps.plugins.sync.nsclient.data import app.aaps.annotations.OpenForTesting import app.aaps.core.interfaces.configuration.Config +import app.aaps.core.interfaces.notifications.Notification import app.aaps.core.interfaces.nsclient.ProcessedDeviceStatusData +import app.aaps.core.interfaces.resources.ResourceHelper import app.aaps.core.interfaces.sharedPreferences.SP +import app.aaps.core.interfaces.ui.UiInteraction import app.aaps.core.interfaces.utils.DateUtil +import app.aaps.core.interfaces.utils.T import app.aaps.core.nssdk.interfaces.RunningConfiguration import app.aaps.core.nssdk.localmodel.devicestatus.NSDeviceStatus import app.aaps.core.utils.HtmlHelper import app.aaps.core.utils.JsonHelper +import app.aaps.plugins.sync.R import javax.inject.Inject import javax.inject.Singleton @@ -72,24 +77,31 @@ class NSDeviceStatusHandler @Inject constructor( private val config: Config, private val dateUtil: DateUtil, private val runningConfiguration: RunningConfiguration, - private val processedDeviceStatusData: ProcessedDeviceStatusData + private val processedDeviceStatusData: ProcessedDeviceStatusData, + private val uiInteraction: UiInteraction, + private val rh: ResourceHelper ) { fun handleNewData(deviceStatuses: Array) { var configurationDetected = false for (i in deviceStatuses.size - 1 downTo 0) { val nsDeviceStatus = deviceStatuses[i] - updatePumpData(nsDeviceStatus) - updateDeviceData(nsDeviceStatus) - updateOpenApsData(nsDeviceStatus) - updateUploaderData(nsDeviceStatus) - nsDeviceStatus.pump?.let { sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0 + if (config.NSCLIENT) { + updatePumpData(nsDeviceStatus) + updateDeviceData(nsDeviceStatus) + updateOpenApsData(nsDeviceStatus) + updateUploaderData(nsDeviceStatus) + } if (config.NSCLIENT && !configurationDetected) nsDeviceStatus.configuration?.let { // copy configuration of Insulin and Sensitivity from main AAPS runningConfiguration.apply(it) configurationDetected = true // pick only newest + } + if (config.APS) { + nsDeviceStatus.pump?.let { sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0 + } } }