From ba419c088c4ac9509589e427772ad78d63f61f35 Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Fri, 16 Aug 2024 17:23:55 -0600 Subject: [PATCH 1/4] -deprecate ContentCard class and update tests/test app/docs --- Documentation/README.md | 2 +- Documentation/sources/propositions/content-card.md | 4 +++- .../propositions/schemas/content-card-schema-data.md | 4 +++- code/gradle.properties | 2 +- .../marketing/mobile/messaging/ContentCard.java | 3 +++ .../mobile/messaging/ContentCardSchemaData.java | 1 + .../mobile/messaging/MessagingConstants.java | 2 +- .../java/com/adobe/marketing/mobile/Messaging.java | 2 +- .../mobile/messagingsample/FeedCardAdapter.kt | 12 +++++++++++- 9 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Documentation/README.md b/Documentation/README.md index c92e34a6f..813d4ad3d 100644 --- a/Documentation/README.md +++ b/Documentation/README.md @@ -36,7 +36,7 @@ - Developer Documentation - [API usage](./sources/api-usage.md#Message Feed and Code-based experiences APIs) - Public classes - - [ContentCard](./sources/propositions/content-card.md) + - [ContentCard - DEPRECATED](./sources/propositions/content-card.md) - [ContentType](./sources/propositions/schemas/content-type.md) - [Proposition](./sources/propositions/proposition.md) - [PropositionItem](./sources/propositions/proposition-item.md) diff --git a/Documentation/sources/propositions/content-card.md b/Documentation/sources/propositions/content-card.md index 9d4c87df6..4787a08b1 100644 --- a/Documentation/sources/propositions/content-card.md +++ b/Documentation/sources/propositions/content-card.md @@ -1,4 +1,6 @@ -# ContentCard +# ContentCard - DEPRECATED + +> This class is *DEPRECATED* as of `Messaging v3.2.0`. Use [ContentCardSchemaData](./schemas/content-card-schema-data.md) instead. An object representing the default content card created in the Adobe Journey Optimizer UI. diff --git a/Documentation/sources/propositions/schemas/content-card-schema-data.md b/Documentation/sources/propositions/schemas/content-card-schema-data.md index cd99a935d..5d28544c0 100644 --- a/Documentation/sources/propositions/schemas/content-card-schema-data.md +++ b/Documentation/sources/propositions/schemas/content-card-schema-data.md @@ -45,7 +45,9 @@ public class ContentCardSchemaData implements SchemaData { # Public functions -## getContentCard +## getContentCard - DEPRECATED + +> The `ContentCard` class is *DEPRECATED* as of `Messaging v3.2.0`. Tries to convert the `content` of this `ContentCardSchemaData` into a [`ContentCard`](./../content-card.md) object. diff --git a/code/gradle.properties b/code/gradle.properties index 79c6855f5..5258b75ca 100644 --- a/code/gradle.properties +++ b/code/gradle.properties @@ -16,7 +16,7 @@ org.gradle.caching=true android.useAndroidX=true moduleName=messaging -moduleVersion=3.1.0 +moduleVersion=3.2.0 #Maven artifact mavenRepoName=AdobeMobileMessagingSdk diff --git a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCard.java b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCard.java index 4bea61b31..578b5ed49 100644 --- a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCard.java +++ b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCard.java @@ -22,7 +22,10 @@ * A {@link ContentCard} object encapsulates the information necessary for a non-disruptive yet * interactive offer. Customers can use the Messaging SDK to render the content card in a * pre-defined format or implement their own rendering. + * + * @deprecated Use {@link ContentCardSchemaData} instead */ +@Deprecated public class ContentCard { private static final String SELF_TAG = "ContentCard"; diff --git a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCardSchemaData.java b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCardSchemaData.java index 97f241ce0..964a43aa0 100644 --- a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCardSchemaData.java +++ b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/ContentCardSchemaData.java @@ -91,6 +91,7 @@ static ContentCardSchemaData getEmpty() { return new ContentCardSchemaData(new JSONObject()); } + @Deprecated @Nullable public ContentCard getContentCard() { if (!contentType.equals(ContentType.APPLICATION_JSON)) { return null; diff --git a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/MessagingConstants.java b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/MessagingConstants.java index 35023ef7b..f02d5ea8e 100644 --- a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/MessagingConstants.java +++ b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/MessagingConstants.java @@ -14,7 +14,7 @@ public final class MessagingConstants { public static final String LOG_TAG = "Messaging"; - static final String EXTENSION_VERSION = "3.1.0"; + static final String EXTENSION_VERSION = "3.2.0"; static final String FRIENDLY_EXTENSION_NAME = "Messaging"; static final String EXTENSION_NAME = "com.adobe.messaging"; static final String RULES_ENGINE_NAME = EXTENSION_NAME + ".rulesengine"; diff --git a/code/messaging/src/phone/java/com/adobe/marketing/mobile/Messaging.java b/code/messaging/src/phone/java/com/adobe/marketing/mobile/Messaging.java index 68ab6ddbc..ccd4fff9e 100644 --- a/code/messaging/src/phone/java/com/adobe/marketing/mobile/Messaging.java +++ b/code/messaging/src/phone/java/com/adobe/marketing/mobile/Messaging.java @@ -31,7 +31,7 @@ import java.util.Map; public final class Messaging { - private static final String EXTENSION_VERSION = "3.1.0"; + private static final String EXTENSION_VERSION = "3.2.0"; private static final String LOG_TAG = "Messaging"; private static final String CLASS_NAME = "Messaging"; diff --git a/code/testapp/src/main/java/com/adobe/marketing/mobile/messagingsample/FeedCardAdapter.kt b/code/testapp/src/main/java/com/adobe/marketing/mobile/messagingsample/FeedCardAdapter.kt index f71e168ca..b551d1d57 100644 --- a/code/testapp/src/main/java/com/adobe/marketing/mobile/messagingsample/FeedCardAdapter.kt +++ b/code/testapp/src/main/java/com/adobe/marketing/mobile/messagingsample/FeedCardAdapter.kt @@ -36,7 +36,11 @@ class FeedCardAdapter(propositions: MutableList) : val proposition = propositions[position] for (item in proposition.items) { val inboundContent = item.contentCardSchemaData - val contentCard = inboundContent?.contentCard + val contentMap = inboundContent?.content as HashMap + val contentCard = MyContentCard() + contentCard.title = contentMap.get("title") ?: "defaultTitle" + contentCard.body = contentMap.get("body") ?: "defaultBody" + contentCard.imageUrl = contentMap.get("imageUrl") ?: "defaultImage" contentCard?.let { it.imageUrl?.let { holder.feedItemImage.setImageBitmap(ImageDownloader.getImage(it)) @@ -80,4 +84,10 @@ class FeedCardAdapter(propositions: MutableList) : init { this.propositions = propositions } +} + +class MyContentCard { + var title: String = "" + var body: String = "" + var imageUrl: String = "" } \ No newline at end of file From 77013e60c527b3bbcc53097132908cbeb490fb7e Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Fri, 16 Aug 2024 17:29:22 -0600 Subject: [PATCH 2/4] -remove strings.xml --- code/messaging/src/main/res/values/strings.xml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 code/messaging/src/main/res/values/strings.xml diff --git a/code/messaging/src/main/res/values/strings.xml b/code/messaging/src/main/res/values/strings.xml deleted file mode 100644 index 51e4f1a7f..000000000 --- a/code/messaging/src/main/res/values/strings.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - messagingSDK - From d29dadb06c3f24949a0ed8e7ab0338f88601bee4 Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Mon, 19 Aug 2024 10:26:48 -0600 Subject: [PATCH 3/4] -fix formatting on the docs page --- Documentation/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/README.md b/Documentation/README.md index 813d4ad3d..0592face1 100644 --- a/Documentation/README.md +++ b/Documentation/README.md @@ -12,7 +12,7 @@ - Prerequisites - Enable push notifications in your app by [adding the Firebase dependency.](https://firebase.google.com/docs/cloud-messaging/android/client) - Developer Documentation - - [API usage](./sources/api-usage.md#Push Messaging APIs) + - [API usage](./sources/api-usage.md#push-messaging-apis) - [PushTrackingStatus](./sources/enum-public-classes/enum-push-tracking-status.md) - [MessagingPushPayload](./sources/enum-public-classes/messaging-push-payload.md) - Guides @@ -23,7 +23,7 @@ ### In-app Messaging - Developer Documentation - - [API usage](./sources/api-usage.md#In-App Messaging APIs) + - [API usage](./sources/api-usage.md#in-app-messaging-apis) - [Message](./sources/enum-public-classes/class-message.md) - Guides - [Programmatically control the display of in-app messages](./sources/in-app-messaging/how-to-presentation-delegate.md) @@ -34,7 +34,7 @@ ### Code-based experiences and content cards - Developer Documentation - - [API usage](./sources/api-usage.md#Message Feed and Code-based experiences APIs) + - [API usage](./sources/api-usage.md#code-based-experiences-and-content-cards-apis) - Public classes - [ContentCard - DEPRECATED](./sources/propositions/content-card.md) - [ContentType](./sources/propositions/schemas/content-type.md) From 80607086bf9b138df42a3ad63255a029899434f9 Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Mon, 19 Aug 2024 11:42:41 -0600 Subject: [PATCH 4/4] -update docs and cherry pick test fix --- .../java/com/adobe/marketing/mobile/messaging/FeedItem.java | 2 +- .../mobile/messaging/ContentCardRulesEngineTests.java | 4 ++-- code/messaging/src/test/resources/feedPropositionContent.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/FeedItem.java b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/FeedItem.java index bfc1c0ff8..74da36f5c 100644 --- a/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/FeedItem.java +++ b/code/messaging/src/main/java/com/adobe/marketing/mobile/messaging/FeedItem.java @@ -20,7 +20,7 @@ * interactive offer. Customers can use the Messaging SDK to render the feed item data in a * pre-defined format or implement their own rendering. * - * @deprecated Use {@link ContentCard} instead. + * @deprecated Use {@link ContentCardSchemaData} instead */ @Deprecated public class FeedItem { diff --git a/code/messaging/src/test/java/com/adobe/marketing/mobile/messaging/ContentCardRulesEngineTests.java b/code/messaging/src/test/java/com/adobe/marketing/mobile/messaging/ContentCardRulesEngineTests.java index d8b2d7499..462b8acd1 100644 --- a/code/messaging/src/test/java/com/adobe/marketing/mobile/messaging/ContentCardRulesEngineTests.java +++ b/code/messaging/src/test/java/com/adobe/marketing/mobile/messaging/ContentCardRulesEngineTests.java @@ -148,7 +148,7 @@ public void test_evaluate_WithMissingDataInConsequencesDetail() { contentCardRulesEngine.evaluate(defaultEvent); // verify - Assert.assertTrue(propositionItemsBySurface.isEmpty()); + Assert.assertNull(propositionItemsBySurface); } @Test @@ -166,6 +166,6 @@ public void test_evaluate_WithMissingSurfaceInConsequencesDetailMetadata() { contentCardRulesEngine.evaluate(defaultEvent); // verify - Assert.assertTrue(propositionItemsBySurface.isEmpty()); + Assert.assertNull(propositionItemsBySurface); } } diff --git a/code/messaging/src/test/resources/feedPropositionContent.json b/code/messaging/src/test/resources/feedPropositionContent.json index 05c92106b..805d4f64c 100644 --- a/code/messaging/src/test/resources/feedPropositionContent.json +++ b/code/messaging/src/test/resources/feedPropositionContent.json @@ -23,7 +23,7 @@ "key": "~timestampu", "matcher": "le", "values": [ - 1723163897 + 2039020785 ] } }