Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ public void getCurrentUserWithCompletion(Callback completion) {
MParticleUser currentUser = MParticle.getInstance().Identity().getCurrentUser();
if (currentUser != null) {
String userID = Long.toString(currentUser.getId());
completion.invoke(null, userID);
boolean isLoggedIn = currentUser.isLoggedIn;
completion.invoke(null, userID, isLoggedIn);
} else {
completion.invoke(null, null);
completion.invoke(null, null, false);
}

}
Expand Down
3 changes: 2 additions & 1 deletion ios/RNMParticle/RNMParticle.m
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ + (void)load {

RCT_EXPORT_METHOD(getCurrentUserWithCompletion:(RCTResponseSenderBlock)completion)
{
completion(@[[NSNull null], [[[MParticle sharedInstance] identity] currentUser].userId.stringValue]);
MParticleUser *currentUser = [[MParticle sharedInstance] identity].currentUser;
completion(@[[NSNull null], currentUser.userId.stringValue, @(currentUser.isLoggedIn)]);
}

RCT_EXPORT_METHOD(getUserIdentities:(NSString *)userId completion:(RCTResponseSenderBlock)completion)
Expand Down
12 changes: 7 additions & 5 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,15 @@ class IdentityRequest {
class Identity {

static getCurrentUser (completion) {
NativeModules.MParticle.getCurrentUserWithCompletion((error, userId) => {
NativeModules.MParticle.getCurrentUserWithCompletion((error, userId, isLoggedIn) => {
if (error) {
console.log(error.stack)
console.log(error.stack);
}
var currentUser = new User(userId)
completion(currentUser)
})
var currentUser = new User(userId);
currentUser.isLoggedIn = isLoggedIn || false;
completion(currentUser);
}
);
}

static identify (IdentityRequest, completion) {
Expand Down