@selligent-marketing-cloud/selligent-react-native 3.3.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -53
- package/android/build.gradle +34 -19
- package/android/libs/RNSelligentMobileSDK.aar +0 -0
- package/android/src/main/AndroidManifest.xml +1 -6
- package/android/src/main/java/com/selligent/EventReceiver.java +1 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +12 -0
- package/documentation/README.md +5 -2
- package/package.json +6 -3
- package/android/src/main/java/com/selligent/BroadcastDataFactory.java +0 -47
- package/android/src/main/java/com/selligent/BroadcastEventDataParser.java +0 -9
- package/android/src/main/java/com/selligent/BroadcastEventType.java +0 -37
- package/android/src/main/java/com/selligent/ButtonAction.java +0 -82
- package/android/src/main/java/com/selligent/ButtonBroadcastEventDataParser.java +0 -50
- package/android/src/main/java/com/selligent/ClearCacheIntervalValue.java +0 -36
- package/android/src/main/java/com/selligent/DeviceIdBroadcastEventDataParser.java +0 -15
- package/android/src/main/java/com/selligent/Event.java +0 -51
- package/android/src/main/java/com/selligent/EventType.java +0 -27
- package/android/src/main/java/com/selligent/GCMTokenBroadcastEventDataParser.java +0 -24
- package/android/src/main/java/com/selligent/InAppMessageBroadcastEventDataParser.java +0 -43
- package/android/src/main/java/com/selligent/InAppMessageRefreshType.java +0 -34
- package/android/src/main/java/com/selligent/NotificationMessageBroadcastEventDataParser.java +0 -19
- package/android/src/main/java/com/selligent/RemoteMessageDisplayType.java +0 -50
- package/android/src/main/java/com/selligent/SMEventFactory.java +0 -37
- package/android/src/main/java/com/selligent/SMSettingsFactory.java +0 -38
- package/android/src/main/java/com/selligent/Settings.java +0 -160
package/README.md
CHANGED
|
@@ -6,14 +6,14 @@ This module provides an API for the usage of the Selligent Mobile SDKs in React
|
|
|
6
6
|
|
|
7
7
|
This module supports the following SDK and tools:
|
|
8
8
|
|
|
9
|
-
> **IMPORTANT** This module
|
|
9
|
+
> **IMPORTANT** This module isn't built using ReactNative's new architecture! It is however compatible with apps that do adopt the new architecture, as far as they are using latest ReactNative's versions.
|
|
10
10
|
|
|
11
11
|
| SDK | Version |
|
|
12
12
|
| ------------------------------------------------------------------------------ | ------- |
|
|
13
|
-
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.
|
|
14
|
-
| [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.
|
|
15
|
-
| ReactNative | 0.
|
|
16
|
-
| Expo SDK |
|
|
13
|
+
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.4.0 |
|
|
14
|
+
| [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.8.0 |
|
|
15
|
+
| ReactNative | 0.72.4 |
|
|
16
|
+
| Expo SDK | 49 |
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -41,46 +41,7 @@ This module supports the following SDK and tools:
|
|
|
41
41
|
|
|
42
42
|
### Android Specific Installation
|
|
43
43
|
|
|
44
|
-
> **IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version
|
|
45
|
-
|
|
46
|
-
> ### **Attention for Huawei developers!**
|
|
47
|
-
>
|
|
48
|
-
> In order to use this module on Huawei devices (without Goggle Play services), you should add the following dependencies in the `build.gradle` files of the Android project in your React Native project:
|
|
49
|
-
>
|
|
50
|
-
> In your Android project's root `build.gradle` file:
|
|
51
|
-
>
|
|
52
|
-
> ```gradle
|
|
53
|
-
>
|
|
54
|
-
> buildscript {
|
|
55
|
-
> repositories {
|
|
56
|
-
> maven { url 'https://developer.huawei.com/repo/' }
|
|
57
|
-
> }
|
|
58
|
-
> dependencies {
|
|
59
|
-
> classpath 'com.huawei.agconnect:agcp:1.6.0.300'
|
|
60
|
-
> }
|
|
61
|
-
> }
|
|
62
|
-
>
|
|
63
|
-
> allProjects: {
|
|
64
|
-
> repositories: {
|
|
65
|
-
> maven { url 'https://developer.huawei.com/repo/' }
|
|
66
|
-
> }
|
|
67
|
-
> }
|
|
68
|
-
>
|
|
69
|
-
> ```
|
|
70
|
-
>
|
|
71
|
-
> In your app module's `build.gradle` file:
|
|
72
|
-
>
|
|
73
|
-
> ```gradle
|
|
74
|
-
>
|
|
75
|
-
> apply plugin: 'com.huawei.agconnect'
|
|
76
|
-
>
|
|
77
|
-
> dependencies {
|
|
78
|
-
> api 'com.huawei.hms:base:6.2.0.300'
|
|
79
|
-
> api 'com.huawei.hms:push:6.1.0.300'
|
|
80
|
-
> api 'com.huawei.hms:maps:6.2.0.301'
|
|
81
|
-
> }
|
|
82
|
-
>
|
|
83
|
-
> ```
|
|
44
|
+
> **IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version 7.0.0 or higher in order to build on Android.
|
|
84
45
|
|
|
85
46
|
<details>
|
|
86
47
|
<summary>Without autolinking (RN 0.59 and below)</summary>
|
|
@@ -101,10 +62,10 @@ This module supports the following SDK and tools:
|
|
|
101
62
|
|
|
102
63
|
buildscript {
|
|
103
64
|
dependencies {
|
|
104
|
-
// Make sure your Gradle plugin version is >=
|
|
105
|
-
classpath("com.android.tools.build:gradle:
|
|
65
|
+
// Make sure your Gradle plugin version is >= 7.0.0
|
|
66
|
+
classpath("com.android.tools.build:gradle:7.0.0")
|
|
106
67
|
// Add the following:
|
|
107
|
-
classpath 'com.google.gms:google-services:4.3.
|
|
68
|
+
classpath 'com.google.gms:google-services:4.3.15'
|
|
108
69
|
}
|
|
109
70
|
}
|
|
110
71
|
```
|
|
@@ -170,7 +131,7 @@ This module supports the following SDK and tools:
|
|
|
170
131
|
buildscript {
|
|
171
132
|
dependencies {
|
|
172
133
|
// Add the following:
|
|
173
|
-
classpath 'com.google.gms:google-services:4.3.
|
|
134
|
+
classpath 'com.google.gms:google-services:4.3.15'
|
|
174
135
|
}
|
|
175
136
|
}
|
|
176
137
|
```
|
|
@@ -213,13 +174,15 @@ This module supports the following SDK and tools:
|
|
|
213
174
|
|
|
214
175
|
> Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
|
|
215
176
|
|
|
216
|
-
3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.
|
|
177
|
+
3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.8.0"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
|
|
217
178
|
|
|
218
|
-
4.
|
|
179
|
+
4. Add the RNSelligentMapper pod in your Podfile: `pod 'RNSelligentMapper', :path => '../node_modules/@selligent-marketing-cloud/selligent-react-native/RNSelligentMapper.podspec'`.
|
|
219
180
|
|
|
220
|
-
5.
|
|
181
|
+
5. Execute `pod install` in the `/ios` folder
|
|
221
182
|
|
|
222
|
-
6.
|
|
183
|
+
6. From now on, open the `.xcworkspace` file to make changes in Xcode
|
|
184
|
+
|
|
185
|
+
7. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
|
|
223
186
|
|
|
224
187
|
```objective-c
|
|
225
188
|
@import RNSelligentMobileSDK;
|
package/android/build.gradle
CHANGED
|
@@ -8,19 +8,29 @@ buildscript {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
|
-
classpath 'com.android.tools.build:gradle:
|
|
11
|
+
classpath 'com.android.tools.build:gradle:8.1.2'
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
apply plugin: 'com.android.library'
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
android {
|
|
19
|
-
|
|
18
|
+
namespace 'com.selligent'
|
|
19
|
+
compileSdk 34
|
|
20
20
|
|
|
21
21
|
defaultConfig {
|
|
22
22
|
minSdkVersion 21
|
|
23
|
-
targetSdkVersion
|
|
23
|
+
targetSdkVersion 34
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
buildFeatures {
|
|
27
|
+
buildConfig true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
sourceSets {
|
|
31
|
+
main {
|
|
32
|
+
jniLibs.srcDirs = ['libs']
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -33,7 +43,7 @@ androidComponents {
|
|
|
33
43
|
variant.buildConfigFields.put("SELLIGENT_SETTINGS", new BuildConfigField("String", "\"" + selligentSettings + "\"", "Selligent settings"))
|
|
34
44
|
}
|
|
35
45
|
catch (Exception ignored) {
|
|
36
|
-
throw new Exception("Selligent requires Android Gradle plugin version
|
|
46
|
+
throw new Exception("Selligent requires Android Gradle plugin version 8.1.0 or higher.")
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
})
|
|
@@ -53,40 +63,45 @@ dependencies {
|
|
|
53
63
|
exclude group:'com.facebook.fbjni'
|
|
54
64
|
exclude group:'com.facebook.yoga'
|
|
55
65
|
}
|
|
56
|
-
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.
|
|
66
|
+
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.4.0'
|
|
57
67
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
58
|
-
implementation 'com.google.firebase:firebase-messaging:23.
|
|
68
|
+
implementation 'com.google.firebase:firebase-messaging:23.2.1'
|
|
59
69
|
implementation 'androidx.work:work-runtime:2.8.1'
|
|
60
70
|
implementation 'androidx.concurrent:concurrent-futures:1.1.0'
|
|
61
71
|
implementation 'androidx.cardview:cardview:1.0.0'
|
|
62
72
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
|
|
63
73
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
|
|
74
|
+
implementation files("libs/RNSelligentMobileSDK.aar")
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
def loadSelligentSettings(variant) {
|
|
67
78
|
def currentFlavor = getCurrentFlavor()
|
|
68
|
-
def
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (currentFlavor !== "") {
|
|
72
|
-
defaultFile = new File("$project.rootDir/../$currentFlavor/$defaultSelligentFileName")
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
def variantSelligentFileName = "selligent.${variant.getName()}.json"
|
|
76
|
-
File variantFile = new File("$project.rootDir/../$variantSelligentFileName")
|
|
77
|
-
|
|
79
|
+
def defaultFileName = "selligent.json"
|
|
80
|
+
def variantFileName = "selligent.${variant.getName()}.json"
|
|
78
81
|
def resultingSettings = null
|
|
79
82
|
|
|
83
|
+
File variantFile = new File("$project.rootDir/../$variantFileName")
|
|
84
|
+
File defaultFile = new File("$project.rootDir/../$defaultFileName")
|
|
85
|
+
File flavorFile = new File("$project.rootDir/../$currentFlavor/$defaultFileName")
|
|
86
|
+
|
|
80
87
|
if (variantFile.exists()) {
|
|
81
|
-
println("Reading Selligent properties for variant ${variant.getName()}
|
|
88
|
+
println("Reading Selligent properties for variant ${variant.getName()} from $variantFile.path")
|
|
82
89
|
resultingSettings = ""
|
|
83
90
|
|
|
84
91
|
variantFile.eachLine { String line ->
|
|
85
92
|
resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
|
|
86
93
|
}
|
|
87
94
|
}
|
|
95
|
+
else if (currentFlavor != "" && flavorFile.exists()) {
|
|
96
|
+
println("Reading Selligent properties for flavor $currentFlavor using $flavorFile.path")
|
|
97
|
+
resultingSettings = ""
|
|
98
|
+
|
|
99
|
+
flavorFile.eachLine { String line ->
|
|
100
|
+
resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
|
|
101
|
+
}
|
|
102
|
+
}
|
|
88
103
|
else if (defaultFile.exists()) {
|
|
89
|
-
println("Reading Selligent properties from
|
|
104
|
+
println("Reading default Selligent properties from ${defaultFile.path} (no variant specific nor flavor $defaultFileName were found)")
|
|
90
105
|
resultingSettings = ""
|
|
91
106
|
|
|
92
107
|
defaultFile.eachLine { String line ->
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ import android.text.TextUtils;
|
|
|
7
7
|
|
|
8
8
|
import com.facebook.react.bridge.WritableMap;
|
|
9
9
|
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
|
10
|
+
import com.selligent.rnmobilesdk.BroadcastDataFactory;
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class EventReceiver extends BroadcastReceiver {
|
|
@@ -30,6 +30,18 @@ import com.facebook.react.bridge.WritableNativeMap;
|
|
|
30
30
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
31
31
|
import com.google.gson.Gson;
|
|
32
32
|
import com.google.gson.reflect.TypeToken;
|
|
33
|
+
import com.selligent.rnmobilesdk.BroadcastEventType;
|
|
34
|
+
import com.selligent.rnmobilesdk.ButtonBroadcastEventDataParser;
|
|
35
|
+
import com.selligent.rnmobilesdk.DeviceIdBroadcastEventDataParser;
|
|
36
|
+
import com.selligent.rnmobilesdk.Event;
|
|
37
|
+
import com.selligent.rnmobilesdk.GCMTokenBroadcastEventDataParser;
|
|
38
|
+
import com.selligent.rnmobilesdk.InAppMessageBroadcastEventDataParser;
|
|
39
|
+
import com.selligent.rnmobilesdk.InAppMessageRefreshType;
|
|
40
|
+
import com.selligent.rnmobilesdk.NotificationMessageBroadcastEventDataParser;
|
|
41
|
+
import com.selligent.rnmobilesdk.RemoteMessageDisplayType;
|
|
42
|
+
import com.selligent.rnmobilesdk.SMEventFactory;
|
|
43
|
+
import com.selligent.rnmobilesdk.SMSettingsFactory;
|
|
44
|
+
import com.selligent.rnmobilesdk.Settings;
|
|
33
45
|
import com.selligent.sdk.SMCallback;
|
|
34
46
|
import com.selligent.sdk.SMEvent;
|
|
35
47
|
import com.selligent.sdk.SMForegroundGcmBroadcastReceiver;
|
package/documentation/README.md
CHANGED
|
@@ -74,7 +74,7 @@ The following properties can be used in the `selligent.json` to further configur
|
|
|
74
74
|
| remoteMessageDisplayType | [enum](#remotemessagesdisplaytype) | The behaviour when receiving a push notification with the app in foreground |
|
|
75
75
|
| appGroupId | string |(iOS Only) The appgroup id necessary for the correct communication between the app and the app extensions |
|
|
76
76
|
| shouldClearBadge | boolean | (iOS Only) Whether or not, clicking a push notification should reset the badge number |
|
|
77
|
-
| shouldDisplayRemoteNotification | boolean | (iOS Only) Whether or not, the SDK should try to display the content linked to a push message (usually, inapp messages) or it will be handled customly
|
|
77
|
+
| shouldDisplayRemoteNotification | boolean | (iOS Only) Whether or not, the SDK should try to display the content linked to a push message (usually, inapp messages) or it will be handled customly
|
|
78
78
|
| enableiOSLogging | [enum](#iosloglevel) | Log level used since the app launch |
|
|
79
79
|
| enableAndroidLogging | boolean | (Android Only) Whether or not, the SDK logging will be enabled since the app launch |
|
|
80
80
|
| doNotListenToThePush | boolean | (Android Only) Whether or not, the SDK will listen for pushs from google |
|
|
@@ -93,12 +93,15 @@ The following properties can be used in the `selligent.json` to further configur
|
|
|
93
93
|
Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#create-an-apns-key) & [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android/tree/master/Documentation#creating-an-application) native SDKs guides in order to optin for push notifications in Apple & Google.
|
|
94
94
|
|
|
95
95
|
**For Android**, if targeting API level 33 and above:
|
|
96
|
+
|
|
96
97
|
1. Add the following line to AndroidManifest.xml:
|
|
98
|
+
|
|
97
99
|
```xml
|
|
98
100
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
2. Add this native code to request the push permission and let the SDK know when it is accepted, in the activity where you want to:
|
|
104
|
+
|
|
102
105
|
```java
|
|
103
106
|
import com.selligent.RNSelligent;
|
|
104
107
|
|
|
@@ -867,7 +870,7 @@ Defines the type of an event.
|
|
|
867
870
|
| USER_REGISTER | number | 90 | Used to send a register event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Selligent platform side. This event will create a new user in your Selligent database, if none was found (you can use an alternate key/value field to search for the user, in the data object, since by default the `email` one will use the `MAIL` column in your Selligent database). |
|
|
868
871
|
| USER_UNREGISTER | number | 91 | Used to send an unregister event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a REGISTERED flag and optionally storing some data at Selligent platform side (this event is not unlinking the user from the device (automatically), at the moment). |
|
|
869
872
|
| USER_LOGIN | number | 92 | Used to send a login event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Selligent platform side. This event will **NOT** create a new user in your Selligent database, if none found. |
|
|
870
|
-
| USER_LOGOUT | number | 93 |
|
|
873
|
+
| USER_LOGOUT | number | 93 | Used to send a logout event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a LOGGED flag and optionally storing some data at Selligent platform side (this event is not unlinking the user from the device (automatically), at the moment). |
|
|
871
874
|
| CUSTOM | number | 94 | Used to send a custom event to the server, with the purpose of keeping track of storing some data at Selligent platform side. |
|
|
872
875
|
|
|
873
876
|
### NotificationButtonType
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"name": "@selligent-marketing-cloud/selligent-react-native",
|
|
6
6
|
"title": "Selligent React Native",
|
|
7
|
-
"version": "3.
|
|
7
|
+
"version": "3.5.0",
|
|
8
8
|
"description": "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"repository": {
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
"metro-react-native-babel-preset": "^0.76.4",
|
|
33
33
|
"react": "18.0.0",
|
|
34
34
|
"react-native": "^0.69.10",
|
|
35
|
-
"ts-jest": "^29.1.0"
|
|
35
|
+
"ts-jest": "^29.1.0",
|
|
36
|
+
"jest-junit": "^16.0.0"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
|
-
"test": "jest"
|
|
39
|
+
"test": "jest --coverage --reporters=jest-junit"
|
|
39
40
|
},
|
|
40
41
|
"files": [
|
|
41
42
|
"/RNSelligentMapper.podspec",
|
|
@@ -43,8 +44,10 @@
|
|
|
43
44
|
"/*.ts",
|
|
44
45
|
"/ios/*.h",
|
|
45
46
|
"/ios/*.m",
|
|
47
|
+
"/android/libs",
|
|
46
48
|
"/android/src/main",
|
|
47
49
|
"/android/build.gradle",
|
|
50
|
+
"/android/settings.gradle",
|
|
48
51
|
"/documentation/README.md"
|
|
49
52
|
]
|
|
50
53
|
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import android.content.Intent;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.WritableMap;
|
|
6
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
7
|
-
import com.selligent.sdk.SMManager;
|
|
8
|
-
|
|
9
|
-
import java.util.HashMap;
|
|
10
|
-
import java.util.Map;
|
|
11
|
-
|
|
12
|
-
class BroadcastDataFactory {
|
|
13
|
-
private BroadcastDataFactory(){}
|
|
14
|
-
|
|
15
|
-
private static Map<String, BroadcastEventDataParser> getBroadcastDataParserMap()
|
|
16
|
-
{
|
|
17
|
-
HashMap<String, BroadcastEventDataParser> parser = new HashMap<>();
|
|
18
|
-
|
|
19
|
-
parser.put(SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE, new InAppMessageBroadcastEventDataParser());
|
|
20
|
-
parser.put(SMManager.BROADCAST_EVENT_BUTTON_CLICKED, new ButtonBroadcastEventDataParser());
|
|
21
|
-
parser.put(SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN, new GCMTokenBroadcastEventDataParser());
|
|
22
|
-
|
|
23
|
-
return parser;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static WritableMap getBroadcastData(String smBroadcastEventType, Intent intent) {
|
|
27
|
-
final WritableMap broadcastData = new WritableNativeMap();
|
|
28
|
-
|
|
29
|
-
final BroadcastEventType broadcastEventType = BroadcastEventType.fromSMBroadcastEventType(smBroadcastEventType);
|
|
30
|
-
String resultingBroadcastEventType = smBroadcastEventType;
|
|
31
|
-
if (broadcastEventType != null) {
|
|
32
|
-
resultingBroadcastEventType = broadcastEventType.getBroadcastEventType();
|
|
33
|
-
}
|
|
34
|
-
broadcastData.putString("broadcastEventType", resultingBroadcastEventType);
|
|
35
|
-
|
|
36
|
-
final BroadcastEventDataParser broadcastEventDataParser = getBroadcastDataParserMap().get(smBroadcastEventType);
|
|
37
|
-
|
|
38
|
-
if (broadcastEventDataParser != null) {
|
|
39
|
-
final WritableMap resultingData = broadcastEventDataParser.parse(intent);
|
|
40
|
-
broadcastData.putMap("data", resultingData);
|
|
41
|
-
} else {
|
|
42
|
-
broadcastData.putMap("data", null);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return broadcastData;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMManager;
|
|
4
|
-
|
|
5
|
-
enum BroadcastEventType {
|
|
6
|
-
ButtonClicked("ButtonClicked", SMManager.BROADCAST_EVENT_BUTTON_CLICKED),
|
|
7
|
-
ReceivedInAppMessage("ReceivedInAppMessage", SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE),
|
|
8
|
-
WillDisplayNotification("WillDisplayNotification", SMManager.BROADCAST_EVENT_WILL_DISPLAY_NOTIFICATION),
|
|
9
|
-
WillDismissNotification("WillDismissNotification", SMManager.BROADCAST_EVENT_WILL_DISMISS_NOTIFICATION),
|
|
10
|
-
ReceivedGCMToken("ReceivedGCMToken", SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN),
|
|
11
|
-
ReceivedNotification("ReceivedRemoteNotification", null),
|
|
12
|
-
ReceivedDeviceId("ReceivedDeviceId", null),
|
|
13
|
-
TriggeredCustomEvent("TriggeredCustomEvent", null);
|
|
14
|
-
|
|
15
|
-
private String broadcastEventType;
|
|
16
|
-
private String smBroadcastEventType;
|
|
17
|
-
|
|
18
|
-
public String getBroadcastEventType() {
|
|
19
|
-
return broadcastEventType;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
BroadcastEventType(String broadcastEventType, String smBroadcastEventType) {
|
|
23
|
-
this.broadcastEventType = broadcastEventType;
|
|
24
|
-
this.smBroadcastEventType = smBroadcastEventType;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public static BroadcastEventType fromSMBroadcastEventType(String smEventType) {
|
|
28
|
-
BroadcastEventType result = null;
|
|
29
|
-
for (BroadcastEventType broadcastEventType: values()) {
|
|
30
|
-
if(smEventType.equals(broadcastEventType.smBroadcastEventType)) {
|
|
31
|
-
result = broadcastEventType;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMLinkAction;
|
|
4
|
-
|
|
5
|
-
public enum ButtonAction
|
|
6
|
-
{
|
|
7
|
-
unknown(100),
|
|
8
|
-
phone(101),
|
|
9
|
-
sms(102),
|
|
10
|
-
mail(103),
|
|
11
|
-
url(104),
|
|
12
|
-
externalApp(105),
|
|
13
|
-
rateApp(106),
|
|
14
|
-
broadcastEvent(107),
|
|
15
|
-
passbook(111),
|
|
16
|
-
deeplink(112),
|
|
17
|
-
simple(113);
|
|
18
|
-
|
|
19
|
-
private final int buttonAction;
|
|
20
|
-
|
|
21
|
-
ButtonAction(int action) { this.buttonAction = action; }
|
|
22
|
-
|
|
23
|
-
public static ButtonAction valueOf(int x)
|
|
24
|
-
{
|
|
25
|
-
switch(x) {
|
|
26
|
-
case 101:
|
|
27
|
-
return phone;
|
|
28
|
-
case 102:
|
|
29
|
-
return sms;
|
|
30
|
-
case 103:
|
|
31
|
-
return mail;
|
|
32
|
-
case 104:
|
|
33
|
-
return url;
|
|
34
|
-
case 105:
|
|
35
|
-
return externalApp;
|
|
36
|
-
case 106:
|
|
37
|
-
return rateApp;
|
|
38
|
-
case 107:
|
|
39
|
-
return broadcastEvent;
|
|
40
|
-
case 111:
|
|
41
|
-
return passbook;
|
|
42
|
-
case 112:
|
|
43
|
-
return deeplink;
|
|
44
|
-
case 113:
|
|
45
|
-
return simple;
|
|
46
|
-
default:
|
|
47
|
-
return unknown;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public static ButtonAction valueOf(SMLinkAction linkAction)
|
|
52
|
-
{
|
|
53
|
-
switch(linkAction) {
|
|
54
|
-
case phone:
|
|
55
|
-
return phone;
|
|
56
|
-
case sms:
|
|
57
|
-
return sms;
|
|
58
|
-
case mail:
|
|
59
|
-
return mail;
|
|
60
|
-
case url:
|
|
61
|
-
return url;
|
|
62
|
-
case externalApp:
|
|
63
|
-
return externalApp;
|
|
64
|
-
case rateApp:
|
|
65
|
-
return rateApp;
|
|
66
|
-
case broadcastEvent:
|
|
67
|
-
return broadcastEvent;
|
|
68
|
-
case passbook:
|
|
69
|
-
return passbook;
|
|
70
|
-
case deeplink:
|
|
71
|
-
return deeplink;
|
|
72
|
-
case simple:
|
|
73
|
-
return simple;
|
|
74
|
-
}
|
|
75
|
-
return unknown;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public int getValue()
|
|
79
|
-
{
|
|
80
|
-
return buttonAction;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import android.content.Intent;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.WritableMap;
|
|
6
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
7
|
-
import com.selligent.sdk.SMManager;
|
|
8
|
-
import com.selligent.sdk.SMNotificationButton;
|
|
9
|
-
|
|
10
|
-
class ButtonBroadcastEventDataParser implements BroadcastEventDataParser {
|
|
11
|
-
@Override
|
|
12
|
-
public WritableMap parse(Intent intent) {
|
|
13
|
-
SMNotificationButton button;
|
|
14
|
-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU)
|
|
15
|
-
{
|
|
16
|
-
button = intent.getSerializableExtra(SMManager.BROADCAST_DATA_BUTTON, SMNotificationButton.class);
|
|
17
|
-
}
|
|
18
|
-
else
|
|
19
|
-
{
|
|
20
|
-
button = (SMNotificationButton)intent.getSerializableExtra(SMManager.BROADCAST_DATA_BUTTON);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return wrap(button);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public WritableMap wrap(SMNotificationButton button)
|
|
27
|
-
{
|
|
28
|
-
final WritableMap resultingMap = new WritableNativeMap();
|
|
29
|
-
|
|
30
|
-
resultingMap.putString("id", button.id);
|
|
31
|
-
resultingMap.putInt("type", ButtonAction.valueOf(button.action).getValue());
|
|
32
|
-
resultingMap.putString("value", button.value);
|
|
33
|
-
resultingMap.putString("label", button.label);
|
|
34
|
-
|
|
35
|
-
if (button.data != null) {
|
|
36
|
-
final WritableMap buttonData = new WritableNativeMap();
|
|
37
|
-
for(String dataKey : button.data.keySet()) {
|
|
38
|
-
buttonData.putString(dataKey, button.data.get(dataKey));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!buttonData.toHashMap().isEmpty()) {
|
|
42
|
-
resultingMap.putMap("data", buttonData);
|
|
43
|
-
} else {
|
|
44
|
-
resultingMap.putMap("data", null);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return resultingMap;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMClearCache;
|
|
4
|
-
|
|
5
|
-
enum ClearCacheIntervalValue {
|
|
6
|
-
AUTO(1, SMClearCache.Auto),
|
|
7
|
-
NONE(2, SMClearCache.None),
|
|
8
|
-
DAY(3, SMClearCache.Day),
|
|
9
|
-
WEEK(4, SMClearCache.Week),
|
|
10
|
-
MONTH(5, SMClearCache.Month),
|
|
11
|
-
QUARTER(6, SMClearCache.Quarter);
|
|
12
|
-
|
|
13
|
-
private Integer index;
|
|
14
|
-
private SMClearCache smClearCache;
|
|
15
|
-
|
|
16
|
-
ClearCacheIntervalValue(Integer index, SMClearCache smClearCache) {
|
|
17
|
-
this.index = index;
|
|
18
|
-
this.smClearCache = smClearCache;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public SMClearCache getSmClearCache() {
|
|
22
|
-
return smClearCache;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public static ClearCacheIntervalValue valueOf(Integer index) {
|
|
26
|
-
ClearCacheIntervalValue result = null;
|
|
27
|
-
for(ClearCacheIntervalValue clearCacheIntervalValue : values()) {
|
|
28
|
-
if(index.equals(clearCacheIntervalValue.index)) {
|
|
29
|
-
result = clearCacheIntervalValue;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if(result == null) throw new IllegalArgumentException("Invalid clearCacheIntervalValue");
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.WritableMap;
|
|
4
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
5
|
-
|
|
6
|
-
class DeviceIdBroadcastEventDataParser {
|
|
7
|
-
|
|
8
|
-
public WritableMap wrap(String deviceId) {
|
|
9
|
-
final WritableMap resultingMap = new WritableNativeMap();
|
|
10
|
-
|
|
11
|
-
resultingMap.putString("deviceId", deviceId);
|
|
12
|
-
|
|
13
|
-
return resultingMap;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import java.util.HashMap;
|
|
4
|
-
import java.util.Hashtable;
|
|
5
|
-
import java.util.Map;
|
|
6
|
-
|
|
7
|
-
class Event {
|
|
8
|
-
|
|
9
|
-
private EventType type;
|
|
10
|
-
private String email;
|
|
11
|
-
private Hashtable<String, String> data;
|
|
12
|
-
|
|
13
|
-
private Event() { }
|
|
14
|
-
|
|
15
|
-
public EventType getType() {
|
|
16
|
-
return type;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public String getEmail() {
|
|
20
|
-
return email;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public Hashtable<String, String> getData() {
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static Event fromHashMap(HashMap<String, Object> eventHashMap) {
|
|
28
|
-
final Integer typeIndex = ((Double) eventHashMap.get("type")).intValue();
|
|
29
|
-
final EventType type = EventType.valueOf(typeIndex);
|
|
30
|
-
String email = null;
|
|
31
|
-
if (eventHashMap.containsKey("email")) {
|
|
32
|
-
email = (String) eventHashMap.get("email");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Hashtable<String, String> data = null;
|
|
36
|
-
if (eventHashMap.containsKey("data")) {
|
|
37
|
-
final HashMap<String, String> dataHashMap = (HashMap<String, String>) eventHashMap.get("data");
|
|
38
|
-
data = new Hashtable<>();
|
|
39
|
-
for (Map.Entry<String, String> entry : dataHashMap.entrySet()) {
|
|
40
|
-
data.put(entry.getKey(), entry.getValue());
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
final Event event = new Event();
|
|
45
|
-
event.type = type;
|
|
46
|
-
event.email = email;
|
|
47
|
-
event.data = data;
|
|
48
|
-
return event;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
enum EventType {
|
|
4
|
-
UserRegister(90),
|
|
5
|
-
UserUnregister(91),
|
|
6
|
-
UserLogin(92),
|
|
7
|
-
UserLogout(93),
|
|
8
|
-
Custom(94);
|
|
9
|
-
|
|
10
|
-
private int index;
|
|
11
|
-
|
|
12
|
-
EventType(Integer index) {
|
|
13
|
-
this.index = index;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public static EventType valueOf(Integer index) {
|
|
17
|
-
EventType result = null;
|
|
18
|
-
for (EventType eventType: values()) {
|
|
19
|
-
if(index.equals(eventType.index)) {
|
|
20
|
-
result = eventType;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (result == null) throw new IllegalArgumentException("Invalid eventType");
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import android.content.Intent;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.WritableMap;
|
|
6
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
7
|
-
import com.selligent.sdk.SMManager;
|
|
8
|
-
|
|
9
|
-
class GCMTokenBroadcastEventDataParser implements BroadcastEventDataParser {
|
|
10
|
-
@Override
|
|
11
|
-
public WritableMap parse(Intent intent) {
|
|
12
|
-
final String token = intent.getStringExtra(SMManager.BROADCAST_DATA_GCM_TOKEN);
|
|
13
|
-
|
|
14
|
-
return wrap(token);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public WritableMap wrap(String token) {
|
|
18
|
-
final WritableMap resultingMap = new WritableNativeMap();
|
|
19
|
-
|
|
20
|
-
resultingMap.putString("token", token);
|
|
21
|
-
|
|
22
|
-
return resultingMap;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import android.content.Intent;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.WritableArray;
|
|
6
|
-
import com.facebook.react.bridge.WritableMap;
|
|
7
|
-
import com.facebook.react.bridge.WritableNativeArray;
|
|
8
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
9
|
-
import com.selligent.sdk.SMInAppMessage;
|
|
10
|
-
import com.selligent.sdk.SMManager;
|
|
11
|
-
|
|
12
|
-
class InAppMessageBroadcastEventDataParser implements BroadcastEventDataParser {
|
|
13
|
-
@Override
|
|
14
|
-
public WritableMap parse(Intent intent) {
|
|
15
|
-
SMInAppMessage[] messages;
|
|
16
|
-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU)
|
|
17
|
-
{
|
|
18
|
-
messages = intent.getSerializableExtra(SMManager.BROADCAST_DATA_IN_APP_MESSAGES, SMInAppMessage[].class);
|
|
19
|
-
}
|
|
20
|
-
else
|
|
21
|
-
{
|
|
22
|
-
messages = (SMInAppMessage[])intent.getSerializableExtra(SMManager.BROADCAST_DATA_IN_APP_MESSAGES);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return wrap(messages);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public WritableMap wrap(SMInAppMessage[] messages)
|
|
29
|
-
{
|
|
30
|
-
final WritableMap resultingMap = new WritableNativeMap();
|
|
31
|
-
|
|
32
|
-
final WritableArray messageArray = new WritableNativeArray();
|
|
33
|
-
for (SMInAppMessage message : messages) {
|
|
34
|
-
WritableMap messageMap = new WritableNativeMap();
|
|
35
|
-
messageMap.putString("id", message.id);
|
|
36
|
-
messageMap.putString("title", message.title);
|
|
37
|
-
messageArray.pushMap(messageMap);
|
|
38
|
-
}
|
|
39
|
-
resultingMap.putArray("messages", messageArray);
|
|
40
|
-
|
|
41
|
-
return resultingMap;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMInAppRefreshType;
|
|
4
|
-
|
|
5
|
-
enum InAppMessageRefreshType {
|
|
6
|
-
NONE(10, SMInAppRefreshType.None),
|
|
7
|
-
MINUTELY(11, SMInAppRefreshType.Minutely),
|
|
8
|
-
HOURLY(12, SMInAppRefreshType.Hourly),
|
|
9
|
-
DAILY(13, SMInAppRefreshType.Daily);
|
|
10
|
-
|
|
11
|
-
private Integer index;
|
|
12
|
-
private SMInAppRefreshType smInAppRefreshType;
|
|
13
|
-
|
|
14
|
-
InAppMessageRefreshType(Integer index, SMInAppRefreshType smInAppRefreshType) {
|
|
15
|
-
this.index = index;
|
|
16
|
-
this.smInAppRefreshType = smInAppRefreshType;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public SMInAppRefreshType getSmInAppRefreshType() {
|
|
20
|
-
return smInAppRefreshType;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static InAppMessageRefreshType valueOf(Integer index) {
|
|
24
|
-
InAppMessageRefreshType result = null;
|
|
25
|
-
for (InAppMessageRefreshType inAppMessageRefreshType: values()) {
|
|
26
|
-
if(index.equals(inAppMessageRefreshType.index)) {
|
|
27
|
-
result = inAppMessageRefreshType;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (result == null) throw new IllegalArgumentException("Invalid inAppMessageRefreshType");
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
}
|
package/android/src/main/java/com/selligent/NotificationMessageBroadcastEventDataParser.java
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.WritableMap;
|
|
4
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
5
|
-
import com.selligent.sdk.SMNotificationMessage;
|
|
6
|
-
|
|
7
|
-
class NotificationMessageBroadcastEventDataParser
|
|
8
|
-
{
|
|
9
|
-
public WritableMap wrap(SMNotificationMessage message)
|
|
10
|
-
{
|
|
11
|
-
final WritableMap resultingMap = new WritableNativeMap();
|
|
12
|
-
|
|
13
|
-
resultingMap.putString("pushId", message.getId());
|
|
14
|
-
resultingMap.putString("name", message.getNotificationTitle());
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return resultingMap;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMRemoteMessageDisplayType;
|
|
4
|
-
|
|
5
|
-
enum RemoteMessageDisplayType {
|
|
6
|
-
AUTOMATIC(20, SMRemoteMessageDisplayType.Automatic),
|
|
7
|
-
NONE(21, SMRemoteMessageDisplayType.None),
|
|
8
|
-
NOTIFICATION(22, SMRemoteMessageDisplayType.Notification);
|
|
9
|
-
|
|
10
|
-
private Integer index;
|
|
11
|
-
private SMRemoteMessageDisplayType smRemoteMessageDisplayType;
|
|
12
|
-
|
|
13
|
-
RemoteMessageDisplayType(Integer index, SMRemoteMessageDisplayType smRemoteMessageDisplayType) {
|
|
14
|
-
this.index = index;
|
|
15
|
-
this.smRemoteMessageDisplayType = smRemoteMessageDisplayType;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public Integer getIndex() {
|
|
19
|
-
return index;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public SMRemoteMessageDisplayType getSmRemoteMessageDisplayType() {
|
|
23
|
-
return smRemoteMessageDisplayType;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static RemoteMessageDisplayType valueOf(Integer index) {
|
|
27
|
-
RemoteMessageDisplayType result = null;
|
|
28
|
-
for (RemoteMessageDisplayType remoteMessageDisplayType : values()) {
|
|
29
|
-
if(index.equals(remoteMessageDisplayType.index)) {
|
|
30
|
-
result = remoteMessageDisplayType;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (result == null) throw new IllegalArgumentException("Invalid remoteMessageDisplayType");
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public static RemoteMessageDisplayType valueOf(SMRemoteMessageDisplayType smRemoteMessageDisplayType) {
|
|
39
|
-
RemoteMessageDisplayType result = null;
|
|
40
|
-
for (RemoteMessageDisplayType remoteMessageDisplayType : values()) {
|
|
41
|
-
if(smRemoteMessageDisplayType == remoteMessageDisplayType.smRemoteMessageDisplayType) {
|
|
42
|
-
result = remoteMessageDisplayType;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (result == null) throw new IllegalArgumentException("Invalid SMRemoteMessageDisplayType");
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMCallback;
|
|
4
|
-
import com.selligent.sdk.SMEvent;
|
|
5
|
-
import com.selligent.sdk.SMEventUserLogin;
|
|
6
|
-
import com.selligent.sdk.SMEventUserLogout;
|
|
7
|
-
import com.selligent.sdk.SMEventUserRegister;
|
|
8
|
-
import com.selligent.sdk.SMEventUserUnregister;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import java.util.Hashtable;
|
|
12
|
-
|
|
13
|
-
class SMEventFactory {
|
|
14
|
-
private SMEventFactory(){}
|
|
15
|
-
|
|
16
|
-
public static SMEvent getSMEvent(Event event, SMCallback callback) {
|
|
17
|
-
final EventType type = event.getType();
|
|
18
|
-
final String email = event.getEmail();
|
|
19
|
-
final Hashtable<String, String> data = event.getData();
|
|
20
|
-
|
|
21
|
-
switch (type) {
|
|
22
|
-
case UserRegister:
|
|
23
|
-
return new SMEventUserRegister(email, data, callback);
|
|
24
|
-
case UserUnregister:
|
|
25
|
-
return new SMEventUserUnregister(email, data, callback);
|
|
26
|
-
case UserLogin:
|
|
27
|
-
return new SMEventUserLogin(email, data, callback);
|
|
28
|
-
case UserLogout:
|
|
29
|
-
return new SMEventUserLogout(email, data, callback);
|
|
30
|
-
case Custom:
|
|
31
|
-
return new SMEvent(null, data, callback);
|
|
32
|
-
default:
|
|
33
|
-
throw new IllegalArgumentException("SMManager sendEvent failed: you provided an invalid EventType");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
import com.selligent.sdk.SMSettings;
|
|
4
|
-
import com.selligent.sdk.SMFrameworkType;
|
|
5
|
-
|
|
6
|
-
class SMSettingsFactory {
|
|
7
|
-
private SMSettingsFactory(){}
|
|
8
|
-
|
|
9
|
-
public static SMSettings getSMSettings(Settings settings) {
|
|
10
|
-
final SMSettings smSettings = new SMSettings();
|
|
11
|
-
smSettings.WebServiceUrl = settings.getUrl();
|
|
12
|
-
smSettings.ClientId = settings.getClientId();
|
|
13
|
-
smSettings.PrivateKey = settings.getPrivateKey();
|
|
14
|
-
smSettings.AddInAppMessageFromPushToInAppMessageList = settings.getAddInAppMessageFromPushToInAppMessageList();
|
|
15
|
-
smSettings.DoNotFetchTheToken = settings.getDoNotFetchTheToken();
|
|
16
|
-
smSettings.DoNotListenToThePush = settings.getDoNotListenToThePush();
|
|
17
|
-
smSettings.LoadCacheAsynchronously = settings.getLoadCacheAsynchronously();
|
|
18
|
-
smSettings.NotificationChannelId = settings.getNotificationChannelId();
|
|
19
|
-
smSettings.NotificationChannelName = settings.getNotificationChannelName();
|
|
20
|
-
smSettings.NotificationChannelDescription = settings.getNotificationChannelDescription();
|
|
21
|
-
smSettings.FrameworkType = SMFrameworkType.reactNative;
|
|
22
|
-
|
|
23
|
-
final ClearCacheIntervalValue clearCacheIntervalValue = settings.getClearCacheIntervalValue();
|
|
24
|
-
if (clearCacheIntervalValue != null) {
|
|
25
|
-
smSettings.ClearCacheIntervalValue = clearCacheIntervalValue.getSmClearCache();
|
|
26
|
-
}
|
|
27
|
-
final InAppMessageRefreshType inAppMessageRefreshType = settings.getInAppMessageRefreshType();
|
|
28
|
-
if (inAppMessageRefreshType != null) {
|
|
29
|
-
smSettings.InAppMessageRefreshType = inAppMessageRefreshType.getSmInAppRefreshType();
|
|
30
|
-
}
|
|
31
|
-
final RemoteMessageDisplayType remoteMessageDisplayType = settings.getRemoteMessageDisplayType();
|
|
32
|
-
if (remoteMessageDisplayType != null) {
|
|
33
|
-
smSettings.RemoteMessageDisplayType = remoteMessageDisplayType.getSmRemoteMessageDisplayType();
|
|
34
|
-
}
|
|
35
|
-
return smSettings;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
package com.selligent;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import java.util.Map;
|
|
5
|
-
|
|
6
|
-
class Settings {
|
|
7
|
-
|
|
8
|
-
private String url;
|
|
9
|
-
private String clientId;
|
|
10
|
-
private String privateKey;
|
|
11
|
-
private String activityName;
|
|
12
|
-
private String notificationSmallIcon;
|
|
13
|
-
private String notificationLargeIcon;
|
|
14
|
-
private String notificationIconColor;
|
|
15
|
-
private boolean addInAppMessageFromPushToInAppMessageList = false;
|
|
16
|
-
private Boolean doNotFetchTheToken = false;
|
|
17
|
-
private Boolean doNotListenToThePush = false;
|
|
18
|
-
private Boolean loadCacheAsynchronously = false;
|
|
19
|
-
private ClearCacheIntervalValue clearCacheIntervalValue;
|
|
20
|
-
private InAppMessageRefreshType inAppMessageRefreshType = InAppMessageRefreshType.NONE;
|
|
21
|
-
private RemoteMessageDisplayType remoteMessageDisplayType;
|
|
22
|
-
private String notificationChannelId = "SMChannel001";
|
|
23
|
-
private String notificationChannelName = "SMDefaultChannel";
|
|
24
|
-
private String notificationChannelDescription = "";
|
|
25
|
-
private Boolean enableAndroidLogging = false;
|
|
26
|
-
|
|
27
|
-
private Settings() { }
|
|
28
|
-
|
|
29
|
-
public String getUrl() {
|
|
30
|
-
return url;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public String getClientId() {
|
|
34
|
-
return clientId;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public String getPrivateKey() {
|
|
38
|
-
return privateKey;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public String getActivityName() {
|
|
42
|
-
return activityName;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public String getNotificationSmallIcon() {
|
|
46
|
-
return notificationSmallIcon;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public String getNotificationLargeIcon() {
|
|
50
|
-
return notificationLargeIcon;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public String getNotificationIconColor() {
|
|
54
|
-
return notificationIconColor;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public Boolean getDoNotListenToThePush() { return doNotListenToThePush; }
|
|
58
|
-
|
|
59
|
-
public Boolean getAddInAppMessageFromPushToInAppMessageList() { return addInAppMessageFromPushToInAppMessageList; }
|
|
60
|
-
|
|
61
|
-
public Boolean getDoNotFetchTheToken() { return doNotFetchTheToken; }
|
|
62
|
-
|
|
63
|
-
public Boolean getLoadCacheAsynchronously() { return loadCacheAsynchronously; }
|
|
64
|
-
|
|
65
|
-
public ClearCacheIntervalValue getClearCacheIntervalValue() {
|
|
66
|
-
return clearCacheIntervalValue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public InAppMessageRefreshType getInAppMessageRefreshType() {
|
|
70
|
-
return inAppMessageRefreshType;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public RemoteMessageDisplayType getRemoteMessageDisplayType() {
|
|
74
|
-
return remoteMessageDisplayType;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public String getNotificationChannelId() {
|
|
78
|
-
return notificationChannelId;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public String getNotificationChannelName() {
|
|
82
|
-
return notificationChannelName;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public String getNotificationChannelDescription() {
|
|
86
|
-
return notificationChannelDescription;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public Boolean getEnableAndroidLogging() { return enableAndroidLogging; }
|
|
90
|
-
|
|
91
|
-
public static Settings fromHashMap(Map<String, Object> settingsHashMap) {
|
|
92
|
-
final Settings settings = new Settings();
|
|
93
|
-
|
|
94
|
-
settings.url = (String) settingsHashMap.get("url");
|
|
95
|
-
settings.clientId = (String) settingsHashMap.get("clientId");
|
|
96
|
-
settings.privateKey = (String) settingsHashMap.get("privateKey");
|
|
97
|
-
settings.activityName = (String) settingsHashMap.get("fullyQualifiedNotificationActivityClassName");
|
|
98
|
-
|
|
99
|
-
if (settingsHashMap.containsKey("notificationSmallIcon")) {
|
|
100
|
-
settings.notificationSmallIcon = (String) settingsHashMap.get("notificationSmallIcon");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (settingsHashMap.containsKey("notificationLargeIcon")) {
|
|
104
|
-
settings.notificationLargeIcon = (String) settingsHashMap.get("notificationLargeIcon");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (settingsHashMap.containsKey("notificationIconColor")) {
|
|
108
|
-
settings.notificationIconColor = (String) settingsHashMap.get("notificationIconColor");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (settingsHashMap.containsKey("addInAppMessageFromPushToInAppMessageList")) {
|
|
112
|
-
settings.addInAppMessageFromPushToInAppMessageList = (Boolean) settingsHashMap.get("addInAppMessageFromPushToInAppMessageList");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (settingsHashMap.containsKey("doNotFetchTheToken")) {
|
|
116
|
-
settings.doNotFetchTheToken = (Boolean) settingsHashMap.get("doNotFetchTheToken");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (settingsHashMap.containsKey("doNotListenToThePush")) {
|
|
120
|
-
settings.doNotListenToThePush = (Boolean) settingsHashMap.get("doNotListenToThePush");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (settingsHashMap.containsKey("loadCacheAsynchronously")) {
|
|
124
|
-
settings.loadCacheAsynchronously = (Boolean) settingsHashMap.get("loadCacheAsynchronously");
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (settingsHashMap.containsKey("notificationChannelId")) {
|
|
128
|
-
settings.notificationChannelId = (String) settingsHashMap.get("notificationChannelId");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (settingsHashMap.containsKey("notificationChannelName")) {
|
|
132
|
-
settings.notificationChannelName = (String) settingsHashMap.get("notificationChannelName");
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (settingsHashMap.containsKey("notificationChannelDescription")) {
|
|
136
|
-
settings.notificationChannelDescription = (String) settingsHashMap.get("notificationChannelDescription");
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (settingsHashMap.containsKey("enableAndroidLogging")) {
|
|
140
|
-
settings.enableAndroidLogging = (Boolean) settingsHashMap.get("enableAndroidLogging");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
final Double clearCacheIndex = (Double) settingsHashMap.get("clearCacheIntervalValue");
|
|
144
|
-
if (clearCacheIndex != null) {
|
|
145
|
-
settings.clearCacheIntervalValue = ClearCacheIntervalValue.valueOf(clearCacheIndex.intValue());
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
final Double inAppMsgRefreshIndex = (Double) settingsHashMap.get("inAppMessageRefreshType");
|
|
149
|
-
if (inAppMsgRefreshIndex != null) {
|
|
150
|
-
settings.inAppMessageRefreshType = InAppMessageRefreshType.valueOf(inAppMsgRefreshIndex.intValue());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
final Double remoteMsgRefreshIndex = (Double) settingsHashMap.get("remoteMessageDisplayType");
|
|
154
|
-
if (remoteMsgRefreshIndex != null) {
|
|
155
|
-
settings.remoteMessageDisplayType = RemoteMessageDisplayType.valueOf(remoteMsgRefreshIndex.intValue());
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return settings;
|
|
159
|
-
}
|
|
160
|
-
}
|