diff --git a/README.md b/README.md index 4cf4e83..e8a707f 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,16 @@ MParticle.Identity.modify(request, (error, userId) => { }); ``` +```js +MParticle.Identity.getCurrentDeviceApplicationStamp((error, deviceApplicationStamp) => { + if (error) { + console.debug(error); //error is an MParticleError + } else { + console.debug(deviceApplicationStamp); + } +}); +``` + ## Attribution ``` var attributions = MParticle.getAttributions(); diff --git a/android/src/main/java/com/mparticle/react/MParticleModule.java b/android/src/main/java/com/mparticle/react/MParticleModule.java index 0f45f15..4b85a73 100644 --- a/android/src/main/java/com/mparticle/react/MParticleModule.java +++ b/android/src/main/java/com/mparticle/react/MParticleModule.java @@ -294,6 +294,12 @@ public void getCurrentUserWithCompletion(Callback completion) { } + @ReactMethod + public void getCurrentDeviceApplicationStampWithCompletion(Callback completion) { + MParticleUser deviceApplication = MParticle.getInstance().Identity().getDeviceApplicationStamp(); + completion.invoke(null, deviceApplication); + } + @ReactMethod public void aliasUsers(final ReadableMap readableMap, final Callback completion) { IdentityApi identityApi = MParticle.getInstance().Identity(); diff --git a/ios/RNMParticle/RNMParticle.m b/ios/RNMParticle/RNMParticle.m index d90f2cc..e4e8028 100644 --- a/ios/RNMParticle/RNMParticle.m +++ b/ios/RNMParticle/RNMParticle.m @@ -345,6 +345,11 @@ + (void)load { completion(@[[NSNull null], [[[MParticle sharedInstance] identity] currentUser].userId.stringValue]); } +RCT_EXPORT_METHOD(getCurrentDeviceApplicationStampWithCompletion:(RCTResponseSenderBlock)completion) +{ + completion(@[[NSNull null], [[[MParticle sharedInstance] identity] deviceApplicationStamp]]); +} + RCT_EXPORT_METHOD(getUserIdentities:(NSString *)userId completion:(RCTResponseSenderBlock)completion) { MParticleUser *selectedUser = [[MParticleUser alloc] init]; diff --git a/js/index.js b/js/index.js index f2ed42b..db39e16 100644 --- a/js/index.js +++ b/js/index.js @@ -305,6 +305,16 @@ class Identity { NativeModules.MParticle.aliasUsers(AliasRequest, completion) } + static getCurrentDeviceApplicationStamp (completion) { + NativeModules.MParticle.getCurrentDeviceApplicationStampWithCompletion((error, deviceApplicationStamp) => { + if (error) { + var parsedError = new MParticleError(error); + completion(parsedError, undefined); + return; + } + completion(undefined, deviceApplicationStamp); + }); + } } // ******** Commerce ********