simplify dependency

This commit is contained in:
Milos Kozak 2022-11-11 20:22:12 +01:00
parent 20e07cb656
commit 4e939e0c8c
42 changed files with 148 additions and 146 deletions

View file

@ -0,0 +1,15 @@
package info.nightscout.rx.events
class EventPreferenceChange : Event {
var changedKey: String? = null
private set
constructor(key: String) {
changedKey = key
}
fun isChanged(key: String): Boolean {
return changedKey == key
}
}

View file

@ -35,7 +35,6 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.databinding.ActivityMainBinding
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
@ -64,6 +63,7 @@ import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.events.EventAppExit
import info.nightscout.rx.events.EventInitializationChanged
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRebuildTabs
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
@ -204,8 +204,8 @@ class MainActivity : NoSplashAppCompatActivity() {
}
private fun processPreferenceChange(ev: EventPreferenceChange) {
if (ev.isChanged(rh, R.string.key_keep_screen_on)) setWakeLock()
if (ev.isChanged(rh, R.string.key_skin)) recreate()
if (ev.isChanged(rh.gs(R.string.key_keep_screen_on))) setWakeLock()
if (ev.isChanged(rh.gs(R.string.key_skin))) recreate()
}
private fun setupViews() {

View file

@ -22,8 +22,7 @@ import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
@ -69,6 +68,7 @@ import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRebuildTabs
import info.nightscout.shared.SafeParse
import info.nightscout.shared.interfaces.ResourceHelper
@ -125,7 +125,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
@Inject lateinit var passwordCheck: PasswordCheck
@Inject lateinit var nsSettingStatus: NSSettingsStatus
@Inject lateinit var openHumansUploader: OpenHumansUploader
@Inject lateinit var openHumansUploaderPlugin: OpenHumansUploaderPlugin
@Inject lateinit var diaconnG8Plugin: DiaconnG8Plugin
override fun onAttach(context: Context) {
@ -225,7 +225,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
addPreferencesFromResource(R.xml.pref_alerts, rootKey)
addPreferencesFromResource(R.xml.pref_datachoices, rootKey)
addPreferencesFromResourceIfEnabled(maintenancePlugin, rootKey)
addPreferencesFromResourceIfEnabled(openHumansUploader, rootKey)
addPreferencesFromResourceIfEnabled(openHumansUploaderPlugin, rootKey)
}
initSummary(preferenceScreen, pluginId != -1)
preprocessPreferences()

View file

@ -9,15 +9,12 @@ import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.plugins.general.actions.ActionsPlugin
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
@ -33,23 +30,16 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugi
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
import info.nightscout.plugins.source.AidexPlugin
import info.nightscout.plugins.source.DexcomPlugin
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.plugins.source.GlunovoPlugin
import info.nightscout.plugins.source.IntelligoPlugin
import info.nightscout.plugins.source.MM640gPlugin
import info.nightscout.plugins.source.PoctechPlugin
import info.nightscout.plugins.source.RandomBgPlugin
import info.nightscout.plugins.source.TomatoPlugin
import info.nightscout.plugins.source.XdripPlugin
import info.nightscout.automation.AutomationPlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
import info.nightscout.plugins.constraints.dstHelper.DstHelperPlugin
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
import info.nightscout.plugins.constraints.storage.StorageConstraintPlugin
import info.nightscout.plugins.constraints.versionChecker.VersionCheckerPlugin
import info.nightscout.plugins.general.actions.ActionsPlugin
import info.nightscout.plugins.general.autotune.AutotunePlugin
import info.nightscout.plugins.general.food.FoodPlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
@ -61,7 +51,17 @@ import info.nightscout.plugins.insulin.InsulinOrefRapidActingPlugin
import info.nightscout.plugins.insulin.InsulinOrefUltraRapidActingPlugin
import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.plugins.source.AidexPlugin
import info.nightscout.plugins.source.DexcomPlugin
import info.nightscout.plugins.source.GlimpPlugin
import info.nightscout.plugins.source.GlunovoPlugin
import info.nightscout.plugins.source.IntelligoPlugin
import info.nightscout.plugins.source.MM640gPlugin
import info.nightscout.plugins.source.NSClientSourcePlugin
import info.nightscout.plugins.source.PoctechPlugin
import info.nightscout.plugins.source.RandomBgPlugin
import info.nightscout.plugins.source.TomatoPlugin
import info.nightscout.plugins.source.XdripPlugin
import info.nightscout.plugins.sync.nsclient.NSClientPlugin
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
@ -417,7 +417,7 @@ abstract class PluginsListModule {
@NotNSClient
@IntoMap
@IntKey(480)
abstract fun bindsOpenHumansPlugin(plugin: OpenHumansUploader): PluginBase
abstract fun bindsOpenHumansPlugin(plugin: OpenHumansUploaderPlugin): PluginBase
@Binds
@AllConfigs

View file

@ -12,7 +12,6 @@ import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.dana.database.DanaHistoryDatabase
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryDatabase
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.insight.database.InsightDatabase
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.logging.UserEntryLogger
@ -33,6 +32,7 @@ import info.nightscout.interfaces.sync.DataSyncSelector
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.extensions.toVisibility
@ -110,7 +110,7 @@ class MaintenanceFragment : DaggerFragment() {
.subscribeOn(aapsSchedulers.io)
.subscribeBy(
onError = { aapsLogger.error("Error clearing databases", it) },
onComplete = { rxBus.send(EventPreferenceChange(rh, R.string.key_units)) }
onComplete = { rxBus.send(EventPreferenceChange(rh.gs(R.string.key_units))) }
)
uel.log(Action.RESET_DATABASES, Sources.Maintenance)
})

View file

@ -31,7 +31,6 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.extensions.directionToIcon
import info.nightscout.androidaps.extensions.valueToUnitsString
@ -94,6 +93,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAcceptOpenLoopChange
import info.nightscout.rx.events.EventExtendedBolusChange
import info.nightscout.rx.events.EventMobileToWear
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.events.EventScale
import info.nightscout.rx.events.EventTempBasalChange
@ -221,7 +221,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overviewData.rangeToDisplay += 6
overviewData.rangeToDisplay = if (overviewData.rangeToDisplay > 24) 6 else overviewData.rangeToDisplay
sp.putInt(R.string.key_rangetodisplay, overviewData.rangeToDisplay)
rxBus.send(EventPreferenceChange(rh, R.string.key_rangetodisplay))
rxBus.send(EventPreferenceChange(rh.gs(R.string.key_rangetodisplay)))
sp.putBoolean(R.string.key_objectiveusescale, true)
false
}
@ -285,7 +285,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
.subscribe({
overviewData.rangeToDisplay = it.hours
sp.putInt(R.string.key_rangetodisplay, it.hours)
rxBus.send(EventPreferenceChange(rh, R.string.key_rangetodisplay))
rxBus.send(EventPreferenceChange(rh.gs(R.string.key_rangetodisplay)))
sp.putBoolean(R.string.key_objectiveusescale, true)
}, fabricPrivacy::logException)
disposable += rxBus

View file

@ -8,7 +8,6 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.RemoteInput
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.toStringShort
import info.nightscout.androidaps.extensions.valueToUnitsString
import info.nightscout.androidaps.interfaces.ActivePlugin
@ -30,6 +29,7 @@ import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAutosensCalculationFinished
import info.nightscout.rx.events.EventInitializationChanged
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.general.wear
import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataHandlerMobile
@ -17,6 +16,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAutosensCalculationFinished
import info.nightscout.rx.events.EventMobileToWear
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.weardata.EventData
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -7,7 +7,6 @@ import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toTemporaryBasal
@ -42,6 +41,7 @@ import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.Event
import info.nightscout.rx.events.EventConfigBuilderChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -116,14 +116,14 @@ class IobCobCalculatorPlugin @Inject constructor(
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event ->
if (event.isChanged(rh, R.string.key_openapsama_autosens_period) ||
event.isChanged(rh, R.string.key_age) ||
event.isChanged(rh, R.string.key_absorption_maxtime) ||
event.isChanged(rh, R.string.key_openapsama_min_5m_carbimpact) ||
event.isChanged(rh, R.string.key_absorption_cutoff) ||
event.isChanged(rh, R.string.key_openapsama_autosens_max) ||
event.isChanged(rh, R.string.key_openapsama_autosens_min) ||
event.isChanged(rh, R.string.key_insulin_oref_peak)
if (event.isChanged(rh.gs(R.string.key_openapsama_autosens_period)) ||
event.isChanged(rh.gs(R.string.key_age)) ||
event.isChanged(rh.gs(R.string.key_absorption_maxtime)) ||
event.isChanged(rh.gs(R.string.key_openapsama_min_5m_carbimpact)) ||
event.isChanged(rh.gs(R.string.key_absorption_cutoff)) ||
event.isChanged(rh.gs(R.string.key_openapsama_autosens_max)) ||
event.isChanged(rh.gs(R.string.key_openapsama_autosens_min)) ||
event.isChanged(rh.gs(R.string.key_insulin_oref_peak))
) {
resetDataAndRunCalculation("onEventPreferenceChange", event)
}

View file

@ -7,13 +7,13 @@ import android.widget.LinearLayout
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.rx.events.EventSWUpdate
import info.nightscout.androidaps.utils.protection.PasswordCheck
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventSWUpdate
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 java.util.concurrent.Executors
import java.util.concurrent.ScheduledFuture
@ -75,7 +75,7 @@ open class SWItem(val injector: HasAndroidInjector, var type: Type) {
override fun run() {
aapsLogger.debug(LTag.CORE, "Firing EventPreferenceChange")
rxBus.send(EventPreferenceChange(rh, preferenceId))
rxBus.send(EventPreferenceChange(rh.gs(preferenceId)))
rxBus.send(EventSWUpdate(false))
scheduledEventPost = null
}

View file

@ -11,7 +11,6 @@ import androidx.work.WorkManager
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.plugins.general.overview.OverviewData
@ -26,6 +25,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.Event
import info.nightscout.rx.events.EventAppInitialized
import info.nightscout.rx.events.EventOfflineChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventTherapyEventChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
@ -99,11 +99,11 @@ class CalculationWorkflow @Inject constructor(
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event ->
if (event.isChanged(rh, R.string.key_units)) {
if (event.isChanged(rh.gs(R.string.key_units))) {
overviewData.reset()
rxBus.send(EventNewHistoryData(0, false))
}
if (event.isChanged(rh, R.string.key_rangetodisplay)) {
if (event.isChanged(rh.gs(R.string.key_rangetodisplay))) {
overviewData.initRange()
runOnScaleChanged()
rxBus.send(EventNewHistoryData(0, false))

View file

@ -6,7 +6,6 @@ import android.os.HandlerThread
import android.os.SystemClock
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.automation.actions.Action
@ -54,6 +53,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventBTChange
import info.nightscout.rx.events.EventChargingState
import info.nightscout.rx.events.EventNetworkChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -137,7 +137,7 @@ class AutomationPlugin @Inject constructor(
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ e ->
if (e.isChanged(rh, R.string.key_location)) {
if (e.isChanged(rh.gs(R.string.key_location))) {
locationServiceHelper.stopService(context)
locationServiceHelper.startService(context)
}

View file

@ -33,7 +33,6 @@ dependencies {
api 'androidx.biometric:biometric:1.1.0'
api "androidx.browser:browser:1.4.0"
api 'androidx.cardview:cardview:1.0.0'
api "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
api "androidx.core:core-ktx:$core_version"
@ -74,8 +73,8 @@ dependencies {
//WorkManager
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
// api "androidx.work:work-rxjava3:$work_version"
api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
//api "androidx.work:work-rxjava3:$work_version"
//api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
api "commons-codec:commons-codec:$commonscodec_version"

View file

@ -1,22 +0,0 @@
package info.nightscout.androidaps.events
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.rx.events.Event
class EventPreferenceChange : Event {
var changedKey: String? = null
private set
constructor(key: String) {
changedKey = key
}
constructor(rh: ResourceHelper, resourceID: Int) {
changedKey = rh.gs(resourceID)
}
fun isChanged(rh: ResourceHelper, id: Int): Boolean {
return changedKey == rh.gs(id)
}
}

View file

@ -260,7 +260,6 @@
<string name="paused">Paused</string>
<string name="invalid">INVALID</string>
<string name="login">Login</string>
<string name="upload_now">Upload now</string>
<string name="prime_fill">Prime/Fill</string>
<string name="overview_insulin_label">Insulin</string>
<string name="stoptemptarget">Stop temp target</string>

View file

@ -27,6 +27,7 @@ dependencies {
api "androidx.core:core-ktx:$core_version"
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
api "io.reactivex.rxjava3:rxjava:$rxjava_version"
api "io.reactivex.rxjava3:rxandroid:$rxandroid_version"
@ -41,11 +42,8 @@ dependencies {
api "androidx.room:room-ktx:$room_version"
api "androidx.room:room-rxjava3:$room_version"
api "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
api "com.google.dagger:dagger-android:$dagger_version"
api "com.google.dagger:dagger-android-support:$dagger_version"
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
allOpen {

View file

@ -17,7 +17,6 @@ android {
dependencies {
implementation project(':core:core-main')
implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':interfaces')
@ -26,4 +25,15 @@ dependencies {
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "androidx.browser:browser:1.4.0"
//WorkManager
api "androidx.work:work-runtime:$work_version"
api "androidx.work:work-runtime-ktx:$work_version"
//api "androidx.work:work-rxjava3:$work_version"
//api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
api "com.google.android.material:material:$material_version"
}

View file

@ -19,7 +19,6 @@ import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHAppIDDelegate
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHCounterDelegate
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHStateDelegate
@ -32,6 +31,7 @@ import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
@ -55,7 +55,7 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class OpenHumansUploader @Inject internal constructor(
class OpenHumansUploaderPlugin @Inject internal constructor(
injector: HasAndroidInjector,
rh: ResourceHelper,
aapsLogger: AAPSLogger,

View file

@ -22,7 +22,7 @@ class OpenHumansWorker(
lateinit var logger: AAPSLogger
@Inject
lateinit var openHumansUploader: OpenHumansUploader
lateinit var openHumansUploader: OpenHumansUploaderPlugin
override suspend fun doWork(): Result {
return try {

View file

@ -10,9 +10,9 @@ import androidx.appcompat.view.ContextThemeWrapper
import androidx.lifecycle.LiveData
import com.google.android.material.button.MaterialButton
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.plugin.general.openhumans.R
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansState
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.androidaps.plugin.general.openhumans.R
import javax.inject.Inject
class OHFragment : DaggerFragment() {
@ -20,7 +20,7 @@ class OHFragment : DaggerFragment() {
@Inject
internal lateinit var stateLiveData: LiveData<OpenHumansState?>
@Inject
internal lateinit var plugin: OpenHumansUploader
internal lateinit var plugin: OpenHumansUploaderPlugin
private lateinit var setup: MaterialButton
private lateinit var logout: MaterialButton

View file

@ -3,14 +3,14 @@ package info.nightscout.androidaps.plugin.general.openhumans.ui
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import javax.inject.Inject
internal class OHLoginViewModel @Inject constructor(
private val plugin: OpenHumansUploader
private val plugin: OpenHumansUploaderPlugin
) : ViewModel(), CoroutineScope by MainScope() {
private val _state = MutableLiveData(State.WELCOME)

View file

@ -54,4 +54,6 @@
<string name="we_re_done">We\'re done!</string>
<string name="silently_upload_date_note">From now on, your phone will silently upload data in the background from time to time.</string>
<string name="close">Close</string>
<string name="upload_now">Upload now</string>
</resources>

View file

@ -12,7 +12,6 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.valueToUnitsString
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
@ -62,6 +61,7 @@ import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNSClientRestart
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
@ -222,7 +222,7 @@ class SmsCommunicatorPlugin @Inject constructor(
}
private fun processSettings(ev: EventPreferenceChange?) {
if (ev == null || ev.isChanged(rh, R.string.key_smscommunicator_allowednumbers)) {
if (ev == null || ev.isChanged(rh.gs(R.string.key_smscommunicator_allowednumbers))) {
val settings = sp.getString(R.string.key_smscommunicator_allowednumbers, "")
allowedNumbers.clear()
val substrings = settings.split(";").toTypedArray()

View file

@ -5,12 +5,12 @@ import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventThemeSwitch
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
@ -40,7 +40,7 @@ class ThemeSwitcherPlugin @Inject constructor(
override fun onStart() {
compositeDisposable.add(rxBus.toObservable(EventPreferenceChange::class.java).subscribe {
if (it.isChanged(rh, id = R.string.key_use_dark_mode)) {
if (it.isChanged(rh.gs(R.string.key_use_dark_mode))) {
setThemeMode()
rxBus.send(EventThemeSwitch())
}

View file

@ -4,7 +4,6 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.toStringShort
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
@ -24,6 +23,7 @@ import info.nightscout.rx.events.EventAppInitialized
import info.nightscout.rx.events.EventAutosensCalculationFinished
import info.nightscout.rx.events.EventConfigBuilderChange
import info.nightscout.rx.events.EventExtendedBolusChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.events.EventTempBasalChange
import info.nightscout.rx.events.EventTreatmentChange

View file

@ -6,7 +6,6 @@ import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
import info.nightscout.androidaps.interfaces.IobCobCalculator
@ -34,6 +33,7 @@ import info.nightscout.plugins.pump.virtual.events.EventVirtualPumpUpdateGui
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -112,7 +112,7 @@ open class VirtualPumpPlugin @Inject constructor(
disposable += rxBus
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh, R.string.key_virtualpump_type)) refreshConfiguration() }, fabricPrivacy::logException)
.subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh.gs(R.string.key_virtualpump_type))) refreshConfiguration() }, fabricPrivacy::logException)
refreshConfiguration()
}

View file

@ -12,7 +12,6 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.interfaces.BuildHelper
@ -39,6 +38,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
import info.nightscout.rx.events.EventChargingState
import info.nightscout.rx.events.EventNetworkChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -197,7 +197,7 @@ class NSClientPlugin @Inject constructor(
override fun pause(newState: Boolean) {
sp.putBoolean(R.string.key_ns_client_paused, newState)
rxBus.send(EventPreferenceChange(rh, R.string.key_ns_client_paused))
rxBus.send(EventPreferenceChange(rh.gs(R.string.key_ns_client_paused)))
}
override val version: NsClient.Version

View file

@ -1,11 +1,11 @@
package info.nightscout.plugins.sync.nsclient
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventChargingState
import info.nightscout.rx.events.EventNetworkChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
@ -30,16 +30,16 @@ class NsClientReceiverDelegate @Inject constructor(
fun onStatusEvent(ev: EventPreferenceChange) {
when {
ev.isChanged(rh, R.string.key_ns_wifi) ||
ev.isChanged(rh, R.string.key_ns_cellular) ||
ev.isChanged(rh, R.string.key_ns_wifi_ssids) ||
ev.isChanged(rh, R.string.key_ns_allow_roaming) -> {
ev.isChanged(rh.gs(R.string.key_ns_wifi)) ||
ev.isChanged(rh.gs(R.string.key_ns_cellular)) ||
ev.isChanged(rh.gs(R.string.key_ns_wifi_ssids)) ||
ev.isChanged(rh.gs(R.string.key_ns_allow_roaming)) -> {
receiverStatusStore.updateNetworkStatus()
receiverStatusStore.lastNetworkEvent?.let { onStatusEvent(it) }
}
ev.isChanged(rh, R.string.key_ns_charging) ||
ev.isChanged(rh, R.string.key_ns_battery) -> {
ev.isChanged(rh.gs(R.string.key_ns_charging)) ||
ev.isChanged(rh.gs(R.string.key_ns_battery)) -> {
receiverStatusStore.broadcastChargingState()
}
}

View file

@ -16,7 +16,6 @@ import com.google.gson.GsonBuilder
import com.google.gson.JsonDeserializer
import dagger.android.DaggerService
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.receivers.DataWorkerStorage
@ -56,6 +55,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
import info.nightscout.rx.events.EventConfigBuilderChange
import info.nightscout.rx.events.EventNSClientRestart
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.sdk.remotemodel.RemoteDeviceStatus
@ -142,9 +142,9 @@ class NSClientService : DaggerService(), NsClient.NSClientService {
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event: EventPreferenceChange ->
if (event.isChanged(rh, R.string.key_nsclientinternal_url) ||
event.isChanged(rh, R.string.key_nsclientinternal_api_secret) ||
event.isChanged(rh, R.string.key_ns_client_paused)
if (event.isChanged(rh.gs(R.string.key_nsclientinternal_url)) ||
event.isChanged(rh.gs(R.string.key_nsclientinternal_api_secret)) ||
event.isChanged(rh.gs(R.string.key_ns_client_paused))
) {
latestDateInReceivedData = 0
destroy()

View file

@ -12,7 +12,6 @@ import androidx.work.OneTimeWorkRequest
import androidx.work.WorkInfo
import androidx.work.WorkManager
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.interfaces.BuildHelper
@ -41,6 +40,7 @@ import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventChargingState
import info.nightscout.rx.events.EventNetworkChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.sdk.NSAndroidClientImpl
@ -237,7 +237,7 @@ class NSClientV3Plugin @Inject constructor(
override fun pause(newState: Boolean) {
sp.putBoolean(R.string.key_ns_client_paused, newState)
rxBus.send(EventPreferenceChange(rh, R.string.key_ns_client_paused))
rxBus.send(EventPreferenceChange(rh.gs(R.string.key_ns_client_paused)))
}
override val version: NsClient.Version

View file

@ -6,7 +6,6 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
@ -27,6 +26,7 @@ import info.nightscout.plugins.sync.tidepool.utils.RateLimit
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNetworkChange
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -109,9 +109,9 @@ class TidepoolPlugin @Inject constructor(
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event ->
if (event.isChanged(rh, R.string.key_tidepool_dev_servers)
|| event.isChanged(rh, R.string.key_tidepool_username)
|| event.isChanged(rh, R.string.key_tidepool_password)
if (event.isChanged(rh.gs(R.string.key_tidepool_dev_servers))
|| event.isChanged(rh.gs(R.string.key_tidepool_username))
|| event.isChanged(rh.gs(R.string.key_tidepool_password))
)
tidepoolUploader.resetInstance()
}, fabricPrivacy::logException)

View file

@ -467,6 +467,7 @@
<string name="tidepool_upload_bg">Upload BG tests</string>
<string name="remove_all">Remove all</string>
<string name="reset_start">Reset start</string>
<string name="upload_now">Upload now</string>
<!-- VirtualPump -->
<string name="key_virtual_pump_upload_status" translatable="false">virtualpump_uploadstatus</string>

View file

@ -11,7 +11,6 @@ import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionServi
import info.nightscout.androidaps.danar.AbstractDanaRPlugin
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.interfaces.constraints.Constraint
@ -28,6 +27,7 @@ import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper

View file

@ -11,7 +11,6 @@ import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.dana.comm.RecordTypes;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
@ -35,6 +34,7 @@ import info.nightscout.interfaces.utils.Round;
import info.nightscout.rx.AapsSchedulers;
import info.nightscout.rx.bus.RxBus;
import info.nightscout.rx.events.EventConfigBuilderChange;
import info.nightscout.rx.events.EventPreferenceChange;
import info.nightscout.rx.logging.AAPSLogger;
import info.nightscout.rx.logging.LTag;
import info.nightscout.shared.interfaces.ResourceHelper;
@ -108,7 +108,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
.toObservable(EventPreferenceChange.class)
.observeOn(aapsSchedulers.getIo())
.subscribe(event -> {
if (event.isChanged(getRh(), R.string.key_danar_bt_name)) {
if (event.isChanged(getRh().gs(R.string.key_danar_bt_name))) {
danaPump.reset();
pumpSync.connectNewPump(true);
getCommandQueue().readStatus(getRh().gs(R.string.device_changed), null);

View file

@ -15,7 +15,6 @@ import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.danar.services.DanaRExecutionService;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.core.fabric.FabricPrivacy;
import info.nightscout.interfaces.constraints.Constraint;
@ -31,6 +30,7 @@ import info.nightscout.rx.AapsSchedulers;
import info.nightscout.rx.bus.RxBus;
import info.nightscout.rx.events.EventAppExit;
import info.nightscout.rx.events.EventOverviewBolusProgress;
import info.nightscout.rx.events.EventPreferenceChange;
import info.nightscout.rx.logging.AAPSLogger;
import info.nightscout.rx.logging.LTag;
import info.nightscout.shared.interfaces.ResourceHelper;

View file

@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.eopatch
import android.os.SystemClock
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmManager
import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager
@ -34,6 +33,7 @@ import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppInitialized
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
@ -85,9 +85,9 @@ class EopatchPumpPlugin @Inject constructor(
.toObservable(EventPreferenceChange::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ event: EventPreferenceChange ->
if (event.isChanged(rh, SettingKeys.LOW_RESERVOIR_REMINDERS) || event.isChanged(rh, SettingKeys.EXPIRATION_REMINDERS)) {
if (event.isChanged(rh.gs(SettingKeys.LOW_RESERVOIR_REMINDERS)) || event.isChanged(rh.gs(SettingKeys.EXPIRATION_REMINDERS))) {
patchManager.changeReminderSetting()
} else if (event.isChanged(rh, SettingKeys.BUZZER_REMINDERS)) {
} else if (event.isChanged(rh.gs(SettingKeys.BUZZER_REMINDERS))) {
patchManager.changeBuzzerSetting()
}
}) { throwable: Throwable -> fabricPrivacy.logException(throwable) }

View file

@ -6,7 +6,6 @@ import android.os.HandlerThread
import android.text.format.DateFormat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
import info.nightscout.androidaps.extensions.toStringFull
@ -68,6 +67,7 @@ import info.nightscout.interfaces.utils.TimeChangeType
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventOverviewBolusProgress
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventProfileSwitchChanged
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.events.EventTempBasalChange
@ -487,10 +487,10 @@ class OmnipodDashPumpPlugin @Inject constructor(
.observeOn(aapsSchedulers.main)
.subscribe(
{
if (it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_enabled) ||
it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown) ||
it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_enabled) ||
it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_units)
if (it.isChanged(rh.gs(R.string.key_omnipod_common_expiration_reminder_enabled)) ||
it.isChanged(rh.gs(R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown)) ||
it.isChanged(rh.gs(R.string.key_omnipod_common_low_reservoir_alert_enabled)) ||
it.isChanged(rh.gs(R.string.key_omnipod_common_low_reservoir_alert_units))
) {
commandQueue.customCommand(CommandUpdateAlertConfiguration(), null)
}

View file

@ -9,7 +9,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonOverviewButtonsBinding
@ -39,6 +38,7 @@ import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventQueueChanged
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP

View file

@ -35,7 +35,6 @@ import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
@ -107,6 +106,7 @@ import info.nightscout.rx.AapsSchedulers;
import info.nightscout.rx.bus.RxBus;
import info.nightscout.rx.events.EventAppExit;
import info.nightscout.rx.events.EventAppInitialized;
import info.nightscout.rx.events.EventPreferenceChange;
import info.nightscout.rx.events.EventRefreshOverview;
import info.nightscout.rx.logging.AAPSLogger;
import info.nightscout.rx.logging.LTag;
@ -330,25 +330,25 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
.toObservable(EventPreferenceChange.class)
.observeOn(aapsSchedulers.getIo())
.subscribe(event -> {
if (event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.BASAL_BEEPS_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.BOLUS_BEEPS_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.TBR_BEEPS_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.SMB_BEEPS_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.SHOW_RILEY_LINK_BATTERY_LEVEL) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.BATTERY_CHANGE_LOGGING_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED)) {
if (event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.BASAL_BEEPS_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.BOLUS_BEEPS_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.TBR_BEEPS_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.SMB_BEEPS_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.RILEY_LINK_STATS_BUTTON_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.SHOW_RILEY_LINK_BATTERY_LEVEL)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.BATTERY_CHANGE_LOGGING_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED))) {
aapsOmnipodErosManager.reloadSettings();
} else if (event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.EXPIRATION_REMINDER_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.LOW_RESERVOIR_ALERT_ENABLED) ||
event.isChanged(getRh(), OmnipodErosStorageKeys.Preferences.LOW_RESERVOIR_ALERT_UNITS)) {
} else if (event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.EXPIRATION_REMINDER_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.LOW_RESERVOIR_ALERT_ENABLED)) ||
event.isChanged(getRh().gs(OmnipodErosStorageKeys.Preferences.LOW_RESERVOIR_ALERT_UNITS))) {
if (!verifyPodAlertConfiguration()) {
getCommandQueue().customCommand(new CommandUpdateAlertConfiguration(), null);
}

View file

@ -9,7 +9,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
@ -47,6 +46,7 @@ import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventQueueChanged
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP

View file

@ -12,7 +12,6 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@ -26,6 +25,7 @@ import info.nightscout.interfaces.maintenance.ImportExportPrefs
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil

View file

@ -11,7 +11,6 @@ import android.view.Window
import android.view.WindowManager
import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
@ -37,6 +36,7 @@ import info.nightscout.interfaces.queue.Callback
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag