diff --git a/SmartWallet.xcodeproj/project.pbxproj b/SmartWallet.xcodeproj/project.pbxproj index 7b07022..e763e66 100644 --- a/SmartWallet.xcodeproj/project.pbxproj +++ b/SmartWallet.xcodeproj/project.pbxproj @@ -54,6 +54,7 @@ CDD094E3242F864E00F5435A /* UserDefaults+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD094E2242F864E00F5435A /* UserDefaults+Extensions.swift */; }; CDD094E5242FD4C900F5435A /* SWIconSelectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD094E4242FD4C900F5435A /* SWIconSelectorViewController.swift */; }; CDD094E7242FD56600F5435A /* SWIconCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD094E6242FD56600F5435A /* SWIconCollectionCell.swift */; }; + CDD094E92430C2CC00F5435A /* SWAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD094E82430C2CC00F5435A /* SWAppConfig.swift */; }; CDD8642D2090E49B00E65E64 /* BudgetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD8642C2090E49B00E65E64 /* BudgetViewController.swift */; }; CDD8642F2090F59A00E65E64 /* BudgetTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD8642E2090F59A00E65E64 /* BudgetTableViewCell.swift */; }; CDD9510B223DC13600178C99 /* DisplayRecordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDD9510A223DC13600178C99 /* DisplayRecordViewController.swift */; }; @@ -144,6 +145,7 @@ CDD094E2242F864E00F5435A /* UserDefaults+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extensions.swift"; sourceTree = ""; }; CDD094E4242FD4C900F5435A /* SWIconSelectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWIconSelectorViewController.swift; sourceTree = ""; }; CDD094E6242FD56600F5435A /* SWIconCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWIconCollectionCell.swift; sourceTree = ""; }; + CDD094E82430C2CC00F5435A /* SWAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWAppConfig.swift; sourceTree = ""; }; CDD8642C2090E49B00E65E64 /* BudgetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetViewController.swift; sourceTree = ""; }; CDD8642E2090F59A00E65E64 /* BudgetTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetTableViewCell.swift; sourceTree = ""; }; CDD864302093F02700E65E64 /* intro.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = intro.mp4; sourceTree = ""; }; @@ -275,6 +277,7 @@ CD51D99420A7A618003791E1 /* AddModel.swift */, CDB1401323C2632F00EFD2CE /* SWAppStatus.swift */, CD4F975A242EC401009839C6 /* SWCategoryData.swift */, + CDD094E82430C2CC00F5435A /* SWAppConfig.swift */, ); path = Data; sourceTree = ""; @@ -638,6 +641,7 @@ CD003DDD23CBDBB300C48083 /* Records+Extensions.swift in Sources */, CDEBB2AD2017E350009ED68F /* Records+CoreDataProperties.swift in Sources */, CDD094E5242FD4C900F5435A /* SWIconSelectorViewController.swift in Sources */, + CDD094E92430C2CC00F5435A /* SWAppConfig.swift in Sources */, CD152F82231C433E0042A6E8 /* SWMonth.swift in Sources */, CD315098205316CF001AD682 /* Style+MyApp.swift in Sources */, CD152F80231C3EB90042A6E8 /* DateFormatter+Extensions.swift in Sources */, diff --git a/SmartWallet/Data/Extensions/UserDefaults+Extensions.swift b/SmartWallet/Data/Extensions/UserDefaults+Extensions.swift index 0a233f2..01e140a 100644 --- a/SmartWallet/Data/Extensions/UserDefaults+Extensions.swift +++ b/SmartWallet/Data/Extensions/UserDefaults+Extensions.swift @@ -10,4 +10,5 @@ import Foundation extension UserDefaults { static let currencySymbolKey = "currencySymbol" + static let snapshotKey = "FASTLANE_SNAPSHOT" } diff --git a/SmartWallet/Data/SWAppConfig.swift b/SmartWallet/Data/SWAppConfig.swift new file mode 100644 index 0000000..5bf0ee3 --- /dev/null +++ b/SmartWallet/Data/SWAppConfig.swift @@ -0,0 +1,15 @@ +// +// SWAppConfig.swift +// SmartWallet +// +// Created by Soheil on 29/03/2020. +// Copyright © 2020 Soheil Novinfard. All rights reserved. +// + +import Foundation + +enum SWAppConfig { + static var isSnapshot: Bool { + return UserDefaults.standard.bool(forKey: UserDefaults.snapshotKey) + } +} diff --git a/SmartWallet/Data/StoreReviewHelper.swift b/SmartWallet/Data/StoreReviewHelper.swift index 28be9ec..c64c896 100644 --- a/SmartWallet/Data/StoreReviewHelper.swift +++ b/SmartWallet/Data/StoreReviewHelper.swift @@ -38,7 +38,8 @@ struct StoreReviewHelper { } fileprivate func requestReview() { - if #available(iOS 10.3, *) { + if #available(iOS 10.3, *), + !SWAppConfig.isSnapshot { SKStoreReviewController.requestReview() } } diff --git a/SmartWallet/UI/Controllers/MainTabBarViewController.swift b/SmartWallet/UI/Controllers/MainTabBarViewController.swift index 26e81eb..3cae099 100644 --- a/SmartWallet/UI/Controllers/MainTabBarViewController.swift +++ b/SmartWallet/UI/Controllers/MainTabBarViewController.swift @@ -28,7 +28,7 @@ class MainTabBarViewController: UITabBarController { private func showSplashScreen() { guard UserDefaults.standard.bool(forKey: "introduced") == false || - UserDefaults.standard.bool(forKey: "FASTLANE_SNAPSHOT") == true else { + SWAppConfig.isSnapshot else { return } let storyboard = UIStoryboard(name: "Main", bundle: nil) @@ -37,7 +37,7 @@ class MainTabBarViewController: UITabBarController { ) as? SplashViewController else { return } - if UserDefaults.standard.bool(forKey: "FASTLANE_SNAPSHOT") == true { + if SWAppConfig.isSnapshot { Facade.share.model.addSampleData() } present(splashVC, animated: false)