diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-07-28 09:11:57 -0700 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-07-28 09:11:57 -0700 |
commit | 977f7f488b78fc1a352972913f6b56638f92463a (patch) | |
tree | 5b740a80bd0c645a7d152889ca28323b8a1ff5f6 | |
parent | a353f9659242048b3420ea73924c2bd799d04341 (diff) | |
download | sdl_ios-977f7f488b78fc1a352972913f6b56638f92463a.tar.gz |
Added observation of when an application enters an invalidate state so we can end timers.
-rw-r--r-- | SmartDeviceLink/SDLTouchManager.m | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLTouchManager.m b/SmartDeviceLink/SDLTouchManager.m index 2e75bad43..593c16338 100644 --- a/SmartDeviceLink/SDLTouchManager.m +++ b/SmartDeviceLink/SDLTouchManager.m @@ -11,6 +11,7 @@ #import "dispatch_timer.h" #import "CGPoint_Util.h" +#import "SDLDebugTool.h" #import "SDLOnTouchEvent.h" #import "SDLPinchGesture.h" #import "SDLProxyListener.h" @@ -87,6 +88,16 @@ static NSUInteger const MaximumNumberOfTouches = 2; _tapDistanceThreshold = 50.0f; _touchEnabled = YES; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(sdl_applicationDidEnterBackground:) + name:UIApplicationDidEnterBackgroundNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(sdl_applicationDidResignActive:) + name:UIApplicationWillResignActiveNotification + object:nil]; + return self; } @@ -270,6 +281,20 @@ static NSUInteger const MaximumNumberOfTouches = 2; self.singleTapTimer = NULL; } +- (void)sdl_applicationDidEnterBackground:(NSNotification*)notification { + if (self.singleTapTimer != NULL) { + [SDLDebugTool logInfo:@"Application is Entering Background. Canceling Single Touch Timer."]; + [self sdl_cancelSingleTapTimer]; + } +} + +- (void)sdl_applicationDidResignActive:(NSNotification*)notification { + if (self.singleTapTimer != NULL) { + [SDLDebugTool logInfo:@"Application is Resigning Active State. Canceling Single Touch Timer."]; + [self sdl_cancelSingleTapTimer]; + } +} + @end NS_ASSUME_NONNULL_END
\ No newline at end of file |