From fcd0f81d37ead86facaf235f3a51311e8308e332 Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Tue, 13 Jun 2023 15:39:51 +0200 Subject: [PATCH 1/6] Enabled third party cookies & WebView now fills entire available space --- .../xs2awizard/components/webview/URLBarWebView.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt index f112dfb..8167761 100644 --- a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt +++ b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt @@ -2,6 +2,8 @@ package com.fintecsystems.xs2awizard.components.webview import android.annotation.SuppressLint import android.graphics.Bitmap +import android.view.ViewGroup +import android.webkit.CookieManager import android.webkit.WebChromeClient import android.webkit.WebView import android.webkit.WebViewClient @@ -140,8 +142,11 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { WebView(it).apply { webView = this - settings.javaScriptEnabled = true + layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + + CookieManager.getInstance().setAcceptThirdPartyCookies(this, true) settings.domStorageEnabled = true + settings.javaScriptEnabled = true addJavascriptInterface(XS2AJavascriptInterface(callbackHandler), "App") webViewClient = object : WebViewClient() { From f5320ab544bbab119723e43b4f54bd86ca85b7d3 Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Tue, 13 Jun 2023 15:41:32 +0200 Subject: [PATCH 2/6] Brought Top Bar in front of the webview --- .../xs2awizard/components/webview/URLBarWebView.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt index 8167761..dba025e 100644 --- a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt +++ b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView +import androidx.compose.ui.zIndex import androidx.core.net.toUri import com.fintecsystems.xs2awizard.R import com.fintecsystems.xs2awizard.components.XS2AWizardViewModel @@ -80,6 +81,7 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { Modifier .fillMaxWidth() .height(48.dp) + .zIndex(1f) ) { Row( modifier = Modifier.fillMaxWidth(), From b4168c25407e444400b8a5e4d7383076047c848e Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Tue, 13 Jun 2023 15:47:56 +0200 Subject: [PATCH 3/6] Version bump --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9cc29a7..0887747 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official GROUP=com.fintecsystems -VERSION_NAME=5.1.0 +VERSION_NAME=5.1.1 POM_URL=https://github.com/FinTecSystems/xs2a-android POM_SCM_URL=git@github.com:FinTecSystems/xs2a-android.git POM_SCM_CONNECTION=scm:git:git@github.com:FinTecSystems/xs2a-android.git From 1890ab6501d98e96f9e5ca16b073a4d86c0a2b1b Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Wed, 14 Jun 2023 09:57:30 +0200 Subject: [PATCH 4/6] Fixed RedirectLineData not being considered in back button check --- .../xs2awizard/components/XS2AWizardViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/XS2AWizardViewModel.kt b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/XS2AWizardViewModel.kt index b108968..03f7069 100644 --- a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/XS2AWizardViewModel.kt +++ b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/XS2AWizardViewModel.kt @@ -171,8 +171,10 @@ class XS2AWizardViewModel( * Returns true if a back button is present on the current form. */ @Suppress("MemberVisibilityCanBePrivate") - fun backButtonIsPresent() = - form.value?.any { it is SubmitLineData && !it.backLabel.isNullOrEmpty() } ?: false + fun backButtonIsPresent() = form.value?.any { + (it is SubmitLineData && !it.backLabel.isNullOrEmpty()) + || (it is RedirectLineData && !it.backLabel.isNullOrEmpty()) + } ?: false /** * Returns true, if network requests should abort. From 95f3be1da8937ff86c510efe4e19ae0672909add Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Wed, 14 Jun 2023 10:04:28 +0200 Subject: [PATCH 5/6] Now giving the topBar and WebView their respective correct color --- .../xs2awizard/components/webview/URLBarWebView.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt index dba025e..112daf7 100644 --- a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt +++ b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt @@ -82,6 +82,7 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { .fillMaxWidth() .height(48.dp) .zIndex(1f) + .background(XS2ATheme.CURRENT.webViewBackgroundColor.value) ) { Row( modifier = Modifier.fillMaxWidth(), @@ -133,18 +134,24 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { .fillMaxWidth() .height(2.dp), progress = loadingIndicatorProgress / 100f, - color = XS2ATheme.CURRENT.tintColor.value + color = XS2ATheme.CURRENT.tintColor.value, + backgroundColor = XS2ATheme.CURRENT.webViewBorderColor.value ) } // WebView AndroidView( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .background(XS2ATheme.CURRENT.webViewBackgroundColor.value), factory = { WebView(it).apply { webView = this - layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + layoutParams = ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) CookieManager.getInstance().setAcceptThirdPartyCookies(this, true) settings.domStorageEnabled = true From 7fead2b82aa094f0b5afa70ef14a6c9ace040aae Mon Sep 17 00:00:00 2001 From: Maik Mursall Date: Wed, 14 Jun 2023 10:20:43 +0200 Subject: [PATCH 6/6] Now directly displays current url --- .../xs2awizard/components/webview/URLBarWebView.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt index 112daf7..9b32199 100644 --- a/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt +++ b/xs2awizard/src/main/java/com/fintecsystems/xs2awizard/components/webview/URLBarWebView.kt @@ -1,7 +1,6 @@ package com.fintecsystems.xs2awizard.components.webview import android.annotation.SuppressLint -import android.graphics.Bitmap import android.view.ViewGroup import android.webkit.CookieManager import android.webkit.WebChromeClient @@ -64,6 +63,7 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { } DisposableEffect(targetUrl, webView) { + currentUrl = targetUrl webView?.loadUrl(targetUrl ?: "about:blank") onDispose { /* no-op */ } @@ -161,16 +161,11 @@ fun URLBarWebView(viewModel: XS2AWizardViewModel) { webViewClient = object : WebViewClient() { @Deprecated("Deprecated in Java") override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { + currentUrl = url view.loadUrl(url) return true } - override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { - super.onPageStarted(view, url, favicon) - - currentUrl = url - } - override fun onPageFinished(view: WebView?, url: String?) { super.onPageFinished(view, url)