From c7026d6f0bc9b7a3c24b6ed5c3c46e529a748b8f Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Dec 2024 05:06:49 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[FIX/#185]=20=EC=83=9D=EC=84=B1=EB=B7=B0=20?= =?UTF-8?q?=EC=98=88=EC=8B=9C=20=ED=94=84=EB=A1=AC=ED=94=84=ED=8A=B8=20API?= =?UTF-8?q?=20type=20path=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/kr/genti/data/dataSource/CreateDataSource.kt | 2 +- .../kr/genti/data/dataSourceImpl/CreateDataSourceImpl.kt | 4 ++-- .../kr/genti/data/repositoryImpl/CreateRepositoryImpl.kt | 4 ++-- data/src/main/java/kr/genti/data/service/CreateService.kt | 7 +++++-- .../kotlin/kr/genti/domain/repository/CreateRepository.kt | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/data/src/main/java/kr/genti/data/dataSource/CreateDataSource.kt b/data/src/main/java/kr/genti/data/dataSource/CreateDataSource.kt index 4a8ee18..f0c0b28 100644 --- a/data/src/main/java/kr/genti/data/dataSource/CreateDataSource.kt +++ b/data/src/main/java/kr/genti/data/dataSource/CreateDataSource.kt @@ -22,7 +22,7 @@ interface CreateDataSource { suspend fun postToVerify(request: KeyRequestDto): BaseResponse - suspend fun getPromptExample(): BaseResponse> + suspend fun getPromptExample(type: String): BaseResponse> suspend fun postToValidatePurchase(request: PurchaseValidRequestDto): BaseResponse } diff --git a/data/src/main/java/kr/genti/data/dataSourceImpl/CreateDataSourceImpl.kt b/data/src/main/java/kr/genti/data/dataSourceImpl/CreateDataSourceImpl.kt index d29961b..3a800fa 100644 --- a/data/src/main/java/kr/genti/data/dataSourceImpl/CreateDataSourceImpl.kt +++ b/data/src/main/java/kr/genti/data/dataSourceImpl/CreateDataSourceImpl.kt @@ -35,8 +35,8 @@ constructor( override suspend fun postToVerify(request: KeyRequestDto): BaseResponse = createService.postToVerify(request) - override suspend fun getPromptExample(): BaseResponse> = - createService.getPromptExample() + override suspend fun getPromptExample(type: String): BaseResponse> = + createService.getPromptExample(type) override suspend fun postToValidatePurchase(request: PurchaseValidRequestDto): BaseResponse = createService.postToValidatePurchase(request) diff --git a/data/src/main/java/kr/genti/data/repositoryImpl/CreateRepositoryImpl.kt b/data/src/main/java/kr/genti/data/repositoryImpl/CreateRepositoryImpl.kt index 4315dae..bcbbb7b 100644 --- a/data/src/main/java/kr/genti/data/repositoryImpl/CreateRepositoryImpl.kt +++ b/data/src/main/java/kr/genti/data/repositoryImpl/CreateRepositoryImpl.kt @@ -51,9 +51,9 @@ constructor( createDataSource.postToVerify(request.toDto()).response } - override suspend fun getPromptExample(): Result> = + override suspend fun getPromptExample(type: String): Result> = runCatching { - createDataSource.getPromptExample().response.map { it.toModel() } + createDataSource.getPromptExample(type).response.map { it.toModel() } } override suspend fun postToValidatePurchase(request: PurchaseValidRequestModel): Result = diff --git a/data/src/main/java/kr/genti/data/service/CreateService.kt b/data/src/main/java/kr/genti/data/service/CreateService.kt index 7ff94fc..997d53f 100644 --- a/data/src/main/java/kr/genti/data/service/CreateService.kt +++ b/data/src/main/java/kr/genti/data/service/CreateService.kt @@ -11,6 +11,7 @@ import kr.genti.data.dto.response.S3PresignedUrlDto import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.POST +import retrofit2.http.Path interface CreateService { @POST("api/v1/presigned-url") @@ -43,8 +44,10 @@ interface CreateService { @Body request: KeyRequestDto, ): BaseResponse - @GET("api/v1/users/examples/with-picture-square") - suspend fun getPromptExample(): BaseResponse> + @GET("api/v1/users/examples/with-picture-square/{type}") + suspend fun getPromptExample( + @Path("type") type: String + ): BaseResponse> @POST("api/v1/users/in-app-purchases/google/receipt-validation") suspend fun postToValidatePurchase( diff --git a/domain/src/main/kotlin/kr/genti/domain/repository/CreateRepository.kt b/domain/src/main/kotlin/kr/genti/domain/repository/CreateRepository.kt index 8c48933..241790f 100644 --- a/domain/src/main/kotlin/kr/genti/domain/repository/CreateRepository.kt +++ b/domain/src/main/kotlin/kr/genti/domain/repository/CreateRepository.kt @@ -21,7 +21,7 @@ interface CreateRepository { suspend fun postToVerify(request: KeyRequestModel): Result - suspend fun getPromptExample(): Result> + suspend fun getPromptExample(type: String): Result> suspend fun postToValidatePurchase(request: PurchaseValidRequestModel): Result } From 889d2367eb1ffda028c9dddd3ffa2da835145739 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Dec 2024 05:13:43 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[FIX/#185]=20=EC=83=9D=EC=84=B1=EB=B7=B0=20?= =?UTF-8?q?=EC=98=88=EC=8B=9C=20=ED=94=84=EB=A1=AC=ED=94=84=ED=8A=B8=20API?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/create/CreateViewModel.kt | 17 +++++++++----- .../presentation/create/DefineFragment.kt | 23 +++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/presentation/src/main/java/kr/genti/presentation/create/CreateViewModel.kt b/presentation/src/main/java/kr/genti/presentation/create/CreateViewModel.kt index d756915..7299d6c 100644 --- a/presentation/src/main/java/kr/genti/presentation/create/CreateViewModel.kt +++ b/presentation/src/main/java/kr/genti/presentation/create/CreateViewModel.kt @@ -73,10 +73,6 @@ constructor( private var firstImageS3KeyList = listOf() private var secondImageS3KeyList = listOf() - init { - // getExamplePrompt() - } - fun modCurrentPercent(amount: Int) { _currentPercent.value += amount } @@ -116,11 +112,16 @@ constructor( _totalGeneratingState.value = UiState.Empty } - private fun getExamplePrompt() { + fun getExamplePrompt() { _getExampleState.value = UiState.Loading + val currentType = when { + !isCreatingParentPic -> TYPE_FREE_ONE + selectedNumber.value == PictureNumber.ONE -> TYPE_PAID_ONE + else -> TYPE_PAID_TWO + } viewModelScope.launch { runCatching { - createRepository.getPromptExample() + createRepository.getPromptExample(currentType) }.onSuccess { _getExampleState.value = UiState.Success(it.getOrThrow()) }.onFailure { @@ -265,5 +266,9 @@ constructor( companion object { const val VALIDATION_FALSE = "VALIDATION_FALSE" const val SERVER_ERROR = "SERVER_ERROR" + + const val TYPE_FREE_ONE = "FREE_ONE" + const val TYPE_PAID_ONE = "PAID_ONE" + const val TYPE_PAID_TWO = "PAID_TWO" } } diff --git a/presentation/src/main/java/kr/genti/presentation/create/DefineFragment.kt b/presentation/src/main/java/kr/genti/presentation/create/DefineFragment.kt index cac132c..8a2816f 100644 --- a/presentation/src/main/java/kr/genti/presentation/create/DefineFragment.kt +++ b/presentation/src/main/java/kr/genti/presentation/create/DefineFragment.kt @@ -49,6 +49,7 @@ class DefineFragment() : BaseFragment(R.layout.fragment_d private fun initView() { binding.vm = viewModel + viewModel.getExamplePrompt() } private fun initCreateBtnListener() { @@ -118,19 +119,17 @@ class DefineFragment() : BaseFragment(R.layout.fragment_d } private fun observeGetExampleState() { - viewModel.getExampleState - .flowWithLifecycle(lifecycle) - .onEach { state -> - when (state) { - is UiState.Success -> { - adapter.submitList(state.data) - binding.dotIndicator.setViewPager(binding.vpCreateRandom) - } - - is UiState.Failure -> toast(stringOf(R.string.error_msg)) - else -> return@onEach + viewModel.getExampleState.flowWithLifecycle(lifecycle).onEach { state -> + when (state) { + is UiState.Success -> { + adapter.submitList(state.data) + binding.dotIndicator.setViewPager(binding.vpCreateRandom) } - }.launchIn(lifecycleScope) + + is UiState.Failure -> toast(stringOf(R.string.error_msg)) + else -> return@onEach + } + }.launchIn(lifecycleScope) } } From f39d6a4121213c64a358a9c646c31cacd16a40c1 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Dec 2024 05:15:11 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[FIX/#185]=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- presentation/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index f023c36..ce8b080 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -154,7 +154,7 @@ 내가 만든 사진 아직 내가 만든 사진이 없어요. 세상에 하나뿐인 나만의 사진을 만들어보세요! - 사진이 저장되었어요\n친구들에게 공유해보세요! + 사진이 저장되었어요 설정 이용 약관 From fa2e0fcd853704d08c0f76f3edee0cf0f9a2652a Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 2 Dec 2024 05:29:20 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[CHORE/#185]=20version=20code=2021=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convention/src/main/java/kr/genti/convention/Constants.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-logic/convention/src/main/java/kr/genti/convention/Constants.kt b/build-logic/convention/src/main/java/kr/genti/convention/Constants.kt index a1891e3..350ca45 100644 --- a/build-logic/convention/src/main/java/kr/genti/convention/Constants.kt +++ b/build-logic/convention/src/main/java/kr/genti/convention/Constants.kt @@ -9,7 +9,7 @@ object Constants { const val minSdk = 28 const val targetSdk = 34 - const val versionCode = 20 + const val versionCode = 21 const val versionName = "2.1.0" const val jvmVersion = "17"