Skip to content

Commit

Permalink
[FEATURE]#218 : FeatureOverview API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Jan 30, 2025
1 parent fd1745d commit 326cc20
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 = "설정하기"),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.bff.wespot.model.dynamicui.component

data class ButtonComponent(
val text: String = "",
val link: String = "",
) : DynamicUiComponent
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.bff.wespot.model.dynamicui.component

sealed interface DynamicUiComponent
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.bff.wespot.model.dynamicui.component

data class TextComponent(
val text: String = "",
) : DynamicUiComponent
8 changes: 8 additions & 0 deletions data/src/main/kotlin/com/bff/wespot/data/di/DataModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -96,4 +98,10 @@ abstract class DataModule {
abstract fun messagingRepository(
messagingRepositoryImpl: MessagingRepositoryImpl
): MessagingRepository

@Binds
@Singleton
abstract fun dynamicUiRepository(
dynamicUiRepositoryImpl: DynamicUiRepositoryImpl
): DynamicUiRepository
}
Original file line number Diff line number Diff line change
@@ -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<FeatureOverview> =
dynamicUiDataSource.getFeatureOverview(notificationType.name).mapCatching { response ->
response.toFeatureOverview()
}
}
Original file line number Diff line number Diff line change
@@ -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<FeatureOverview>
}

0 comments on commit 326cc20

Please sign in to comment.