-
Notifications
You must be signed in to change notification settings - Fork 34
[SDK-368] Fix in-app creation causing crash due to problems with webview #999
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| import android.os.Bundle; | ||
| import android.os.Handler; | ||
| import android.os.Looper; | ||
| import android.util.AndroidRuntimeException; | ||
| import android.util.DisplayMetrics; | ||
| import android.view.Display; | ||
| import android.view.Gravity; | ||
|
|
@@ -200,9 +201,12 @@ | |
| applyWindowGravity(getDialog().getWindow(), "onCreateView"); | ||
| } | ||
|
|
||
| webView = new IterableWebView(getContext()); | ||
| webView = createWebViewSafely(getContext()); | ||
| if (webView == null) { | ||
| dismissAllowingStateLoss(); | ||
| return null; | ||
| } | ||
| webView.setId(R.id.webView); | ||
|
|
||
| webView.createWithHtml(this, htmlString); | ||
|
|
||
| if (orientationListener == null) { | ||
|
|
@@ -324,7 +328,9 @@ | |
| */ | ||
| @Override | ||
| public void onStop() { | ||
| orientationListener.disable(); | ||
| if (orientationListener != null) { | ||
| orientationListener.disable(); | ||
| } | ||
|
|
||
| super.onStop(); | ||
| } | ||
|
|
@@ -747,6 +753,15 @@ | |
| return InAppLayout.CENTER; | ||
| } | ||
| } | ||
|
|
||
| private IterableWebView createWebViewSafely(Context context) { | ||
| try { | ||
| return new IterableWebView(context); | ||
|
||
| } catch (AndroidRuntimeException e) { | ||
|
||
| IterableLogger.e(TAG, "Failed to create WebView", e); | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| enum InAppLayout { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.