Skip to content

Commit

Permalink
Merge pull request #13 from novinfard/snapshot-fixes
Browse files Browse the repository at this point in the history
Prevented the app from opening the review popup in snapshot mode
  • Loading branch information
novinfard authored Mar 29, 2020
2 parents 1f96ac7 + 876bd2c commit e800a74
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions SmartWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -144,6 +145,7 @@
CDD094E2242F864E00F5435A /* UserDefaults+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extensions.swift"; sourceTree = "<group>"; };
CDD094E4242FD4C900F5435A /* SWIconSelectorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWIconSelectorViewController.swift; sourceTree = "<group>"; };
CDD094E6242FD56600F5435A /* SWIconCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWIconCollectionCell.swift; sourceTree = "<group>"; };
CDD094E82430C2CC00F5435A /* SWAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWAppConfig.swift; sourceTree = "<group>"; };
CDD8642C2090E49B00E65E64 /* BudgetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetViewController.swift; sourceTree = "<group>"; };
CDD8642E2090F59A00E65E64 /* BudgetTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BudgetTableViewCell.swift; sourceTree = "<group>"; };
CDD864302093F02700E65E64 /* intro.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = intro.mp4; sourceTree = "<group>"; };
Expand Down Expand Up @@ -275,6 +277,7 @@
CD51D99420A7A618003791E1 /* AddModel.swift */,
CDB1401323C2632F00EFD2CE /* SWAppStatus.swift */,
CD4F975A242EC401009839C6 /* SWCategoryData.swift */,
CDD094E82430C2CC00F5435A /* SWAppConfig.swift */,
);
path = Data;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
1 change: 1 addition & 0 deletions SmartWallet/Data/Extensions/UserDefaults+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ import Foundation

extension UserDefaults {
static let currencySymbolKey = "currencySymbol"
static let snapshotKey = "FASTLANE_SNAPSHOT"
}
15 changes: 15 additions & 0 deletions SmartWallet/Data/SWAppConfig.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
3 changes: 2 additions & 1 deletion SmartWallet/Data/StoreReviewHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ struct StoreReviewHelper {
}

fileprivate func requestReview() {
if #available(iOS 10.3, *) {
if #available(iOS 10.3, *),
!SWAppConfig.isSnapshot {
SKStoreReviewController.requestReview()
}
}
Expand Down
4 changes: 2 additions & 2 deletions SmartWallet/UI/Controllers/MainTabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit e800a74

Please sign in to comment.