-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20112 from wordpress-mobile/fix-in-app-reviews-crash
Fix in app reviews crash
- Loading branch information
Showing
3 changed files
with
19 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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
15 changes: 15 additions & 0 deletions
15
WordPress/src/main/java/org/wordpress/android/util/extensions/InAppReviewExtensions.kt
This file contains 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 org.wordpress.android.util.extensions | ||
|
||
import com.google.android.gms.tasks.Task | ||
import com.google.android.play.core.review.ReviewException | ||
import com.google.android.play.core.review.ReviewInfo | ||
import com.google.android.play.core.review.model.ReviewErrorCode | ||
import org.wordpress.android.util.AppLog | ||
|
||
fun Task<ReviewInfo>.logException() { | ||
val errorMessage = "Error fetching ReviewInfo object from Review API to start in-app review process" | ||
(exception as? ReviewException)?.let { | ||
@ReviewErrorCode val reviewErrorCode = it.errorCode | ||
AppLog.e(AppLog.T.UTILS, errorMessage, reviewErrorCode) | ||
} ?: AppLog.e(AppLog.T.UTILS, "$errorMessage: ${exception?.message}") | ||
} |