15
15
***************************************************************************/
16
16
17
17
#import " OPTLYEventDispatcher.h"
18
- #import < OptimizelySDKShared/Reachability.h>
19
18
19
+ // TODO - Flush events when network connection has become available.
20
20
21
21
// --- Event URLs ----
22
- NSString * const OPTLYEventDispatcherHostName = @" https://logx.optimizely.com" ;
23
22
NSString * const OPTLYEventDispatcherImpressionEventURL = @" https://logx.optimizely.com/log/decision" ;
24
23
NSString * const OPTLYEventDispatcherConversionEventURL = @" https://logx.optimizely.com/log/event" ;
25
24
@@ -448,38 +447,18 @@ - (void)setupApplicationNotificationHandlers {
448
447
object: app];
449
448
}
450
449
451
- - (void )applicationDidFinishLaunching : (id )notificaton {
452
-
453
- [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (reachabilityDidChange: ) name: kReachabilityChangedNotification object: nil ];
454
-
455
- // Initialize Reachability
456
- Reachability *hostReachability = [Reachability reachabilityWithHostName: OPTLYEventDispatcherHostName];
457
- Reachability *internetReachability = [Reachability reachabilityForInternetConnection ];
458
- // Start Monitoring
459
- [internetReachability startNotifier ];
460
- [hostReachability startNotifier ];
461
-
462
- OPTLYLogInfo (@" applicationDidBecomeActive" );
463
- }
464
450
465
- - (void )reachabilityDidChange : (NSNotification *)notification {
466
- Reachability *reachability = (Reachability *)[notification object ];
467
-
468
- if ([reachability currentReachabilityStatus ] != NotReachable) {
469
- OPTLYLogInfo (@" Network is reachable." );
470
- } else {
471
- OPTLYLogInfo (@" Network is unreachable" );
472
- }
451
+ - (void )applicationDidFinishLaunching : (id )notificaton {
452
+ [self flushEvents ];
453
+ OPTLYLogInfo (@" applicationDidFinishLaunching" );
473
454
}
474
455
475
456
- (void )applicationDidBecomeActive : (id )notificaton {
476
- [self flushEvents ];
477
457
OPTLYLogInfo (@" applicationDidBecomeActive" );
478
458
}
479
459
480
460
- (void )applicationDidEnterBackground : (id )notification {
481
461
[self flushEvents ];
482
- // [[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
483
462
OPTLYLogInfo (@" applicationDidEnterBackground" );
484
463
}
485
464
@@ -493,10 +472,13 @@ - (void)applicationWillResignActive:(id)notification {
493
472
494
473
- (void )applicationWillTerminate : (id )notification {
495
474
[self flushEvents ];
496
- // [[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
497
475
OPTLYLogInfo (@" applicationWillTerminate" );
498
476
}
499
477
478
+ - (void )dealloc {
479
+ [[NSNotificationCenter defaultCenter ] removeObserver: self ];
480
+ }
481
+
500
482
# pragma mark - Helper Methods
501
483
- (BOOL )haveEventsToSend : (OPTLYDataStoreEventType)eventType cachedData : (BOOL )cachedData
502
484
{
0 commit comments