Skip to content

Commit 5a6e707

Browse files
Renamed property. Alphabetized protocol and class imports.
1 parent 1919de0 commit 5a6e707

File tree

3 files changed

+10
-34
lines changed

3 files changed

+10
-34
lines changed

OptimizelySDKCore/OptimizelySDKCore/OPTLYBuilder.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ typedef void (^OPTLYBuilderBlock)(OPTLYBuilder * _Nullable builder);
4747
/// User profile stores user-specific data, like bucketing.
4848
@property (nonatomic, strong, nullable) id<OPTLYUserProfile> userProfile;
4949

50-
@property (nonatomic, strong, nullable) id<OPTLYUserProfile> userProfile;
51-
5250
/// Create an Optimizely Builder object.
5351
+ (nullable instancetype)builderWithBlock:(nonnull OPTLYBuilderBlock)block;
5452

OptimizelySDKCore/OptimizelySDKCore/OPTLYEventDispatcher.m

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,38 +44,6 @@ + (BOOL)conformsToOPTLYEventDispatcherProtocol:(Class)instanceClass
4444

4545
@implementation OPTLYEventDispatcherBasic
4646

47-
- (void)dispatchEvent:(NSDictionary *)params
48-
toURL:(NSURL *)url
49-
completionHandler:(void(^)(NSURLResponse *response, NSError *error))completion
50-
{
51-
NSURLSession *ephemeralSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]];
52-
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
53-
[request setHTTPMethod:kHTTPRequestMethodPost];
54-
55-
NSError *JSONSerializationError = nil;
56-
NSData *data = [NSJSONSerialization dataWithJSONObject:params
57-
options:kNilOptions
58-
error:&JSONSerializationError];
59-
60-
[request addValue:kHTTPHeaderFieldValueApplicationJSON forHTTPHeaderField:kHTTPHeaderFieldContentType];
61-
62-
if (!JSONSerializationError) {
63-
NSURLSessionUploadTask *uploadTask = [ephemeralSession uploadTaskWithRequest:request
64-
fromData:data
65-
completionHandler:^(NSData *data,NSURLResponse *response,NSError *error) {
66-
if (completion) {
67-
completion(response, error);
68-
}
69-
}];
70-
71-
[uploadTask resume];
72-
}
73-
}
74-
75-
@end
76-
77-
@implementation OPTLYEventDispatcherBasic
78-
7947
- (void)dispatchImpressionEvent:(nonnull NSDictionary *)params
8048
callback:(nullable void(^)(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error))callback {
8149
NSURL *url = [NSURL URLWithString:kEventDispatcherImpressionEventURL];

OptimizelySDKShared/OptimizelySDKShared/OPTLYDatafileManager.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ @interface OPTLYDatafileManager ()
2626
@property OPTLYDataStore *dataStore;
2727
@property OPTLYNetworkService *networkService;
2828

29+
+ (BOOL)conformsToOPTLYDatafileManagerProtocol:(Class)instanceClass {
30+
// compile time check
31+
BOOL isValidProtocolDeclaration = [instanceClass conformsToProtocol:@protocol(OPTLYDatafileManager)];
32+
33+
// runtime check
34+
BOOL implementsDownloadDatafileMethod = [instanceClass instancesRespondToSelector:@selector(downloadDatafile:completionHandler:)];
35+
36+
return isValidProtocolDeclaration && implementsDownloadDatafileMethod;
37+
}
38+
2939
@end
3040

3141
@implementation OPTLYDatafileManager

0 commit comments

Comments
 (0)