react-native-netmera 1.9.0-beta02 → 1.9.0-beta03
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
|
@@ -337,9 +337,6 @@ const updateUser = () => {
|
|
|
337
337
|
user.msisdn = <msisdn>;
|
|
338
338
|
user.gender = <gender>;
|
|
339
339
|
|
|
340
|
-
// User update async
|
|
341
|
-
Netmera.updateUser(user)
|
|
342
|
-
|
|
343
340
|
// User update sync
|
|
344
341
|
Netmera.updateUser(user)
|
|
345
342
|
.then(() => {
|
|
@@ -351,6 +348,20 @@ const updateUser = () => {
|
|
|
351
348
|
}
|
|
352
349
|
```
|
|
353
350
|
|
|
351
|
+
```
|
|
352
|
+
const updateUser = () => {
|
|
353
|
+
const user = new NetmeraUser();
|
|
354
|
+
user.userId = <userId>;
|
|
355
|
+
user.name = <name>;
|
|
356
|
+
user.surname = <surname>;
|
|
357
|
+
user.msisdn = <msisdn>;
|
|
358
|
+
user.gender = <gender>;
|
|
359
|
+
|
|
360
|
+
// User update async
|
|
361
|
+
Netmera.updateUserAsync(user);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
354
365
|
##### Sending Event Examples
|
|
355
366
|
|
|
356
367
|
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).
|
|
@@ -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
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
|
};
|