resolve cyclic dependency
This commit is contained in:
parent
65f107b01d
commit
389ef01861
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.general.wear
|
||||||
|
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import dagger.Lazy
|
||||||
import info.nightscout.androidaps.Config
|
import info.nightscout.androidaps.Config
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
|
@ -50,7 +51,7 @@ class ActionStringHandler @Inject constructor(
|
||||||
private val constraintChecker: ConstraintChecker,
|
private val constraintChecker: ConstraintChecker,
|
||||||
private val profileFunction: ProfileFunction,
|
private val profileFunction: ProfileFunction,
|
||||||
private val mainApp: MainApp,
|
private val mainApp: MainApp,
|
||||||
private val loopPlugin: LoopPlugin,
|
private val loopPlugin: Lazy<LoopPlugin>,
|
||||||
private val wearPlugin: WearPlugin,
|
private val wearPlugin: WearPlugin,
|
||||||
private val treatmentsPlugin: TreatmentsPlugin,
|
private val treatmentsPlugin: TreatmentsPlugin,
|
||||||
private val configBuilderPlugin: ConfigBuilderPlugin,
|
private val configBuilderPlugin: ConfigBuilderPlugin,
|
||||||
|
@ -390,7 +391,7 @@ class ActionStringHandler @Inject constructor(
|
||||||
get() {
|
get() {
|
||||||
var ret = ""
|
var ret = ""
|
||||||
// decide if enabled/disabled closed/open; what Plugin as APS?
|
// decide if enabled/disabled closed/open; what Plugin as APS?
|
||||||
if (loopPlugin.isEnabled(loopPlugin.getType())) {
|
if (loopPlugin.get().isEnabled(loopPlugin.get().getType())) {
|
||||||
ret += if (constraintChecker.isClosedLoopAllowed().value()) {
|
ret += if (constraintChecker.isClosedLoopAllowed().value()) {
|
||||||
"CLOSED LOOP\n"
|
"CLOSED LOOP\n"
|
||||||
} else {
|
} else {
|
||||||
|
@ -500,7 +501,7 @@ class ActionStringHandler @Inject constructor(
|
||||||
} else if ("dismissoverviewnotification" == act[0]) {
|
} else if ("dismissoverviewnotification" == act[0]) {
|
||||||
rxBus.send(EventDismissNotification(SafeParse.stringToInt(act[1])))
|
rxBus.send(EventDismissNotification(SafeParse.stringToInt(act[1])))
|
||||||
} else if ("changeRequest" == act[0]) {
|
} else if ("changeRequest" == act[0]) {
|
||||||
loopPlugin.acceptChangeRequest()
|
loopPlugin.get().acceptChangeRequest()
|
||||||
val notificationManager = mainApp.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = mainApp.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
notificationManager.cancel(Constants.notificationID)
|
notificationManager.cancel(Constants.notificationID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.general.wear
|
package info.nightscout.androidaps.plugins.general.wear
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import dagger.Lazy
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.events.*
|
import info.nightscout.androidaps.events.*
|
||||||
|
@ -15,8 +16,8 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
|
||||||
import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService
|
import info.nightscout.androidaps.plugins.general.wear.wearintegration.WatchUpdaterService
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -28,7 +29,7 @@ class WearPlugin internal @Inject constructor(
|
||||||
private val resourceHelper: ResourceHelper,
|
private val resourceHelper: ResourceHelper,
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val mainApp: MainApp,
|
private val mainApp: MainApp,
|
||||||
private val loopPlugin: LoopPlugin
|
private val loopPlugin: Lazy<LoopPlugin>
|
||||||
) : PluginBase(PluginDescription()
|
) : PluginBase(PluginDescription()
|
||||||
.mainType(PluginType.GENERAL)
|
.mainType(PluginType.GENERAL)
|
||||||
.fragmentClass(WearFragment::class.java.name)
|
.fragmentClass(WearFragment::class.java.name)
|
||||||
|
@ -77,7 +78,7 @@ class WearPlugin internal @Inject constructor(
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventRefreshOverview::class.java)
|
.toObservable(EventRefreshOverview::class.java)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe({ event: EventRefreshOverview? -> if (WatchUpdaterService.shouldReportLoopStatus(loopPlugin.isEnabled(PluginType.LOOP))) sendDataToWatch(true, false, false) }) { FabricPrivacy.logException(it) })
|
.subscribe({ event: EventRefreshOverview? -> if (WatchUpdaterService.shouldReportLoopStatus(loopPlugin.get().isEnabled(PluginType.LOOP))) sendDataToWatch(true, false, false) }) { FabricPrivacy.logException(it) })
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
.toObservable(EventBolusRequested::class.java)
|
.toObservable(EventBolusRequested::class.java)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
|
|
Loading…
Reference in a new issue