Skip to content

Commit e7f452c

Browse files
committed
[DIA-2026] UnityController.m file is fixed to be able handle native iOS SDK v. 6.4.1
1 parent 7dadf50 commit e7f452c

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

Assets/ConsentManagementProvider/Plugins/iOS/Source/UnityController.m

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,61 +109,68 @@ - (void) addTargetingParamForCampaignType : (int) campaignType : (char*) key : (
109109
// NSLog(@"params => %@", params);
110110
}
111111

112-
-(void) consrtuctLib : (int) accountId _:(char*) propName _: (int) arrSize _: (int[]) campaignTypes _: (int) campaignsEnvironment _: (long) timeOutSeconds
112+
-(void) consrtuctLib : (int) accountId _:(char*) propName _: (int) arrSize _: (int[]) campaignTypes _: (int) campaignsEnvironment _: (long) timeOutSeconds
113113
{
114114
SPError * err = [self checkIfPropNameNotNull: propName];
115115
if(err != nil)
116116
{
117117
[self onErrorWithError:err];
118118
}else{
119119
NSString* nsPropName = [self convertCharToNSString:propName];;
120-
120+
121121
@try
122122
{
123123
SPPropertyName *propertyName = [[SPPropertyName alloc] init:nsPropName error:NULL];
124-
124+
125125
SPCampaign * gdpr = nil;
126126
SPCampaign * ccpa = nil;
127127
SPCampaign * ios14 = nil;
128-
128+
129129
NSMutableDictionary<NSString *, NSString *> * gdprParams;
130130
NSMutableDictionary<NSString *, NSString *> * ccpaParams;
131131
NSMutableDictionary<NSString *, NSString *> * ios14Params;
132-
132+
133133
for (int index=0; index < arrSize; index++)
134134
{
135135
SPCampaignType type = campaignTypes[index];
136136
// NSLog(@"and type is... %ld", (long)type);
137-
137+
138138
NSNumber * nsCampaignType = [NSNumber numberWithInt:index];
139139
NSMutableDictionary<NSString *, NSString *> * campaignParams = params[[nsCampaignType stringValue]];
140-
SPCampaignEnv * env = campaignsEnvironment;
141-
140+
// SPCampaignEnv * env = campaignsEnvironment;
141+
142142
if(type == SPCampaignTypeGdpr)
143143
{
144144
gdprParams = campaignParams;
145145
if([gdprParams count] == 0){
146146
[gdprParams setObject:@"" forKey:@""];
147147
}
148+
// gdpr = [[SPCampaign alloc]
149+
// initWithEnvironment:env
150+
// targetingParams:gdprParams];
148151
gdpr = [[SPCampaign alloc]
149-
initWithEnvironment:env
150-
targetingParams:gdprParams];
152+
initWithTargetingParams:gdprParams];
153+
151154
}else if(type == SPCampaignTypeCcpa){
152155
ccpaParams = campaignParams;
153156
if([ccpaParams count] == 0){
154157
[ccpaParams setObject:@"" forKey:@""];
155158
}
159+
// ccpa = [[SPCampaign alloc]
160+
// initWithEnvironment:env
161+
// targetingParams: ccpaParams];
156162
ccpa = [[SPCampaign alloc]
157-
initWithEnvironment:env
158-
targetingParams: ccpaParams];
163+
initWithTargetingParams: ccpaParams];
159164
}else if(type == SPCampaignTypeIos14){
160165
ios14Params = campaignParams;
161166
if([ios14Params count] == 0){
162167
[ios14Params setObject:@"" forKey:@""];
163168
}
169+
// ios14 = [[SPCampaign alloc]
170+
// initWithEnvironment:env
171+
// targetingParams: ios14Params];
164172
ios14 = [[SPCampaign alloc]
165-
initWithEnvironment:env
166-
targetingParams: ios14Params];
173+
initWithTargetingParams: ios14Params];
167174
}else{
168175
SPError *myErr = [SPError errorWithDomain:@"SPConsentManager"
169176
code:100
@@ -174,14 +181,19 @@ -(void) consrtuctLib : (int) accountId _:(char*) propName _: (int) arrSize _: (i
174181
}
175182
}
176183
// NSLog(@"%@ ||| %@ ||| %@", gdpr.description, ccpa.description, ios14.description);
177-
184+
178185
SPCampaigns * campaigns = [[SPCampaigns alloc]
179186
initWithGdpr: gdpr
180187
ccpa: ccpa
181188
ios14: ios14];
189+
190+
SPCampaignEnv * env = campaignsEnvironment;
191+
NSLog(@" ENVIRONMENT: %ld", (long)env);
192+
182193
consentManager = [[SPConsentManager alloc]
183194
initWithAccountId:accountId
184195
propertyName: propertyName
196+
campaignsEnv: env
185197
campaigns: campaigns
186198
delegate: self];
187199
consentManager.messageTimeoutInSeconds = timeOutSeconds;
@@ -294,4 +306,4 @@ - (void)onConsentReadyWithUserData:(SPUserData *)userData {
294306
UnitySendMessage([self getGOName], "OnConsentReady", [self convertNSStringToChar:[userData toJSON]]);
295307
}
296308

297-
@end
309+
@end

0 commit comments

Comments
 (0)