From 28dfecfe20ed437ad0903fb2d863d5339203cb51 Mon Sep 17 00:00:00 2001 From: Jeong Taehun Date: Thu, 7 Sep 2023 08:27:18 +0900 Subject: [PATCH] =?UTF-8?q?[#259,=20=EC=9C=84=EC=A0=AF=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [작업내용] - Lint Error 제거 --- .../com/droidknights/app2023/DroidKnightsWidget.kt | 9 ++++----- .../droidknights/app2023/DroidKnightsWidgetReceiver.kt | 9 ++++----- .../kotlin/com/droidknights/app2023/WidgetSessionCard.kt | 1 - .../kotlin/com/droidknights/app2023/di/WidgetModule.kt | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt b/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt index a521cca4..cb8d8a79 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidget.kt @@ -26,7 +26,7 @@ import androidx.glance.layout.padding import com.droidknights.app2023.DroidKnightsWidgetReceiver.Companion.KEY_SESSION_IDS import com.droidknights.app2023.core.designsystem.theme.KnightsGlanceTheme import com.droidknights.app2023.core.model.Session -import com.droidknights.app2023.di.WidgetInterface +import com.droidknights.app2023.di.WidgetModule import dagger.hilt.EntryPoints class DroidKnightsWidget : GlanceAppWidget() { @@ -36,10 +36,9 @@ class DroidKnightsWidget : GlanceAppWidget() { } override suspend fun provideGlance(context: Context, id: GlanceId) { - - val widgetInterface: WidgetInterface = EntryPoints.get( + val widgetModule: WidgetModule = EntryPoints.get( context.applicationContext, - WidgetInterface::class.java + WidgetModule::class.java ) provideContent { @@ -50,7 +49,7 @@ class DroidKnightsWidget : GlanceAppWidget() { LaunchedEffect(state) { list = arrayListOf().apply { state?.forEach { - this.add(widgetInterface.getSessionUseCase().invoke(it)) + this.add(widgetModule.getSessionUseCase().invoke(it)) } } } diff --git a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt b/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt index 9d1067c9..56138a57 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/DroidKnightsWidgetReceiver.kt @@ -10,7 +10,7 @@ import androidx.glance.appwidget.GlanceAppWidgetReceiver import androidx.glance.appwidget.state.updateAppWidgetState import androidx.glance.appwidget.updateAll import androidx.glance.state.PreferencesGlanceStateDefinition -import com.droidknights.app2023.di.WidgetInterface +import com.droidknights.app2023.di.WidgetModule import dagger.hilt.EntryPoints import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope @@ -41,19 +41,18 @@ class DroidKnightsWidgetReceiver : GlanceAppWidgetReceiver() { } } - private fun getBookmarkedSessionAndUpdateWidget( context: Context, glanceAppWidget: GlanceAppWidget ) { - val widgetInterface: WidgetInterface = EntryPoints.get( + val widgetModule: WidgetModule = EntryPoints.get( context.applicationContext, - WidgetInterface::class.java + WidgetModule::class.java ) CoroutineScope(Dispatchers.IO).launch { val glanceIds = GlanceAppWidgetManager(context).getGlanceIds(DroidKnightsWidget::class.java) - widgetInterface.getBookmarkedSessionsUseCase().invoke().collect { list -> + widgetModule.getBookmarkedSessionsUseCase().invoke().collect { list -> glanceIds.forEach { glanceId -> updateAppWidgetState( context = context, diff --git a/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt b/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt index 3f19bd7f..80c54c5c 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/WidgetSessionCard.kt @@ -57,7 +57,6 @@ fun WidgetSessionCard(session: Session) { ) ) } - } } } diff --git a/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt b/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt index dfd781ca..5a094033 100644 --- a/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt +++ b/widget/src/main/kotlin/com/droidknights/app2023/di/WidgetModule.kt @@ -8,7 +8,7 @@ import dagger.hilt.components.SingletonComponent @EntryPoint @InstallIn(SingletonComponent::class) -interface WidgetInterface { +interface WidgetModule { fun getBookmarkedSessionsUseCase(): GetBookmarkedSessionsUseCase fun getSessionUseCase(): GetSessionUseCase