react-native-netmera 1.3.8 → 1.4.1

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.
Files changed (61) hide show
  1. package/README.md +276 -185
  2. package/RNNetmera.podspec +8 -6
  3. package/android/build/.transforms/{00a1a2a97b81c133eb73f4c946b323aa.bin → 5e6250db45de369f8592b678730f6ff3/results.bin} +0 -0
  4. package/android/build/.transforms/5e6250db45de369f8592b678730f6ff3/transformed/classes/classes.dex +0 -0
  5. package/android/build/.transforms/{8b103fc7545c9799a16ff009dc2ead52.bin → f62dff1c96346bd5377ea8eccb1b7016/results.bin} +0 -0
  6. package/android/build/.transforms/f62dff1c96346bd5377ea8eccb1b7016/transformed/classes/classes.dex +0 -0
  7. package/android/build/generated/source/buildConfig/debug/com/netmera/reactnativesdk/BuildConfig.java +0 -2
  8. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
  9. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
  10. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  11. package/android/build/intermediates/{compile_only_not_namespaced_r_class_jar → compile_r_class_jar}/debug/R.jar +0 -0
  12. package/android/build/intermediates/compile_symbol_list/debug/R.txt +1 -4
  13. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -1
  14. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/BuildConfig.class +0 -0
  15. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmera.class +0 -0
  16. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraCategoryObject.class +0 -0
  17. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration.class +0 -0
  18. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$1.class +0 -0
  19. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$10.class +0 -0
  20. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$2.class +0 -0
  21. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$3.class +0 -0
  22. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$4.class +0 -0
  23. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$5.class +0 -0
  24. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$6.class +0 -0
  25. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$7.class +0 -0
  26. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$8.class +0 -0
  27. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$9.class +0 -0
  28. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule.class +0 -0
  29. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.class +0 -0
  30. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushHeadlessService.class +0 -0
  31. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil$1.class +0 -0
  32. package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil.class +0 -0
  33. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
  34. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  35. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1 -4
  36. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  37. package/android/build.gradle +3 -3
  38. package/android/src/main/java/com/netmera/reactnativesdk/RNNetmera.java +2 -6
  39. package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +116 -5
  40. package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.java +9 -7
  41. package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraUtil.java +52 -4
  42. package/index.js +19 -320
  43. package/ios/RNNetmera.h +2 -2
  44. package/ios/RNNetmera.m +64 -2
  45. package/ios/RNNetmeraUtils.h +4 -0
  46. package/ios/RNNetmeraUtils.m +38 -0
  47. package/package.json +1 -1
  48. package/src/Netmera.js +223 -0
  49. package/src/NetmeraInbox.js +95 -0
  50. package/src/NetmeraUser.js +92 -0
  51. package/android/build/.transforms/00a1a2a97b81c133eb73f4c946b323aa/classes/classes.dex +0 -0
  52. package/android/build/.transforms/8b103fc7545c9799a16ff009dc2ead52/classes/classes.dex +0 -0
  53. package/android/build/.transforms/9e086edd0cadc1c3e325107cef1d09ca/classes/classes.dex +0 -0
  54. package/android/build/.transforms/9e086edd0cadc1c3e325107cef1d09ca.bin +0 -1
  55. package/android/build/.transforms/b0d220ccd1945e73ed321c4b96bb37de/classes/classes.dex +0 -0
  56. package/android/build/.transforms/b0d220ccd1945e73ed321c4b96bb37de.bin +0 -1
  57. package/android/build/.transforms/f70db9a523a6c7b9af14929671f6c09b/classes/classes.dex +0 -0
  58. package/android/build/.transforms/f70db9a523a6c7b9af14929671f6c09b.bin +0 -1
  59. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -27
  60. package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
  61. package/android/build/intermediates/merged_manifests/debug/output.json +0 -27
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
- compile project(':react-native-netmera')
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 'http://developer.huawei.com/repo/'}
53
+ maven {url 'https://developer.huawei.com/repo/'}
54
54
  }
55
55
 
56
56
  dependencies {
57
- classpath 'com.android.tools.build:gradle:4.0.2'
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 'http://developer.huawei.com/repo/'}
68
+ maven { url 'https://developer.huawei.com/repo/'}
69
+ maven { url "https://release.netmera.com/release/android" }
69
70
  }
70
71
  }
71
72
  ```
@@ -99,6 +100,7 @@ apply plugin: 'com.google.gms.google-services'
99
100
  super.onCreate();
100
101
  RNNetmeraConfiguration netmeraConfiguration = new RNNetmeraConfiguration.Builder()
101
102
  .firebaseSenderId(<YOUR GCM SENDER ID>)
103
+ .huaweiSenderId(<YOUR HMS SENDER ID>)
102
104
  .apiKey(<YOUR NETMERA API KEY>) // This is for enabling Netmera logs.
103
105
  .logging(true)
104
106
  .build(this);
@@ -129,28 +131,69 @@ export const onPushDismiss = async (message) => {
129
131
  export const onPushButtonClicked = async (message) => {
130
132
  console.log("onPushButtonClicked: ", message);
131
133
  };
134
+
135
+ export const onCarouselObjectSelected = async (message) => {
136
+ console.log("onCarouselObjectSelected: ", message);
137
+ };
132
138
  ```
133
139
 
134
140
  8) Init `NetmeraBroadcastReceiver` inside your `index.js` file.
135
141
 
136
142
  ```
137
- import { onPushButtonClicked,
138
- onPushDismiss,
139
- onPushOpen,
140
- onPushReceive,
141
- onPushRegister
142
- } from "./NetmeraPushHeadlessTask";
143
-
144
- Netmera.initBroadcastReceiver(
145
- onPushRegister,
146
- onPushReceive,
147
- onPushOpen,
148
- onPushDismiss,
149
- onPushButtonClicked
150
- )
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
+ )
151
160
 
152
- // This should be called after Netmera.initBroadcastReceiver method.
153
- AppRegistry.registerComponent(appName, () => App);
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
+ })
154
197
  ```
155
198
 
156
199
  ### Setup - iOS Part
@@ -169,12 +212,14 @@ $ pod install
169
212
  #import <React/RCTBridge.h>
170
213
  #import <React/RCTBundleURLProvider.h>
171
214
  #import <React/RCTRootView.h>
215
+ #import <React/RCTLinkingManager.h>
172
216
  #import <RNNetmera/RNNetmeraRCTEventEmitter.h>
173
217
  #import <RNNetmera/RNNetmeraUtils.h>
174
218
  #import <RNNetmera/RNNetmera.h>
175
219
 
176
220
  @implementation AppDelegate
177
221
 
222
+
178
223
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
179
224
  {
180
225
 
@@ -194,12 +239,21 @@ $ pod install
194
239
  [self.window makeKeyAndVisible];
195
240
 
196
241
  [RNNetmera logging: YES];
197
- [RNNetmera initNetmera:@"<apiKey>"];
242
+ [RNNetmera initNetmera:<apiKey>];
198
243
  [RNNetmera requestPushNotificationAuthorization];
199
244
  [RNNetmera setPushDelegate:self];
200
245
  return YES;
201
246
  }
202
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
+
203
257
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
204
258
  {
205
259
  #if DEBUG
@@ -246,8 +300,6 @@ export const onPushReceive = async (message) => {
246
300
  console.log("onPushReceive: ", message);
247
301
  };
248
302
  ```
249
- Please take a look at `Setup-Android part 7`
250
-
251
303
 
252
304
  ### Calling React Native methods
253
305
 
@@ -314,175 +366,214 @@ updateUser() {
314
366
  ##### Netmera Inbox Examples
315
367
 
316
368
  ```
317
- constructor() {
318
- super();
319
- this.state = {
320
- inbox: [],
321
- inboxState: Netmera.PUSH_OBJECT_STATUS_ALL,
322
- countForStatus: 0
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
- };
369
+ constructor() {
370
+ super();
371
+ this.state = {
372
+ inbox: [],
373
+ inboxState: Netmera.PUSH_OBJECT_STATUS_ALL,
374
+ countForStatus: 0
375
+ }
376
+ }
397
377
 
398
- inboxUpdateStatus = async () => {
399
- if (this.state.inboxState === Netmera.PUSH_OBJECT_STATUS_ALL) {
400
- Alert.alert("Error", "Please select different status than all!!")
401
- console.log("Please select different status than all!!");
402
- return;
403
- }
404
- if (this.state.inbox === undefined || this.state.inbox < 2) {
405
- Alert.alert("Error", "Push objects count is less then 2!")
406
- console.log("Push objects count is less then 2!");
407
- return;
408
- }
409
- Netmera.inboxUpdateStatus(0, 2, this.state.inboxState).then(() => {
410
- console.log("2 push object status was changed successfully.")
411
- }).catch((error) => {
412
- console.log("error: " + error)
413
- });
414
- };
415
-
416
- updateInboxState = (value) => {
417
- this.setState({inboxState: value})
418
- };
419
-
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
+ };
420
489
  ```
421
490
 
422
491
  ##### Netmera Inbox Category Examples
423
492
 
424
493
  ```
425
- constructor() {
426
- super();
427
- this.state = {
428
- categories: [],
429
- categoryState: Netmera.PUSH_OBJECT_STATUS_ALL,
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
- };
494
+ constructor() {
495
+ super();
496
+ this.state = {
497
+ categories: [],
498
+ userCategoryPreferences: [],
499
+ categoryState: Netmera.PUSH_OBJECT_STATUS_ALL,
500
+ }
501
+ }
482
502
 
483
- updateCategoryState = (value) => {
484
- this.setState({categoryState: value})
485
- };
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
+ };
486
577
  ```
487
578
 
488
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 = "1.0.0"
5
- s.summary = "RNNetmera"
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.platform = :ios, "8.0"
15
+ s.platforms = { :ios => "9.0" }
14
16
  s.source = { :git => "https://github.com/author/RNNetmera.git", :tag => "master" }
15
- s.source_files = "ios/*.{h,m}"
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.1'
21
+ s.dependency 'Netmera','3.14.10-WithoutDependency'
20
22
  end
21
23
 
22
24
 
@@ -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,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
+ }
@@ -0,0 +1,2 @@
1
+ aarFormatVersion=1.0
2
+ aarMetadataVersion=1.0
@@ -3413,7 +3413,6 @@ int string abc_searchview_description_voice 0x0
3413
3413
  int string abc_shareactionprovider_share_with 0x0
3414
3414
  int string abc_shareactionprovider_share_with_application 0x0
3415
3415
  int string abc_toolbar_collapse_description 0x0
3416
- int string ag_sdk_cbg_root 0x0
3417
3416
  int string aimodule_exclude_domain 0x0
3418
3417
  int string alert_description 0x0
3419
3418
  int string androidx_startup 0x0
@@ -3486,11 +3485,10 @@ int string header_description 0x0
3486
3485
  int string hide_bottom_view_on_scroll_behavior 0x0
3487
3486
  int string hms_abort 0x0
3488
3487
  int string hms_abort_message 0x0
3488
+ int string hms_apk_not_installed_hints 0x0
3489
3489
  int string hms_bindfaildlg_message 0x0
3490
3490
  int string hms_bindfaildlg_title 0x0
3491
3491
  int string hms_cancel 0x0
3492
- int string hms_cancel_after_cancel 0x0
3493
- int string hms_cancel_install_message 0x0
3494
3492
  int string hms_check_failure 0x0
3495
3493
  int string hms_checking 0x0
3496
3494
  int string hms_confirm 0x0
@@ -3499,7 +3497,6 @@ int string hms_download_no_space 0x0
3499
3497
  int string hms_download_retry 0x0
3500
3498
  int string hms_downloading_loading 0x0
3501
3499
  int string hms_install 0x0
3502
- int string hms_install_after_cancel 0x0
3503
3500
  int string hms_install_message 0x0
3504
3501
  int string hms_is_spoof 0x0
3505
3502
  int string hms_push_channel 0x0
@@ -1 +1 @@
1
- #Sat Mar 26 13:02:45 TRT 2022
1
+ #Sun May 01 12:38:49 TRT 2022