diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2020-11-30 11:17:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 11:17:28 -0500 |
commit | a87a7b77d8e9c146349049808cf64d98c8400e68 (patch) | |
tree | 52803c3bacae1c096a791dde32cdb6be77a8b0eb | |
parent | d38b709e42a7ce794780a469868b627a74fba396 (diff) | |
parent | 03f7c2055442afbe7c00fca1116b75df04abc713 (diff) | |
download | sdl_ios-a87a7b77d8e9c146349049808cf64d98c8400e68.tar.gz |
Merge pull request #1854 from smartdevicelink/bugfix/issue-1827-Example-app-reset-template-when-HMI-level-changes
Fix for template reset on hmi level changes in example apps
-rw-r--r-- | Example Apps/Example ObjC/ProxyManager.m | 12 | ||||
-rw-r--r-- | Example Apps/Example Swift/ProxyManager.swift | 12 |
2 files changed, 14 insertions, 10 deletions
diff --git a/Example Apps/Example ObjC/ProxyManager.m b/Example Apps/Example ObjC/ProxyManager.m index ed2c057e3..0d13454d7 100644 --- a/Example Apps/Example ObjC/ProxyManager.m +++ b/Example Apps/Example ObjC/ProxyManager.m @@ -164,6 +164,10 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sdlex_showInitialData { + // Send static menu items and soft buttons + [self sdlex_createMenus]; + self.sdlManager.screenManager.softButtonObjects = [self.buttonManager allScreenSoftButtons]; + if (![self.sdlManager.hmiLevel isEqualToEnum:SDLHMILevelFull]) { return; } [self.sdlManager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithPredefinedLayout:SDLPredefinedLayoutNonMedia] withCompletionHandler:nil]; @@ -243,17 +247,15 @@ NS_ASSUME_NONNULL_BEGIN // This is our first time in a non-NONE state self.firstHMILevel = newLevel; - // Send static menu items and soft buttons - [self sdlex_createMenus]; - self.sdlManager.screenManager.softButtonObjects = [self.buttonManager allScreenSoftButtons]; - // Subscribe to vehicle data. [self.vehicleDataManager subscribeToVehicleOdometer]; + + //Handle initial launch + [self sdlex_showInitialData]; } if ([newLevel isEqualToEnum:SDLHMILevelFull]) { // The SDL app is in the foreground. Always try to show the initial state to guard against some possible weird states. Duplicates will be ignored by Core. - [self sdlex_showInitialData]; [self.subscribeButtonManager subscribeToAllPresetButtons]; } else if ([newLevel isEqualToEnum:SDLHMILevelLimited]) { // An active NAV or MEDIA SDL app is in the background diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift index bce2617ad..8a53e7c76 100644 --- a/Example Apps/Example Swift/ProxyManager.swift +++ b/Example Apps/Example Swift/ProxyManager.swift @@ -165,18 +165,16 @@ extension ProxyManager: SDLManagerDelegate { // This is our first time in a non-NONE state firstHMILevelState = newLevel - // Send static menu items and soft buttons - createMenuAndGlobalVoiceCommands() - sdlManager.screenManager.softButtonObjects = buttonManager.allScreenSoftButtons() - // Subscribe to vehicle data. vehicleDataManager.subscribeToVehicleOdometer() + + //Handle initial launch + showInitialData() } switch newLevel { case .full: // The SDL app is in the foreground. Always try to show the initial state to guard against some possible weird states. Duplicates will be ignored by Core. - showInitialData() subscribeButtonManager.subscribeToPresetButtons() case .limited: break // An active NAV or MEDIA SDL app is in the background case .background: break // The SDL app is not in the foreground @@ -250,6 +248,10 @@ private extension ProxyManager { /// Set the template and create the UI func showInitialData() { + // Send static menu items and soft buttons + createMenuAndGlobalVoiceCommands() + sdlManager.screenManager.softButtonObjects = buttonManager.allScreenSoftButtons() + guard sdlManager.hmiLevel == .full else { return } sdlManager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .nonMedia), withCompletionHandler: nil) |