From 326cc2012a60cc593d4feae1f19ab3b4e93ee396 Mon Sep 17 00:00:00 2001 From: jeongjaino Date: Fri, 31 Jan 2025 00:10:01 +0900 Subject: [PATCH] =?UTF-8?q?[FEATURE]#218=20:=20FeatureOverview=20API=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/model/dynamicui/FeatureOverview.kt | 12 ++++++++++++ .../dynamicui/component/ButtonComponent.kt | 6 ++++++ .../dynamicui/component/DynamicUiComponent.kt | 3 +++ .../dynamicui/component/ImageComponent.kt | 10 ++++++++++ .../model/dynamicui/component/TextComponent.kt | 5 +++++ .../com/bff/wespot/data/di/DataModule.kt | 8 ++++++++ .../dynamicui/DynamicUiRepositoryImpl.kt | 18 ++++++++++++++++++ .../dynamicui/DynamicUiRepository.kt | 8 ++++++++ 8 files changed, 70 insertions(+) create mode 100644 core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/FeatureOverview.kt create mode 100644 core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ButtonComponent.kt create mode 100644 core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/DynamicUiComponent.kt create mode 100644 core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ImageComponent.kt create mode 100644 core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/TextComponent.kt create mode 100644 data/src/main/kotlin/com/bff/wespot/data/repository/dynamicui/DynamicUiRepositoryImpl.kt create mode 100644 domain/src/main/kotlin/com/bff/wespot/domain/repository/dynamicui/DynamicUiRepository.kt diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/FeatureOverview.kt b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/FeatureOverview.kt new file mode 100644 index 00000000..cbe44c12 --- /dev/null +++ b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/FeatureOverview.kt @@ -0,0 +1,12 @@ +package com.bff.wespot.model.dynamicui + +import com.bff.wespot.model.dynamicui.component.ButtonComponent +import com.bff.wespot.model.dynamicui.component.ImageComponent +import com.bff.wespot.model.dynamicui.component.TextComponent + +data class FeatureOverview( + val headerText: TextComponent = TextComponent("새로운 기능"), + val overview: ImageComponent = ImageComponent(), + val dismissButton: ButtonComponent = ButtonComponent(text = "다음에 하기"), + val navigateButton: ButtonComponent = ButtonComponent(text = "설정하기"), +) diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ButtonComponent.kt b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ButtonComponent.kt new file mode 100644 index 00000000..6d7953de --- /dev/null +++ b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ButtonComponent.kt @@ -0,0 +1,6 @@ +package com.bff.wespot.model.dynamicui.component + +data class ButtonComponent( + val text: String = "", + val link: String = "", +) : DynamicUiComponent diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/DynamicUiComponent.kt b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/DynamicUiComponent.kt new file mode 100644 index 00000000..e86cf0eb --- /dev/null +++ b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/DynamicUiComponent.kt @@ -0,0 +1,3 @@ +package com.bff.wespot.model.dynamicui.component + +sealed interface DynamicUiComponent diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ImageComponent.kt b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ImageComponent.kt new file mode 100644 index 00000000..7ffbad94 --- /dev/null +++ b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/ImageComponent.kt @@ -0,0 +1,10 @@ +package com.bff.wespot.model.dynamicui.component + +data class ImageComponent( + val url: String = "", + val width: Int = -1, + val height: Int = -1, +) : DynamicUiComponent { + fun isFillMaxWidth() = this.width == 0 + fun isFillMaxHeight() = this.height == 0 +} diff --git a/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/TextComponent.kt b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/TextComponent.kt new file mode 100644 index 00000000..fe891719 --- /dev/null +++ b/core/model/src/main/kotlin/com/bff/wespot/model/dynamicui/component/TextComponent.kt @@ -0,0 +1,5 @@ +package com.bff.wespot.model.dynamicui.component + +data class TextComponent( + val text: String = "", +) : DynamicUiComponent diff --git a/data/src/main/kotlin/com/bff/wespot/data/di/DataModule.kt b/data/src/main/kotlin/com/bff/wespot/data/di/DataModule.kt index 54ebde31..337e2722 100644 --- a/data/src/main/kotlin/com/bff/wespot/data/di/DataModule.kt +++ b/data/src/main/kotlin/com/bff/wespot/data/di/DataModule.kt @@ -4,6 +4,7 @@ import com.bff.wespot.data.repository.CommonRepositoryImpl import com.bff.wespot.data.repository.DataStoreRepositoryImpl import com.bff.wespot.data.repository.firebase.config.RemoteConfigRepositoryImpl import com.bff.wespot.data.repository.auth.AuthRepositoryImpl +import com.bff.wespot.data.repository.dynamicui.DynamicUiRepositoryImpl import com.bff.wespot.data.repository.firebase.messaging.MessagingRepositoryImpl import com.bff.wespot.data.repository.message.MessageRepositoryImpl import com.bff.wespot.data.repository.message.MessageStorageRepositoryImpl @@ -15,6 +16,7 @@ import com.bff.wespot.domain.repository.CommonRepository import com.bff.wespot.domain.repository.DataStoreRepository import com.bff.wespot.domain.repository.firebase.config.RemoteConfigRepository import com.bff.wespot.domain.repository.auth.AuthRepository +import com.bff.wespot.domain.repository.dynamicui.DynamicUiRepository import com.bff.wespot.domain.repository.firebase.messaging.MessagingRepository import com.bff.wespot.domain.repository.message.MessageRepository import com.bff.wespot.domain.repository.message.MessageStorageRepository @@ -96,4 +98,10 @@ abstract class DataModule { abstract fun messagingRepository( messagingRepositoryImpl: MessagingRepositoryImpl ): MessagingRepository + + @Binds + @Singleton + abstract fun dynamicUiRepository( + dynamicUiRepositoryImpl: DynamicUiRepositoryImpl + ): DynamicUiRepository } diff --git a/data/src/main/kotlin/com/bff/wespot/data/repository/dynamicui/DynamicUiRepositoryImpl.kt b/data/src/main/kotlin/com/bff/wespot/data/repository/dynamicui/DynamicUiRepositoryImpl.kt new file mode 100644 index 00000000..3f8ddcf9 --- /dev/null +++ b/data/src/main/kotlin/com/bff/wespot/data/repository/dynamicui/DynamicUiRepositoryImpl.kt @@ -0,0 +1,18 @@ +package com.bff.wespot.data.repository.dynamicui + +import com.bff.wespot.data.remote.source.dynamicui.DynamicUiDataSource +import com.bff.wespot.domain.repository.dynamicui.DynamicUiRepository +import com.bff.wespot.model.dynamicui.FeatureOverview +import com.bff.wespot.model.notification.NotificationType +import javax.inject.Inject + +class DynamicUiRepositoryImpl @Inject constructor( + private val dynamicUiDataSource: DynamicUiDataSource, +): DynamicUiRepository { + override suspend fun getFeatureOverview( + notificationType: NotificationType, + ): Result = + dynamicUiDataSource.getFeatureOverview(notificationType.name).mapCatching { response -> + response.toFeatureOverview() + } +} diff --git a/domain/src/main/kotlin/com/bff/wespot/domain/repository/dynamicui/DynamicUiRepository.kt b/domain/src/main/kotlin/com/bff/wespot/domain/repository/dynamicui/DynamicUiRepository.kt new file mode 100644 index 00000000..44f28908 --- /dev/null +++ b/domain/src/main/kotlin/com/bff/wespot/domain/repository/dynamicui/DynamicUiRepository.kt @@ -0,0 +1,8 @@ +package com.bff.wespot.domain.repository.dynamicui + +import com.bff.wespot.model.dynamicui.FeatureOverview +import com.bff.wespot.model.notification.NotificationType + +interface DynamicUiRepository { + suspend fun getFeatureOverview(notificationType: NotificationType): Result +}