Skip to content

Commit

Permalink
[iOS] Improve haptic engine cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbaroni committed Nov 14, 2024
1 parent 07ff65e commit cdb491e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions package/ios/TurboHapticsModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,13 @@ - (instancetype)init {
if (self = [super init]) {
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(handleAppWillResignActive:)
selector:@selector(handleAppStateChange:)
name:UIApplicationWillResignActiveNotification
object:nil];
[center addObserver:self
selector:@selector(handleAppDidEnterBackground:)
selector:@selector(handleAppStateChange:)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[center addObserver:self
selector:@selector(handleAppWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
}
return self;
}
Expand All @@ -44,15 +40,7 @@ - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)handleAppWillResignActive:(NSNotification *)notification {
TurboHapticsHostObject::cleanup();
}

- (void)handleAppDidEnterBackground:(NSNotification *)notification {
TurboHapticsHostObject::cleanup();
}

- (void)handleAppWillEnterForeground:(NSNotification *)notification {
- (void)handleAppStateChange:(NSNotification *)notification {
TurboHapticsHostObject::cleanup();
}

Expand Down

0 comments on commit cdb491e

Please sign in to comment.