From d0e9d39d59b9d427e169bb7a21d13f0c574c0114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAkshay?= <“ayyanchira.akshay@gmail.com”> Date: Sun, 26 Feb 2023 10:35:32 -0800 Subject: [PATCH] [MOB - 5694] - Add try catch around animation Adding try catch around show and hide webview animation --- ...IterableInAppFragmentHTMLNotification.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java index cf47cbca9..ba11b3c2e 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java @@ -351,10 +351,13 @@ private void showAndAnimateWebView() { default: animationResource = R.anim.fade_in_custom; } - - Animation anim = AnimationUtils.loadAnimation(getContext(), animationResource); - anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION); - webView.startAnimation(anim); + try { + Animation anim = AnimationUtils.loadAnimation(getContext(), animationResource); + anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION); + webView.startAnimation(anim); + } catch (Exception e) { + IterableLogger.e(TAG, "Failed to show inapp with animation"); + } } } @@ -378,10 +381,15 @@ private void hideWebView() { animationResource = R.anim.fade_out_custom; } - Animation anim = AnimationUtils.loadAnimation(getContext(), - animationResource); - anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION); - webView.startAnimation(anim); + try { + Animation anim = AnimationUtils.loadAnimation(getContext(), + animationResource); + anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION); + webView.startAnimation(anim); + } catch (Exception e) { + IterableLogger.e(TAG, "Failed to hide inapp with animation"); + } + } hideInAppBackground();