Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilveirah committed Jun 19, 2024
2 parents 958d998 + eebcf2c commit a42f6f8
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 35 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ Java
}
```

>If required for your app's log out process, your organization can use the [`clearAllData`](#clearalldata) function to erase local data. Once cleared, your organization can then call `spConsentLib.loadMessage` to collect consent from a non-authenticated user or `spConsentLib.loadMessage` with a new `authId` for a new authenticated user.
## Setting a Targeting Param

Targeting params allow you to set arbitrary key/value pairs. These key/value pairs are sent to Sourcepoint servers where they can be used to take a decision within the scenario builder.
Expand Down Expand Up @@ -1172,7 +1174,7 @@ private val spConsentLib by spConsentLibLazy {
propertyName = "automation-mobile-usnat"
messLanguage = MessageLanguage.ENGLISH
+(CampaignType.GDPR)
+(CampaignType.USNAT to setOf(ConfigOption.TRANSITION_CCPA_AUTH)) // or use addCampaign(SpCampaign(campaignType = CampaignType.USNAT, configParams = setOf(TRANSITION_CCPA_AUTH)))
+mapOf(CampaignType.USNAT to setOf(ConfigOption.TRANSITION_CCPA_AUTH)) // or use addCampaign(SpCampaign(campaignType = CampaignType.USNAT, configParams = setOf(TRANSITION_CCPA_AUTH)))
}
}
```
Expand Down Expand Up @@ -1207,7 +1209,7 @@ val cmpConfig : SpConfig = config {
propertyId = 123456
propertyName = "demo.android.test"
messLanguage = MessageLanguage.ENGLISH
+(CampaignType.USNAT to setOf(ConfigOption.SUPPORT_LEGACY_USPSTRING))
+mapOf(CampaignType.USNAT to setOf(ConfigOption.SUPPORT_LEGACY_USPSTRING))
}
```

Expand Down
2 changes: 1 addition & 1 deletion cmplibrary/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME = 7.8.3
VERSION_NAME = 7.8.4

POM_NAME = cmplibrary
POM_REPO = sourcepoint
Expand Down
5 changes: 2 additions & 3 deletions cmplibrary/release_note.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*[DIA-3945](https://sourcepoint.atlassian.net/browse/DIA-3945) Added Tagalog as message language [#819](https://github.com/SourcePointUSA/android-cmp-app/pull/819)
*[DIA-3946](https://sourcepoint.atlassian.net/browse/DIA-3946) Fixed an issue causing consent uuid to be null for server-sided sampled properties [#820](https://github.com/SourcePointUSA/android-cmp-app/pull/820)
*[DIA-4086](https://sourcepoint.atlassian.net/browse/DIA-4086) Fixed an issue affecting users taking consent action when legislation applies is false [#822](https://github.com/SourcePointUSA/android-cmp-app/pull/822)
*[ DIA-4112](https://sourcepoint.atlassian.net/browse/ DIA-4112) Fixed an issue preventing links from being opened on external browser [#825](https://github.com/SourcePointUSA/android-cmp-app/pull/825)
*[HCD-525](https://sourcepoint.atlassian.net/browse/HCD-525) Improve documentation on authenticated consent [#823](https://github.com/SourcePointUSA/android-cmp-app/pull/823)
7 changes: 6 additions & 1 deletion cmplibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent>
</queries>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.sourcepoint.cmplibrary.core.web

import android.graphics.Bitmap
import android.net.http.SslError
import android.os.Build
import android.webkit.* //ktlint-disable
import com.sourcepoint.cmplibrary.exception.* //ktlint-disable
import com.sourcepoint.cmplibrary.exception.ConsentLibExceptionK
Expand Down Expand Up @@ -62,6 +61,7 @@ internal class SPWebViewClient(
onError(WebViewException(description = error.toString()))
}

@Deprecated("Will be removed once we bump min supported API level to 24")
override fun onReceivedError(view: WebView, errorCode: Int, description: String, failingUrl: String?) {
super.onReceivedError(view, errorCode, description, failingUrl)
onError(WebViewException(description = description))
Expand All @@ -78,10 +78,14 @@ internal class SPWebViewClient(
return false
}

@Deprecated("Will be removed once we bump min supported API level to 24")
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
wv.context.loadLinkOnExternalBrowser(url) {
onNoIntentActivitiesFoundFor(it)
}
wv.context.loadLinkOnExternalBrowser(url, onNoIntentActivitiesFoundFor)
return true
}

override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
wv.context.loadLinkOnExternalBrowser(request?.url.toString(), onNoIntentActivitiesFoundFor)
return true
}

Expand All @@ -95,16 +99,14 @@ internal class SPWebViewClient(
errorResponse: WebResourceResponse?
) {
super.onReceivedHttpError(view, request, errorResponse)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val nl = System.getProperty("line.separator")
val message = errorResponse?.responseHeaders!!.toList().fold(StringBuilder()) { acc, pair ->
acc.append("${pair.first}:${pair.second} $nl")
acc
}.toString()
val errMess = "Error loading SPWebViewClient $nl StatusCode ---> ${errorResponse.statusCode} $nl$message "
logger.e(this::class.java.name, errMess)
onError(UrlLoadingException(description = "The client failed to load the resource!!"))
}
val nl = System.lineSeparator()
val message = errorResponse?.responseHeaders!!.toList().fold(StringBuilder()) { acc, pair ->
acc.append("${pair.first}:${pair.second} $nl")
acc
}.toString()
val errMess = "Error loading SPWebViewClient $nl StatusCode ---> ${errorResponse.statusCode} $nl$message "
logger.e(this::class.java.name, errMess)
onError(UrlLoadingException(description = "The client failed to load the resource!!"))
}

override fun onPageCommitVisible(view: WebView?, url: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ internal fun Context.loadLinkOnExternalBrowser(
) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
val canBeProcessed = isIntentExecutable(this, intent)
if (canBeProcessed)
if (canOpenURLIntent(this, intent))
startActivity(intent)
else
onNoIntentActivitiesFound(url)
}

internal fun isIntentExecutable(context: Context, uriIntent: Intent): Boolean {
internal fun canOpenURLIntent(context: Context, uriIntent: Intent): Boolean {
val packageManager = context.packageManager
val scheme = uriIntent.scheme
if (scheme == null || scheme != "http" && scheme != "https") {
Expand All @@ -35,23 +34,17 @@ internal fun isIntentExecutable(context: Context, uriIntent: Intent): Boolean {
packageManager.queryIntentActivities(uriIntent, 0)
}.filterNot { it.activityInfo?.packageName?.startsWith("com.google.android.tv.frameworkpackagestubs") ?: false }

if (resolvedActivityList.isEmpty()) {
return false
}

return true
return resolvedActivityList.isNotEmpty()
}

internal fun WebView.getLinkUrl(testResult: WebView.HitTestResult): String {
if (doesLinkContainImage(testResult)) {
val handler = Handler()
val message = handler.obtainMessage()
val message = Handler().obtainMessage()
requestFocusNodeHref(message)
return message.data["url"] as? String ?: ""
}
return testResult.extra ?: ""
}

internal fun doesLinkContainImage(testResult: WebView.HitTestResult): Boolean {
return testResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE
}
internal fun doesLinkContainImage(testResult: WebView.HitTestResult): Boolean =
testResult.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE
2 changes: 1 addition & 1 deletion samples/metaapp/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Mar 21 18:04:23 UTC 2024
VERSION_CODE=120
VERSION_CODE=122

0 comments on commit a42f6f8

Please sign in to comment.