From 5fd188e9746e6d38c26c01068980e40f3f6c87b3 Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Fri, 6 Dec 2024 18:54:54 -0300 Subject: [PATCH 1/6] feat(iOS): Change status bar and navigation bar color according on theme using swift code --- android/app/capacitor.build.gradle | 2 + android/capacitor.settings.gradle | 3 ++ ios/App/App/Echo.swift | 78 +++++++++++++++++++++++++++++ ios/App/PluginViewController.swift | 4 ++ ios/App/Podfile | 1 + ios/App/Podfile.lock | 8 ++- package.json | 1 + src/lib/plugins/safeAreaColoriOS.ts | 34 +++++++++++++ src/lib/utils/Mobile.ts | 8 +++ src/routes/+layout.svelte | 12 +++-- 10 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 ios/App/App/Echo.swift create mode 100644 src/lib/plugins/safeAreaColoriOS.ts diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index fe7e5d776..19bad1825 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -16,6 +16,8 @@ dependencies { implementation project(':capacitor-keyboard') implementation project(':capacitor-screen-orientation') implementation project(':capacitor-splash-screen') + implementation project(':capacitor-status-bar') + } diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index 7ca103cf7..7f6f655ac 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -22,3 +22,6 @@ project(':capacitor-screen-orientation').projectDir = new File('../node_modules/ include ':capacitor-splash-screen' project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') + +include ':capacitor-status-bar' +project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') diff --git a/ios/App/App/Echo.swift b/ios/App/App/Echo.swift new file mode 100644 index 000000000..1d8ba2a29 --- /dev/null +++ b/ios/App/App/Echo.swift @@ -0,0 +1,78 @@ +import Capacitor +import UIKit + +@objc(EchoPlugin) +public class EchoPlugin: CAPPlugin, CAPBridgedPlugin { + public let identifier = "EchoPlugin" + public let jsName = "Echo" + public let pluginMethods: [CAPPluginMethod] = [ + CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise) + ] + + @objc func echo(_ call: CAPPluginCall) { + let value = call.getString("color") ?? "" + guard let uiColor = UIColor(hex: value) else { + call.reject("Invalid color format") + return + } + + DispatchQueue.main.async { + if #available(iOS 13.0, *) { + // Find the active window in iOS 13 or later + if let window = UIApplication.shared.connectedScenes + .compactMap({ $0 as? UIWindowScene }) + .flatMap({ $0.windows }) + .first(where: { $0.isKeyWindow }) { + + window.backgroundColor = uiColor // Set the background color + call.resolve(["value": "Color set successfully"]) + } else { + 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.resolve(["value": value]) + } +} + +extension UIColor { + convenience init?(hex: String) { + var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() + + if hexSanitized.hasPrefix("#") { + hexSanitized.remove(at: hexSanitized.startIndex) + } + + var rgb: UInt64 = 0 + guard Scanner(string: hexSanitized).scanHexInt64(&rgb) else { return nil } + + let length = hexSanitized.count + switch length { + case 6: // RGB + self.init( + red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, + green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, + blue: CGFloat(rgb & 0x0000FF) / 255.0, + alpha: 1.0 + ) + case 8: // RGBA + self.init( + red: CGFloat((rgb & 0xFF000000) >> 24) / 255.0, + green: CGFloat((rgb & 0x00FF0000) >> 16) / 255.0, + blue: CGFloat((rgb & 0x0000FF00) >> 8) / 255.0, + alpha: CGFloat(rgb & 0x000000FF) / 255.0 + ) + default: + return nil + } + } +} diff --git a/ios/App/PluginViewController.swift b/ios/App/PluginViewController.swift index 2fa31a81a..7d7925d19 100644 --- a/ios/App/PluginViewController.swift +++ b/ios/App/PluginViewController.swift @@ -2,6 +2,10 @@ import UIKit import Capacitor class PluginViewController: CAPBridgeViewController { + override open func capacitorDidLoad() { + bridge?.registerPluginInstance(EchoPlugin()) + } + override open func viewDidLoad() { super.viewDidLoad() diff --git a/ios/App/Podfile b/ios/App/Podfile index 9876b9ace..9d8a50a01 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -18,6 +18,7 @@ def capacitor_pods pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard' pod 'CapacitorScreenOrientation', :path => '../../node_modules/@capacitor/screen-orientation' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' + pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar' end target 'App' do diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index d926ffb28..762de7234 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -16,6 +16,8 @@ PODS: - Capacitor - CapacitorSplashScreen (6.0.2): - Capacitor + - CapacitorStatusBar (6.0.2): + - Capacitor DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" @@ -27,6 +29,7 @@ DEPENDENCIES: - "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)" - "CapacitorScreenOrientation (from `../../node_modules/@capacitor/screen-orientation`)" - "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)" + - "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)" EXTERNAL SOURCES: Capacitor: @@ -47,6 +50,8 @@ EXTERNAL SOURCES: :path: "../../node_modules/@capacitor/screen-orientation" CapacitorSplashScreen: :path: "../../node_modules/@capacitor/splash-screen" + CapacitorStatusBar: + :path: "../../node_modules/@capacitor/status-bar" SPEC CHECKSUMS: Capacitor: 1f3c7b9802d958cd8c4eb63895fff85dff2e1eea @@ -58,7 +63,8 @@ SPEC CHECKSUMS: CapacitorKeyboard: 460c6f9ec5e52c84f2742d5ce2e67bbc7ab0ebb0 CapacitorScreenOrientation: 3bb823f5d265190301cdc5d58a568a287d98972a CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624 + CapacitorStatusBar: 3b9ac7d0684770522c532d1158a1434512ab1477 -PODFILE CHECKSUM: 0bfaa008b5f31bb57606a8c6259197a6af507ba4 +PODFILE CHECKSUM: 97c46b79f9ec807c302bf24e1511e3e277306740 COCOAPODS: 1.16.2 diff --git a/package.json b/package.json index 9b4209a8e..33f3dc696 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@capacitor/keyboard": "^6.0.3", "@capacitor/screen-orientation": "^6.0.3", "@capacitor/splash-screen": "^6.0.2", + "@capacitor/status-bar": "^6.0.2", "@dicebear/collection": "^9.0.1", "@dicebear/core": "^9.0.1", "@dicebear/identicon": "^9.0.1", diff --git a/src/lib/plugins/safeAreaColoriOS.ts b/src/lib/plugins/safeAreaColoriOS.ts new file mode 100644 index 000000000..249955e04 --- /dev/null +++ b/src/lib/plugins/safeAreaColoriOS.ts @@ -0,0 +1,34 @@ +import { log } from "$lib/utils/Logger" +import { registerPlugin } from "@capacitor/core" +import { StatusBar, Style } from "@capacitor/status-bar" + +interface IEchoPlugin { + echo(options: { color: string }): Promise<{ value: string }> +} + +const Echo = registerPlugin("Echo") + +async function setNewSafeAreasColorOniOS(color: string) { + try { + log.info("Calling native iOS function to change status bar color") + + // Check if the color is 'white' and convert to hex + if (color.toLowerCase() === "white") { + color = "#FFFFFF" + log.info(`Converted color "white" to hexadecimal: ${color}`) + await StatusBar.setStyle({ style: Style.Light }) + log.debug("Change status bar style to light") + } else { + await StatusBar.setStyle({ style: Style.Dark }) + log.debug("Change status bar style to dark") + } + + await Echo.echo({ color }) + } catch (error) { + log.error("Error trying to call swift function:", error) + } +} + +export function changeSafeAreaColorsOniOS(color: string) { + setNewSafeAreasColorOniOS(color) +} diff --git a/src/lib/utils/Mobile.ts b/src/lib/utils/Mobile.ts index 24ecfe19a..1f073922e 100644 --- a/src/lib/utils/Mobile.ts +++ b/src/lib/utils/Mobile.ts @@ -27,3 +27,11 @@ export function isAndroid(): boolean { } return platform === "android" } + +export function isiOSMobile(): boolean { + if (platform === null) { + log.warn("Platform info not yet loaded. Assuming 'false'.") + return false + } + return platform === "ios" +} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 03c9d4c0e..3d8c07fc2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -28,8 +28,9 @@ import Market from "$lib/components/market/Market.svelte" import { swipe } from "$lib/components/ui/Swipe" import { ScreenOrientation } from "@capacitor/screen-orientation" - import { fetchDeviceInfo, isAndroid, isAndroidOriOS } from "$lib/utils/Mobile" + import { fetchDeviceInfo, isAndroid, isAndroidOriOS, isiOSMobile } from "$lib/utils/Mobile" import { changeSafeAreaColorsOnAndroid } from "$lib/plugins/safeAreaColorAndroid" + import { changeSafeAreaColorsOniOS } from "$lib/plugins/safeAreaColoriOS" log.debug("Initializing app, layout routes page.") @@ -230,11 +231,14 @@ function changeSafeAreaColors() { setTimeout(() => { + const rootStyles = getComputedStyle(document.documentElement) + let mainBgColor = rootStyles.getPropertyValue("--background").trim() if (isAndroid()) { - const rootStyles = getComputedStyle(document.documentElement) - let mainBgColor = rootStyles.getPropertyValue("--background").trim() changeSafeAreaColorsOnAndroid(mainBgColor) } + if (isiOSMobile()) { + changeSafeAreaColorsOniOS(mainBgColor) + } }, 1000) } @@ -289,7 +293,7 @@ onMount(async () => { await fetchDeviceInfo() - if (await isAndroidOriOS()) { + if (isAndroidOriOS()) { lockOrientation() } From a5b2b1b133bfcbc92fc98b4564fafe1a19aecbc1 Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Fri, 6 Dec 2024 19:04:37 -0300 Subject: [PATCH 2/6] feat(iOS, Android): Rename and refactor Echo plugin to SafeAreasColorPlugin with updated methods for color handling --- .../App/{Echo.swift => PluginSafeAreasColor.swift} | 12 ++++++------ ios/App/PluginViewController.swift | 2 +- src/lib/plugins/safeAreaColorAndroid.ts | 11 +++++++++++ src/lib/plugins/safeAreaColoriOS.ts | 8 ++++---- 4 files changed, 22 insertions(+), 11 deletions(-) rename ios/App/App/{Echo.swift => PluginSafeAreasColor.swift} (87%) diff --git a/ios/App/App/Echo.swift b/ios/App/App/PluginSafeAreasColor.swift similarity index 87% rename from ios/App/App/Echo.swift rename to ios/App/App/PluginSafeAreasColor.swift index 1d8ba2a29..726bb0c62 100644 --- a/ios/App/App/Echo.swift +++ b/ios/App/App/PluginSafeAreasColor.swift @@ -1,15 +1,15 @@ import Capacitor import UIKit -@objc(EchoPlugin) -public class EchoPlugin: CAPPlugin, CAPBridgedPlugin { - public let identifier = "EchoPlugin" - public let jsName = "Echo" +@objc(SafeAreasColorPlugin) +public class SafeAreasColorPlugin: CAPPlugin, CAPBridgedPlugin { + public let identifier = "SafeAreasColorPlugin" + public let jsName = "SafeAreasColor" public let pluginMethods: [CAPPluginMethod] = [ - CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise) + CAPPluginMethod(name: "changeSafeAreasColorOniOS", returnType: CAPPluginReturnPromise) ] - @objc func echo(_ call: CAPPluginCall) { + @objc func changeSafeAreasColorOniOS(_ call: CAPPluginCall) { let value = call.getString("color") ?? "" guard let uiColor = UIColor(hex: value) else { call.reject("Invalid color format") diff --git a/ios/App/PluginViewController.swift b/ios/App/PluginViewController.swift index 7d7925d19..a9445195a 100644 --- a/ios/App/PluginViewController.swift +++ b/ios/App/PluginViewController.swift @@ -3,7 +3,7 @@ import Capacitor class PluginViewController: CAPBridgeViewController { override open func capacitorDidLoad() { - bridge?.registerPluginInstance(EchoPlugin()) + bridge?.registerPluginInstance(SafeAreasColorPlugin()) } override open func viewDidLoad() { diff --git a/src/lib/plugins/safeAreaColorAndroid.ts b/src/lib/plugins/safeAreaColorAndroid.ts index 02730a278..2439883b7 100644 --- a/src/lib/plugins/safeAreaColorAndroid.ts +++ b/src/lib/plugins/safeAreaColorAndroid.ts @@ -1,5 +1,6 @@ import { log } from "$lib/utils/Logger" import { registerPlugin } from "@capacitor/core" +import { StatusBar, Style } from "@capacitor/status-bar" interface ISafeAreaColorPlugin { setStatusBarColor(options: { color: string }): Promise<{ value: string }> @@ -11,6 +12,16 @@ const SafeAreaColorPlugin = registerPlugin("SafeAreaColorP async function setStatusBarColor(color: string) { try { log.info("Calling native android function to change status bar color") + if (color.toLowerCase() === "white") { + color = "#FFFFFF" + log.info(`Converted color "white" to hexadecimal: ${color}`) + await StatusBar.setStyle({ style: Style.Light }) + log.debug("Change status bar style to light") + } else { + await StatusBar.setStyle({ style: Style.Dark }) + log.debug("Change status bar style to dark") + } + await SafeAreaColorPlugin.setStatusBarColor({ color }) } catch (error) { log.error("Error setting status bar color:", error) diff --git a/src/lib/plugins/safeAreaColoriOS.ts b/src/lib/plugins/safeAreaColoriOS.ts index 249955e04..606799c45 100644 --- a/src/lib/plugins/safeAreaColoriOS.ts +++ b/src/lib/plugins/safeAreaColoriOS.ts @@ -2,11 +2,11 @@ import { log } from "$lib/utils/Logger" import { registerPlugin } from "@capacitor/core" import { StatusBar, Style } from "@capacitor/status-bar" -interface IEchoPlugin { - echo(options: { color: string }): Promise<{ value: string }> +interface ISafeAreasColorPlugin { + changeSafeAreasColorOniOS(options: { color: string }): Promise<{ value: string }> } -const Echo = registerPlugin("Echo") +const Echo = registerPlugin("SafeAreasColor") async function setNewSafeAreasColorOniOS(color: string) { try { @@ -23,7 +23,7 @@ async function setNewSafeAreasColorOniOS(color: string) { log.debug("Change status bar style to dark") } - await Echo.echo({ color }) + await Echo.changeSafeAreasColorOniOS({ color }) } catch (error) { log.error("Error trying to call swift function:", error) } From f06f82273af95b64822a8b86bc40369bbce278b4 Mon Sep 17 00:00:00 2001 From: stavares843 Date: Mon, 9 Dec 2024 20:06:51 +0000 Subject: [PATCH 3/6] fix build --- ios/App/App.xcodeproj/project.pbxproj | 4 ++++ ios/App/Podfile.lock | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index a14b920dc..8366b0ee4 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; }; 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; }; 56524E4F2CE8119000C237C2 /* PluginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56524E4E2CE8119000C237C2 /* PluginViewController.swift */; }; + 567DF60B2D0784C1003BA7AC /* PluginSafeAreasColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DF60A2D0784C1003BA7AC /* PluginSafeAreasColor.swift */; }; A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; }; /* End PBXBuildFile section */ @@ -29,6 +30,7 @@ 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; 56524E4E2CE8119000C237C2 /* PluginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginViewController.swift; sourceTree = ""; }; + 567DF60A2D0784C1003BA7AC /* PluginSafeAreasColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PluginSafeAreasColor.swift; path = App/PluginSafeAreasColor.swift; sourceTree = ""; }; AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; @@ -57,6 +59,7 @@ 504EC2FB1FED79650016851F = { isa = PBXGroup; children = ( + 567DF60A2D0784C1003BA7AC /* PluginSafeAreasColor.swift */, 56524E4E2CE8119000C237C2 /* PluginViewController.swift */, 504EC3061FED79650016851F /* App */, 504EC3051FED79650016851F /* Products */, @@ -213,6 +216,7 @@ buildActionMask = 2147483647; files = ( 504EC3081FED79650016851F /* AppDelegate.swift in Sources */, + 567DF60B2D0784C1003BA7AC /* PluginSafeAreasColor.swift in Sources */, 56524E4F2CE8119000C237C2 /* PluginViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index 762de7234..488b84c88 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -14,7 +14,7 @@ PODS: - Capacitor - CapacitorScreenOrientation (6.0.3): - Capacitor - - CapacitorSplashScreen (6.0.2): + - CapacitorSplashScreen (6.0.3): - Capacitor - CapacitorStatusBar (6.0.2): - Capacitor @@ -62,7 +62,7 @@ SPEC CHECKSUMS: CapacitorFilesystem: c832a3f6d4870c3872688e782ae8e33665e6ecbf CapacitorKeyboard: 460c6f9ec5e52c84f2742d5ce2e67bbc7ab0ebb0 CapacitorScreenOrientation: 3bb823f5d265190301cdc5d58a568a287d98972a - CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624 + CapacitorSplashScreen: 68893659d77b5f82d753b3a70475082845e3039c CapacitorStatusBar: 3b9ac7d0684770522c532d1158a1434512ab1477 PODFILE CHECKSUM: 97c46b79f9ec807c302bf24e1511e3e277306740 From 5d999c83c816450f0f0c71d37a389677b8d256b7 Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Thu, 12 Dec 2024 17:18:45 -0300 Subject: [PATCH 4/6] feat(App): update safe area handling to support iOS 16 and later --- ios/App/App/PluginSafeAreasColor.swift | 10 ++-------- ios/App/PluginViewController.swift | 10 ++++------ 2 files changed, 6 insertions(+), 14 deletions(-) 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) + } } } From 08b2fbf96fbbf464815903bb99b012a2a8b451f7 Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Thu, 12 Dec 2024 17:19:32 -0300 Subject: [PATCH 5/6] chore(android): remove unnecessary blank line in capacitor.build.gradle --- android/app/capacitor.build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index 19bad1825..43c29cf84 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -17,7 +17,6 @@ dependencies { implementation project(':capacitor-screen-orientation') implementation project(':capacitor-splash-screen') implementation project(':capacitor-status-bar') - } From 4118fdbc6f54cc42e9f58770d63f413b900e8267 Mon Sep 17 00:00:00 2001 From: lgmarchi Date: Thu, 12 Dec 2024 19:27:32 -0300 Subject: [PATCH 6/6] refactor(Mobile): remove unused isiOSMobile function --- src/lib/utils/Mobile.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/lib/utils/Mobile.ts b/src/lib/utils/Mobile.ts index c4f6952fd..1f073922e 100644 --- a/src/lib/utils/Mobile.ts +++ b/src/lib/utils/Mobile.ts @@ -20,13 +20,6 @@ export function isAndroidOriOS(): boolean { return platform === "ios" || platform === "android" } -export function isiOSMobile(): boolean { - if (platform === null) { - log.warn("Platform info not yet loaded. Assuming 'false'.") - return false - } - return platform === "ios" -} export function isAndroid(): boolean { if (platform === null) { log.warn("Platform info not yet loaded. Assuming 'false'.")