From 320146f51cc87a238fd5440e78801cef5d2f7b34 Mon Sep 17 00:00:00 2001 From: LiarPrincess <4982138+LiarPrincess@users.noreply.github.com> Date: Tue, 1 Feb 2022 09:16:36 +0100 Subject: [PATCH] [App] Refactor in 'AppDelegate' --- Wroclive/AppDelegate.swift | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Wroclive/AppDelegate.swift b/Wroclive/AppDelegate.swift index 7e7c3920..8b0cd024 100644 --- a/Wroclive/AppDelegate.swift +++ b/Wroclive/AppDelegate.swift @@ -74,8 +74,12 @@ public final class AppDelegate: UIResponder, UIApplicationDelegate { os_log("Adding observers for Apple frameworks", log: self.log, type: .debug) self.storeUpdater = self.dispatchStoreUpdatesFromAppleFrameworks() - // 'os_log' is inside the function - self.overrideLocaleIfInDebugMode(.pl) +#if DEBUG + let debugLocale = Localizable.Locale.pl + let debugLocaleString = String(describing: debugLocale) + os_log("Setting locale: %{public}@", log: self.log, type: .debug, debugLocaleString) + Localizable.setLocale(debugLocale) +#endif os_log("Setting up theme", log: self.log, type: .debug) ColorScheme.initialize() @@ -104,7 +108,7 @@ public final class AppDelegate: UIResponder, UIApplicationDelegate { } private func logDocumentsDirectoryIfRunningInSimulator() { - #if targetEnvironment(simulator) +#if targetEnvironment(simulator) let documentDir = self.environment.storage.documentsDirectory.path os_log( "Simulator documents directory: %{public}@", @@ -112,7 +116,7 @@ public final class AppDelegate: UIResponder, UIApplicationDelegate { type: .debug, documentDir ) - #endif +#endif } // MARK: - Redux @@ -164,14 +168,6 @@ public final class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: - UI - private func overrideLocaleIfInDebugMode(_ value: Localizable.Locale) { - #if DEBUG - let description = String(describing: value) - os_log("Setting locale: %{public}@", log: self.log, type: .debug, description) - Localizable.setLocale(value) - #endif - } - private func startMapUpdates() -> MapUpdateScheduler { return MapUpdateScheduler( store: self.store,