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.content.Context
|
||||
import dagger.Lazy
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.MainApp
|
||||
|
@ -50,7 +51,7 @@ class ActionStringHandler @Inject constructor(
|
|||
private val constraintChecker: ConstraintChecker,
|
||||
private val profileFunction: ProfileFunction,
|
||||
private val mainApp: MainApp,
|
||||
private val loopPlugin: LoopPlugin,
|
||||
private val loopPlugin: Lazy<LoopPlugin>,
|
||||
private val wearPlugin: WearPlugin,
|
||||
private val treatmentsPlugin: TreatmentsPlugin,
|
||||
private val configBuilderPlugin: ConfigBuilderPlugin,
|
||||
|
@ -390,7 +391,7 @@ class ActionStringHandler @Inject constructor(
|
|||
get() {
|
||||
var ret = ""
|
||||
// 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()) {
|
||||
"CLOSED LOOP\n"
|
||||
} else {
|
||||
|
@ -500,7 +501,7 @@ class ActionStringHandler @Inject constructor(
|
|||
} else if ("dismissoverviewnotification" == act[0]) {
|
||||
rxBus.send(EventDismissNotification(SafeParse.stringToInt(act[1])))
|
||||
} else if ("changeRequest" == act[0]) {
|
||||
loopPlugin.acceptChangeRequest()
|
||||
loopPlugin.get().acceptChangeRequest()
|
||||
val notificationManager = mainApp.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.cancel(Constants.notificationID)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.general.wear
|
||||
|
||||
import android.content.Intent
|
||||
import dagger.Lazy
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
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.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||
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.sharedPreferences.SP
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import javax.inject.Inject
|
||||
|
@ -28,7 +29,7 @@ class WearPlugin internal @Inject constructor(
|
|||
private val resourceHelper: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val mainApp: MainApp,
|
||||
private val loopPlugin: LoopPlugin
|
||||
private val loopPlugin: Lazy<LoopPlugin>
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
.fragmentClass(WearFragment::class.java.name)
|
||||
|
@ -77,7 +78,7 @@ class WearPlugin internal @Inject constructor(
|
|||
disposable.add(rxBus
|
||||
.toObservable(EventRefreshOverview::class.java)
|
||||
.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
|
||||
.toObservable(EventBolusRequested::class.java)
|
||||
.observeOn(Schedulers.io())
|
||||
|
|
Loading…
Reference in a new issue