File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
app/src/main/java/to/bitkit/repositories Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ class WidgetsRepo @Inject constructor(
4444 private val widgetsStore : WidgetsStore ,
4545 private val settingsStore : SettingsStore ,
4646) {
47- // TODO Only refresh in loop widgets displayed in the Home
48- // TODO Perform a refresh when the preview screen is displayed
4947 private val repoScope = CoroutineScope (bgDispatcher + SupervisorJob ())
5048
5149 val widgetsDataFlow = widgetsStore.data
@@ -126,7 +124,14 @@ class WidgetsRepo @Inject constructor(
126124 ) {
127125 repoScope.launch {
128126 while (true ) {
129- updateWidget(service, updateStore)
127+ val isEnabled = widgetsDataFlow.first().widgets.any {
128+ it.type == service.widgetType
129+ }
130+
131+ if (isEnabled) {
132+ updateWidget(service, updateStore)
133+ }
134+
130135 delay(service.refreshInterval)
131136 }
132137 }
You can’t perform that action at this time.
0 commit comments