react-native-netmera 1.3.8 → 1.4.3
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/.idea/{netmera-sdk-react-native.iml → NetmeraSDKReactNative.iml} +0 -0
- package/.idea/modules.xml +1 -1
- package/README.md +279 -222
- package/RNNetmera.podspec +8 -6
- package/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/gradle.xml +0 -2
- package/android/build/generated/source/buildConfig/debug/com/netmera/reactnativesdk/BuildConfig.java +0 -2
- package/android/build/generated/source/buildConfig/release/com/netmera/reactnativesdk/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/release/aapt/AndroidManifest.xml +15 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/release/aapt/output-metadata.json +16 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
- package/android/build/intermediates/aar_metadata/release/aar-metadata.properties +2 -0
- package/android/build/intermediates/annotation_processor_list/release/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_library_classes_jar/release/classes.jar +0 -0
- package/android/build/intermediates/{compile_only_not_namespaced_r_class_jar → compile_r_class_jar}/debug/R.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/release/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +1 -5
- package/android/build/intermediates/compile_symbol_list/release/R.txt +6750 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeReleaseJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeReleaseShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageReleaseAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageReleaseResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/packageReleaseResources/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmera.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraCategoryObject.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$10.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$5.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$6.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$7.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$8.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$9.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushHeadlessService.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmera.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraCategoryObject.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration$1.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration$Builder.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraEvent.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$1.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$10.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$2.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$3.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$4.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$5.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$6.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$7.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$8.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule$9.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraModule.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraPackage.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraPushHeadlessService.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraUser.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraUtil$1.class +0 -0
- package/android/build/intermediates/javac/release/classes/com/netmera/reactnativesdk/RNNetmeraUtil.class +0 -0
- package/android/build/intermediates/library_manifest/release/AndroidManifest.xml +15 -0
- package/android/build/intermediates/local_only_symbol_list/release/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +5 -5
- package/android/build/intermediates/manifest_merge_blame_file/release/manifest-merger-blame-release-report.txt +20 -0
- package/android/build/intermediates/navigation_json/release/navigation.json +1 -0
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
- package/android/build/intermediates/packaged_manifests/release/output-metadata.json +16 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/release/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1 -5
- package/android/build/intermediates/symbol_list_with_package_name/release/package-aware-r.txt +4875 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +31 -31
- package/android/build/outputs/logs/manifest-merger-release-report.txt +43 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +3 -3
- package/android/local.properties +2 -2
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmera.java +2 -6
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +116 -5
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.java +9 -7
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraUtil.java +52 -4
- package/index.js +19 -320
- package/ios/RNNetmera.h +2 -2
- package/ios/RNNetmera.m +64 -2
- package/ios/RNNetmeraRCTEventEmitter.m +16 -1
- package/ios/RNNetmeraUtils.h +4 -0
- package/ios/RNNetmeraUtils.m +38 -0
- package/package.json +1 -1
- package/src/Netmera.js +223 -0
- package/src/NetmeraInbox.js +95 -0
- package/src/NetmeraUser.js +92 -0
- package/.idea/misc.xml +0 -7
- package/android/build/.transforms/00a1a2a97b81c133eb73f4c946b323aa/classes/classes.dex +0 -0
- package/android/build/.transforms/00a1a2a97b81c133eb73f4c946b323aa.bin +0 -1
- package/android/build/.transforms/8b103fc7545c9799a16ff009dc2ead52/classes/classes.dex +0 -0
- package/android/build/.transforms/8b103fc7545c9799a16ff009dc2ead52.bin +0 -1
- package/android/build/.transforms/9e086edd0cadc1c3e325107cef1d09ca/classes/classes.dex +0 -0
- package/android/build/.transforms/9e086edd0cadc1c3e325107cef1d09ca.bin +0 -1
- package/android/build/.transforms/b0d220ccd1945e73ed321c4b96bb37de/classes/classes.dex +0 -0
- package/android/build/.transforms/b0d220ccd1945e73ed321c4b96bb37de.bin +0 -1
- package/android/build/.transforms/f70db9a523a6c7b9af14929671f6c09b/classes/classes.dex +0 -0
- package/android/build/.transforms/f70db9a523a6c7b9af14929671f6c09b.bin +0 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -27
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/merged_manifests/debug/output.json +0 -27
- package/ios/RNNetmera.xcodeproj/xcuserdata/ensarbayhan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
File without changes
|
package/.idea/modules.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ProjectModuleManager">
|
|
4
4
|
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/NetmeraSDKReactNative.iml" filepath="$PROJECT_DIR$/.idea/NetmeraSDKReactNative.iml" />
|
|
6
6
|
</modules>
|
|
7
7
|
</component>
|
|
8
8
|
</project>
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ NETMERA is a Mobile Application Engagement Platform. We offer a series of develo
|
|
|
32
32
|
```
|
|
33
33
|
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
|
34
34
|
```
|
|
35
|
-
|
|
35
|
+
implementation project(':react-native-netmera')
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
For both native sides(Android & iOS) you don't have to include extra Netmera SDK libraries.
|
|
@@ -50,11 +50,11 @@ buildscript {
|
|
|
50
50
|
repositories {
|
|
51
51
|
google()
|
|
52
52
|
jcenter()
|
|
53
|
-
maven {url '
|
|
53
|
+
maven {url 'https://developer.huawei.com/repo/'}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
dependencies {
|
|
57
|
-
classpath 'com.android.tools.build:gradle:4.
|
|
57
|
+
classpath 'com.android.tools.build:gradle:4.1.3'
|
|
58
58
|
classpath 'com.google.gms:google-services:4.3.10'
|
|
59
59
|
classpath 'com.huawei.agconnect:agcp:1.6.3.300'
|
|
60
60
|
}
|
|
@@ -65,7 +65,8 @@ allprojects {
|
|
|
65
65
|
google()
|
|
66
66
|
jcenter()
|
|
67
67
|
maven { url 'https://maven.google.com'}
|
|
68
|
-
maven {url '
|
|
68
|
+
maven { url 'https://developer.huawei.com/repo/'}
|
|
69
|
+
maven { url "https://release.netmera.com/release/android" }
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
```
|
|
@@ -81,10 +82,11 @@ allprojects {
|
|
|
81
82
|
}
|
|
82
83
|
```
|
|
83
84
|
|
|
84
|
-
5) Add the following into the
|
|
85
|
+
5) Add the following into the top of app's build.gradle file
|
|
85
86
|
|
|
86
87
|
```
|
|
87
88
|
apply plugin: 'com.google.gms.google-services'
|
|
89
|
+
apply plugin: 'com.huawei.agconnect'
|
|
88
90
|
```
|
|
89
91
|
|
|
90
92
|
6) Create an application class as shown below.
|
|
@@ -99,6 +101,7 @@ apply plugin: 'com.google.gms.google-services'
|
|
|
99
101
|
super.onCreate();
|
|
100
102
|
RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
|
|
101
103
|
.firebaseSenderId(<YOUR GCM SENDER ID>)
|
|
104
|
+
.huaweiSenderId(<YOUR HMS SENDER ID>)
|
|
102
105
|
.apiKey(<YOUR NETMERA API KEY>) // This is for enabling Netmera logs.
|
|
103
106
|
.logging(true)
|
|
104
107
|
.build(this);
|
|
@@ -129,28 +132,69 @@ export const onPushDismiss = async (message) => {
|
|
|
129
132
|
export const onPushButtonClicked = async (message) => {
|
|
130
133
|
console.log("onPushButtonClicked: ", message);
|
|
131
134
|
};
|
|
135
|
+
|
|
136
|
+
export const onCarouselObjectSelected = async (message) => {
|
|
137
|
+
console.log("onCarouselObjectSelected: ", message);
|
|
138
|
+
};
|
|
132
139
|
```
|
|
133
140
|
|
|
134
141
|
8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
|
|
135
142
|
|
|
136
143
|
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
import {
|
|
145
|
+
onCarouselObjectSelected,
|
|
146
|
+
onPushButtonClicked,
|
|
147
|
+
onPushDismiss,
|
|
148
|
+
onPushOpen,
|
|
149
|
+
onPushReceive,
|
|
150
|
+
onPushRegister
|
|
151
|
+
} from "./NetmeraPushHeadlessTask";
|
|
152
|
+
|
|
153
|
+
Netmera.initBroadcastReceiver(
|
|
154
|
+
onPushRegister,
|
|
155
|
+
onPushReceive,
|
|
156
|
+
onPushOpen,
|
|
157
|
+
onPushDismiss,
|
|
158
|
+
onPushButtonClicked,
|
|
159
|
+
onCarouselObjectSelected
|
|
160
|
+
)
|
|
151
161
|
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
// This should be called after Netmera.initBroadcastReceiver method.
|
|
163
|
+
AppRegistry.registerComponent(appName, () => App);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
9) If you have custom Firebase Messaging integration, please see usage below.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
messaging()
|
|
170
|
+
.getToken(firebase.app().options.messagingSenderId)
|
|
171
|
+
.then(pushToken => {
|
|
172
|
+
Netmera.onNetmeraNewToken(pushToken)
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
messaging().onMessage(async remoteMessage => {
|
|
176
|
+
if (Netmera.isNetmeraRemoteMessage(remoteMessage.data)) {
|
|
177
|
+
Netmera.onNetmeraFirebasePushMessageReceived(remoteMessage.from, remoteMessage.data)
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
10) If you have custom Huawei Messaging integration, please see usage below.
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
HmsPushInstanceId.getToken("")
|
|
186
|
+
.then((result) => {
|
|
187
|
+
Netmera.onNetmeraNewToken(result.result)
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
HmsPushEvent.onRemoteMessageReceived(event => {
|
|
191
|
+
const remoteMessage = new RNRemoteMessage(event.msg);
|
|
192
|
+
let data = JSON.parse(remoteMessage.getData())
|
|
193
|
+
console.log("onRemoteMessageReceived", data)
|
|
194
|
+
if (Netmera.isNetmeraRemoteMessage(data)) {
|
|
195
|
+
Netmera.onNetmeraHuaweiPushMessageReceived(remoteMessage.getFrom(), data)
|
|
196
|
+
}
|
|
197
|
+
})
|
|
154
198
|
```
|
|
155
199
|
|
|
156
200
|
### Setup - iOS Part
|
|
@@ -166,11 +210,7 @@ $ pod install
|
|
|
166
210
|
```
|
|
167
211
|
#import "AppDelegate.h"
|
|
168
212
|
|
|
169
|
-
#import <React/RCTBridge.h>
|
|
170
|
-
#import <React/RCTBundleURLProvider.h>
|
|
171
|
-
#import <React/RCTRootView.h>
|
|
172
213
|
#import <RNNetmera/RNNetmeraRCTEventEmitter.h>
|
|
173
|
-
#import <RNNetmera/RNNetmeraUtils.h>
|
|
174
214
|
#import <RNNetmera/RNNetmera.h>
|
|
175
215
|
|
|
176
216
|
@implementation AppDelegate
|
|
@@ -178,39 +218,16 @@ $ pod install
|
|
|
178
218
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
179
219
|
{
|
|
180
220
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
184
|
-
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
185
|
-
moduleName:@"example"
|
|
186
|
-
initialProperties:nil];
|
|
187
|
-
|
|
188
|
-
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
|
189
|
-
|
|
190
|
-
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
191
|
-
UIViewController *rootViewController = [UIViewController new];
|
|
192
|
-
rootViewController.view = rootView;
|
|
193
|
-
self.window.rootViewController = rootViewController;
|
|
194
|
-
[self.window makeKeyAndVisible];
|
|
195
|
-
|
|
221
|
+
// Init Netmera
|
|
196
222
|
[RNNetmera logging: YES];
|
|
197
|
-
[RNNetmera initNetmera:@"
|
|
223
|
+
[RNNetmera initNetmera:[ReactNativeConfig envFor:@"NETMERA_API_KEY"]]; // Replace this with your own NETMERA API KEY.
|
|
198
224
|
[RNNetmera requestPushNotificationAuthorization];
|
|
199
225
|
[RNNetmera setPushDelegate:self];
|
|
226
|
+
[Netmera setAppGroupName:@"group.com.netmerareactnativeexample"]; // Set your app group name
|
|
227
|
+
|
|
200
228
|
return YES;
|
|
201
229
|
}
|
|
202
230
|
|
|
203
|
-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
204
|
-
{
|
|
205
|
-
#if DEBUG
|
|
206
|
-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
|
207
|
-
#else
|
|
208
|
-
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
209
|
-
#endif
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// MARK: Push Delegate Methods
|
|
213
|
-
|
|
214
231
|
// Take push payload for Push clicked:
|
|
215
232
|
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
|
|
216
233
|
{
|
|
@@ -246,8 +263,15 @@ export const onPushReceive = async (message) => {
|
|
|
246
263
|
console.log("onPushReceive: ", message);
|
|
247
264
|
};
|
|
248
265
|
```
|
|
249
|
-
Please take a look at `Setup-Android part 7`
|
|
250
266
|
|
|
267
|
+
3) In order to use iOS10 Media Push, follow the instructions in [Netmera Product Hub.](https://developer.netmera.com/en/IOS/Push-Notifications#using-ios10-media-push)
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
// For receiving Media Push, you must add Netmera pods to top of your Podfile
|
|
271
|
+
pod "Netmera", "3.14.10-WithoutDependency"
|
|
272
|
+
pod "Netmera/NotificationServiceExtension", "3.14.10-WithoutDependency"
|
|
273
|
+
pod "Netmera/NotificationContentExtension", "3.14.10-WithoutDependency"
|
|
274
|
+
```
|
|
251
275
|
|
|
252
276
|
### Calling React Native methods
|
|
253
277
|
|
|
@@ -314,175 +338,214 @@ updateUser() {
|
|
|
314
338
|
##### Netmera Inbox Examples
|
|
315
339
|
|
|
316
340
|
```
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
fetchInbox = async () => {
|
|
327
|
-
try {
|
|
328
|
-
const netmeraInboxFilter = new NetmeraInboxFilter();
|
|
329
|
-
netmeraInboxFilter.status = this.state.inboxState;
|
|
330
|
-
netmeraInboxFilter.pageSize = 2;
|
|
331
|
-
const inbox = await Netmera.fetchInbox(netmeraInboxFilter);
|
|
332
|
-
console.log("inbox", inbox);
|
|
333
|
-
this.setState({inbox: inbox});
|
|
334
|
-
} catch (e) {
|
|
335
|
-
console.log("error", e)
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
fetchNextPage = async () => {
|
|
340
|
-
try {
|
|
341
|
-
const inbox = await Netmera.fetchNextPage();
|
|
342
|
-
this.setState({inbox: inbox});
|
|
343
|
-
console.log("inbox", inbox)
|
|
344
|
-
} catch (e) {
|
|
345
|
-
console.log("error", e)
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
updateAll = async () => {
|
|
350
|
-
if (!this.state.inbox !== undefined) {
|
|
351
|
-
let updateStatus = this.state.inboxState;
|
|
352
|
-
if (updateStatus === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
353
|
-
Alert.alert("Error", "Please select different status than all!!")
|
|
354
|
-
console.log("Please select different status than all!!");
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
Netmera.updateAll(this.state.inboxState).then(() => {
|
|
360
|
-
this.fetchInbox();
|
|
361
|
-
}).catch((error) => {
|
|
362
|
-
console.log("error: " + error)
|
|
363
|
-
})
|
|
364
|
-
} catch (error) {
|
|
365
|
-
console.log("error: " + error)
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
handlePushObject = async () => {
|
|
371
|
-
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
372
|
-
Netmera.handlePushObject(this.state.inbox[0].pushId)
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
handleInteractiveAction = async () => {
|
|
377
|
-
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
378
|
-
for (let i = 0; i < this.state.inbox.length; i++) {
|
|
379
|
-
const element = this.state.inbox[i];
|
|
380
|
-
if (element.interactiveActions !== undefined && element.interactiveActions.length > 0) {
|
|
381
|
-
const action = JSON.parse(element.interactiveActions)[0]
|
|
382
|
-
Netmera.handleInteractiveAction(action.id);
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
countForStatus = async () => {
|
|
390
|
-
try {
|
|
391
|
-
const count = await Netmera.countForStatus(this.state.inboxState);
|
|
392
|
-
this.setState({countForStatus: count})
|
|
393
|
-
} catch (error) {
|
|
394
|
-
console.log("error: " + error)
|
|
395
|
-
}
|
|
396
|
-
};
|
|
341
|
+
constructor() {
|
|
342
|
+
super();
|
|
343
|
+
this.state = {
|
|
344
|
+
inbox: [],
|
|
345
|
+
inboxState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
346
|
+
countForStatus: 0
|
|
347
|
+
}
|
|
348
|
+
}
|
|
397
349
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
350
|
+
fetchInbox = async () => {
|
|
351
|
+
try {
|
|
352
|
+
const netmeraInboxFilter = new NetmeraInboxFilter();
|
|
353
|
+
netmeraInboxFilter.status = this.state.inboxState;
|
|
354
|
+
netmeraInboxFilter.pageSize = 2;
|
|
355
|
+
const inbox = await Netmera.fetchInbox(netmeraInboxFilter);
|
|
356
|
+
console.log("inbox", inbox);
|
|
357
|
+
this.setState({inbox: inbox});
|
|
358
|
+
} catch (e) {
|
|
359
|
+
console.log("error", e)
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
fetchNextPage = async () => {
|
|
364
|
+
try {
|
|
365
|
+
const inbox = await Netmera.fetchNextPage();
|
|
366
|
+
this.setState({inbox: inbox});
|
|
367
|
+
console.log("inbox", inbox)
|
|
368
|
+
} catch (e) {
|
|
369
|
+
console.log("error", e)
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
updateAll = async () => {
|
|
374
|
+
if (!this.state.inbox !== undefined) {
|
|
375
|
+
let updateStatus = this.state.inboxState;
|
|
376
|
+
if (updateStatus === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
377
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
378
|
+
console.log("Please select different status than all!!");
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
try {
|
|
383
|
+
Netmera.updateAll(this.state.inboxState).then(() => {
|
|
384
|
+
this.fetchInbox();
|
|
385
|
+
}).catch((error) => {
|
|
386
|
+
console.log("error: " + error)
|
|
387
|
+
})
|
|
388
|
+
} catch (error) {
|
|
389
|
+
console.log("error: " + error)
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
handlePushObject = async () => {
|
|
395
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
396
|
+
Netmera.handlePushObject(this.state.inbox[0].pushId)
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
handleInteractiveAction = async () => {
|
|
401
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
402
|
+
for (let i = 0; i < this.state.inbox.length; i++) {
|
|
403
|
+
const element = this.state.inbox[i];
|
|
404
|
+
if (element.interactiveActions !== undefined && element.interactiveActions.length > 0) {
|
|
405
|
+
const action = JSON.parse(element.interactiveActions)[0]
|
|
406
|
+
Netmera.handleInteractiveAction(action.id);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
countForStatus = async () => {
|
|
414
|
+
try {
|
|
415
|
+
const count = await Netmera.countForStatus(this.state.inboxState);
|
|
416
|
+
this.setState({countForStatus: count})
|
|
417
|
+
} catch (e) {
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
inboxUpdateStatus = async () => {
|
|
422
|
+
if (this.state.inboxState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
423
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
424
|
+
console.log("Please select different status than all!!");
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (this.state.inbox === undefined || this.state.inbox < 2) {
|
|
428
|
+
Alert.alert("Error", "Push objects count is less then 2!")
|
|
429
|
+
console.log("Push objects count is less then 2!");
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
Netmera.inboxUpdateStatus(0, 2, this.state.inboxState).then(() => {
|
|
433
|
+
console.log("2 push object status was changed successfully.")
|
|
434
|
+
}).catch((error) => {
|
|
435
|
+
console.log("error: " + error)
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
updateInboxState = (value) => {
|
|
440
|
+
this.setState({inboxState: value})
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
inboxCountForStatus = async () => {
|
|
444
|
+
try {
|
|
445
|
+
const filter = new NMInboxStatusCountFilter();
|
|
446
|
+
filter.nmInboxStatus = this.state.inboxState;
|
|
447
|
+
filter.includeExpired = true;
|
|
448
|
+
const nmInboxStatusCount = await Netmera.getInboxCountForStatus(filter);
|
|
449
|
+
|
|
450
|
+
let countStatusText = "ALL: " + nmInboxStatusCount[NMInboxStatus.STATUS_ALL] + ", " +
|
|
451
|
+
"READ: " + nmInboxStatusCount[NMInboxStatus.STATUS_READ] + ", " +
|
|
452
|
+
"UNREAD: " + nmInboxStatusCount[NMInboxStatus.STATUS_UNREAD] + ", " +
|
|
453
|
+
"DELETED: " + nmInboxStatusCount[NMInboxStatus.STATUS_DELETED]
|
|
454
|
+
|
|
455
|
+
this.setState({countForStatus: countStatusText})
|
|
456
|
+
console.log("nmInboxStatusCount: ", countStatusText);
|
|
457
|
+
} catch (e) {
|
|
458
|
+
console.log("error", e)
|
|
459
|
+
}
|
|
460
|
+
};
|
|
420
461
|
```
|
|
421
462
|
|
|
422
463
|
##### Netmera Inbox Category Examples
|
|
423
464
|
|
|
424
465
|
```
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
fetchCategory = async () => {
|
|
434
|
-
try {
|
|
435
|
-
const netmeraCategoryFilter = new NetmeraCategoryFilter();
|
|
436
|
-
netmeraCategoryFilter.status = this.state.categoryState;
|
|
437
|
-
netmeraCategoryFilter.pageSize = 1;
|
|
438
|
-
const categories = await Netmera.fetchCategory(netmeraCategoryFilter);
|
|
439
|
-
console.log("categories", categories);
|
|
440
|
-
this.setState({categories: categories});
|
|
441
|
-
} catch (e) {
|
|
442
|
-
console.log("error", e)
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
fetchNextCategoryPage = async () => {
|
|
447
|
-
try {
|
|
448
|
-
const categories = await Netmera.fetchNextCategoryPage();
|
|
449
|
-
this.setState({categories: categories});
|
|
450
|
-
console.log("categories", categories)
|
|
451
|
-
} catch (e) {
|
|
452
|
-
console.log("error", e)
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
handlePushObject = async () => {
|
|
457
|
-
if (this.state.categories !== undefined && this.state.categories.length > 0) {
|
|
458
|
-
Netmera.handleLastMessage(this.state.categories[0].categoryName)
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
updateStatusCategories = async () => {
|
|
463
|
-
if (this.state.categoryState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
464
|
-
Alert.alert("Error", "Please select different status than all!!")
|
|
465
|
-
console.log("Please select different status than all!!");
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (this.state.categories === undefined || this.state.categories < 1) {
|
|
469
|
-
Alert.alert("Error", "Category object not found!")
|
|
470
|
-
console.log("Category object not found!");
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
const count = this.state.categories.length < 3 ? this.state.categories.length : 2;
|
|
475
|
-
|
|
476
|
-
Netmera.updateStatusByCategories(0, count, this.state.categoryState).then(() => {
|
|
477
|
-
console.log("Category object status was changed successfully.")
|
|
478
|
-
}).catch((error) => {
|
|
479
|
-
console.log("error: " + error)
|
|
480
|
-
});
|
|
481
|
-
};
|
|
466
|
+
constructor() {
|
|
467
|
+
super();
|
|
468
|
+
this.state = {
|
|
469
|
+
categories: [],
|
|
470
|
+
userCategoryPreferences: [],
|
|
471
|
+
categoryState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
472
|
+
}
|
|
473
|
+
}
|
|
482
474
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
475
|
+
fetchCategory = async () => {
|
|
476
|
+
try {
|
|
477
|
+
const netmeraCategoryFilter = new NetmeraCategoryFilter();
|
|
478
|
+
netmeraCategoryFilter.status = this.state.categoryState;
|
|
479
|
+
netmeraCategoryFilter.pageSize = 1;
|
|
480
|
+
const categories = await Netmera.fetchCategory(netmeraCategoryFilter);
|
|
481
|
+
console.log("categories", categories);
|
|
482
|
+
this.setState({categories: categories});
|
|
483
|
+
} catch (e) {
|
|
484
|
+
console.log("error", e)
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
fetchNextCategoryPage = async () => {
|
|
489
|
+
try {
|
|
490
|
+
const categories = await Netmera.fetchNextCategoryPage();
|
|
491
|
+
this.setState({categories: categories});
|
|
492
|
+
console.log("categories", categories)
|
|
493
|
+
} catch (e) {
|
|
494
|
+
console.log("error", e)
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
handlePushObject = async () => {
|
|
499
|
+
if (this.state.categories !== undefined && this.state.categories.length > 0) {
|
|
500
|
+
Netmera.handleLastMessage(this.state.categories[0].categoryName)
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
updateStatusCategories = async () => {
|
|
505
|
+
if (this.state.categoryState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
506
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
507
|
+
console.log("Please select different status than all!!");
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
if (this.state.categories === undefined || this.state.categories < 1) {
|
|
511
|
+
Alert.alert("Error", "Category object not found!")
|
|
512
|
+
console.log("Category object not found!");
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const count = this.state.categories.length < 3 ? this.state.categories.length : 2;
|
|
517
|
+
|
|
518
|
+
Netmera.updateStatusByCategories(0, count, this.state.categoryState).then(() => {
|
|
519
|
+
console.log("Category object status was changed successfully.")
|
|
520
|
+
}).catch((error) => {
|
|
521
|
+
console.log("error: " + error)
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
updateCategoryState = (value) => {
|
|
526
|
+
this.setState({categoryState: value})
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
getUserCategoryPreferenceList = async () => {
|
|
530
|
+
Netmera.getUserCategoryPreferenceList().then((response) => {
|
|
531
|
+
this.setState({categories: response})
|
|
532
|
+
console.log("User Category Preference List: " + response)
|
|
533
|
+
}).catch((error) => {
|
|
534
|
+
console.log("error: " + error)
|
|
535
|
+
});
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
setUserCategoryPreference = async (item) => {
|
|
539
|
+
Netmera.setUserCategoryPreference(item.categoryId, !item.optInStatus).then(() => {
|
|
540
|
+
console.log("Successfully set user category preference list")
|
|
541
|
+
setTimeout(() => {
|
|
542
|
+
this.getUserCategoryPreferenceList()
|
|
543
|
+
}, 500)
|
|
544
|
+
|
|
545
|
+
}).catch((error) => {
|
|
546
|
+
console.log("error: " + error)
|
|
547
|
+
});
|
|
548
|
+
};
|
|
486
549
|
```
|
|
487
550
|
|
|
488
551
|
##### Netmera Getting ExternalId (if exists before)
|
|
@@ -491,10 +554,4 @@ updateUser() {
|
|
|
491
554
|
Netmera.currentExternalId()
|
|
492
555
|
```
|
|
493
556
|
|
|
494
|
-
|
|
495
|
-
For detailed information please explore example folder in the Netmera sdk library.
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
557
|
+
Please explore example folder in the Netmera SDK library for detailed information.
|
package/RNNetmera.podspec
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
1
4
|
|
|
2
5
|
Pod::Spec.new do |s|
|
|
3
6
|
s.name = "RNNetmera"
|
|
4
|
-
s.version = "
|
|
5
|
-
s.summary = "
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
6
9
|
s.description = <<-DESC
|
|
7
10
|
RNNetmera
|
|
8
11
|
DESC
|
|
9
12
|
s.homepage = "https://github.com/author/RNNetmera.git"
|
|
10
13
|
s.license = "MIT"
|
|
11
|
-
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
|
|
12
14
|
s.author = { "author" => "author@domain.cn" }
|
|
13
|
-
s.
|
|
15
|
+
s.platforms = { :ios => "9.0" }
|
|
14
16
|
s.source = { :git => "https://github.com/author/RNNetmera.git", :tag => "master" }
|
|
15
|
-
s.source_files = "ios
|
|
17
|
+
s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
|
|
16
18
|
s.requires_arc = true
|
|
17
19
|
|
|
18
20
|
s.dependency 'React'
|
|
19
|
-
s.dependency 'Netmera','3.14.
|
|
21
|
+
s.dependency 'Netmera','3.14.10-WithoutDependency'
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
|
|
Binary file
|
|
Binary file
|
package/android/.idea/gradle.xml
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
|
-
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
3
|
<component name="GradleSettings">
|
|
5
4
|
<option name="linkedExternalProjectsSettings">
|
|
6
5
|
<GradleProjectSettings>
|
|
7
6
|
<option name="testRunner" value="GRADLE" />
|
|
8
7
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
8
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
-
<option name="resolveModulePerSourceSet" value="false" />
|
|
11
9
|
</GradleProjectSettings>
|
|
12
10
|
</option>
|
|
13
11
|
</component>
|
package/android/build/generated/source/buildConfig/debug/com/netmera/reactnativesdk/BuildConfig.java
CHANGED
|
@@ -7,6 +7,4 @@ public final class BuildConfig {
|
|
|
7
7
|
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
|
8
8
|
public static final String LIBRARY_PACKAGE_NAME = "com.netmera.reactnativesdk";
|
|
9
9
|
public static final String BUILD_TYPE = "debug";
|
|
10
|
-
public static final int VERSION_CODE = 1;
|
|
11
|
-
public static final String VERSION_NAME = "1.0";
|
|
12
10
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automatically generated file. DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
package com.netmera.reactnativesdk;
|
|
5
|
+
|
|
6
|
+
public final class BuildConfig {
|
|
7
|
+
public static final boolean DEBUG = false;
|
|
8
|
+
public static final String LIBRARY_PACKAGE_NAME = "com.netmera.reactnativesdk";
|
|
9
|
+
public static final String BUILD_TYPE = "release";
|
|
10
|
+
}
|