Skip to content

Commit

Permalink
feat: Update External iD on Initialization (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker authored Jun 12, 2024
1 parent ee542cb commit 5e1d301
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Sources/mParticle-Appboy/MPKitAppboy.m
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ - (void)start {
[self->appboyInstance setInAppMessagePresenter:inAppMessageUI];
#endif

FilteredMParticleUser *currentUser = [[self kitApi] getCurrentUserWithKit:self];
[self updateUser:currentUser request:currentUser.userIdentities];

self->_started = YES;

dispatch_async(dispatch_get_main_queue(), ^{
Expand Down Expand Up @@ -818,26 +821,26 @@ - (nonnull MPKitExecStatus *)setUserAttribute:(nonnull NSString *)key values:(no
}

- (nonnull MPKitExecStatus *)onIdentifyComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request {
return [self updateUser:user request:request];
return [self updateUser:user request:request.userIdentities];
}

- (nonnull MPKitExecStatus *)onLoginComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request {
return [self updateUser:user request:request];
return [self updateUser:user request:request.userIdentities];
}

- (nonnull MPKitExecStatus *)onLogoutComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request {
return [self updateUser:user request:request];
return [self updateUser:user request:request.userIdentities];
}

- (nonnull MPKitExecStatus *)onModifyComplete:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request {
return [self updateUser:user request:request];
return [self updateUser:user request:request.userIdentities];
}

- (nonnull MPKitExecStatus *)updateUser:(FilteredMParticleUser *)user request:(FilteredMPIdentityApiRequest *)request {
- (nonnull MPKitExecStatus *)updateUser:(FilteredMParticleUser *)user request:(NSDictionary<NSNumber *,NSString *> *)userIdentities {
MPKitExecStatus *execStatus = nil;

if (request.userIdentities) {
NSMutableDictionary *userIDsCopy = [request.userIdentities copy];
if (userIdentities) {
NSMutableDictionary *userIDsCopy = [userIdentities copy];
NSString *userId;

if (_configuration[userIdTypeKey]) {
Expand Down

0 comments on commit 5e1d301

Please sign in to comment.