Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
LasOri committed Dec 6, 2022
2 parents 58162a2 + 3fd623f commit bea36bb
Show file tree
Hide file tree
Showing 11 changed files with 322 additions and 57 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build Documentation

on:
push:
branches:
- dev
paths:
- docs/**

jobs:
build-docs:
name: Build documentation
uses: emartech/me-workflows/.github/workflows/build-docs.yaml@main
secrets: inherit
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$Versions.kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$Versions.kotlin_version"
classpath "com.github.ben-manes:gradle-versions-plugin:0.43.0"
classpath "com.github.ben-manes:gradle-versions-plugin:0.44.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
Expand Down
23 changes: 12 additions & 11 deletions buildSrc/src/main/java/Dependency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ object Versions {
const val kotlin_version = "1.7.20"
const val kotlin_coroutines_version = "1.6.4"
const val kotlin_test_version = "3.4.2"
const val mockito_version = "4.8.1"
const val mockito_core_version = "4.8.0"
const val mockito_version = "4.9.0"
const val mockito_core_version = "4.9.0"
const val firebase_messaging_version = "23.1.0"
const val support_test_version = "1.4.0"
const val support_test_version = "1.5.1"
const val support_rules_test_version = "1.5.0"
const val support_library = "1.5.1"
const val support_test_extensions = "1.1.3"
const val support_test_fragment = "1.5.3"
const val support_test_extensions = "1.1.4"
const val support_test_fragment = "1.5.4"
const val support_annotations = "1.5.0"
const val buildToolsVersion = "31.0.0"
const val multiDexVersion = "2.0.0"
const val kotlinMockito = "4.0.0"
const val kotlinMockito = "4.1.0"
const val location_services_version = "21.0.1"
const val espresso_idling_resources = "3.4.0"
const val espresso_idling_resources = "3.5.0"
const val archLifecycleVersion = "2.5.1"
const val java8LifecycleVersion = "2.5.1"
const val securityCryptoVersion = "1.1.0-alpha03"
const val byte_buddy_version = "1.12.18"
const val byte_buddy_version = "1.12.19"
const val google_tink_version = "1.7.0"
const val huawei_agconnect_core_version = "1.7.2.300"
const val huawei_agconnect_core_version = "1.7.3.302"
const val huawei_hms_push_version = "6.7.0.300"
const val mockkVersion = "1.13.2"
const val mockkVersion = "1.13.3"
const val webkit = "1.5.0"
}

Expand Down Expand Up @@ -61,7 +62,7 @@ object TestLibs {
const val kotlin_mockito = "org.mockito.kotlin:mockito-kotlin:${Versions.kotlinMockito}"
const val byte_buddy = "net.bytebuddy:byte-buddy:${Versions.byte_buddy_version}"
const val support_test_runner = "androidx.test:runner:${Versions.support_test_version}"
const val support_test_rules = "androidx.test:rules:${Versions.support_test_version}"
const val support_test_rules = "androidx.test:rules:${Versions.support_rules_test_version}"
const val support_test_extensions =
"androidx.test.ext:junit:${Versions.support_test_extensions}"
const val support_test_fragment =
Expand Down
18 changes: 2 additions & 16 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
# What's new

### [InApp](https://github.com/emartech/android-emarsys-sdk/wiki#3-inapp)

* Added dark mode support for InApp and inline InApp messages. Please check the [GitHub wiki](https://github.com/emartech/android-emarsys-sdk/wiki#33-dark-mode) to see how to set up your application based on Android API level.

### [Push](https://github.com/emartech/android-emarsys-sdk/wiki#2-push)

* Added support for updatable and deletable push messages.

# What's fixed

### [DeepLink](https://github.com/emartech/android-emarsys-sdk/wiki#5-deeplink)

* DeepLink tracking now works without the Mobile Engage feature enabled (without setting an application code).

### [Push](https://github.com/emartech/android-emarsys-sdk/wiki#2-push)
### [Inbox](https://github.com/emartech/android-emarsys-sdk/wiki#7-messageinbox)

* Fixed an issue when sometimes interacting with a push message lasted for 5 seconds.
* Fixed possible issue where a malformed URL could crash the SDK.
6 changes: 6 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: android-emarsys-sdk
title: Android Emarsys SDK
version: master
start_page: ROOT:index.adoc
nav:
- modules/ROOT/nav.adoc
2 changes: 2 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* https://github.com/emartech/android-emarsys-sdk/wiki[Api]
* xref:push.adoc[Push]
3 changes: 3 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
== Android Emarsys SDK

https://github.com/emartech/android-emarsys-sdk/blob/master/README.md[README]
234 changes: 234 additions & 0 deletions docs/modules/ROOT/pages/push.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
= Push

== Styles

Style can be `MESSAGE` , `THUMBNAIL`, `BIG_PICTURE`, `BIG_TEXT` or just leave out the whole property for Compatibility Mode

== Rich Push

Rich push messages can contain images, actions.
The maximum number of actions in a push message is 3. See examples below.

.App Event
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title":"Hello Demo!",
"channel_id":"ems_sample_news",
"u":{"sid":"asdf"},
"body":"This is a push message",
"image_url":"https://firebase.google.com/images/social.png",
"ems":{
"multichannelId":"campaignId",
"style":"MESSAGE",
"actions": [
{
"id": "id1",
"title": "App event",
"type": "MEAppEvent",
"name": "AppEventName",
"payload": {"key":"value", "key2":"vale"}
}
]
},
"ems_msg": {}
}
}
----

.ExternalUrl
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title":"Hello Demo!",
"channel_id":"ems_sample_news",
"u":{"sid":"asdf"},
"body":"This is a push message",
"image_url":"https://firebase.google.com/images/social.png",
"ems":{
"multichannelId":"campaignId",
"style":"MESSAGE",
"actions": [
{
"id": "id1",
"title": "External Url",
"type": "OpenExternalUrl",
"url": "https://www.emarsys.com"
}
]
},
"ems_msg": {}
}
}
----

.CustomEvent
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title":"Hello Demo!",
"channel_id":"ems_sample_news",
"u":{"sid":"asdf"},
"body":"This is a push message",
"image_url":"https://firebase.google.com/images/social.png",
"ems":{
"multichannelId":"campaignId",
"style":"MESSAGE",
"actions": [
{
"id": "id3",
"title": "Custom Event",
"type": "MECustomEvent",
"name": "testCustomEvent",
"payload": {"key":"value", "key2":"vale"}
}
]
},
"ems_msg": {}
}
}
----

.Dismiss
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title":"Hello Demo!",
"channel_id":"ems_sample_news",
"u":{"sid":"asdf"},
"body":"This is a push message",
"image_url":"https://firebase.google.com/images/social.png",
"ems":{
"multichannelId":"campaignId",
"style":"MESSAGE",
"actions": [
{
"id": "id3",
"title": "Dismiss",
"type": "Dismiss"
}
]
},
"ems_msg": {}
}
}
----

=== Update/Delete

Add notificationMethod to the `ems` object.
Operation value can be INIT, UPDATE or DELETE The SDK is going to find the push notification based on its `collapseId`

.notificationMethod
[source,json]
----
"notificationMethod": {
"operation":"UPDATE",
"collapseId":12345
},
----

.Example
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title": "Update - Push",
"channel_id": "ems_sample_news",
"u": {
"sid": "asdf"
},
"body": "Hello",
"image_url": "https://firebase.google.com/images/social.png",
"ems": {
"multichannelId": "campaignId",
"notificationMethod": {
"operation":"UPDATE",
"collapseId":12345
},
"actions": [
{
"id": "id1",
"title": "Custom Event",
"type": "MECustomEvent",
"name": "customEventName",
"payload": {
"key": "value",
"key2": "vale"
}
}
]
},
"ems_msg": {}
}
}
----

== Silent Push

No notification is going to be shown on the device but the SDK is going to trigger the app event at receive.

.Example
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"ems": {
"multichannelId": "campaignId",
"silent": true,
"actions": [
{
"id": "id1",
"title": "App event",
"type": "MEAppEvent",
"name": "nameOfTheAppEvent",
"payload": {
"key": "value",
"key2": "vale"
}
}
]
},
"ems_msg": {}
}
}
----

== Push to in-app

An in-app message is going to be shown at receive with the defined url.

.Example
[source,json]
----
{
"to": "{{push_token}}",
"data": {
"title": "ALICE - Push",
"channel_id": "ems_sample_news",
"u": {
"sid": "asdf"
},
"body": "Hello",
"image_url": "https://firebase.google.com/images/social.png",
"ems": {
"multichannelId": "campaignId",
"inapp": {
"campaign_id": "222",
"url": "https://www.emarsys.com/"
}
},
"ems_msg": {}
}
}
----
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class MessageInboxResponseMapperTest {
"testTitle2",
"OpenExternalUrl",
URL("https://www.test.com")
),
OpenExternalUrlActionModel(
"testId4",
"testTitle2",
"OpenExternalUrl",
URL("https://")
)
)
),
Expand Down Expand Up @@ -183,6 +189,12 @@ class MessageInboxResponseMapperTest {
"title": "testTitle2",
"type": "OpenExternalUrl",
"url": "https://www.test.com"
},
{
"id": "testId4",
"title": "testTitle2",
"type": "OpenExternalUrl",
"url": "notUrl"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@ class MessageInboxResponseMapper : Mapper<ResponseModel, InboxResult> {
) else JSONObject()
)
)
"OpenExternalUrl" -> OpenExternalUrlActionModel(
actionJson.getString("id"),
actionJson.getString("title"),
actionJson.getString("type"),
URL(actionJson.getString("url"))
)
"OpenExternalUrl" -> {
val url = try {
URL(actionJson.getString("url"))
} catch (ignored: Exception) {
URL("https://")
}
OpenExternalUrlActionModel(
actionJson.getString("id"),
actionJson.getString("title"),
actionJson.getString("type"),
url
)
}
"MECustomEvent" -> CustomEventActionModel(
actionJson.getString("id"),
actionJson.getString("title"),
Expand Down
Loading

0 comments on commit bea36bb

Please sign in to comment.