-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Play Service error handle #2900
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2900 +/- ##
=========================================
Coverage 62.52% 62.52%
Complexity 1203 1203
=========================================
Files 267 267
Lines 6357 6357
Branches 881 881
=========================================
Hits 3975 3975
Misses 1831 1831
Partials 551 551 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first pass, @shobhitagarwal1612 PTAL as well?
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Outdated
Show resolved
Hide resolved
…lay-service' into anandwana001/2783/handle-googleplay-service
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/startup/StartupViewModel.kt
Outdated
Show resolved
Hide resolved
} catch (e: Exception) { | ||
Timber.e( | ||
e, | ||
"Failed to handle activity result for requestCode: $requestCode. Exception details: ${e.message}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message and stack trace are already logged by Timber.e
, no need to add it to the message as well.
@@ -37,29 +38,31 @@ constructor( | |||
* Displays a dialog to install Google Play Services, if missing. Throws an error if install not | |||
* possible or cancelled. | |||
*/ | |||
suspend fun installGooglePlayServices() { | |||
suspend fun installGooglePlayServices(): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a Boolean
return value means the caller needs to address both return value and thrown exceptions as failure states. Since we need to catch exceptions anyway, why not rely on those for error states?
} | ||
|
||
private fun startResolution(status: Int, requestCode: Int, throwable: Throwable) { | ||
if (!googleApiAvailability.isUserResolvableError(status)) throw throwable | ||
private suspend fun startResolution(status: Int, requestCode: Int): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here.
@@ -29,7 +29,10 @@ internal constructor( | |||
|
|||
/** Checks & installs Google Play Services and initializes the login flow. */ | |||
suspend fun initializeLogin() { | |||
googleApiManager.installGooglePlayServices() | |||
val isGooglePlayServicesAvailable = googleApiManager.installGooglePlayServices() | |||
if (!isGooglePlayServicesAvailable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here. This entire condition goes away if installGooglePlayServices
throws an exception.
# Conflicts: # ground/src/main/java/com/google/android/ground/system/GoogleApiManager.kt # ground/src/main/java/com/google/android/ground/ui/startup/StartupFragment.kt
Closing as it is fixed at #2924 |
Fixes #2783
@shobhitagarwal1612 @gino-m PTAL?