File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121@property (nonatomic , strong , nullable ) MPKitAPI *kitApi;
2222
2323+ (void )overrideMarketingCloudId : (NSString * _Nullable)mid ;
24+ + (void )willOverrideMarketingCloudId : (BOOL )willOverrideMid ;
2425
2526@end
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ @interface MPKitAdobe ()
2929@implementation MPKitAdobe
3030
3131static NSString *_midOverride = nil ;
32+ static BOOL _willOverrideMid = NO ;
3233
3334+ (NSNumber *)kitCode {
3435 return @124 ;
@@ -41,13 +42,23 @@ + (void)load {
4142 [MParticle registerExtension: kitRegister];
4243}
4344
45+ static __weak MPKitAdobe *_sharedInstance = nil ;
4446+ (void )overrideMarketingCloudId : (NSString *)mid {
4547 _midOverride = mid;
48+ if (mid) {
49+ [[MParticle sharedInstance ] setIntegrationAttributes: @{marketingCloudIdIntegrationAttributeKey: mid} forKit: [[self class ] kitCode ]];
50+ }
51+ [_sharedInstance performSelectorOnMainThread: @selector (sendNetworkRequest ) withObject: nil waitUntilDone: NO ];
52+ }
53+
54+ + (void )willOverrideMarketingCloudId : (BOOL )willOverrideMid {
55+ _willOverrideMid = willOverrideMid;
4656}
4757
4858#pragma mark MPKitInstanceProtocol methods
4959
5060- (MPKitExecStatus *)didFinishLaunchingWithConfiguration : (NSDictionary *)configuration {
61+ _sharedInstance = self;
5162 MPKitExecStatus *execStatus = nil ;
5263
5364 _organizationId = [configuration[organizationIdConfigurationKey] copy ];
@@ -124,6 +135,10 @@ - (NSString *)pushToken {
124135}
125136
126137- (void )sendNetworkRequest {
138+ if (_willOverrideMid && !_midOverride) {
139+ return ;
140+ }
141+
127142 NSString *marketingCloudId = _midOverride;
128143 if (!marketingCloudId) {
129144 marketingCloudId = [self marketingCloudIdFromIntegrationAttributes ];
You can’t perform that action at this time.
0 commit comments