Skip to content

Commit 03d8a69

Browse files
authored
Merge pull request #522 from Iterable/MOB-5694-Try-Catch-around-webview-animation
[MOB - 5694] - Add try catch around animation
2 parents 6ef8a31 + d0e9d39 commit 03d8a69

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,13 @@ private void showAndAnimateWebView() {
351351
default:
352352
animationResource = R.anim.fade_in_custom;
353353
}
354-
355-
Animation anim = AnimationUtils.loadAnimation(getContext(), animationResource);
356-
anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION);
357-
webView.startAnimation(anim);
354+
try {
355+
Animation anim = AnimationUtils.loadAnimation(getContext(), animationResource);
356+
anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION);
357+
webView.startAnimation(anim);
358+
} catch (Exception e) {
359+
IterableLogger.e(TAG, "Failed to show inapp with animation");
360+
}
358361
}
359362
}
360363

@@ -378,10 +381,15 @@ private void hideWebView() {
378381
animationResource = R.anim.fade_out_custom;
379382
}
380383

381-
Animation anim = AnimationUtils.loadAnimation(getContext(),
382-
animationResource);
383-
anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION);
384-
webView.startAnimation(anim);
384+
try {
385+
Animation anim = AnimationUtils.loadAnimation(getContext(),
386+
animationResource);
387+
anim.setDuration(IterableConstants.ITERABLE_IN_APP_ANIMATION_DURATION);
388+
webView.startAnimation(anim);
389+
} catch (Exception e) {
390+
IterableLogger.e(TAG, "Failed to hide inapp with animation");
391+
}
392+
385393
}
386394

387395
hideInAppBackground();

0 commit comments

Comments
 (0)