Skip to content

Commit f24bc05

Browse files
committed
chore: remove unused code
1 parent 97a63fb commit f24bc05

File tree

1 file changed

+3
-38
lines changed

1 file changed

+3
-38
lines changed

app/src/main/java/to/bitkit/repositories/WidgetsRepo.kt

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class WidgetsRepo @Inject constructor(
6969
observeWidgetStateChanges()
7070
}
7171

72-
/**
73-
* Observe widget enable/disable changes and manage coroutine lifecycle
74-
*/
7572
private fun observeWidgetStateChanges() {
7673
repoScope.launch {
7774
widgetsDataFlow
@@ -83,11 +80,7 @@ class WidgetsRepo @Inject constructor(
8380
}
8481
}
8582

86-
/**
87-
* Sync running jobs with enabled widgets
88-
* - Cancel jobs for disabled widgets
89-
* - Start jobs for newly enabled widgets
90-
*/
83+
9184
private fun updateWidgetJobs(enabledWidgetTypes: Set<WidgetType>) {
9285
val widgetTypesWithServices = WidgetType.entries.filter {
9386
it != WidgetType.CALCULATOR
@@ -105,9 +98,6 @@ class WidgetsRepo @Inject constructor(
10598
}
10699
}
107100

108-
/**
109-
* Start periodic refresh for a specific widget type
110-
*/
111101
private fun startWidgetRefresh(widgetType: WidgetType) {
112102
stopWidgetRefresh(widgetType)
113103

@@ -153,9 +143,7 @@ class WidgetsRepo @Inject constructor(
153143
widgetJobs[widgetType] = job
154144
}
155145

156-
/**
157-
* Stop refresh coroutine for a specific widget type
158-
*/
146+
159147
private fun stopWidgetRefresh(widgetType: WidgetType) {
160148
widgetJobs[widgetType]?.cancel()
161149
widgetJobs.remove(widgetType)
@@ -191,9 +179,7 @@ class WidgetsRepo @Inject constructor(
191179

192180
suspend fun fetchAllPeriods() = withContext(bgDispatcher) { priceService.fetchAllPeriods() }
193181

194-
/**
195-
* Update a specific widget type
196-
*/
182+
197183
private suspend fun <T> updateWidget(
198184
service: WidgetService<T>,
199185
updateStore: suspend (T) -> Unit,
@@ -213,27 +199,6 @@ class WidgetsRepo @Inject constructor(
213199
_refreshStates.update { it + (widgetType to false) }
214200
}
215201

216-
/**
217-
* Manually refresh all widgets
218-
*/
219-
suspend fun refreshAllWidgets(): Result<Unit> = runCatching {
220-
updateWidget(newsService) { articles ->
221-
widgetsStore.updateArticles(articles)
222-
}
223-
updateWidget(factsService) { facts ->
224-
widgetsStore.updateFacts(facts)
225-
}
226-
updateWidget(blocksService) { block ->
227-
widgetsStore.updateBlock(block)
228-
}
229-
updateWidget(weatherService) { weather ->
230-
widgetsStore.updateWeather(weather)
231-
}
232-
updateWidget(priceService) { price ->
233-
widgetsStore.updatePrice(price)
234-
}
235-
}
236-
237202
suspend fun refreshEnabledWidgets() = withContext(bgDispatcher) {
238203
widgetsDataFlow.first().widgets.forEach {
239204
refreshWidget(it.type)

0 commit comments

Comments
 (0)