File tree Expand file tree Collapse file tree 3 files changed +10
-34
lines changed
OptimizelySDKCore/OptimizelySDKCore
OptimizelySDKShared/OptimizelySDKShared Expand file tree Collapse file tree 3 files changed +10
-34
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ typedef void (^OPTLYBuilderBlock)(OPTLYBuilder * _Nullable builder);
47
47
// / User profile stores user-specific data, like bucketing.
48
48
@property (nonatomic , strong , nullable ) id <OPTLYUserProfile> userProfile;
49
49
50
- @property (nonatomic , strong , nullable ) id <OPTLYUserProfile> userProfile;
51
-
52
50
// / Create an Optimizely Builder object.
53
51
+ (nullable instancetype )builderWithBlock : (nonnull OPTLYBuilderBlock)block ;
54
52
Original file line number Diff line number Diff line change @@ -44,38 +44,6 @@ + (BOOL)conformsToOPTLYEventDispatcherProtocol:(Class)instanceClass
44
44
45
45
@implementation OPTLYEventDispatcherBasic
46
46
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
-
79
47
- (void )dispatchImpressionEvent : (nonnull NSDictionary *)params
80
48
callback : (nullable void (^)(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error))callback {
81
49
NSURL *url = [NSURL URLWithString: kEventDispatcherImpressionEventURL ];
Original file line number Diff line number Diff line change @@ -26,6 +26,16 @@ @interface OPTLYDatafileManager ()
26
26
@property OPTLYDataStore *dataStore;
27
27
@property OPTLYNetworkService *networkService;
28
28
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
+
29
39
@end
30
40
31
41
@implementation OPTLYDatafileManager
You can’t perform that action at this time.
0 commit comments