Skip to content

Commit 6e68b01

Browse files
Renamed properties with event handler to event dispatcher.
1 parent 0453ea9 commit 6e68b01

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

OptimizelySDKEventDispatcher/OptimizelySDKEventDispatcher/OPTLYEventDispatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ typedef void (^OPTLYEventDispatcherResponse)(NSData * _Nullable data, NSURLRespo
4242
@interface OPTLYEventDispatcher : NSObject <OPTLYEventDispatcher>
4343

4444
/// The interval at which the SDK will attempt to dispatch any events remaining in our events queue (in ms)
45-
@property (nonatomic, assign, readonly) NSInteger eventHandlerDispatchInterval;
45+
@property (nonatomic, assign, readonly) NSInteger eventDispatcherDispatchInterval;
4646
/// The time for which the SDK will attempt to continue re-trying an event dispatch (in ms)
47-
@property (nonatomic, assign, readonly) NSInteger eventHandlerDispatchTimeout;
47+
@property (nonatomic, assign, readonly) NSInteger eventDispatcherDispatchTimeout;
4848

4949
/// Logger provided by the user
5050
@property (nonatomic, strong, nullable) id<OPTLYLogger> logger;

OptimizelySDKEventDispatcher/OptimizelySDKEventDispatcher/OPTLYEventDispatcher.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ - (instancetype)initWithBuilder:(OPTLYEventDispatcherBuilder *)builder {
5555

5656
_logger = builder.logger;
5757

58-
if (builder.eventHandlerDispatchInterval > 0) {
59-
_eventHandlerDispatchInterval = builder.eventHandlerDispatchInterval;
58+
if (builder.eventDispatcherDispatchInterval > 0) {
59+
_eventHandlerDispatchInterval = builder.eventDispatcherDispatchInterval;
6060
} else {
61-
NSString *logMessage = [NSString stringWithFormat: OPTLYLoggerMessagesEventDispatcherInvalidInterval, builder.eventHandlerDispatchInterval];
61+
NSString *logMessage = [NSString stringWithFormat: OPTLYLoggerMessagesEventDispatcherInvalidInterval, builder.eventDispatcherDispatchInterval];
6262
[_logger logMessage:logMessage withLevel:OptimizelyLogLevelWarning];
6363
}
6464

65-
if (builder.eventHandlerDispatchTimeout > 0) {
66-
_eventHandlerDispatchTimeout = builder.eventHandlerDispatchTimeout;
65+
if (builder.eventDispatcherDispatchTimeout > 0) {
66+
_eventHandlerDispatchTimeout = builder.eventDispatcherDispatchTimeout;
6767
} else {
68-
NSString *logMessage = [NSString stringWithFormat:OPTLYLoggerMessagesEventDispatcherInvalidTimeout, builder.eventHandlerDispatchTimeout];
68+
NSString *logMessage = [NSString stringWithFormat:OPTLYLoggerMessagesEventDispatcherInvalidTimeout, builder.eventDispatcherDispatchTimeout];
6969
[_logger logMessage:logMessage withLevel:OptimizelyLogLevelWarning];
7070
}
7171

@@ -104,14 +104,14 @@ - (void)setupNetworkTimer:(void(^)())completion
104104
__weak typeof(self) weakSelf = self;
105105
dispatch_block_t block = ^{
106106
__typeof__(self) strongSelf = weakSelf;
107-
if (strongSelf.eventHandlerDispatchInterval > 0) {
108-
strongSelf.timer = [NSTimer scheduledTimerWithTimeInterval:strongSelf.eventHandlerDispatchInterval
107+
if (strongSelf.eventDispatcherDispatchInterval > 0) {
108+
strongSelf.timer = [NSTimer scheduledTimerWithTimeInterval:strongSelf.eventDispatcherDispatchInterval
109109
target:strongSelf
110110
selector:@selector(flushEvents)
111111
userInfo:nil
112112
repeats:YES];
113113

114-
NSString *logMessage = [NSString stringWithFormat: OPTLYLoggerMessagesEventDispatcherNetworkTimerEnabled, self.eventHandlerDispatchInterval, self.eventHandlerDispatchTimeout, self.maxDispatchBackoffRetries];
114+
NSString *logMessage = [NSString stringWithFormat: OPTLYLoggerMessagesEventDispatcherNetworkTimerEnabled, self.eventDispatcherDispatchInterval, self.eventDispatcherDispatchTimeout, self.maxDispatchBackoffRetries];
115115
[_logger logMessage:logMessage withLevel:OptimizelyLogLevelDebug];
116116

117117
if (completion) {
@@ -529,7 +529,7 @@ - (BOOL)isTimerEnabled
529529
{
530530
BOOL timerIsNotNil = self.timer != nil;
531531
BOOL timerIsValid = self.timer.valid;
532-
BOOL timerIntervalIsSet = (self.timer.timeInterval == self.eventHandlerDispatchInterval) && (self.eventHandlerDispatchInterval > 0);
532+
BOOL timerIntervalIsSet = (self.timer.timeInterval == self.eventDispatcherDispatchInterval) && (self.eventDispatcherDispatchInterval > 0);
533533
BOOL timeoutIsValid = self.maxDispatchBackoffRetries > 0;
534534

535535
return timerIsNotNil && timerIsValid && timerIntervalIsSet && timeoutIsValid;

OptimizelySDKEventDispatcher/OptimizelySDKEventDispatcher/OPTLYEventDispatcherBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ typedef void (^OPTLYEventDispatcherBuilderBlock)(OPTLYEventDispatcherBuilder * _
3737
+ (nullable instancetype)builderWithBlock:(nonnull OPTLYEventDispatcherBuilderBlock)block;
3838

3939
/// The interval at which the SDK will attempt to dispatch any events remaining in our events queue
40-
@property (nonatomic, assign, readwrite) NSInteger eventHandlerDispatchInterval;
40+
@property (nonatomic, assign, readwrite) NSInteger eventDispatcherDispatchInterval;
4141
/// The timeout period in which the SDK will attempt to dispatch any events remaining in our events queue
42-
@property (nonatomic, assign, readwrite) NSInteger eventHandlerDispatchTimeout;
42+
@property (nonatomic, assign, readwrite) NSInteger eventDispatcherDispatchTimeout;
4343
/// Logger provided by the user
4444
@property (nonatomic, strong, nullable) id<OPTLYLogger> logger;
4545

OptimizelySDKEventDispatcher/OptimizelySDKEventDispatcherTests/OPTLYEventDispatcherTest.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,23 @@ - (void)tearDown {
7878
- (void)testEventDispatcherInitWithBuilderBlock
7979
{
8080
OPTLYEventDispatcher *eventDispatcher = [OPTLYEventDispatcher initWithBuilderBlock:^(OPTLYEventDispatcherBuilder *builder) {
81-
builder.eventHandlerDispatchInterval = kEventHandlerDispatchInterval;
82-
builder.eventHandlerDispatchTimeout = kEventHandlerDispatchTimeout;
81+
builder.eventDispatcherDispatchInterval = kEventHandlerDispatchInterval;
82+
builder.eventDispatcherDispatchTimeout = kEventHandlerDispatchTimeout;
8383
builder.logger = [OPTLYLoggerDefault new];
8484
}];
8585

8686
XCTAssertNotNil(eventDispatcher);
87-
XCTAssert(eventDispatcher.eventHandlerDispatchInterval == kEventHandlerDispatchInterval, @"Invalid dispatch timeout set.");
88-
XCTAssert(eventDispatcher.eventHandlerDispatchTimeout == kEventHandlerDispatchTimeout, @"Invalid dispatch timeout set.");
87+
XCTAssert(eventDispatcher.eventDispatcherDispatchInterval == kEventHandlerDispatchInterval, @"Invalid dispatch timeout set.");
88+
XCTAssert(eventDispatcher.eventDispatcherDispatchTimeout == kEventHandlerDispatchTimeout, @"Invalid dispatch timeout set.");
8989
XCTAssertNotNil(eventDispatcher.logger);
9090
XCTAssert([eventDispatcher.logger isKindOfClass:[OPTLYLoggerDefault class]]);
9191

9292
eventDispatcher = [OPTLYEventDispatcher initWithBuilderBlock:^(OPTLYEventDispatcherBuilder *builder) {
9393
}];
9494

9595
XCTAssertNotNil(eventDispatcher);
96-
XCTAssert(eventDispatcher.eventHandlerDispatchInterval == OPTLYEventDispatcherDefaultDispatchIntervalTime_ms, @"Invalid default dispatch interval set.");
97-
XCTAssert(eventDispatcher.eventHandlerDispatchTimeout == OPTLYEventDispatcherDefaultDispatchTimeout_ms, @"Invalid default dispatch timeout set.");
96+
XCTAssert(eventDispatcher.eventDispatcherDispatchInterval == OPTLYEventDispatcherDefaultDispatchIntervalTime_ms, @"Invalid default dispatch interval set.");
97+
XCTAssert(eventDispatcher.eventDispatcherDispatchTimeout == OPTLYEventDispatcherDefaultDispatchTimeout_ms, @"Invalid default dispatch timeout set.");
9898
XCTAssertNil(eventDispatcher.logger);
9999
}
100100

@@ -201,8 +201,8 @@ - (void)testMaxDispatchBackoffRetriesAndPowerOf2 {
201201
[self stubFailureResponse];
202202

203203
OPTLYEventDispatcher *eventDispatcher = [OPTLYEventDispatcher initWithBuilderBlock:^(OPTLYEventDispatcherBuilder *builder) {
204-
builder.eventHandlerDispatchInterval = kEventHandlerDispatchInterval;
205-
builder.eventHandlerDispatchTimeout = kEventHandlerDispatchTimeout;
204+
builder.eventDispatcherDispatchInterval = kEventHandlerDispatchInterval;
205+
builder.eventDispatcherDispatchTimeout = kEventHandlerDispatchTimeout;
206206
builder.logger = [OPTLYLoggerDefault new];
207207
}];
208208

OptimizelyiOSDemoApp/OptimizelyiOSDemoApp/AppDelegate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2525
// Optimizely SDK test parameters
2626
let userId = "1234"
2727
let revenue = NSNumber(value: 88)
28-
let eventHandlerDispatchInterval = 1000
28+
let eventDispatcherDispatchInterval = 1000
2929

3030
// default parameters for initializing Optimizely from saved datafile
3131
let datafileName = "test_data_10_experiments"
@@ -94,7 +94,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
9494
print(fileContents)
9595

9696
let eventDispatcherBuilderBlock : OPTLYEventDispatcherBuilderBlock = {(builder)in
97-
builder?.eventHandlerDispatchInterval = self.eventHandlerDispatchInterval
97+
builder?.eventDispatcherDispatchInterval = self.eventDispatcherDispatchInterval
9898
}
9999
let eventDispatcher = OPTLYEventDispatcher.initWithBuilderBlock(eventDispatcherBuilderBlock)
100100

@@ -115,7 +115,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
115115

116116
let networkService = OPTLYNetworkService()
117117
let eventDispatcherBuilderBlock : OPTLYEventDispatcherBuilderBlock = {[weak self] (builder)in
118-
builder?.eventHandlerDispatchInterval = self!.eventHandlerDispatchInterval
118+
builder?.eventDispatcherDispatchInterval = self!.eventDispatcherDispatchInterval
119119
}
120120
let eventDispatcher = OPTLYEventDispatcher.initWithBuilderBlock(eventDispatcherBuilderBlock)
121121

0 commit comments

Comments
 (0)