From 34350341613ff51e7b56a5f30a946e6bc5e0ae08 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 28 Aug 2024 05:34:20 -0700 Subject: [PATCH] Fix review crash issue --- .../java/org/traccar/client/GoogleMainApplication.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/google/java/org/traccar/client/GoogleMainApplication.kt b/app/src/google/java/org/traccar/client/GoogleMainApplication.kt index d46e89ae..b7d5eed2 100644 --- a/app/src/google/java/org/traccar/client/GoogleMainApplication.kt +++ b/app/src/google/java/org/traccar/client/GoogleMainApplication.kt @@ -47,10 +47,13 @@ class GoogleMainApplication : MainApplication() { if (!ratingShown && totalDuration > RATING_THRESHOLD) { val reviewManager = ReviewManagerFactory.create(activity) reviewManager.requestReviewFlow().addOnCompleteListener { infoTask: Task -> - 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() + } + } } } }