Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

배경화면 커스텀 #101

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
75383b5
refactor: AdminMain -> ThemeList 네이밍 리팩토링
tak8997 Dec 1, 2024
7379fe5
feat: 배경화면 커스텀 유도 바텀시트 단순 ui 작업 및 네비게이션 처리
tak8997 Dec 1, 2024
f4b2aed
feat: 백그라운드 커스텀 유도 다이얼로그 ui 및 프레젠테이션 로직 처리
tak8997 Dec 15, 2024
0c113cb
feat: banner ui 개선
tak8997 Dec 15, 2024
0ae1b2a
feat: 테마 리스트 ui 개선
tak8997 Dec 15, 2024
a29535e
feat: 타이머 배경 설정 ui 작업
tak8997 Dec 25, 2024
6569aab
feat: 배경설정 안내 ui 작업
tak8997 Dec 25, 2024
6e91fbf
feat: 구독 결제 유도 바텀시트 다이얼로그 ui 작업
tak8997 Jan 1, 2025
b2a1810
feat: 배경 설정 데이터 전달 및 이미지 처리
tak8997 Jan 5, 2025
a29d6b0
feat: 이미지 없고 배경 활성화 하려고 할때 토스트 처리
tak8997 Jan 5, 2025
763fe0a
Merge branch 'develop' into feature/배경화면_커스텀_1차
tak8997 Jan 11, 2025
da1ab2c
feat: 테마 이미지 설정 토글 api 작업
tak8997 Jan 11, 2025
d9e1c16
feat: 테마 배경 토글 api 연결 및 프레젠테이션 로직 처리
tak8997 Jan 11, 2025
5a93aa9
feat: 배경 커스텀 화면으로 이동 처리
tak8997 Jan 18, 2025
852ec03
feat: 배경화면 커스텀 상세화면 ui 작업
tak8997 Jan 19, 2025
dd41db2
feat: 줌, 드래그를 위한 PhotoView 추가
tak8997 Jan 19, 2025
cc94730
feat: 배경화면 커스텀 정보 db 저장 및 ui를 위한 클래스 추가
tak8997 Jan 25, 2025
61ee136
feat: 배경화면 커스텀 화면으로 네비게이션 처리
tak8997 Jan 25, 2025
526d976
feat: db converter 추가
tak8997 Jan 25, 2025
a4c5e48
feat: db 버전업
tak8997 Jan 25, 2025
0559876
feat: 테마 이미지 정보 필드 수정
tak8997 Jan 25, 2025
483bdeb
feat: ThemEntitiy 필드 추가
tak8997 Jan 25, 2025
0c2f856
feat: 테마 가져올때, 배경 커스텀 정보도 저장할 수 있도록 수정
tak8997 Jan 25, 2025
da289cb
feat: 배경 커스텀 ui, 프레젠테이션 로직 처리
tak8997 Jan 25, 2025
83694c6
feat: 테마 배경 설정 안내 봤는지 여부에 대한 처리
tak8997 Jan 25, 2025
d5cd6fa
revert 클래스 네이밍 수정
tak8997 Jan 25, 2025
cba83c5
Merge branch 'develop' into feature/배경화면_커스텀_1차
tak8997 Jan 25, 2025
83b73a0
feat: 어드민 메인 페이지 테마 이미지 처리
tak8997 Jan 25, 2025
56e2b17
feat: banner api 수정
tak8997 Jan 25, 2025
fe9608d
refactor: 메소드 명 수정
tak8997 Jan 25, 2025
1b6e4fe
feat: 배너 구독여부와 상관없이 보여주도록 수정
tak8997 Jan 25, 2025
6663559
refactor: 하드코딩 수정 및 클래스 필드 수정
tak8997 Jan 25, 2025
8c2518b
feat: 구독 api 연결 및 ui 처리
tak8997 Jan 30, 2025
e5ea868
feat: 월 구독 처리
tak8997 Jan 30, 2025
1c7cc2c
feat: theme 업데이트 전에 theme이 존재하는지 체크하는 dao추가
tak8997 Feb 1, 2025
da4400f
feat: 배경 활성화 api 수정된 것 반영
tak8997 Feb 1, 2025
3d18a28
fix: 배경 설정 안내 ui 버그 수정
tak8997 Feb 2, 2025
5dd9061
fix: 배경화면 커스텀 기능 안내 다이얼로그 앱 진입시 한번 봤으면 다시 안보이도록 수정
tak8997 Feb 2, 2025
e01917a
fix: 이미지 색상 틴트 적용
tak8997 Feb 2, 2025
3e508fc
fix: 테마 리프레시 로직 처리 추가
tak8997 Feb 2, 2025
9f40e28
fix: 테마 배경 이미지 placeholder 수정
tak8997 Feb 2, 2025
2a0231c
fix: 유저 구독 상태에 따른 문구 분기
tak8997 Feb 2, 2025
fa72de6
fix: 테마 배경 이미지 미리보기 ui 적용 및 centerCrop 처리
tak8997 Feb 2, 2025
72b74b7
fix: 백그라운드 이미지 커스텀 투명도 ui 수정
tak8997 Feb 2, 2025
797a2d9
fix: 이미지 커스텀 안내 ui visible 디폴값 수정
tak8997 Feb 2, 2025
c9d9e0e
fix: 배경화면 커스텀 안내 레이아웃 숨김 처리
tak8997 Feb 8, 2025
1a2d99a
fix: 배경화면 수정화면 이미지뷰 scaleType 수정
tak8997 Feb 8, 2025
1053612
feat: 게임 화면에 커스텀 배경화면 적용
tak8997 Feb 8, 2025
123a6d3
fix: 토글 싸이즈 수정
tak8997 Feb 8, 2025
06d05a6
fix: 금액에 ,(콤마) 추가
tak8997 Feb 8, 2025
4474c28
fix: 테마 안내 배경 블러 처리
tak8997 Feb 8, 2025
f9230d0
fix: dismiss -> popbackstack
tak8997 Feb 8, 2025
84bac0b
feat: 이미지 편집중이면 나가기 확인 다이얼로그 띄우기
tak8997 Feb 8, 2025
81ebd1f
fix: 이미지 드래그 할때도 안내 레이아웃 숨김 처리
tak8997 Feb 8, 2025
8a38d16
fix: game 화면에서는 이미지 터치, 드래그, 스케일 편집이 불가능하도록 처리
tak8997 Feb 8, 2025
7c896d5
fix: 배경 이미지 알파 설정
tak8997 Feb 8, 2025
e7f627f
fix: 배너 ui수정
tak8997 Feb 8, 2025
98a7799
fix: OnBackPressedCallback 수정
tak8997 Feb 8, 2025
ab02d71
fix: 커스텀 이미지 투명도 수정
tak8997 Feb 8, 2025
7267fe2
feat: 게임 시작전 배경 이미지 보여주기
tak8997 Feb 9, 2025
bc437d5
fix: rendered 플래그 제거
tak8997 Feb 9, 2025
461ee8d
fix: 테마 배경 이미지 on/off에 따른 Game화면 반영 여부 처리
tak8997 Feb 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/src/main/res/mipmap-xxhdpi/subscribe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ class SettingDataSource @Inject constructor(
data.first().userEmail
}

fun setRecommendBackgroundCustomDialogHidden(time: Long) = runBlocking {
dataStore.updateData { it.copy(backgroundCustomDialogHideUntil = time) }
}

fun getRecommendBackgroundCustomDialogHiddenUntil() = runBlocking {
data.first().backgroundCustomDialogHideUntil
juhwankim-dev marked this conversation as resolved.
Show resolved Hide resolved
}

fun getBackgroundSettingsNoticeShown() = runBlocking {
data.first().backgroundSettingsNoticeShown
}

fun updateBackgroundSettingsShown() = runBlocking {
dataStore.updateData { it.copy(backgroundSettingsNoticeShown = true) }
}

suspend fun saveAppPassword(password: String) {
dataStore.updateData {
it.copy(appPassword = password)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.nextroom.nextroom.data.datasource
import com.nextroom.nextroom.data.network.ApiService
import com.nextroom.nextroom.domain.model.Mypage
import com.nextroom.nextroom.domain.model.Result
import com.nextroom.nextroom.domain.model.SubscriptionPlan
import com.nextroom.nextroom.domain.model.Ticket
import com.nextroom.nextroom.domain.model.UserSubscribeStatus
import com.nextroom.nextroom.domain.model.mapOnSuccess
Expand All @@ -24,4 +25,8 @@ class SubscriptionDataSource @Inject constructor(
suspend fun getTicketInfo(): Result<Ticket> {
return apiService.getSubscriptionTicketInfo().mapOnSuccess { it.data.toDomainModel() }
}

suspend fun getSubscriptionPlan(): Result<SubscriptionPlan> {
return apiService.getSubscriptionPlan().mapOnSuccess { it.data.toDomainModel() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class ThemeLocalDataSource @Inject constructor(
}
}

suspend fun isThemeExist(themeId: Int): Boolean {
return themeDao.isThemeExist(themeId)
}

suspend fun getUpdatedInfo(themeId: Int): Long {
return themeTimeDao.getTimeInfo(themeId)?.recentUpdated ?: 0L
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nextroom.nextroom.data.datasource

import com.nextroom.nextroom.data.model.ThemeBackgroundActivationId
import com.nextroom.nextroom.data.network.ApiService
import com.nextroom.nextroom.data.network.response.toDomain
import com.nextroom.nextroom.domain.model.Result
Expand All @@ -15,4 +16,8 @@ class ThemeRemoteDataSource @Inject constructor(
return apiService.getThemes()
.mapOnSuccess { it.data.toDomain() }
}

suspend fun putActiveThemeBackgroundImage(themeBackgroundActivationId: ThemeBackgroundActivationId): Result<Unit> {
return apiService.putActiveThemeBackgroundImage(themeBackgroundActivationId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ data class AppSettings(
val lastLaunchDate: Long = 0L,
val emailSaveChecked: Boolean = false,
val userEmail: String = "",
val backgroundCustomDialogHideUntil: Long = 0L,
val backgroundSettingsNoticeShown: Boolean = false,
val networkDisconnectedCount: Int = 0,
val appPassword: String = "",
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.nextroom.nextroom.data.model.ThemeTimeEntity

@Database(
entities = [ThemeEntity::class, ThemeTimeEntity::class, HintEntity::class, GameStateEntity::class, GameStatsEntity::class, HintStatsEntity::class],
version = 5,
version = 7,
)
@TypeConverters(TypeConverter::class)
abstract class NextRoomDatabase : RoomDatabase() {
Expand Down
3 changes: 3 additions & 0 deletions data/src/main/java/com/nextroom/nextroom/data/db/ThemeDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ interface ThemeDao {
@Query("SELECT * FROM $THEME_TABLE_NAME WHERE themeId = :themeId LIMIT 1")
fun getTheme(themeId: Int): Flow<ThemeEntity>

@Query("SELECT EXISTS(SELECT * FROM $THEME_TABLE_NAME WHERE themeId = :themeId)")
suspend fun isThemeExist(themeId : Int) : Boolean

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertThemes(vararg themes: ThemeEntity)

Expand Down
13 changes: 13 additions & 0 deletions data/src/main/java/com/nextroom/nextroom/data/db/TypeConverter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.nextroom.nextroom.data.db
import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.nextroom.nextroom.domain.model.ThemeImageCustomInfo
import java.lang.reflect.Type


Expand All @@ -27,4 +28,16 @@ class TypeConverter {
fun listToJson(list: List<String?>?): String {
return Gson().toJson(list)
}

@TypeConverter
fun themeImageCustomInfoToJson(themeImageCustomInfo: ThemeImageCustomInfo?): String? {
if (themeImageCustomInfo == null) return null
return Gson().toJson(themeImageCustomInfo)
}

@TypeConverter
fun jsonToThemeImageCustomInfo(json: String?): ThemeImageCustomInfo? {
if (json == null) return null
return Gson().fromJson(json, ThemeImageCustomInfo::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.room.ForeignKey
import androidx.room.PrimaryKey
import com.nextroom.nextroom.data.model.GameStateEntity.Companion.GAME_STATE_TABLE
import com.nextroom.nextroom.domain.model.GameState
import com.nextroom.nextroom.domain.model.ThemeImageCustomInfo

@Entity(
tableName = GAME_STATE_TABLE,
Expand All @@ -23,6 +24,8 @@ data class GameStateEntity(
val hintLimit: Int,
val usedHints: Set<Int>,
val startTime: Long, // 게임을 시작한 시간
val themeImageUrl: String? = null,
val themeImageCustomInfo: ThemeImageCustomInfo? = null,
) {
companion object {
const val GAME_STATE_TABLE = "GameState"
Expand All @@ -38,5 +41,7 @@ fun GameStateEntity.toDomain(): GameState {
hintLimit = hintLimit,
usedHints = usedHints,
startTime = startTime,
themeImageUrl = themeImageUrl,
themeImageCustomInfo = themeImageCustomInfo
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.nextroom.nextroom.data.model

import com.google.gson.annotations.SerializedName

data class ThemeBackgroundActivationId(
@SerializedName("active")
val activate: List<Int>,
@SerializedName("deactive")
val deactivate: List<Int>
)
10 changes: 10 additions & 0 deletions data/src/main/java/com/nextroom/nextroom/data/model/ThemeEntity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.room.Entity
import androidx.room.PrimaryKey
import com.nextroom.nextroom.data.model.ThemeEntity.Companion.THEME_TABLE_NAME
import com.nextroom.nextroom.domain.model.Hint
import com.nextroom.nextroom.domain.model.ThemeImageCustomInfo
import com.nextroom.nextroom.domain.model.ThemeInfo

@Entity(tableName = THEME_TABLE_NAME)
Expand All @@ -13,6 +14,9 @@ data class ThemeEntity(
val title: String = "",
val timeLimitInMinute: Int = 60,
val hintLimit: Int = -1,
val useTimerUrl: Boolean = false,
val themeImageUrl: String? = null,
val themeImageCustomInfo: ThemeImageCustomInfo? = null
) {
companion object {
const val THEME_TABLE_NAME = "Theme"
Expand All @@ -26,6 +30,9 @@ fun ThemeEntity.toDomain(hints: List<Hint> = emptyList()): ThemeInfo {
timeLimitInMinute = timeLimitInMinute,
hintLimit = hintLimit,
hints = hints,
useTimerUrl = useTimerUrl,
themeImageUrl = themeImageUrl,
themeImageCustomInfo = themeImageCustomInfo
)
}

Expand All @@ -40,6 +47,9 @@ fun ThemeInfo.toEntity(adminCode: String): ThemeEntity {
title = title,
timeLimitInMinute = timeLimitInMinute,
hintLimit = hintLimit,
useTimerUrl = useTimerUrl,
themeImageUrl = themeImageUrl,
themeImageCustomInfo = themeImageCustomInfo
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.nextroom.nextroom.data.network

import com.nextroom.nextroom.data.network.response.SubscriptionPlanDto
import com.nextroom.nextroom.data.model.ThemeBackgroundActivationId
import com.nextroom.nextroom.data.model.TokenDto
import com.nextroom.nextroom.data.network.request.LoginRequest
import com.nextroom.nextroom.data.network.request.PurchaseToken
Expand All @@ -19,6 +21,7 @@ import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Query

interface ApiService {
Expand Down Expand Up @@ -55,4 +58,10 @@ interface ApiService {

@GET("api/v1/banner")
suspend fun getBanners(): Result<BaseListResponse<BannerDto>>

@PUT("api/v1/theme/timer/active")
suspend fun putActiveThemeBackgroundImage(@Body themeBackgroundActivationId: ThemeBackgroundActivationId): Result<Unit>

@GET("api/v1/subscription/plan")
suspend fun getSubscriptionPlan(): Result<BaseResponse<SubscriptionPlanDto>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import com.nextroom.nextroom.domain.model.Banner
data class BannerDto(
@SerializedName("description")
val description: String,
@SerializedName("imageUrl")
val imageUrl: String,
@SerializedName("url")
val imageUrl: String
val linkUrl: String
)

fun BannerDto.toDomain() = Banner(
description = description,
linkUrl = imageUrl
imageUrl = imageUrl,
linkUrl = linkUrl
)

fun List<BannerDto>.toDomain(): List<Banner> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.nextroom.nextroom.data.network.response

import com.google.gson.annotations.SerializedName
import com.nextroom.nextroom.domain.model.SubscriptionPlan
import java.math.BigDecimal

data class SubscriptionPlanDto(
@SerializedName("url")
val url: String,
@SerializedName("plans")
val plans: List<PlanDto>
) {

data class PlanDto(
@SerializedName("id")
val id: Int,
@SerializedName("subscriptionProductId")
val subscriptionProductId: String,
@SerializedName("planId")
val planId: String,
@SerializedName("productName")
val productName: String,
@SerializedName("description")
val description: String,
@SerializedName("subDescription")
val subDescription: String,
@SerializedName("originPrice")
val originPrice: BigDecimal,
@SerializedName("sellPrice")
val sellPrice: BigDecimal
) {
fun toDomainModel(): SubscriptionPlan.Plan {
return SubscriptionPlan.Plan(
id = id,
subscriptionProductId = subscriptionProductId,
planId = planId,
productName = productName,
description = description,
subDescription = subDescription,
originPrice = originPrice,
sellPrice = sellPrice
)
}
}

fun toDomainModel(): SubscriptionPlan {
return SubscriptionPlan(
url = url,
plans = plans.map { it.toDomainModel() }
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ data class ThemeDto(
val createdAt: String,
@SerializedName("modifiedAt")
val modifiedAt: String,
@SerializedName("useTimerUrl")
juhwankim-dev marked this conversation as resolved.
Show resolved Hide resolved
val useTimerUrl: Boolean,
@SerializedName("themeImageUrl")
juhwankim-dev marked this conversation as resolved.
Show resolved Hide resolved
val themeImageUrl: String? = null
)

fun ThemeDto.toDomain(hints: List<Hint> = emptyList()): ThemeInfo {
Expand All @@ -26,6 +30,8 @@ fun ThemeDto.toDomain(hints: List<Hint> = emptyList()): ThemeInfo {
timeLimitInMinute = timeLimit,
hintLimit = hintLimit,
hints = hints,
useTimerUrl = useTimerUrl,
themeImageUrl = themeImageUrl
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.nextroom.nextroom.data.datasource.UserDataSource
import com.nextroom.nextroom.domain.model.LoginInfo
import com.nextroom.nextroom.domain.model.Mypage
import com.nextroom.nextroom.domain.model.Result
import com.nextroom.nextroom.domain.model.SubscriptionPlan
import com.nextroom.nextroom.domain.model.UserSubscribeStatus
import com.nextroom.nextroom.domain.model.onSuccess
import com.nextroom.nextroom.domain.repository.AdminRepository
Expand Down Expand Up @@ -74,4 +75,8 @@ class AdminRepositoryImpl @Inject constructor(
override suspend fun getAppPassword(): String {
return settingDataSource.getAppPassword()
}

override suspend fun getSubscriptionPlan(): Result<SubscriptionPlan> {
return subscriptionDataSource.getSubscriptionPlan()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ class DataStoreRepositoryImpl @Inject constructor(
if (firstInit) settingDataSource.setLastLaunchDate()
}

override fun setRecommendBackgroundCustomDialogHidden(time: Long) {
settingDataSource.setRecommendBackgroundCustomDialogHidden(time)
}

override fun getRecommendBackgroundCustomDialogHiddenUntil(): Long {
return settingDataSource.getRecommendBackgroundCustomDialogHiddenUntil()
}

override fun updateBackgroundSettingsShown() {
settingDataSource.updateBackgroundSettingsShown()
}

override fun getBackgroundSettingsNoticeShown(): Boolean {
return settingDataSource.getBackgroundSettingsNoticeShown()
}

override suspend fun getNetworkDisconnectedCount(): Int {
return settingDataSource.getNetworkDisconnectedCount()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.nextroom.nextroom.data.db.GameStateDao
import com.nextroom.nextroom.data.model.GameStateEntity
import com.nextroom.nextroom.data.model.toDomain
import com.nextroom.nextroom.domain.model.GameState
import com.nextroom.nextroom.domain.model.ThemeImageCustomInfo
import com.nextroom.nextroom.domain.repository.GameStateRepository
import com.nextroom.nextroom.domain.repository.TimerRepository
import javax.inject.Inject
Expand All @@ -19,6 +20,8 @@ class GameStateRepositoryImpl @Inject constructor(
hintLimit: Int,
usedHints: Set<Int>,
startTime: Long,
themeImageUrl: String?,
themeImageCustomInfo: ThemeImageCustomInfo?,
) {
val themeId = settingDataSource.getLatestGameCode()
gameStateDao.insertGameState(
Expand All @@ -28,6 +31,8 @@ class GameStateRepositoryImpl @Inject constructor(
hintLimit = hintLimit,
usedHints = usedHints,
startTime = startTime,
themeImageUrl = themeImageUrl,
themeImageCustomInfo = themeImageCustomInfo
),
)
}
Expand Down
Loading