Skip to content

Commit

Permalink
Fix review crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Aug 28, 2024
1 parent 4d328df commit 3435034
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/src/google/java/org/traccar/client/GoogleMainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ class GoogleMainApplication : MainApplication() {
if (!ratingShown && totalDuration > RATING_THRESHOLD) {
val reviewManager = ReviewManagerFactory.create(activity)
reviewManager.requestReviewFlow().addOnCompleteListener { infoTask: Task<ReviewInfo?> ->
val reviewInfo = infoTask.result
if (infoTask.isSuccessful && reviewInfo != null) {
val flow = reviewManager.launchReviewFlow(activity, reviewInfo)
flow.addOnCompleteListener { preferences.edit().putBoolean(KEY_RATING_SHOWN, true).apply() }
if (infoTask.isSuccessful) {
val reviewInfo = infoTask.result
if (reviewInfo != null) {
reviewManager.launchReviewFlow(activity, reviewInfo).addOnCompleteListener {
preferences.edit().putBoolean(KEY_RATING_SHOWN, true).apply()
}
}
}
}
}
Expand Down

0 comments on commit 3435034

Please sign in to comment.