Skip to content
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

Merge staging into main for Core 3.1.2 #710

Merged
merged 8 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package com.adobe.marketing.mobile.internal

internal object CoreConstants {
const val LOG_TAG = "MobileCore"
const val VERSION = "3.1.1"
const val VERSION = "3.1.2"

object EventDataKeys {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import android.webkit.WebView
import androidx.activity.compose.BackHandler
import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.compose.ui.window.DialogWindowProvider
import com.adobe.marketing.mobile.services.ui.Presentable
import com.adobe.marketing.mobile.services.ui.common.PresentationStateManager
import com.adobe.marketing.mobile.services.ui.message.GestureTracker
Expand Down Expand Up @@ -67,7 +72,8 @@ internal fun MessageScreen(
inAppMessageSettings = inAppMessageSettings,
gestureTracker = gestureTracker,
onCreated = { onCreated(it) },
onDisposed = { onDisposed() }
onDisposed = { onDisposed() },
onBackPressed = onBackPressed
)
}

Expand All @@ -85,23 +91,61 @@ internal fun Message(
inAppMessageSettings: InAppMessageSettings,
gestureTracker: GestureTracker,
onCreated: (WebView) -> Unit,
onDisposed: () -> Unit
onDisposed: () -> Unit,
onBackPressed: () -> Unit
) {
// Backdrop for the InAppMessage only takes into effect if the InAppMessage is taking over the UI
if (inAppMessageSettings.shouldTakeOverUi) {
MessageBackdrop(
/* Dialog is used to take over the UI when the InAppMessage is set to take over the UI.
This is necessary to ensure that the InAppMessage is displayed on top of the UI.
Which will ensure that ScreenReader can read the content of the InAppMessage only and not the underlying UI.
*/
Dialog(
properties = DialogProperties(
usePlatformDefaultWidth = false,
dismissOnBackPress = true,
dismissOnClickOutside = false
),
onDismissRequest = {
onBackPressed()
}
) {
/* Remove the default dim and animations for the dialog window
Customer can set their own dim and animations if needed and those will be honoured in MessageBackdrop inside Message
*/

val dialogWindow = (LocalView.current.parent as? DialogWindowProvider)?.window

SideEffect {
dialogWindow?.let {
it.setDimAmount(0f)
it.setWindowAnimations(-1)
}
}

// Backdrop for the InAppMessage only takes into effect if the InAppMessage is taking over the UI
MessageBackdrop(
visibility = isVisible,
inAppMessageSettings = inAppMessageSettings,
gestureTracker = gestureTracker
)

// Frame that holds the InAppMessage
MessageFrame(
visibility = isVisible,
inAppMessageSettings = inAppMessageSettings,
gestureTracker = gestureTracker,
onCreated = onCreated,
onDisposed = onDisposed
)
}
} else {
// Frame that holds the InAppMessage
MessageFrame(
visibility = isVisible,
inAppMessageSettings = inAppMessageSettings,
gestureTracker = gestureTracker
gestureTracker = gestureTracker,
onCreated = onCreated,
onDisposed = onDisposed
)
}

// Frame that holds the InAppMessage
MessageFrame(
visibility = isVisible,
inAppMessageSettings = inAppMessageSettings,
gestureTracker = gestureTracker,
onCreated = onCreated,
onDisposed = onDisposed
)
}
2 changes: 1 addition & 1 deletion code/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android.useAndroidX=true

#Maven artifacts
#Core extension
coreExtensionVersion=3.1.1
coreExtensionVersion=3.1.2
coreExtensionName=core
coreMavenRepoName=AdobeMobileCoreSdk
coreMavenRepoDescription=Android Core Extension for Adobe Mobile Marketing
Expand Down
Binary file modified code/testapp/src/main/assets/ADBMobileConfig-rules.zip
Binary file not shown.
1 change: 1 addition & 0 deletions code/testapp/src/main/assets/ADBMobileConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"lifecycle.sessionTimeout": 300,
"global.privacy": "optedin",
"property.id": "PR16596147e65c4d37980310bae3097e6b",
"bundled_configuration": true,
"build.environment": "dev"
}
10 changes: 10 additions & 0 deletions code/testapp/src/main/assets/ADBMobileConfig_custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rules.url": "https://assets.adobedtm.com/94f571f308d5/fec7505defe0/launch-eaa54c95a6b5-development-rules.zip",
"experienceCloud.org": "972C898555E9F7BC7F000101@AdobeOrg",
"lifecycle.sessionTimeout": 300,
"global.privacy": "optedin",
"property.id": "PR16596147e65c4d37980310bae3097e6b",
"bundled_configuration": true,
"custom_configuration_name": true,
"build.environment": "dev"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@
package com.adobe.marketing.mobile.core.testapp

import android.widget.Toast
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Button
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
Expand All @@ -38,6 +48,7 @@ import com.adobe.marketing.mobile.services.ServiceProvider

@Composable
fun CoreView(navController: NavHostController) {
var appId by remember { mutableStateOf("your-appId") }
Column(Modifier.padding(8.dp)) {
Button(onClick = {
navController.navigate(NavRoutes.HomeView.route)
Expand All @@ -55,14 +66,36 @@ fun CoreView(navController: NavHostController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
Button(onClick = {
showCoreVersion()
MobileCore.configureWithFileInAssets("ADBMobileConfig_custom.json")
}) {
Text(text = "extensionVersion")
Text(text = "configureWithFileInAssets()")
}
Surface(
border = BorderStroke(1.dp, Color.Gray),
shape = RoundedCornerShape(8.dp),
modifier = Modifier.padding(8.dp)
) {
Column(
modifier = Modifier.padding(PaddingValues(8.dp)),
horizontalAlignment = Alignment.CenterHorizontally
) {
OutlinedTextField(
value = appId,
onValueChange = { appId = it },
label = { Text("appId") }
)
Button(onClick = {
MobileCore.configureWithAppID(appId)
}) {
Text(text = "configureWithAppID(\"appId\")")
}
}
}

Button(onClick = {
updateConfiguration()
}) {
Text(text = "updateConfiguration(optedout)")
Text(text = "updateConfiguration")
}
Button(onClick = {
clearUpdatedConfiguration()
Expand All @@ -87,6 +120,12 @@ fun CoreView(navController: NavHostController) {
}) {
Text(text = "getPrivacyStatus")
}
Button(onClick = {
// The bundled rule is configured to triggers a postback for the following condition: a trackAction event with the action type 'bundled_trigger_postback'.
MobileCore.trackAction("bundled_trigger_postback", null)
}) {
Text(text = "Trigger bundled rule consequence(postback)")
}
Button(onClick = {
MobileCore.setLogLevel(LoggingMode.VERBOSE)
}) {
Expand Down Expand Up @@ -184,21 +223,6 @@ fun CoreView(navController: NavHostController) {
}) {
Text(text = "trackState")
}
Button(onClick = {
MobileCore.lifecycleStart(null)
}) {
Text(text = "lifecycleStart")
}
Button(onClick = {
MobileCore.lifecycleStart(mapOf("key" to "value"))
}) {
Text(text = "lifecycleStart(contextData)")
}
Button(onClick = {
MobileCore.lifecyclePause()
}) {
Text(text = "lifecyclePause")
}
Button(onClick = {
MobileCore.resetIdentities()
}) {
Expand All @@ -220,7 +244,7 @@ private fun showCoreVersion() {
}

private fun updateConfiguration() {
MobileCore.updateConfiguration(mapOf("global.privacy" to "optedout"))
MobileCore.updateConfiguration(mapOf("custom_key" to "custom_value"))
}

private fun clearUpdatedConfiguration() {
Expand All @@ -234,4 +258,4 @@ fun DefaultPreviewForCoreView() {
AEPSDKCoreAndroidTheme {
CoreView(rememberNavController())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.adobe.marketing.mobile.MobileCore
import com.adobe.marketing.mobile.Signal
import com.adobe.marketing.mobile.core.testapp.ui.theme.AEPSDKCoreAndroidTheme

@Composable
fun LifecycleView(navController: NavHostController) {
Expand All @@ -37,6 +41,29 @@ fun LifecycleView(navController: NavHostController) {
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Signal extension version - ${Signal.extensionVersion()}")
Button(onClick = {
MobileCore.lifecycleStart(null)
}) {
Text(text = "lifecycleStart")
}
Button(onClick = {
MobileCore.lifecycleStart(mapOf("key" to "value"))
}) {
Text(text = "lifecycleStart(contextData)")
}
Button(onClick = {
MobileCore.lifecyclePause()
}) {
Text(text = "lifecyclePause")
}
}
}
}

@Preview(showBackground = true)
@Composable
fun DefaultPreviewForCoreViewForLifecycleView() {
AEPSDKCoreAndroidTheme {
LifecycleView(rememberNavController())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ package com.adobe.marketing.mobile.core.testapp
import android.app.Application
import android.util.Log
import androidx.core.os.UserManagerCompat
import com.adobe.marketing.mobile.EventSource
import com.adobe.marketing.mobile.EventType
import com.adobe.marketing.mobile.Identity
import com.adobe.marketing.mobile.Lifecycle
import com.adobe.marketing.mobile.LoggingMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,14 @@ fun SignalView(navController: NavHostController) {
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Example of the malformed URL: https://www.adobe.com:_80/", fontSize = 10.sp)
OutlinedTextField(
value = url,
onValueChange = { url = it },
label = { Text("URL") }
)
Button(onClick = {
MobileCore.dispatchEvent(
Event.Builder("consequence event", EventType.RULES_ENGINE, EventSource.RESPONSE_CONTENT).setEventData(
mapOf(
"triggeredconsequence" to mapOf(
"type" to "pii",
"detail" to mapOf(
"timeout" to 0,
"templateurl" to url
)
)
)
).build())
Text(text = "Signal extension version - ${Signal.extensionVersion()}")

Button(onClick = {
// To test this, configure a rule in your launch property that triggers a postbackk for the following condition: a trackAction event with the action type 'trigger_postback'.
MobileCore.trackAction("trigger_postback", null)
}) {
Text(text = "post back")
Text(text = "trigger rule consequence(postback)")
}
// openURL is covered by automation test, we can enable it later if needed for customer issue verification
Button(onClick = {},enabled = false) {
Text(text = "open URL")
}
Text(text = "Signal extension version - ${Signal.extensionVersion()}")
}

}
Expand Down
Loading
Loading