From 6e8405d8003f14a25a781ce0daf2f86aa4df280b Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Mon, 8 Aug 2022 15:06:56 +0200 Subject: [PATCH] [#909] Create Environment Util for iOS (#910) --- ios/CCC.xcodeproj/project.pbxproj | 4 ++++ ios/CCC/Application.swift | 10 +++------- ios/CCC/Util/EnvironmentUtil.swift | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 ios/CCC/Util/EnvironmentUtil.swift diff --git a/ios/CCC.xcodeproj/project.pbxproj b/ios/CCC.xcodeproj/project.pbxproj index 53774d9b4b..74583ee28c 100644 --- a/ios/CCC.xcodeproj/project.pbxproj +++ b/ios/CCC.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 5C8EB4A9260CB5E200DC4A90 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5C8EB4A8260CB5E200DC4A90 /* GoogleService-Info.plist */; }; 5C8FDBDD25BF3FBE00F280FF /* ObservableSEED.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C8FDBDC25BF3FBE00F280FF /* ObservableSEED.swift */; }; 5C94AC32282FA4B2004C9B3D /* CurrencyImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C94AC31282FA4B2004C9B3D /* CurrencyImageView.swift */; }; + 5C9645D628A137FE001DC24E /* EnvironmentUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C9645D528A137FE001DC24E /* EnvironmentUtil.swift */; }; 5C9A59BB25C350DE006745B0 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C9A59BA25C350DE006745B0 /* MainView.swift */; }; 5C9C75C82603A36A00D66FDD /* ToolbarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C9C75C72603A36A00D66FDD /* ToolbarButton.swift */; }; 5CB954BF26932408007632DC /* BannerAdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB954BE26932408007632DC /* BannerAdView.swift */; }; @@ -98,6 +99,7 @@ 5C8EB4A8260CB5E200DC4A90 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 5C8FDBDC25BF3FBE00F280FF /* ObservableSEED.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableSEED.swift; sourceTree = ""; }; 5C94AC31282FA4B2004C9B3D /* CurrencyImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyImageView.swift; sourceTree = ""; }; + 5C9645D528A137FE001DC24E /* EnvironmentUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentUtil.swift; sourceTree = ""; }; 5C9A59BA25C350DE006745B0 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; 5C9C75C72603A36A00D66FDD /* ToolbarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarButton.swift; sourceTree = ""; }; 5CB954BE26932408007632DC /* BannerAdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerAdView.swift; sourceTree = ""; }; @@ -263,6 +265,7 @@ 5CF57E39269588060081E4BB /* RewardedAd.swift */, 5CF57E3B2695A3B20081E4BB /* InterstitialAd.swift */, 5CEA86F42840CF65001386FB /* NotificationManager.swift */, + 5C9645D528A137FE001DC24E /* EnvironmentUtil.swift */, ); path = Util; sourceTree = ""; @@ -497,6 +500,7 @@ 5C9A59BB25C350DE006745B0 /* MainView.swift in Sources */, 5C5D09362562EBDE00DA9C4A /* Koin.swift in Sources */, 5C31E42D28142058008C42B9 /* SelectionView.swift in Sources */, + 5C9645D628A137FE001DC24E /* EnvironmentUtil.swift in Sources */, 5C5D093C2562EC2D00DA9C4A /* CalculatorView.swift in Sources */, 5CF8BE4627DE334100E441F5 /* WebView.swift in Sources */, 5C31E42228141CC9008C42B9 /* KeyboardView.swift in Sources */, diff --git a/ios/CCC/Application.swift b/ios/CCC/Application.swift index 61921eeb08..6c0c5ff46b 100644 --- a/ios/CCC/Application.swift +++ b/ios/CCC/Application.swift @@ -13,11 +13,7 @@ import FirebaseCore import GoogleMobileAds import BackgroundTasks -#if RELEASE - let logger = LoggerKt.doInitLogger(enableCrashlytics: true) -#else - let logger = LoggerKt.doInitLogger(enableCrashlytics: false) -#endif +let logger = LoggerKt.doInitLogger(enableCrashlytics: EnvironmentUtil.isRelease) @main struct Application: App { @@ -33,9 +29,9 @@ struct Application: App { init() { logger.i(message: {"Application init"}) - #if RELEASE + if EnvironmentUtil.isRelease { FirebaseApp.configure() - #endif + } // GADMobileAds.sharedInstance().start(completionHandler: nil) diff --git a/ios/CCC/Util/EnvironmentUtil.swift b/ios/CCC/Util/EnvironmentUtil.swift new file mode 100644 index 0000000000..12ddec7b33 --- /dev/null +++ b/ios/CCC/Util/EnvironmentUtil.swift @@ -0,0 +1,19 @@ +// +// EnvironmentUtil.swift +// CCC +// +// Created by Mustafa Ozhan on 08.08.22. +// Copyright © 2022 orgName. All rights reserved. +// + +import Foundation + +public struct EnvironmentUtil { + public static var isRelease: Bool { + #if RELEASE + return true + #else + return false + #endif + } +}