Skip to content

Commit d41bf81

Browse files
jaeoptthomaszurkan-optimizely
authored andcommitted
(fix): rename protocols in OPTLYJSONModel to avoid conflicts with JSONModel in client apps (#431)
* fix name conflicts of OPTLYJSONModel protocols * cleanup
1 parent 98f640f commit d41bf81

File tree

15 files changed

+40
-44
lines changed

15 files changed

+40
-44
lines changed

OptimizelySDKCore/OPTLYJSONModel/OPTLYJSONModel/OPTLYJSONModel/OPTLYJSONModel.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
3535
/////////////////////////////////////////////////////////////////////////////////////////////
3636

3737
DEPRECATED_ATTRIBUTE
38-
@protocol ConvertOnDemand
39-
@end
40-
41-
DEPRECATED_ATTRIBUTE
42-
@protocol Index
38+
@protocol OPTLYIndex
4339
@end
4440

4541
#pragma mark - Property Protocols
@@ -50,7 +46,7 @@ DEPRECATED_ATTRIBUTE
5046
* @property (strong, nonatomic) NSString<Ignore> *propertyName;
5147
*
5248
*/
53-
@protocol Ignore
49+
@protocol OPTLYIgnore
5450
@end
5551

5652
/**
@@ -66,7 +62,7 @@ DEPRECATED_ATTRIBUTE
6662
/**
6763
* Make all objects compatible to avoid compiler warnings
6864
*/
69-
@interface NSObject (OPTLYJSONModelPropertyCompatibility) <OPTLYOptional, Ignore>
65+
@interface NSObject (OPTLYJSONModelPropertyCompatibility) <OPTLYOptional, OPTLYIgnore>
7066
@end
7167

7268
/////////////////////////////////////////////////////////////////////////////////////////////

OptimizelySDKCore/OPTLYJSONModel/OPTLYJSONModel/OPTLYJSONModel/OPTLYJSONModel.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ -(void)__inspectProperties
609609

610610
if ([protocolName isEqualToString:@"OPTLYOptional"]) {
611611
p.isOptional = YES;
612-
} else if([protocolName isEqualToString:@"Index"]) {
612+
} else if([protocolName isEqualToString:@"OPTLYIndex"]) {
613613
#pragma GCC diagnostic push
614614
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
615615
p.isIndex = YES;
@@ -621,7 +621,7 @@ -(void)__inspectProperties
621621
p.name,
622622
OBJC_ASSOCIATION_RETAIN // This is atomic
623623
);
624-
} else if([protocolName isEqualToString:@"Ignore"]) {
624+
} else if([protocolName isEqualToString:@"OPTLYIgnore"]) {
625625
p = nil;
626626
} else {
627627
p.protocol = protocolName;

OptimizelySDKCore/OPTLYJSONModelTests/Models/Headers/ConcurrentReposModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
#pragma GCC diagnostic push
4141
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
42-
@property (strong, nonatomic) NSString<Index>* name;
42+
@property (strong, nonatomic) NSString<OPTLYIndex>* name;
4343
#pragma GCC diagnostic pop
4444

4545
@end

OptimizelySDKCore/OPTLYJSONModelTests/Models/Headers/GitHubKeyMapRepoModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#pragma GCC diagnostic push
3333
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
34-
@property (assign, nonatomic) NSString<Index>* name;
34+
@property (assign, nonatomic) NSString<OPTLYIndex>* name;
3535
#pragma GCC diagnostic pop
3636

3737
@end

OptimizelySDKCore/OPTLYJSONModelTests/Models/Headers/GitHubRepoModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#pragma GCC diagnostic push
4040
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
41-
@property (strong, nonatomic) NSString<Index>* name;
41+
@property (strong, nonatomic) NSString<OPTLYIndex>* name;
4242
#pragma GCC diagnostic pop
4343

4444
@end

OptimizelySDKCore/OPTLYJSONModelTests/Models/Headers/OptionalPropModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
@property (assign, nonatomic) int fillerNumber;
3131
@property (strong, nonatomic) NSString<OPTLYOptional>* notRequredProperty;
32-
@property (strong, nonatomic) NSString<Ignore>* ignoredProperty;
32+
@property (strong, nonatomic) NSString<OPTLYIgnore>* ignoredProperty;
3333
@property (assign, nonatomic) CGPoint notRequiredPoint;
3434

3535
+(BOOL)propertyIsOptional:(NSString*)propertyName;

OptimizelySDKCore/OPTLYJSONModelTests/Models/Headers/PostModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#pragma GCC diagnostic push
3030
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
31-
@property (strong, nonatomic) NSString<Index>* id;
31+
@property (strong, nonatomic) NSString<OPTLYIndex>* id;
3232
#pragma GCC diagnostic pop
3333

3434
@property (strong, nonatomic) NSString<OPTLYOptional>* name;

OptimizelySDKCore/OptimizelySDKCore/OPTLYAudience.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@interface OPTLYAudience()
2525
/// String representation of the conditions
26-
@property (nonatomic, strong) NSString<Ignore> *conditionsString;
26+
@property (nonatomic, strong) NSString<OPTLYIgnore> *conditionsString;
2727
@end
2828

2929
@implementation OPTLYAudience

OptimizelySDKCore/OptimizelySDKCore/OPTLYBaseCondition.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
@interface OPTLYBaseCondition()
2424
/// String representation of self
25-
@property (nonatomic, strong) NSString<Ignore> *stringRepresentation;
25+
@property (nonatomic, strong) NSString<OPTLYIgnore> *stringRepresentation;
2626
@end
2727

2828
@implementation OPTLYBaseCondition

OptimizelySDKCore/OptimizelySDKCore/OPTLYExperiment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_END
4545
/// The experiment's status.
4646
@property (nonatomic, strong, nonnull) NSString *status;
4747
/// The group ID the experiment belongs to.
48-
@property (nonatomic, strong, nullable) NSString<Ignore> *groupId;
48+
@property (nonatomic, strong, nullable) NSString<OPTLYIgnore> *groupId;
4949
/// The experiment's traffic allocations.
5050
@property (nonatomic, strong, nonnull) NSArray<OPTLYTrafficAllocation *><OPTLYTrafficAllocation> *trafficAllocations;
5151
/// An array of audience Ids for the experiment

OptimizelySDKCore/OptimizelySDKCore/OPTLYExperiment.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
@interface OPTLYExperiment()
2525
/// A mapping of an experiment's variation's ID to the matching variation.
2626
/// @{NSString *variationId : OPTLYVariation *variation}
27-
@property (nonatomic, strong) NSDictionary<Ignore> *variationIdToVariationMap;
27+
@property (nonatomic, strong) NSDictionary<OPTLYIgnore> *variationIdToVariationMap;
2828
/// A mapping of an experiment's variation's Key to the matching variation.
2929
/// @{NSString *variationKey : OPTLYVariation *variation}
30-
@property (nonatomic, strong) NSDictionary<Ignore> *variationKeyToVariationMap;
30+
@property (nonatomic, strong) NSDictionary<OPTLYIgnore> *variationKeyToVariationMap;
3131
/// A JSON String containing the expirement's audience conditions
32-
@property (nonatomic, strong) NSString<Ignore> *conditionsString;
32+
@property (nonatomic, strong) NSString<OPTLYIgnore> *conditionsString;
3333
@end
3434

3535
@implementation OPTLYExperiment

OptimizelySDKCore/OptimizelySDKCore/OPTLYFeatureFlag.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@interface OPTLYFeatureFlag()
2525

26-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYFeatureVariable *><Ignore> *featureVariableKeyToFeatureVariableMap;
26+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYFeatureVariable *><OPTLYIgnore> *featureVariableKeyToFeatureVariableMap;
2727

2828
@end
2929

OptimizelySDKCore/OptimizelySDKCore/OPTLYProjectConfig.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ NS_ASSUME_NONNULL_END
6363

6464
/// a comprehensive list of experiments that includes experiments being whitelisted (in Groups)
6565
@property (nonatomic, strong, nullable) NSArray<OPTLYExperiment *><OPTLYExperiment, OPTLYOptional> *allExperiments;
66-
@property (nonatomic, strong, nullable) id<OPTLYLogger, Ignore> logger;
67-
@property (nonatomic, strong, nullable) id<OPTLYErrorHandler, Ignore> errorHandler;
68-
@property (nonatomic, strong, readonly, nullable) id<OPTLYUserProfileService, Ignore> userProfileService;
66+
@property (nonatomic, strong, nullable) id<OPTLYLogger, OPTLYIgnore> logger;
67+
@property (nonatomic, strong, nullable) id<OPTLYErrorHandler, OPTLYIgnore> errorHandler;
68+
@property (nonatomic, strong, readonly, nullable) id<OPTLYUserProfileService, OPTLYIgnore> userProfileService;
6969

7070
/// Returns the client type (e.g., objective-c-sdk, ios-sdk, tvos-sdk)
71-
@property (nonatomic, strong, readonly, nonnull) NSString<Ignore> *clientEngine;
71+
@property (nonatomic, strong, readonly, nonnull) NSString<OPTLYIgnore> *clientEngine;
7272
/// Returns the client version number
73-
@property (nonatomic, strong, readonly, nonnull) NSString<Ignore> *clientVersion;
73+
@property (nonatomic, strong, readonly, nonnull) NSString<OPTLYIgnore> *clientVersion;
7474
/// List of Optimizely Feature Flags objects
7575
@property (nonatomic, strong, nonnull) NSArray<OPTLYFeatureFlag *><OPTLYFeatureFlag, OPTLYOptional> *featureFlags;
7676
/// List of Optimizely Rollouts objects

OptimizelySDKCore/OptimizelySDKCore/OPTLYProjectConfig.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@
3838

3939
@interface OPTLYProjectConfig()
4040

41-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYAudience *><Ignore> *audienceIdToAudienceMap;
42-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYEvent *><Ignore> *eventKeyToEventMap;
43-
@property (nonatomic, strong) NSDictionary<NSString *, NSString *><Ignore> *eventKeyToEventIdMap;
44-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYExperiment *><Ignore> *experimentIdToExperimentMap;
45-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYExperiment *><Ignore> *experimentKeyToExperimentMap;
46-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYFeatureFlag *><Ignore> *featureFlagKeyToFeatureFlagMap;
47-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYRollout *><Ignore> *rolloutIdToRolloutMap;
48-
@property (nonatomic, strong) NSDictionary<NSString *, NSArray *><Ignore> *experimentIdToFeatureIdsMap;
49-
@property (nonatomic, strong) NSDictionary<NSString *, NSString *><Ignore> *experimentKeyToExperimentIdMap;
50-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYGroup *><Ignore> *groupIdToGroupMap;
51-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYAttribute *><Ignore> *attributeKeyToAttributeMap;
52-
//@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableDictionary<NSString *, NSString *>><Ignore> *forcedVariationMap;
41+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYAudience *><OPTLYIgnore> *audienceIdToAudienceMap;
42+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYEvent *><OPTLYIgnore> *eventKeyToEventMap;
43+
@property (nonatomic, strong) NSDictionary<NSString *, NSString *><OPTLYIgnore> *eventKeyToEventIdMap;
44+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYExperiment *><OPTLYIgnore> *experimentIdToExperimentMap;
45+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYExperiment *><OPTLYIgnore> *experimentKeyToExperimentMap;
46+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYFeatureFlag *><OPTLYIgnore> *featureFlagKeyToFeatureFlagMap;
47+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYRollout *><OPTLYIgnore> *rolloutIdToRolloutMap;
48+
@property (nonatomic, strong) NSDictionary<NSString *, NSArray *><OPTLYIgnore> *experimentIdToFeatureIdsMap;
49+
@property (nonatomic, strong) NSDictionary<NSString *, NSString *><OPTLYIgnore> *experimentKeyToExperimentIdMap;
50+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYGroup *><OPTLYIgnore> *groupIdToGroupMap;
51+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYAttribute *><OPTLYIgnore> *attributeKeyToAttributeMap;
52+
//@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableDictionary<NSString *, NSString *>><OPTLYIgnore> *forcedVariationMap;
5353
// userId --> experimentId --> variationId
54-
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableDictionary *><Ignore> *forcedVariationMap;
54+
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableDictionary *><OPTLYIgnore> *forcedVariationMap;
5555

5656
@end
5757

@@ -158,15 +158,15 @@ - (instancetype)initWithBuilder:(OPTLYProjectConfigBuilder *)builder {
158158
if (![OPTLYUserProfileServiceUtility conformsToOPTLYUserProfileServiceProtocol:[builder.userProfileService class]]) {
159159
[builder.logger logMessage:OPTLYErrorHandlerMessagesUserProfileInvalid withLevel:OptimizelyLogLevelWarning];
160160
} else {
161-
_userProfileService = (id<OPTLYUserProfileService, Ignore>)builder.userProfileService;
161+
_userProfileService = (id<OPTLYUserProfileService, OPTLYIgnore>)builder.userProfileService;
162162
}
163163
}
164164

165165
_clientEngine = builder.clientEngine;
166166
_clientVersion = builder.clientVersion;
167167

168-
_errorHandler = (id<OPTLYErrorHandler, Ignore>)builder.errorHandler;
169-
_logger = (id<OPTLYLogger, Ignore>)builder.logger;
168+
_errorHandler = (id<OPTLYErrorHandler, OPTLYIgnore>)builder.errorHandler;
169+
_logger = (id<OPTLYLogger, OPTLYIgnore>)builder.logger;
170170
return self;
171171
}
172172

@@ -455,7 +455,7 @@ - (NSDictionary *)eventKeyToEventMap {
455455
return _experimentKeyToExperimentIdMap;
456456
}
457457

458-
- (NSDictionary<NSString *,NSArray *><Ignore> *)experimentIdToFeatureIdsMap
458+
- (NSDictionary<NSString *,NSArray *><OPTLYIgnore> *)experimentIdToFeatureIdsMap
459459
{
460460
if (!_experimentIdToFeatureIdsMap) {
461461
_experimentIdToFeatureIdsMap = [self generateExperimentIdToFeatureIdsMap];

OptimizelySDKCore/OptimizelySDKCore/OPTLYVariation.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@interface OPTLYVariation()
2222
/// A mapping of Feature Variable IDs to Variable Usages constructed during the initialization of Variation objects from the list of Variable Usages.
23-
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYVariableUsage *><Ignore> *variableIdToVariableUsageMap;
23+
@property (nonatomic, strong) NSDictionary<NSString *, OPTLYVariableUsage *><OPTLYIgnore> *variableIdToVariableUsageMap;
2424
@end
2525

2626
@implementation OPTLYVariation

0 commit comments

Comments
 (0)