Skip to content

Commit

Permalink
fix(config): set anonymous contact after changeAppCode
Browse files Browse the repository at this point in the history
SUITEDEV-36858

Co-authored-by: LasOri <[email protected]>
  • Loading branch information
LordAndras and LasOri committed Oct 30, 2024
1 parent 63b45a4 commit b4687c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/MobileEngage/RequestTools/MERequestContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ -(void)setOpenIdToken:(NSString *)openIdToken {
}

- (void)setApplicationCode:(NSString *)applicationCode {
[self reset];
_applicationCode = applicationCode;
if (applicationCode) {
[MEExperimental enableFeature:EMSInnerFeature.mobileEngage];
Expand Down
17 changes: 17 additions & 0 deletions Tests/MobileEngageTests/Request/MERequestContextTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#import "EMSStorage.h"
#import "EMSStorageProtocol.h"
#import "XCTestCase+Helper.h"
#import <OCMock/OCMock.h>

SPEC_BEGIN(MERequestContextTests)

Expand Down Expand Up @@ -290,6 +291,22 @@
[[theValue([MEExperimental isFeatureEnabled:EMSInnerFeature.mobileEngage]) should] beYes];
[[theValue([MEExperimental isFeatureEnabled:EMSInnerFeature.eventServiceV4]) should] beYes];
});

it(@"should call reset when appCode is set",
^{
MERequestContext *context = [[MERequestContext alloc] initWithApplicationCode:applicationCode
uuidProvider:uuidProvider
timestampProvider:timestampProvider
deviceInfo:deviceInfo
storage:storage];

MERequestContext *partialMockContext = OCMPartialMock(context);

[partialMockContext setApplicationCode:@"EMS11-C3FD3"];
[[theValue([MEExperimental isFeatureEnabled:EMSInnerFeature.mobileEngage]) should] beYes];
[[theValue([MEExperimental isFeatureEnabled:EMSInnerFeature.eventServiceV4]) should] beYes];
OCMVerify([partialMockContext reset]);
});
});

describe(@"hasContactIdentification",
Expand Down

0 comments on commit b4687c8

Please sign in to comment.