diff --git a/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebView.kt b/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebView.kt index 6e8aa74de10..ab9996d016e 100644 --- a/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebView.kt +++ b/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebView.kt @@ -46,16 +46,21 @@ internal class PaymentAuthWebView : WebView { setWebViewClient(webViewClient) } - fun hasOpenedApp(): Boolean { - return webViewClient?.hasOpenedApp == true + fun onForegrounded() { + if (webViewClient?.hasOpenedApp == true) { + // If another app was opened, assume it was a bank app where payment authentication + // was completed. Upon foregrounding this screen, load the completion URL. + webViewClient?.completionUrlParam?.let { + loadUrl(it) + } + } } - fun getCompletionUrl(): String? = webViewClient?.completionUrlParam - @SuppressLint("SetJavaScriptEnabled") private fun configureSettings() { settings.javaScriptEnabled = true settings.allowContentAccess = false + settings.domStorageEnabled = true } internal class PaymentAuthWebViewClient( diff --git a/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebViewActivity.java b/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebViewActivity.java index 8a1d13483cd..39140eb45fd 100644 --- a/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebViewActivity.java +++ b/stripe/src/main/java/com/stripe/android/view/PaymentAuthWebViewActivity.java @@ -59,20 +59,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { mWebView = webView; } - @Override - protected void onPostResume() { - super.onPostResume(); - - if (mWebView != null && mWebView.hasOpenedApp()) { - // If another app was opened, assume it was a bank app where payment authentication - // was completed. Upon foregrounding this screen, load the completion URL. - final String completionUrl = mWebView.getCompletionUrl(); - if (completionUrl != null) { - mWebView.loadUrl(completionUrl); - } - } - } - @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.payment_auth_web_view_menu, menu);