Skip to content

Commit

Permalink
Fix: Resolves crash in Android (webView.engine is null) with Capacitor (
Browse files Browse the repository at this point in the history
  • Loading branch information
dtarnawsky committed May 22, 2022
1 parent dcf066e commit 1056b63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/android/LottieSplashScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ class LottieSplashScreen : CordovaPlugin() {
animationView.addAnimatorListener(
object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
webView.engine.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationStart'))") { }
webView.engine?.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationStart'))") { }
}

override fun onAnimationEnd(animation: Animator) {
webView.engine.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationEnd'))") { }
webView.engine?.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationEnd'))") { }
val hideAfterAnimationDone = preferences.getBoolean(
"LottieHideAfterAnimationEnd",
false
Expand All @@ -288,11 +288,11 @@ class LottieSplashScreen : CordovaPlugin() {
}

override fun onAnimationCancel(animation: Animator) {
webView.engine.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationCancel'))") { }
webView.engine?.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationCancel'))") { }
}

override fun onAnimationRepeat(animation: Animator) {
webView.engine.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationRepeat'))") { }
webView.engine?.evaluateJavascript("document.dispatchEvent(new Event('lottieAnimationRepeat'))") { }
}
}
)
Expand Down

0 comments on commit 1056b63

Please sign in to comment.