Skip to content

Commit

Permalink
Don't crash if play services is not available when updating dynamic l…
Browse files Browse the repository at this point in the history
…inks
  • Loading branch information
warting committed Jan 14, 2022
1 parent 71bc8ad commit 138f235
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package se.warting.firebasecompose.dynamiclinks

import android.content.Context
import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -35,8 +36,11 @@ internal fun rememberMutableDynamicLinksState(
if (getPendingDynamicLinkDataOnStart) {
DisposableEffect(firebaseAuthState) {
val refreshDynamicLink: Job = scope.launch {

firebaseAuthState.updateDynamicLink()
try {
firebaseAuthState.updateDynamicLink()
} catch (e: com.google.android.gms.common.api.ApiException) {
Log.e("ApiException", e.localizedMessage, e)
}
}
onDispose {
refreshDynamicLink.cancel(
Expand Down

0 comments on commit 138f235

Please sign in to comment.