diff --git a/ios/App/App/PluginSafeAreasColor.swift b/ios/App/App/PluginSafeAreasColor.swift index 726bb0c62..800dbef31 100644 --- a/ios/App/App/PluginSafeAreasColor.swift +++ b/ios/App/App/PluginSafeAreasColor.swift @@ -17,7 +17,7 @@ public class SafeAreasColorPlugin: CAPPlugin, CAPBridgedPlugin { } DispatchQueue.main.async { - if #available(iOS 13.0, *) { + if #available(iOS 16.0, *) { // Find the active window in iOS 13 or later if let window = UIApplication.shared.connectedScenes .compactMap({ $0 as? UIWindowScene }) @@ -30,13 +30,7 @@ public class SafeAreasColorPlugin: CAPPlugin, CAPBridgedPlugin { call.reject("No active window found") } } else { - // For iOS 12 and earlier - if let window = UIApplication.shared.keyWindow { - window.backgroundColor = uiColor - call.resolve(["value": "Color set successfully"]) - } else { - call.reject("No key window found") - } + call.reject("Earlier versions than iOS 16 are not supported") } } diff --git a/ios/App/PluginViewController.swift b/ios/App/PluginViewController.swift index a9445195a..788d7f246 100644 --- a/ios/App/PluginViewController.swift +++ b/ios/App/PluginViewController.swift @@ -39,17 +39,15 @@ class PluginViewController: CAPBridgeViewController { var leftPadding: CGFloat = 0 var rightPadding: CGFloat = 0 - if #available(iOS 13.0, *) { + if #available(iOS 16.0, *) { let window = view.window ?? UIApplication.shared.windows.first { $0.isKeyWindow } topPadding = window?.safeAreaInsets.top ?? 0 bottomPadding = window?.safeAreaInsets.bottom ?? 0 leftPadding = window?.safeAreaInsets.left ?? 0 rightPadding = window?.safeAreaInsets.right ?? 0 - } else { - topPadding = UIApplication.shared.statusBarFrame.height - } - webView.frame.origin = CGPoint(x: leftPadding, y: topPadding) - webView.frame.size = CGSize(width: UIScreen.main.bounds.width - leftPadding - rightPadding, height: UIScreen.main.bounds.height - topPadding - bottomPadding) + webView.frame.origin = CGPoint(x: leftPadding, y: topPadding) + webView.frame.size = CGSize(width: UIScreen.main.bounds.width - leftPadding - rightPadding, height: UIScreen.main.bounds.height - topPadding - bottomPadding) + } } }