Commit 8c3d4828 authored by Mygod's avatar Mygod

Ensure broadcast in main

parent 3e9674eb
...@@ -194,12 +194,12 @@ object BaseService { ...@@ -194,12 +194,12 @@ object BaseService {
callbacks.unregister(cb) callbacks.unregister(cb)
} }
fun stateChanged(s: State, msg: String?) { fun stateChanged(s: State, msg: String?) = launch {
val profileName = profileName val profileName = profileName
broadcast { it.stateChanged(s.ordinal, profileName, msg) } broadcast { it.stateChanged(s.ordinal, profileName, msg) }
} }
fun trafficPersisted(ids: List<Long>) { fun trafficPersisted(ids: List<Long>) = launch {
if (bandwidthListeners.isNotEmpty() && ids.isNotEmpty()) broadcast { item -> if (bandwidthListeners.isNotEmpty() && ids.isNotEmpty()) broadcast { item ->
if (bandwidthListeners.contains(item.asBinder())) ids.forEach(item::trafficPersisted) if (bandwidthListeners.contains(item.asBinder())) ids.forEach(item::trafficPersisted)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment