Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne authored and FabianDevel committed Nov 24, 2023
1 parent 4718601 commit 5ee9c05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ import kotlinx.coroutines.withContext
object StoreUtils {

//region In-App Update

fun initAppUpdateManager(context: Context, onInstall: () -> Unit) = Unit

fun FragmentActivity.checkUpdateIsAvailable(
appId: String,
versionCode: Int,
resultLauncher: ActivityResultLauncher<IntentSenderRequest>,
onResult: (updateIsAvailable: Boolean) -> Unit,
inAppResultLauncher: ActivityResultLauncher<IntentSenderRequest>,
onFDroidResult: (updateIsAvailable: Boolean) -> Unit,
) {
lifecycleScope.launch {
val lastVersionCode = FdroidApiTools().getLastRelease(appId)
Expand All @@ -56,7 +55,6 @@ object StoreUtils {
//endregion

//region In-App Review

fun FragmentActivity.launchInAppReview() = Unit
//endRegion
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ object StoreUtils {
}

//region In-App Update

fun initAppUpdateManager(context: Context, onInstall: () -> Unit) {
appUpdateManager = AppUpdateManagerFactory.create(context)
onInstallDownloaded = onInstall
Expand All @@ -59,14 +58,14 @@ object StoreUtils {
fun checkUpdateIsAvailable(
appId: String,
versionCode: Int,
resultLauncher: ActivityResultLauncher<IntentSenderRequest>,
onResult: (updateIsAvailable: Boolean) -> Unit,
inAppResultLauncher: ActivityResultLauncher<IntentSenderRequest>,
onFdroidResult: (updateIsAvailable: Boolean) -> Unit,
) {
appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo ->
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& appUpdateInfo.isUpdateTypeAllowed(UPDATE_TYPE)
) {
startUpdateFlow(appUpdateInfo, resultLauncher)
startUpdateFlow(appUpdateInfo, inAppResultLauncher)
}
}
}
Expand Down Expand Up @@ -103,7 +102,6 @@ object StoreUtils {
//endregion

//region In-App Review

fun FragmentActivity.launchInAppReview() {
ReviewManagerFactory.create(this).apply {
val requestReviewFlow = requestReviewFlow()
Expand Down

0 comments on commit 5ee9c05

Please sign in to comment.