Skip to content

Commit

Permalink
fix: Remove unnecessary calls to removeObserver (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjenkins authored and einsteinx2 committed Nov 30, 2022
1 parent 7302e0d commit a288ba4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 37 deletions.
6 changes: 0 additions & 6 deletions mParticle-Apple-SDK/Kits/MPKitActivity.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ - (instancetype)init {
return self;
}

- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:mParticleKitDidBecomeActiveNotification
object:nil];
}

#pragma mark Private accessors
- (NSMutableArray<MPKitActivityMapping *> *)activityMappings {
if (!_activityMappings) {
Expand Down
6 changes: 0 additions & 6 deletions mParticle-Apple-SDK/Kits/MPKitContainer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ - (instancetype)init {
return self;
}

- (void)dealloc {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidFinishLaunchingNotification object:nil];
}

#pragma mark Notification handlers
- (void)handleApplicationDidBecomeActive:(NSNotification *)notification {
dispatch_async(dispatch_get_main_queue(), ^{
Expand Down
13 changes: 0 additions & 13 deletions mParticle-Apple-SDK/MPBackendController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,6 @@ - (instancetype)initWithDelegate:(id<MPBackendControllerDelegate>)delegate {
}

- (void)dealloc {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidFinishLaunchingNotification object:nil];
[notificationCenter removeObserver:self name:kMPNetworkPerformanceMeasurementNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];

#if TARGET_OS_IOS == 1
[notificationCenter removeObserver:self name:kMPRemoteNotificationDeviceTokenNotification object:nil];
#endif

[self endUploadTimer];
}

Expand Down
6 changes: 0 additions & 6 deletions mParticle-Apple-SDK/Utils/MPStateMachine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ - (instancetype)init {
}

- (void)dealloc {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
[notificationCenter removeObserver:self name:MParticleReachabilityChangedNotification object:nil];

if (_reachability != nil) {
[_reachability stopNotifier];
}
Expand Down
6 changes: 0 additions & 6 deletions mParticle-Apple-SDK/mParticle.m
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,6 @@ - (instancetype)init {
return self;
}

- (void)dealloc {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
}

#pragma mark Private accessors
- (NSMutableDictionary *)configSettings {
if (_configSettings) {
Expand Down

0 comments on commit a288ba4

Please sign in to comment.