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 +}