react-native-netmera 1.9.0-beta02 → 1.9.0-beta04

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -285,6 +285,16 @@ AppRegistry.registerComponent(appName, () => App);
285
285
 
286
286
  3. If you have custom Firebase Messaging integration, please see usage below.
287
287
 
288
+ 1- Add the following line to your `AndroidManifest.xml` file inside the `application` tag to remove Netmera's default FCM service
289
+
290
+ ```
291
+ <service
292
+ android:name="com.netmera.nmfcm.NMFirebaseService"
293
+ tools:node="remove" />
294
+ ```
295
+
296
+ 2- Update `FirebaseMessaging` methods like below
297
+
288
298
  ```
289
299
  messaging()
290
300
  .getToken(firebase.app().options.messagingSenderId)
@@ -308,6 +318,16 @@ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
308
318
 
309
319
  4. If you have custom Huawei Messaging integration, please see usage below.
310
320
 
321
+ 1- Add the following line to your `AndroidManifest.xml` file inside the `application` tag to remove Netmera's default HMS service
322
+
323
+ ```
324
+ <service
325
+ android:name="com.netmera.nmhms.NMHuaweiService"
326
+ tools:node="remove" />
327
+ ```
328
+
329
+ 2- Update `HuaweiPushKit` methods like below
330
+
311
331
  ```
312
332
  HmsPushInstanceId.getToken("")
313
333
  .then((result) => {
@@ -337,9 +357,6 @@ const updateUser = () => {
337
357
  user.msisdn = <msisdn>;
338
358
  user.gender = <gender>;
339
359
 
340
- // User update async
341
- Netmera.updateUser(user)
342
-
343
360
  // User update sync
344
361
  Netmera.updateUser(user)
345
362
  .then(() => {
@@ -351,6 +368,20 @@ const updateUser = () => {
351
368
  }
352
369
  ```
353
370
 
371
+ ```
372
+ const updateUser = () => {
373
+ const user = new NetmeraUser();
374
+ user.userId = <userId>;
375
+ user.name = <name>;
376
+ user.surname = <surname>;
377
+ user.msisdn = <msisdn>;
378
+ user.gender = <gender>;
379
+
380
+ // User update async
381
+ Netmera.updateUserAsync(user);
382
+ }
383
+ ```
384
+
354
385
  ##### Sending Event Examples
355
386
 
356
387
  You can send your events as follows. For more examples, please see the [example project](https://github.com/Netmera/Netmera-React-Native-Example/blob/master/src/Screens/Event.js).
@@ -19,7 +19,7 @@ android {
19
19
  }
20
20
 
21
21
  dependencies {
22
- implementation 'com.netmera:nmcore:4.3.0'
22
+ implementation 'com.netmera:nmcore:4.3.2'
23
23
  implementation 'com.netmera:nmfcm:4.0.2'
24
24
  implementation 'com.netmera:nmhms:4.0.1'
25
25
  implementation 'com.facebook.react:react-native:+'
@@ -367,6 +367,31 @@ public class RNNetmeraModule extends ReactContextBaseJavaModule {
367
367
  });
368
368
  }
369
369
 
370
+ @ReactMethod
371
+ public void updateUserAsync(ReadableMap readableMap) {
372
+ Map userMap = RNNetmeraUtil.toMap(readableMap);
373
+ userMap.values().removeAll(Collections.singleton(null));
374
+ RNNetmeraUser netmeraUser = new RNNetmeraUser();
375
+
376
+ if (hasKey(userMap, USER_ID)) {
377
+ netmeraUser.setUserId(readableMap.getString(USER_ID));
378
+ userMap.remove(USER_ID);
379
+ }
380
+
381
+ if (hasKey(userMap, EMAIL)) {
382
+ netmeraUser.setEmail(readableMap.getString(EMAIL));
383
+ userMap.remove(EMAIL);
384
+ }
385
+
386
+ if (hasKey(userMap, MSISDN)) {
387
+ netmeraUser.setMsisdn(readableMap.getString(MSISDN));
388
+ userMap.remove(MSISDN);
389
+ }
390
+
391
+ netmeraUser.setUserParameters(userMap);
392
+ Netmera.updateUser(netmeraUser);
393
+ }
394
+
370
395
  @ReactMethod
371
396
  public void handlePushObject(String pushId) {
372
397
  if (netmeraInbox == null) {
package/ios/RNNetmera.m CHANGED
@@ -320,6 +320,23 @@ RCT_EXPORT_METHOD(updateUser:(NSDictionary *)userDictionary
320
320
  }];
321
321
  }
322
322
 
323
+ RCT_EXPORT_METHOD(updateUserAsync:(NSDictionary *)userDictionary) {
324
+ NSMutableDictionary *userMutableDictionary = [userDictionary mutableCopy];
325
+ NSArray *keysForNullValues = [userMutableDictionary allKeysForObject:[NSNull null]];
326
+ [userMutableDictionary removeObjectsForKeys:keysForNullValues];
327
+
328
+ RNNetmeraUser *user = [[RNNetmeraUser alloc] init];
329
+ user.userId=[userMutableDictionary objectForKey:@"userId"];
330
+ user.MSISDN=[userMutableDictionary objectForKey:@"msisdn"];
331
+ user.email=[userMutableDictionary objectForKey:@"email"];
332
+ [userMutableDictionary removeObjectForKey:@"userId"];
333
+ [userMutableDictionary removeObjectForKey:@"email"];
334
+ [userMutableDictionary removeObjectForKey:@"msisdn"];
335
+
336
+ user.userParameters = userMutableDictionary;
337
+ [Netmera updateUser:user];
338
+ }
339
+
323
340
  RCT_EXPORT_METHOD(setApiKey:(NSString *)apiKey) {
324
341
  [Netmera setAPIKey:apiKey];
325
342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-netmera",
3
- "version": "1.9.0-beta02",
3
+ "version": "1.9.0-beta04",
4
4
  "description": "Netmera React Native SDK",
5
5
  "main": "index.ts",
6
6
  "author": "netmera",
package/src/Netmera.ts CHANGED
@@ -237,6 +237,10 @@ export default class Netmera {
237
237
  return RNNetmera.updateUser(user);
238
238
  };
239
239
 
240
+ static updateUserAsync = (user: NetmeraUser): void => {
241
+ return RNNetmera.updateUserAsync(user);
242
+ };
243
+
240
244
  static updateAll = (inboxStatus: number) => {
241
245
  return RNNetmera.updateAll(inboxStatus);
242
246
  };