-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/#273] 인앱 리뷰 유도 기능을 구현합니다. #274
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
236f58c
[ADD/#273] 플레이스토어 인앱 리뷰를 위한 의존성을 추가합니다.
SYAAINN 402cde0
[FEAT/#273] 인앱 리뷰를 위한 InAppReviewManager를 정의합니다.
SYAAINN d0e33d4
[FEAT/#273] 리뷰 팝업을 노출할 지에 대한 flag를 담은 SharedPreferences를 분리합니다.
SYAAINN 0cc06d0
[FEAT/#273] 홈화면에서 리뷰 팝업이 정상적으로 노출되는지 확인합니다.
SYAAINN 8908804
[FEAT/#273] 답장확인으로부터 홈화면으로 돌아왔는 지를 검사하는 코드를 추가합니다.
SYAAINN 7eb6053
[REFACTOR/#273] LaunchedEffect 변경, context 초기화 안정성 증가, Timber 제거를 수행합니다.
SYAAINN da8f6c4
[REFACTOR/#273] 리뷰 팝업 노출에 관한 에러 대응을 보완합니다.
SYAAINN 02cffb4
[CHORE/#273] SharedPreferences의 property setter를 개선합니다.
SYAAINN 0fa677f
[REFACTOR/#273] ReviewRepository를 정의하여 Repository Pattern을 준수합니다.
SYAAINN 79a4ba9
[CHORE/#273] 마켓 이동 함수를 AppUpdateUtils를 사용합니다.
SYAAINN 1da7261
[CHORE/#273] 파라미터 전달을 개선합니다.
SYAAINN 25d06c6
[CHORE/#273] 인앱리뷰 팝업 노출 조건 검사 부분을 개선합니다.
SYAAINN 4e97a13
Resolve Git Conflict
SYAAINN 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
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/sopt/clody/core/review/InAppReviewManager.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.sopt.clody.core.review | ||
|
|
||
| import android.app.Activity | ||
| import com.google.android.play.core.review.ReviewManagerFactory | ||
| import com.sopt.clody.presentation.utils.appupdate.AppUpdateUtils | ||
| import timber.log.Timber | ||
|
|
||
| object InAppReviewManager { | ||
| fun showPopup(activity: Activity) { | ||
| if (activity.isFinishing || activity.isDestroyed) return | ||
|
|
||
| val reviewManager = ReviewManagerFactory.create(activity) | ||
| val request = reviewManager.requestReviewFlow() | ||
|
|
||
| request.addOnCompleteListener { task -> | ||
| if (task.isSuccessful) { | ||
| val reviewInfo = task.result | ||
| reviewManager.launchReviewFlow(activity, reviewInfo) | ||
| } else { | ||
| try { | ||
| AppUpdateUtils.navigateToMarket(activity) | ||
| } catch (e: Exception) { | ||
| e.printStackTrace() | ||
| Timber.e(e, "Failed to open store for app review") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/sopt/clody/data/local/datasource/AppReviewLocalDataSource.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.sopt.clody.data.local.datasource | ||
|
|
||
| interface AppReviewLocalDataSource { | ||
| var shouldShowPopup: Boolean | ||
| } |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/sopt/clody/data/local/datasourceimpl/AppReviewLocalDataSourceImpl.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.sopt.clody.data.local.datasourceimpl | ||
|
|
||
| import android.content.SharedPreferences | ||
| import androidx.core.content.edit | ||
| import com.sopt.clody.data.local.datasource.AppReviewLocalDataSource | ||
| import com.sopt.clody.di.qualifier.ReviewPrefs | ||
| import javax.inject.Inject | ||
|
|
||
| class AppReviewLocalDataSourceImpl @Inject constructor( | ||
| @ReviewPrefs private val sharedPreferences: SharedPreferences, | ||
| ) : AppReviewLocalDataSource { | ||
|
|
||
| override var shouldShowPopup: Boolean | ||
| get() = sharedPreferences.getBoolean(SHOULD_SHOW_POPUP, true) | ||
| set(value) = sharedPreferences.edit { putBoolean(SHOULD_SHOW_POPUP, value) } | ||
|
Comment on lines
+13
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P5 |
||
|
|
||
| companion object { | ||
| private const val SHOULD_SHOW_POPUP = "shouldShowPopup" | ||
| } | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/sopt/clody/data/repositoryimpl/ReviewRepositoryImpl.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.sopt.clody.data.repositoryimpl | ||
|
|
||
| import com.sopt.clody.data.local.datasource.AppReviewLocalDataSource | ||
| import com.sopt.clody.domain.repository.ReviewRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class ReviewRepositoryImpl @Inject constructor( | ||
| private val appReviewLocalDataSource: AppReviewLocalDataSource, | ||
| ) : ReviewRepository { | ||
| override fun getShouldShowPopup(): Boolean = appReviewLocalDataSource.shouldShowPopup | ||
|
|
||
| override fun setShouldShowPopup(state: Boolean) { | ||
| appReviewLocalDataSource.shouldShowPopup = state | ||
| } | ||
| } |
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
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/sopt/clody/domain/repository/ReviewRepository.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package com.sopt.clody.domain.repository | ||
|
|
||
| interface ReviewRepository { | ||
| fun getShouldShowPopup(): Boolean | ||
| fun setShouldShowPopup(state: Boolean) | ||
| } |
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
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.
🛠️ Refactor suggestion
Add null check for reviewInfo before launching review flow.
While the task success check is good, you should also validate that
reviewInfois not null before launching the review flow to prevent potential crashes.request.addOnCompleteListener { task -> if (task.isSuccessful) { val reviewInfo = task.result - reviewManager.launchReviewFlow(activity, reviewInfo) + if (reviewInfo != null) { + reviewManager.launchReviewFlow(activity, reviewInfo) + } } else {📝 Committable suggestion
🤖 Prompt for AI Agents