diff options
author | Frank Elias <francois.elias@livio.io> | 2021-04-29 16:42:26 -0400 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-04-29 16:42:26 -0400 |
commit | 8376ab0eb141924c350d7f7f0c530fb92eb530b0 (patch) | |
tree | 853fcb41b50d5723772f331c42c5f6831d8619a7 | |
parent | 58eae973a422da1da70f311930f3f42e27c45655 (diff) | |
download | sdl_ios-bugfix/issue-1978-swift-and-objc-example-apps-sometimes-the-image-is-not-sent-on-the-first-hmi-level-of-full.tar.gz |
re-upload image when there is errorbugfix/issue-1978-swift-and-objc-example-apps-sometimes-the-image-is-not-sent-on-the-first-hmi-level-of-full
-rw-r--r-- | Example Apps/Example ObjC/ProxyManager.m | 6 | ||||
-rw-r--r-- | Example Apps/Example Swift/ProxyManager.swift | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Example Apps/Example ObjC/ProxyManager.m b/Example Apps/Example ObjC/ProxyManager.m index 06ab5dd02..8a254d604 100644 --- a/Example Apps/Example ObjC/ProxyManager.m +++ b/Example Apps/Example ObjC/ProxyManager.m @@ -209,6 +209,12 @@ NS_ASSUME_NONNULL_BEGIN } [screenManager endUpdatesWithCompletionHandler:^(NSError * _Nullable error) { + if (error && screenManager.primaryGraphic == nil && [self sdlex_imageFieldSupported:SDLImageFieldNameGraphic]) { + screenManager.primaryGraphic = areImagesVisible ? [SDLArtwork persistentArtworkWithImage:[[UIImage imageNamed:ExampleAppLogoName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] asImageFormat:SDLArtworkImageFormatPNG] : nil; + } else if (error && screenManager.primaryGraphic == nil && [self sdlex_imageFieldSupported:SDLImageFieldNameSecondaryGraphic]) { + screenManager.secondaryGraphic = areImagesVisible ? [SDLArtwork persistentArtworkWithImage:[UIImage imageNamed:CarBWIconImageName] asImageFormat:SDLArtworkImageFormatPNG] : nil; + } + SDLLogD(@"Updated text and graphics, error? %@", error); }]; } diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift index 9cbee5d6b..297b13186 100644 --- a/Example Apps/Example Swift/ProxyManager.swift +++ b/Example Apps/Example Swift/ProxyManager.swift @@ -297,6 +297,12 @@ private extension ProxyManager { screenManager.endUpdates(completionHandler: { (error) in guard error != nil else { return } + if screenManager.primaryGraphic == nil && self.imageFieldSupported(imageFieldName: SDLImageFieldName.graphic) { + screenManager.primaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: ExampleAppLogoName)!.withRenderingMode(.alwaysOriginal), persistent: false, as: .PNG) : nil + } else if screenManager.primaryGraphic == nil && self.imageFieldSupported(imageFieldName:SDLImageFieldName.secondaryGraphic) { + screenManager.secondaryGraphic = areImagesVisible ? SDLArtwork(image: UIImage(named: CarBWIconImageName)!, persistent: false, as: .PNG) : nil + } + SDLLog.e("Textfields, graphics and soft buttons failed to update: \(error!.localizedDescription)") }) } |