-
Notifications
You must be signed in to change notification settings - Fork 0
[PC-1298] PR 피드백 수정 #167
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
Merged
Merged
[PC-1298] PR 피드백 수정 #167
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5247edd
[PC-1298] app/debug 불필요한 파일들 제거
kkh725 8a4d905
[PC-1298] compose.material3.adaptive 의존성 store 에만 추가하는 방식으로 수정
kkh725 e11dd9e
[PC-1298] consumeProductList 의미없는 주석 제거
kkh725 d404113
[PC-1298] 주석 제거
kkh725 90b8180
[PC-1298] AdaptiveLayout -> feature:store 에서만 사용하게 수정
kkh725 744ee59
[PC-1298] BillingHelperImpl.kt 에서만 사용하는 toPieceProduct 메서드 수정
kkh725 1b4799f
[PC-1298] feature:store 모듈에서 billingclient 의존성 제거
kkh725 e1d1c09
[PC-1298] 주석 제거
kkh725 27dc5be
[PC-1298] kotlin.collection.immutable 의존성 추가 및 list->immutableList로 변환
kkh725 dcfa4a6
[PC-1298] 서버에서 consume 작업 및 unConsumed 상품 처리를 담당 -> 클라쪽 처리 로직 삭제.
kkh725 79be15a
[PC-1298] StoreState의 products -> promotion, normal 으로 분리, puzzleCoun…
kkh725 5b95e77
[PC-1298] 뷰모델에서 액티비티 제거 후 sideEffect로 분리
kkh725 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| package com.puzzle.store | ||
|
|
||
| import android.content.ContentValues.TAG | ||
| import android.util.Log | ||
| import androidx.lifecycle.viewModelScope | ||
| import com.puzzle.billing.BillingHelper | ||
|
|
@@ -29,9 +28,8 @@ class StoreViewModel @Inject constructor( | |
|
|
||
| init { | ||
| viewModelScope.launch { | ||
| processUnConsumedProducts() | ||
| getAvailableProducts() | ||
| collectPurchaseProducts() | ||
| getAvailableProducts() | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -56,18 +54,16 @@ class StoreViewModel @Inject constructor( | |
| } | ||
| } | ||
|
|
||
| private fun collectPurchaseProducts() { | ||
| viewModelScope.launch { | ||
| billingHelper.purchaseProduct.collectLatest { product -> | ||
| if (product != null) { | ||
| suspendRunCatching { | ||
| paymentRepository.purchaseProduct(product) | ||
| }.onSuccess { | ||
| Log.d([email protected], "purchaseProduct api success") | ||
| }.onFailure { | ||
| Log.e([email protected], "purchaseProduct api fail") | ||
| errorHelper.sendError(it) | ||
| } | ||
| private suspend fun collectPurchaseProducts() { | ||
| billingHelper.purchaseProduct.collectLatest { product -> | ||
| if (product != null) { | ||
| suspendRunCatching { | ||
| paymentRepository.purchaseProduct(product) | ||
| }.onSuccess { | ||
| Log.d([email protected], "purchaseProduct api success") | ||
| }.onFailure { | ||
| Log.e([email protected], "purchaseProduct api fail") | ||
| errorHelper.sendError(it) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -76,30 +72,12 @@ class StoreViewModel @Inject constructor( | |
| private suspend fun getAvailableProducts() { | ||
| suspendRunCatching { | ||
| val availableProducts = paymentRepository.getAvailableProduct() | ||
| Log.d("test", "viewModel : $availableProducts") | ||
| billingHelper.getAvailableProducts(availableProducts) | ||
| }.onSuccess { products -> | ||
| setState { copy(products = products) } | ||
| }.onFailure { | ||
| errorHelper.sendError(it) | ||
| } | ||
| } | ||
|
|
||
| // consume 되지 않은 상품 처리 | ||
| private suspend fun processUnConsumedProducts() { | ||
| val unConsumedProducts = billingHelper.getUnconsumedProductList() | ||
|
|
||
| if (unConsumedProducts.isNotEmpty()) { | ||
| suspendRunCatching { | ||
| // paymentRepository.purchaseProductList(unConsumedProducts) 로 변경 예정 | ||
| paymentRepository.purchaseProduct(unConsumedProducts.first()) | ||
| }.onSuccess { | ||
| Log.d([email protected], "purchaseProduct api success") | ||
| }.onFailure { | ||
| Log.e([email protected], "purchaseProduct api fail") | ||
| errorHelper.sendError(it) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/com/puzzle/common/ui/AdaptiveLayout.kt → ...ava/com/puzzle/store/ui/AdaptiveLayout.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분, UI레벨에서 말고 처음부터 StoreState로 매핑해줄 때 해주는 것이 더 깔끔해보여요!