load Action String Handler
This commit is contained in:
parent
906fc35da5
commit
b077b1d5b1
2 changed files with 10 additions and 3 deletions
|
@ -59,7 +59,7 @@ class ActionStringHandler @Inject constructor(
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val rxBus: RxBusWrapper,
|
private val rxBus: RxBusWrapper,
|
||||||
private val aapsLogger: AAPSLogger,
|
private val aapsLogger: AAPSLogger,
|
||||||
aapsSchedulers: AapsSchedulers,
|
private val aapsSchedulers: AapsSchedulers,
|
||||||
private val resourceHelper: ResourceHelper,
|
private val resourceHelper: ResourceHelper,
|
||||||
private val injector: HasAndroidInjector,
|
private val injector: HasAndroidInjector,
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
@ -92,7 +92,7 @@ class ActionStringHandler @Inject constructor(
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
init {
|
fun setup() {
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventWearInitiateAction::class.java)
|
.toObservable(EventWearInitiateAction::class.java)
|
||||||
.observeOn(aapsSchedulers.main)
|
.observeOn(aapsSchedulers.main)
|
||||||
|
@ -104,6 +104,10 @@ class ActionStringHandler @Inject constructor(
|
||||||
.subscribe({ handleConfirmation(it.action) }, fabricPrivacy::logException)
|
.subscribe({ handleConfirmation(it.action) }, fabricPrivacy::logException)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun tearDown(){
|
||||||
|
disposable.clear()
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private fun handleInitiate(actionString: String) {
|
private fun handleInitiate(actionString: String) {
|
||||||
if (!sp.getBoolean(R.string.key_wear_control, false)) return
|
if (!sp.getBoolean(R.string.key_wear_control, false)) return
|
||||||
|
|
|
@ -35,7 +35,8 @@ class WearPlugin @Inject constructor(
|
||||||
private val mainApp: MainApp,
|
private val mainApp: MainApp,
|
||||||
private val fabricPrivacy: FabricPrivacy,
|
private val fabricPrivacy: FabricPrivacy,
|
||||||
private val loopPlugin: Lazy<LoopPlugin>,
|
private val loopPlugin: Lazy<LoopPlugin>,
|
||||||
private val rxBus: RxBusWrapper
|
private val rxBus: RxBusWrapper,
|
||||||
|
private val actionStringHandler: Lazy<ActionStringHandler>
|
||||||
|
|
||||||
) : PluginBase(PluginDescription()
|
) : PluginBase(PluginDescription()
|
||||||
.mainType(PluginType.GENERAL)
|
.mainType(PluginType.GENERAL)
|
||||||
|
@ -127,11 +128,13 @@ class WearPlugin @Inject constructor(
|
||||||
mainApp.startService(intent)
|
mainApp.startService(intent)
|
||||||
}
|
}
|
||||||
}, fabricPrivacy::logException))
|
}, fabricPrivacy::logException))
|
||||||
|
actionStringHandler.get().setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
disposable.clear()
|
disposable.clear()
|
||||||
super.onStop()
|
super.onStop()
|
||||||
|
actionStringHandler.get().setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendDataToWatch(status: Boolean, basals: Boolean, bgValue: Boolean) {
|
private fun sendDataToWatch(status: Boolean, basals: Boolean, bgValue: Boolean) {
|
||||||
|
|
Loading…
Reference in a new issue