From f29ce9bb724181ddfb591550d8a9c9ab6126fe69 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 3 Apr 2020 20:10:22 +0200 Subject: [PATCH] Fix setting iOS status bar color with new xcode apis --- android_openssl | 2 +- packaging/ios/platformhelperios.mm | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/android_openssl b/android_openssl index ebb0b68b..d97317e8 160000 --- a/android_openssl +++ b/android_openssl @@ -1 +1 @@ -Subproject commit ebb0b68be41f4559a4785db5951b7d8cfa042e6e +Subproject commit d97317e856d55a2f5399f17888f1852fee8b9553 diff --git a/packaging/ios/platformhelperios.mm b/packaging/ios/platformhelperios.mm index 10f1288b..83d06292 100644 --- a/packaging/ios/platformhelperios.mm +++ b/packaging/ios/platformhelperios.mm @@ -102,8 +102,18 @@ void PlatformHelperIOS::generateNotificationFeedback() void PlatformHelperIOS::setTopPanelColorInternal(const QColor &color) { - UIView *statusBar = (UIView *)[[UIApplication sharedApplication] valueForKey:@"statusBar"]; - statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()]; + if (@available(iOS 13.0, *)) { + UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame]; + if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) { + statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()]; + } + [[UIApplication sharedApplication].keyWindow addSubview:statusBar]; + } else { + UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.frame]; + if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) { + statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()]; + } + } if (((color.red() * 299 + color.green() * 587 + color.blue() * 114) / 1000) > 123) { [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];