react-native-netmera 1.3.6 → 1.4.2
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 +277 -188
- 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/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +1 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +3610 -384
- 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/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/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$Builder.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/library_manifest/debug/AndroidManifest.xml +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +6 -6
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +2710 -12
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +31 -31
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +5 -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/RNNetmeraConfiguration.java +0 -12
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +116 -5
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.java +13 -5
- 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/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/07da1e78aa5e2a23e865850e1fa31195/classes/classes.dex +0 -0
- package/android/build/.transforms/07da1e78aa5e2a23e865850e1fa31195.bin +0 -1
- package/android/build/.transforms/1cc655d17744898d5287444bc3b54ccd/classes/classes.dex +0 -0
- package/android/build/.transforms/1cc655d17744898d5287444bc3b54ccd.bin +0 -1
- package/android/build/.transforms/1d7e2a596c5a01e1599ed8d99d8fed25/classes/classes.dex +0 -0
- package/android/build/.transforms/1d7e2a596c5a01e1599ed8d99d8fed25.bin +0 -1
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2/classes/classes.dex +0 -0
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2.bin +0 -1
- package/android/build/.transforms/6bd284ae922673d08694a1221c01809c/classes/classes.dex +0 -0
- package/android/build/.transforms/6bd284ae922673d08694a1221c01809c.bin +0 -1
- package/android/build/.transforms/a8f21d984467d686c5d11cdc3f508ab2/classes/classes.dex +0 -0
- package/android/build/.transforms/a8f21d984467d686c5d11cdc3f508ab2.bin +0 -1
- package/android/build/.transforms/ae3b3ad311ea4fe5b0c3652f1d5b8a07/classes/classes.dex +0 -0
- package/android/build/.transforms/ae3b3ad311ea4fe5b0c3652f1d5b8a07.bin +0 -1
- package/android/build/.transforms/cc45f1af54894b49e3ec8f6b5a05a8d7/classes/classes.dex +0 -0
- package/android/build/.transforms/cc45f1af54894b49e3ec8f6b5a05a8d7.bin +0 -1
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f/classes/classes.dex +0 -0
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f.bin +0 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -27
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- 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
|
@@ -4,8 +4,6 @@ NETMERA is a Mobile Application Engagement Platform. We offer a series of develo
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
`$ npm install react-native-netmera --save`
|
|
10
8
|
|
|
11
9
|
### Mostly automatic installation
|
|
@@ -34,7 +32,7 @@ NETMERA is a Mobile Application Engagement Platform. We offer a series of develo
|
|
|
34
32
|
```
|
|
35
33
|
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
|
36
34
|
```
|
|
37
|
-
|
|
35
|
+
implementation project(':react-native-netmera')
|
|
38
36
|
```
|
|
39
37
|
|
|
40
38
|
For both native sides(Android & iOS) you don't have to include extra Netmera SDK libraries.
|
|
@@ -52,13 +50,13 @@ buildscript {
|
|
|
52
50
|
repositories {
|
|
53
51
|
google()
|
|
54
52
|
jcenter()
|
|
55
|
-
maven {url '
|
|
53
|
+
maven {url 'https://developer.huawei.com/repo/'}
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
dependencies {
|
|
59
57
|
classpath 'com.android.tools.build:gradle:4.1.3'
|
|
60
|
-
classpath 'com.google.gms:google-services:4.3.
|
|
61
|
-
classpath 'com.huawei.agconnect:agcp:1.
|
|
58
|
+
classpath 'com.google.gms:google-services:4.3.10'
|
|
59
|
+
classpath 'com.huawei.agconnect:agcp:1.6.3.300'
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
|
@@ -67,7 +65,8 @@ allprojects {
|
|
|
67
65
|
google()
|
|
68
66
|
jcenter()
|
|
69
67
|
maven { url 'https://maven.google.com'}
|
|
70
|
-
maven {url '
|
|
68
|
+
maven { url 'https://developer.huawei.com/repo/'}
|
|
69
|
+
maven { url "https://release.netmera.com/release/android" }
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
```
|
|
@@ -101,6 +100,7 @@ apply plugin: 'com.google.gms.google-services'
|
|
|
101
100
|
super.onCreate();
|
|
102
101
|
RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
|
|
103
102
|
.firebaseSenderId(<YOUR GCM SENDER ID>)
|
|
103
|
+
.huaweiSenderId(<YOUR HMS SENDER ID>)
|
|
104
104
|
.apiKey(<YOUR NETMERA API KEY>) // This is for enabling Netmera logs.
|
|
105
105
|
.logging(true)
|
|
106
106
|
.build(this);
|
|
@@ -131,28 +131,69 @@ export const onPushDismiss = async (message) => {
|
|
|
131
131
|
export const onPushButtonClicked = async (message) => {
|
|
132
132
|
console.log("onPushButtonClicked: ", message);
|
|
133
133
|
};
|
|
134
|
+
|
|
135
|
+
export const onCarouselObjectSelected = async (message) => {
|
|
136
|
+
console.log("onCarouselObjectSelected: ", message);
|
|
137
|
+
};
|
|
134
138
|
```
|
|
135
139
|
|
|
136
140
|
8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
|
|
137
141
|
|
|
138
142
|
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
import {
|
|
144
|
+
onCarouselObjectSelected,
|
|
145
|
+
onPushButtonClicked,
|
|
146
|
+
onPushDismiss,
|
|
147
|
+
onPushOpen,
|
|
148
|
+
onPushReceive,
|
|
149
|
+
onPushRegister
|
|
150
|
+
} from "./NetmeraPushHeadlessTask";
|
|
151
|
+
|
|
152
|
+
Netmera.initBroadcastReceiver(
|
|
153
|
+
onPushRegister,
|
|
154
|
+
onPushReceive,
|
|
155
|
+
onPushOpen,
|
|
156
|
+
onPushDismiss,
|
|
157
|
+
onPushButtonClicked,
|
|
158
|
+
onCarouselObjectSelected
|
|
159
|
+
)
|
|
153
160
|
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
// This should be called after Netmera.initBroadcastReceiver method.
|
|
162
|
+
AppRegistry.registerComponent(appName, () => App);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
9) If you have custom Firebase Messaging integration, please see usage below.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
messaging()
|
|
169
|
+
.getToken(firebase.app().options.messagingSenderId)
|
|
170
|
+
.then(pushToken => {
|
|
171
|
+
Netmera.onNetmeraNewToken(pushToken)
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
messaging().onMessage(async remoteMessage => {
|
|
175
|
+
if (Netmera.isNetmeraRemoteMessage(remoteMessage.data)) {
|
|
176
|
+
Netmera.onNetmeraFirebasePushMessageReceived(remoteMessage.from, remoteMessage.data)
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
10) If you have custom Huawei Messaging integration, please see usage below.
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
HmsPushInstanceId.getToken("")
|
|
185
|
+
.then((result) => {
|
|
186
|
+
Netmera.onNetmeraNewToken(result.result)
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
HmsPushEvent.onRemoteMessageReceived(event => {
|
|
190
|
+
const remoteMessage = new RNRemoteMessage(event.msg);
|
|
191
|
+
let data = JSON.parse(remoteMessage.getData())
|
|
192
|
+
console.log("onRemoteMessageReceived", data)
|
|
193
|
+
if (Netmera.isNetmeraRemoteMessage(data)) {
|
|
194
|
+
Netmera.onNetmeraHuaweiPushMessageReceived(remoteMessage.getFrom(), data)
|
|
195
|
+
}
|
|
196
|
+
})
|
|
156
197
|
```
|
|
157
198
|
|
|
158
199
|
### Setup - iOS Part
|
|
@@ -171,12 +212,14 @@ $ pod install
|
|
|
171
212
|
#import <React/RCTBridge.h>
|
|
172
213
|
#import <React/RCTBundleURLProvider.h>
|
|
173
214
|
#import <React/RCTRootView.h>
|
|
215
|
+
#import <React/RCTLinkingManager.h>
|
|
174
216
|
#import <RNNetmera/RNNetmeraRCTEventEmitter.h>
|
|
175
217
|
#import <RNNetmera/RNNetmeraUtils.h>
|
|
176
218
|
#import <RNNetmera/RNNetmera.h>
|
|
177
219
|
|
|
178
220
|
@implementation AppDelegate
|
|
179
221
|
|
|
222
|
+
|
|
180
223
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
181
224
|
{
|
|
182
225
|
|
|
@@ -196,12 +239,21 @@ $ pod install
|
|
|
196
239
|
[self.window makeKeyAndVisible];
|
|
197
240
|
|
|
198
241
|
[RNNetmera logging: YES];
|
|
199
|
-
[RNNetmera initNetmera
|
|
242
|
+
[RNNetmera initNetmera:<apiKey>];
|
|
200
243
|
[RNNetmera requestPushNotificationAuthorization];
|
|
201
244
|
[RNNetmera setPushDelegate:self];
|
|
202
245
|
return YES;
|
|
203
246
|
}
|
|
204
247
|
|
|
248
|
+
- (BOOL)application:(UIApplication *)application
|
|
249
|
+
openURL:(NSURL *)url
|
|
250
|
+
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
|
251
|
+
{
|
|
252
|
+
|
|
253
|
+
NSURL *deeplinkUrl=Netmera.recentPushObject.action.deeplinkURL;
|
|
254
|
+
return [RCTLinkingManager application:application openURL:deeplinkUrl options:options];
|
|
255
|
+
}
|
|
256
|
+
|
|
205
257
|
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
206
258
|
{
|
|
207
259
|
#if DEBUG
|
|
@@ -248,8 +300,6 @@ export const onPushReceive = async (message) => {
|
|
|
248
300
|
console.log("onPushReceive: ", message);
|
|
249
301
|
};
|
|
250
302
|
```
|
|
251
|
-
Please take a look at `Setup-Android part 7`
|
|
252
|
-
|
|
253
303
|
|
|
254
304
|
### Calling React Native methods
|
|
255
305
|
|
|
@@ -316,175 +366,214 @@ updateUser() {
|
|
|
316
366
|
##### Netmera Inbox Examples
|
|
317
367
|
|
|
318
368
|
```
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
fetchInbox = async () => {
|
|
329
|
-
try {
|
|
330
|
-
const netmeraInboxFilter = new NetmeraInboxFilter();
|
|
331
|
-
netmeraInboxFilter.status = this.state.inboxState;
|
|
332
|
-
netmeraInboxFilter.pageSize = 2;
|
|
333
|
-
const inbox = await Netmera.fetchInbox(netmeraInboxFilter);
|
|
334
|
-
console.log("inbox", inbox);
|
|
335
|
-
this.setState({inbox: inbox});
|
|
336
|
-
} catch (e) {
|
|
337
|
-
console.log("error", e)
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
fetchNextPage = async () => {
|
|
342
|
-
try {
|
|
343
|
-
const inbox = await Netmera.fetchNextPage();
|
|
344
|
-
this.setState({inbox: inbox});
|
|
345
|
-
console.log("inbox", inbox)
|
|
346
|
-
} catch (e) {
|
|
347
|
-
console.log("error", e)
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
updateAll = async () => {
|
|
352
|
-
if (!this.state.inbox !== undefined) {
|
|
353
|
-
let updateStatus = this.state.inboxState;
|
|
354
|
-
if (updateStatus === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
355
|
-
Alert.alert("Error", "Please select different status than all!!")
|
|
356
|
-
console.log("Please select different status than all!!");
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
try {
|
|
361
|
-
Netmera.updateAll(this.state.inboxState).then(() => {
|
|
362
|
-
this.fetchInbox();
|
|
363
|
-
}).catch((error) => {
|
|
364
|
-
console.log("error: " + error)
|
|
365
|
-
})
|
|
366
|
-
} catch (error) {
|
|
367
|
-
console.log("error: " + error)
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
handlePushObject = async () => {
|
|
373
|
-
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
374
|
-
Netmera.handlePushObject(this.state.inbox[0].pushId)
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
handleInteractiveAction = async () => {
|
|
379
|
-
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
380
|
-
for (let i = 0; i < this.state.inbox.length; i++) {
|
|
381
|
-
const element = this.state.inbox[i];
|
|
382
|
-
if (element.interactiveActions !== undefined && element.interactiveActions.length > 0) {
|
|
383
|
-
const action = JSON.parse(element.interactiveActions)[0]
|
|
384
|
-
Netmera.handleInteractiveAction(action.id);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
countForStatus = async () => {
|
|
392
|
-
try {
|
|
393
|
-
const count = await Netmera.countForStatus(this.state.inboxState);
|
|
394
|
-
this.setState({countForStatus: count})
|
|
395
|
-
} catch (error) {
|
|
396
|
-
console.log("error: " + error)
|
|
397
|
-
}
|
|
398
|
-
};
|
|
369
|
+
constructor() {
|
|
370
|
+
super();
|
|
371
|
+
this.state = {
|
|
372
|
+
inbox: [],
|
|
373
|
+
inboxState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
374
|
+
countForStatus: 0
|
|
375
|
+
}
|
|
376
|
+
}
|
|
399
377
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
378
|
+
fetchInbox = async () => {
|
|
379
|
+
try {
|
|
380
|
+
const netmeraInboxFilter = new NetmeraInboxFilter();
|
|
381
|
+
netmeraInboxFilter.status = this.state.inboxState;
|
|
382
|
+
netmeraInboxFilter.pageSize = 2;
|
|
383
|
+
const inbox = await Netmera.fetchInbox(netmeraInboxFilter);
|
|
384
|
+
console.log("inbox", inbox);
|
|
385
|
+
this.setState({inbox: inbox});
|
|
386
|
+
} catch (e) {
|
|
387
|
+
console.log("error", e)
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
fetchNextPage = async () => {
|
|
392
|
+
try {
|
|
393
|
+
const inbox = await Netmera.fetchNextPage();
|
|
394
|
+
this.setState({inbox: inbox});
|
|
395
|
+
console.log("inbox", inbox)
|
|
396
|
+
} catch (e) {
|
|
397
|
+
console.log("error", e)
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
updateAll = async () => {
|
|
402
|
+
if (!this.state.inbox !== undefined) {
|
|
403
|
+
let updateStatus = this.state.inboxState;
|
|
404
|
+
if (updateStatus === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
405
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
406
|
+
console.log("Please select different status than all!!");
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
try {
|
|
411
|
+
Netmera.updateAll(this.state.inboxState).then(() => {
|
|
412
|
+
this.fetchInbox();
|
|
413
|
+
}).catch((error) => {
|
|
414
|
+
console.log("error: " + error)
|
|
415
|
+
})
|
|
416
|
+
} catch (error) {
|
|
417
|
+
console.log("error: " + error)
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
handlePushObject = async () => {
|
|
423
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
424
|
+
Netmera.handlePushObject(this.state.inbox[0].pushId)
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
handleInteractiveAction = async () => {
|
|
429
|
+
if (this.state.inbox !== undefined && this.state.inbox.length > 0) {
|
|
430
|
+
for (let i = 0; i < this.state.inbox.length; i++) {
|
|
431
|
+
const element = this.state.inbox[i];
|
|
432
|
+
if (element.interactiveActions !== undefined && element.interactiveActions.length > 0) {
|
|
433
|
+
const action = JSON.parse(element.interactiveActions)[0]
|
|
434
|
+
Netmera.handleInteractiveAction(action.id);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
countForStatus = async () => {
|
|
442
|
+
try {
|
|
443
|
+
const count = await Netmera.countForStatus(this.state.inboxState);
|
|
444
|
+
this.setState({countForStatus: count})
|
|
445
|
+
} catch (e) {
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
inboxUpdateStatus = async () => {
|
|
450
|
+
if (this.state.inboxState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
451
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
452
|
+
console.log("Please select different status than all!!");
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (this.state.inbox === undefined || this.state.inbox < 2) {
|
|
456
|
+
Alert.alert("Error", "Push objects count is less then 2!")
|
|
457
|
+
console.log("Push objects count is less then 2!");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
Netmera.inboxUpdateStatus(0, 2, this.state.inboxState).then(() => {
|
|
461
|
+
console.log("2 push object status was changed successfully.")
|
|
462
|
+
}).catch((error) => {
|
|
463
|
+
console.log("error: " + error)
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
updateInboxState = (value) => {
|
|
468
|
+
this.setState({inboxState: value})
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
inboxCountForStatus = async () => {
|
|
472
|
+
try {
|
|
473
|
+
const filter = new NMInboxStatusCountFilter();
|
|
474
|
+
filter.nmInboxStatus = this.state.inboxState;
|
|
475
|
+
filter.includeExpired = true;
|
|
476
|
+
const nmInboxStatusCount = await Netmera.getInboxCountForStatus(filter);
|
|
477
|
+
|
|
478
|
+
let countStatusText = "ALL: " + nmInboxStatusCount[NMInboxStatus.STATUS_ALL] + ", " +
|
|
479
|
+
"READ: " + nmInboxStatusCount[NMInboxStatus.STATUS_READ] + ", " +
|
|
480
|
+
"UNREAD: " + nmInboxStatusCount[NMInboxStatus.STATUS_UNREAD] + ", " +
|
|
481
|
+
"DELETED: " + nmInboxStatusCount[NMInboxStatus.STATUS_DELETED]
|
|
482
|
+
|
|
483
|
+
this.setState({countForStatus: countStatusText})
|
|
484
|
+
console.log("nmInboxStatusCount: ", countStatusText);
|
|
485
|
+
} catch (e) {
|
|
486
|
+
console.log("error", e)
|
|
487
|
+
}
|
|
488
|
+
};
|
|
422
489
|
```
|
|
423
490
|
|
|
424
491
|
##### Netmera Inbox Category Examples
|
|
425
492
|
|
|
426
493
|
```
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
fetchCategory = async () => {
|
|
436
|
-
try {
|
|
437
|
-
const netmeraCategoryFilter = new NetmeraCategoryFilter();
|
|
438
|
-
netmeraCategoryFilter.status = this.state.categoryState;
|
|
439
|
-
netmeraCategoryFilter.pageSize = 1;
|
|
440
|
-
const categories = await Netmera.fetchCategory(netmeraCategoryFilter);
|
|
441
|
-
console.log("categories", categories);
|
|
442
|
-
this.setState({categories: categories});
|
|
443
|
-
} catch (e) {
|
|
444
|
-
console.log("error", e)
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
fetchNextCategoryPage = async () => {
|
|
449
|
-
try {
|
|
450
|
-
const categories = await Netmera.fetchNextCategoryPage();
|
|
451
|
-
this.setState({categories: categories});
|
|
452
|
-
console.log("categories", categories)
|
|
453
|
-
} catch (e) {
|
|
454
|
-
console.log("error", e)
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
handlePushObject = async () => {
|
|
459
|
-
if (this.state.categories !== undefined && this.state.categories.length > 0) {
|
|
460
|
-
Netmera.handleLastMessage(this.state.categories[0].categoryName)
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
updateStatusCategories = async () => {
|
|
465
|
-
if (this.state.categoryState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
466
|
-
Alert.alert("Error", "Please select different status than all!!")
|
|
467
|
-
console.log("Please select different status than all!!");
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
if (this.state.categories === undefined || this.state.categories < 1) {
|
|
471
|
-
Alert.alert("Error", "Category object not found!")
|
|
472
|
-
console.log("Category object not found!");
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
const count = this.state.categories.length < 3 ? this.state.categories.length : 2;
|
|
477
|
-
|
|
478
|
-
Netmera.updateStatusByCategories(0, count, this.state.categoryState).then(() => {
|
|
479
|
-
console.log("Category object status was changed successfully.")
|
|
480
|
-
}).catch((error) => {
|
|
481
|
-
console.log("error: " + error)
|
|
482
|
-
});
|
|
483
|
-
};
|
|
494
|
+
constructor() {
|
|
495
|
+
super();
|
|
496
|
+
this.state = {
|
|
497
|
+
categories: [],
|
|
498
|
+
userCategoryPreferences: [],
|
|
499
|
+
categoryState: Netmera.PUSH_OBJECT_STATUS_ALL,
|
|
500
|
+
}
|
|
501
|
+
}
|
|
484
502
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
503
|
+
fetchCategory = async () => {
|
|
504
|
+
try {
|
|
505
|
+
const netmeraCategoryFilter = new NetmeraCategoryFilter();
|
|
506
|
+
netmeraCategoryFilter.status = this.state.categoryState;
|
|
507
|
+
netmeraCategoryFilter.pageSize = 1;
|
|
508
|
+
const categories = await Netmera.fetchCategory(netmeraCategoryFilter);
|
|
509
|
+
console.log("categories", categories);
|
|
510
|
+
this.setState({categories: categories});
|
|
511
|
+
} catch (e) {
|
|
512
|
+
console.log("error", e)
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
fetchNextCategoryPage = async () => {
|
|
517
|
+
try {
|
|
518
|
+
const categories = await Netmera.fetchNextCategoryPage();
|
|
519
|
+
this.setState({categories: categories});
|
|
520
|
+
console.log("categories", categories)
|
|
521
|
+
} catch (e) {
|
|
522
|
+
console.log("error", e)
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
handlePushObject = async () => {
|
|
527
|
+
if (this.state.categories !== undefined && this.state.categories.length > 0) {
|
|
528
|
+
Netmera.handleLastMessage(this.state.categories[0].categoryName)
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
updateStatusCategories = async () => {
|
|
533
|
+
if (this.state.categoryState === Netmera.PUSH_OBJECT_STATUS_ALL) {
|
|
534
|
+
Alert.alert("Error", "Please select different status than all!!")
|
|
535
|
+
console.log("Please select different status than all!!");
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (this.state.categories === undefined || this.state.categories < 1) {
|
|
539
|
+
Alert.alert("Error", "Category object not found!")
|
|
540
|
+
console.log("Category object not found!");
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
const count = this.state.categories.length < 3 ? this.state.categories.length : 2;
|
|
545
|
+
|
|
546
|
+
Netmera.updateStatusByCategories(0, count, this.state.categoryState).then(() => {
|
|
547
|
+
console.log("Category object status was changed successfully.")
|
|
548
|
+
}).catch((error) => {
|
|
549
|
+
console.log("error: " + error)
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
updateCategoryState = (value) => {
|
|
554
|
+
this.setState({categoryState: value})
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
getUserCategoryPreferenceList = async () => {
|
|
558
|
+
Netmera.getUserCategoryPreferenceList().then((response) => {
|
|
559
|
+
this.setState({categories: response})
|
|
560
|
+
console.log("User Category Preference List: " + response)
|
|
561
|
+
}).catch((error) => {
|
|
562
|
+
console.log("error: " + error)
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
setUserCategoryPreference = async (item) => {
|
|
567
|
+
Netmera.setUserCategoryPreference(item.categoryId, !item.optInStatus).then(() => {
|
|
568
|
+
console.log("Successfully set user category preference list")
|
|
569
|
+
setTimeout(() => {
|
|
570
|
+
this.getUserCategoryPreferenceList()
|
|
571
|
+
}, 500)
|
|
572
|
+
|
|
573
|
+
}).catch((error) => {
|
|
574
|
+
console.log("error: " + error)
|
|
575
|
+
});
|
|
576
|
+
};
|
|
488
577
|
```
|
|
489
578
|
|
|
490
579
|
##### Netmera Getting ExternalId (if exists before)
|
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
|
}
|
package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"artifactType": {
|
|
4
|
+
"type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
|
|
5
|
+
"kind": "Directory"
|
|
6
|
+
},
|
|
7
|
+
"applicationId": "com.netmera.reactnativesdk",
|
|
8
|
+
"variantName": "debug",
|
|
9
|
+
"elements": [
|
|
10
|
+
{
|
|
11
|
+
"type": "SINGLE",
|
|
12
|
+
"filters": [],
|
|
13
|
+
"outputFile": "AndroidManifest.xml"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
Binary file
|
|
Binary file
|