From 96020bedb8a614b79f3003f47e109937d80e84ed Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Mon, 9 May 2022 19:26:25 +0200 Subject: [PATCH 1/2] chore(splash-screen): use getConfig instead of getConfigValue --- .../ios/Plugin/SplashScreenPlugin.swift | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/splash-screen/ios/Plugin/SplashScreenPlugin.swift b/splash-screen/ios/Plugin/SplashScreenPlugin.swift index 1fee828e9..0fc65bf7b 100644 --- a/splash-screen/ios/Plugin/SplashScreenPlugin.swift +++ b/splash-screen/ios/Plugin/SplashScreenPlugin.swift @@ -58,10 +58,10 @@ public class SplashScreenPlugin: CAPPlugin { private func splashScreenConfig() -> SplashScreenConfig { var config = SplashScreenConfig() - if let backgroundColor = getConfigValue("backgroundColor") as? String { + if let backgroundColor = getConfig().getString(configKey: "backgroundColor") { config.backgroundColor = UIColor.capacitor.color(fromHex: backgroundColor) } - if let spinnerStyle = getConfigValue("iosSpinnerStyle") as? String { + if let spinnerStyle = getConfig().getString(configKey: "iosSpinnerStyle") { switch spinnerStyle.lowercased() { case "small": config.spinnerStyle = .white @@ -69,19 +69,13 @@ public class SplashScreenPlugin: CAPPlugin { config.spinnerStyle = .whiteLarge } } - if let spinnerColor = getConfigValue("spinnerColor") as? String { + if let spinnerColor = getConfig().getString(configKey: "spinnerColor") { config.spinnerColor = UIColor.capacitor.color(fromHex: spinnerColor) } - if let showSpinner = getConfigValue("showSpinner") as? Bool { - config.showSpinner = showSpinner - } + config.showSpinner = getConfig().getBoolean(configKey: "showSpinner", defaultValue: config.showSpinner) - if let launchShowDuration = getConfigValue("launchShowDuration") as? Int { - config.launchShowDuration = launchShowDuration - } - if let launchAutoHide = getConfigValue("launchAutoHide") as? Bool { - config.launchAutoHide = launchAutoHide - } + config.launchShowDuration = getConfig().getInt(configKey: "launchShowDuration", defaultValue: config.launchShowDuration) + config.launchAutoHide = getConfig().getBoolean(configKey: "launchAutoHide", defaultValue: config.launchAutoHide) return config } From 7da5ffcff5738583cb93265f0fdf2d1b62baee30 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 12 May 2022 11:14:21 +0200 Subject: [PATCH 2/2] without labels --- splash-screen/ios/Plugin/SplashScreenPlugin.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/splash-screen/ios/Plugin/SplashScreenPlugin.swift b/splash-screen/ios/Plugin/SplashScreenPlugin.swift index 0fc65bf7b..6c1c9aec4 100644 --- a/splash-screen/ios/Plugin/SplashScreenPlugin.swift +++ b/splash-screen/ios/Plugin/SplashScreenPlugin.swift @@ -58,10 +58,10 @@ public class SplashScreenPlugin: CAPPlugin { private func splashScreenConfig() -> SplashScreenConfig { var config = SplashScreenConfig() - if let backgroundColor = getConfig().getString(configKey: "backgroundColor") { + if let backgroundColor = getConfig().getString("backgroundColor") { config.backgroundColor = UIColor.capacitor.color(fromHex: backgroundColor) } - if let spinnerStyle = getConfig().getString(configKey: "iosSpinnerStyle") { + if let spinnerStyle = getConfig().getString("iosSpinnerStyle") { switch spinnerStyle.lowercased() { case "small": config.spinnerStyle = .white @@ -69,13 +69,13 @@ public class SplashScreenPlugin: CAPPlugin { config.spinnerStyle = .whiteLarge } } - if let spinnerColor = getConfig().getString(configKey: "spinnerColor") { + if let spinnerColor = getConfig().getString("spinnerColor") { config.spinnerColor = UIColor.capacitor.color(fromHex: spinnerColor) } - config.showSpinner = getConfig().getBoolean(configKey: "showSpinner", defaultValue: config.showSpinner) + config.showSpinner = getConfig().getBoolean("showSpinner", config.showSpinner) - config.launchShowDuration = getConfig().getInt(configKey: "launchShowDuration", defaultValue: config.launchShowDuration) - config.launchAutoHide = getConfig().getBoolean(configKey: "launchAutoHide", defaultValue: config.launchAutoHide) + config.launchShowDuration = getConfig().getInt("launchShowDuration", config.launchShowDuration) + config.launchAutoHide = getConfig().getBoolean("launchAutoHide", config.launchAutoHide) return config }