Skip to content

Commit

Permalink
Improved help view model
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Sep 11, 2024
1 parent 5b0327a commit c31b2a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
11 changes: 0 additions & 11 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import com.d4rk.englishwithlidia.plus.utils.IntentUtils
import com.google.android.play.core.review.ReviewInfo
import com.google.android.play.core.review.ReviewManagerFactory
import kotlinx.coroutines.Dispatchers
Expand All @@ -20,12 +21,21 @@ class HelpViewModel(application: Application) : AndroidViewModel(application) {
viewModelScope.launch(Dispatchers.IO) {
val reviewManager = ReviewManagerFactory.create(getApplication())
val request = reviewManager.requestReviewFlow()
val packageName = getApplication<Application>().packageName
request.addOnCompleteListener { task ->
if (task.isSuccessful) {
_reviewInfo.value = task.result
} else {
task.exception?.printStackTrace()
task.exception?.let {
task.exception?.printStackTrace()
IntentUtils.sendEmailToDeveloper(getApplication())
}
}
}.addOnFailureListener {
IntentUtils.openUrl(
getApplication(),
"https://play.google.com/store/apps/details?id=$packageName&showAllReviews=true"
)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
agp = "8.5.1"
appcompat = "1.7.0"
appUpdateKtx = "2.1.0"
coilCompose = "2.6.0"
coilCompose = "2.7.0"
composeBom = "2024.06.00"
coreKtx = "1.13.1"
billing = "7.0.0"
datastoreCore = "1.1.1"
graphicsShapes = "1.0.0-beta01"
graphicsShapes = "1.0.0-rc01"
ktorClientContentNegotiation = "2.3.12"
ktorClientCio = "2.3.12"
ktorClientCore = "2.3.12"
ktorSerializationKotlinxJson = "2.3.12"
lifecycle = "2.8.3"
lifecycle = "2.8.4"
lottieCompose = "6.4.1"
material = "1.12.0"
kotlinxCoroutinesAndroid = "1.8.1"
media3Exoplayer = "1.3.1"
media3Exoplayer = "1.4.0"
multidex = "2.0.1"
slf4jSimple = "2.0.13"
volley = "1.2.1"
Expand All @@ -25,7 +25,7 @@ coreSplashscreen = "1.0.1"
firebaseBom = "32.8.1"
kotlin = "2.0.0"
junit = "4.13.2"
activityCompose = "1.9.0"
activityCompose = "1.9.1"
junitVersion = "1.2.1"
navigationCompose = "2.7.7"
constraintlayoutCompose = "1.0.1"
Expand Down

0 comments on commit c31b2a1

Please sign in to comment.