refactor: Drop per-emission flow logger and redundant widget logs

This commit is contained in:
darken
2026-04-25 16:19:21 +02:00
committed by Matthias Urhahn
parent 5360f54ea8
commit 5e727e907d
3 changed files with 2 additions and 16 deletions
@@ -16,7 +16,6 @@ import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.scan
import kotlinx.coroutines.flow.shareIn
@@ -54,7 +53,6 @@ fun <T> Flow<T>.takeUntilAfter(predicate: suspend (T) -> Boolean) = transformWhi
fun <T> Flow<T>.setupCommonEventHandlers(tag: String, identifier: () -> String) = this
.onStart { log(tag, VERBOSE) { "${identifier()}.onStart()" } }
.onEach { log(tag, VERBOSE) { "${identifier()}.onEach(): $it" } }
.onCompletion { log(tag, VERBOSE) { "${identifier()}.onCompletion()" } }
.catch {
if (it.hasCause(CancellationException::class)) {
@@ -3,9 +3,6 @@ package eu.darken.capod.main.ui.widget
import android.content.Context
import androidx.glance.appwidget.updateAll
import dagger.hilt.android.qualifiers.ApplicationContext
import eu.darken.capod.common.debug.logging.Logging.Priority.VERBOSE
import eu.darken.capod.common.debug.logging.log
import eu.darken.capod.common.debug.logging.logTag
import javax.inject.Inject
import javax.inject.Singleton
@@ -16,12 +13,7 @@ class WidgetManager @Inject constructor(
) {
suspend fun refreshWidgets() {
log(TAG, VERBOSE) { "refreshWidgets()" }
BatteryGlanceWidget().updateAll(context)
AncGlanceWidget().updateAll(context)
}
companion object {
val TAG = logTag("Widget", "Manager")
}
}
@@ -36,12 +36,8 @@ class WidgetSettings @Inject constructor(
}
}
fun getWidgetProfile(widgetId: Int): ProfileId? {
val profileId = runBlocking {
dataStore.data.first()[stringPreferencesKey(getWidgetProfileKey(widgetId))]
}
log(TAG, VERBOSE) { "getWidgetProfile(widgetId=$widgetId) = $profileId" }
return profileId
fun getWidgetProfile(widgetId: Int): ProfileId? = runBlocking {
dataStore.data.first()[stringPreferencesKey(getWidgetProfileKey(widgetId))]
}
fun removeWidget(widgetId: Int) {