summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2020-06-15 09:03:31 -0400
committerNicoleYarroch <nicole@livio.io>2020-06-15 09:03:31 -0400
commitfe3a7e751768407b7ccbf279386164c920b0f4f2 (patch)
tree90d156711d8f8ec1a5542017f1aa3a8cf8ab4ea2
parentac576d4246305962f280a5828d1dbed532a24957 (diff)
downloadsdl_ios-fe3a7e751768407b7ccbf279386164c920b0f4f2.tar.gz
Removed duplicate notifications
Added check for current app state Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r--SmartDeviceLink/SDLSecondaryTransportManager.m8
1 files changed, 6 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLSecondaryTransportManager.m b/SmartDeviceLink/SDLSecondaryTransportManager.m
index a173a18d1..ea90652ba 100644
--- a/SmartDeviceLink/SDLSecondaryTransportManager.m
+++ b/SmartDeviceLink/SDLSecondaryTransportManager.m
@@ -144,11 +144,15 @@ struct TransportProtocolUpdated {
_tcpPort = TCPPortUnspecified;
_backgroundTaskManager = [[SDLBackgroundTaskManager alloc] initWithBackgroundTaskName:BackgroundTaskSecondaryTransportName];
+
_currentApplicationState = UIApplicationStateInactive;
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ __strong typeof(weakSelf) strongSelf = weakSelf;
+ strongSelf.currentApplicationState = UIApplication.sharedApplication.applicationState;
+ });
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_hmiStatusDidChange:) name:SDLDidChangeHMIStatusNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_appStateDidUpdate:) name:UIApplicationDidBecomeActiveNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_appStateDidUpdate:) name:UIApplicationWillResignActiveNotification object:nil];
return self;
}