From 81bef44e510840fc4fc5765733901c2b0f2c35a3 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Mon, 16 Sep 2019 23:00:00 -0400 Subject: [PATCH 01/13] Update display name to MHacks 12 --- MHacks.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 2 +- MHacks/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MHacks.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MHacks.xcodeproj/project.xcworkspace/contents.xcworkspacedata index ef16f75..919434a 100644 --- a/MHacks.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/MHacks.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/MHacks/Info.plist b/MHacks/Info.plist index 09c49c6..71c3018 100644 --- a/MHacks/Info.plist +++ b/MHacks/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - MHacks 11 + MHacks 12 CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier From 0c9f074ae65b24af321f67c7fbc7b83b4fc52030 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Wed, 9 Oct 2019 22:06:34 -0400 Subject: [PATCH 02/13] Simhacks refresh fix? --- MHacks/SiMHacksViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 6485337..b467bac 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -187,6 +187,8 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // TODO: Get user's rank from gameState when available APIManager.shared.getGameState { newState in + print(newState ?? "nothin") + guard let gState = newState?["state"] else { self.makeAlertController(title: "ERROR: could not parse state.", message: "Could not parse state from the server response.") return @@ -373,7 +375,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U present(scannerNavigationController, animated: true, completion: nil) - self.getQuests() + self.collectionView.reloadData() self.getLeaderboard() } } From 257c608f389edee73aa55557f725472637eeac12 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Wed, 9 Oct 2019 22:15:59 -0400 Subject: [PATCH 03/13] Moar fixes?? --- MHacks/SiMHacksViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index b467bac..710e549 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -375,7 +375,8 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U present(scannerNavigationController, animated: true, completion: nil) - self.collectionView.reloadData() + self.currentQuests = [] + self.getQuests() self.getLeaderboard() } } From a5afb4bb9d65e04bcfcc170c24d3dcd2a3cb85be Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Wed, 9 Oct 2019 22:27:42 -0400 Subject: [PATCH 04/13] Fixing --- MHacks/SiMHacksViewController.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 710e549..2ea46d0 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -373,11 +373,16 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U let scannerNavigationController = UINavigationController(rootViewController: scannerViewController) scannerNavigationController.isToolbarHidden = false - present(scannerNavigationController, animated: true, completion: nil) + present(scannerNavigationController, animated: true) { + print("YOOOOOOO") + self.currentQuests = [] + self.getQuests() + self.getLeaderboard() + } + +// present(scannerNavigationController, animated: true, completion: ) + - self.currentQuests = [] - self.getQuests() - self.getLeaderboard() } } From fe81f62c3b164a1748f628fc839f29326ba1e98a Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Wed, 9 Oct 2019 22:49:54 -0400 Subject: [PATCH 05/13] Refresh quest view after scanning complete --- MHacks/SiMHacksViewController.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 2ea46d0..040c372 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -374,15 +374,11 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U scannerNavigationController.isToolbarHidden = false present(scannerNavigationController, animated: true) { - print("YOOOOOOO") self.currentQuests = [] self.getQuests() + self.collectionView.reloadData() self.getLeaderboard() } - -// present(scannerNavigationController, animated: true, completion: ) - - } } From 24f73157b98b616adab91cf03158ce2c3ce70399 Mon Sep 17 00:00:00 2001 From: img Date: Wed, 9 Oct 2019 23:08:27 -0400 Subject: [PATCH 06/13] make leaderboard not select --- MHacks/SiMHacksViewController.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 040c372..366292d 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -258,7 +258,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Get data from API APIManager.shared.getGameState { newState in - + print("gamestate=\(newState)"); guard let gState = newState?["state"] else { self.makeAlertController(title: "ERROR: could not parse state.", message: "Could not parse state from the server response.") return @@ -376,7 +376,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U present(scannerNavigationController, animated: true) { self.currentQuests = [] self.getQuests() - self.collectionView.reloadData() + print("quests=\(self.currentQuests)") self.getLeaderboard() } } @@ -504,6 +504,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U cell.positionLabel.text = "\(data.position)" cell.nameLabel.text = data.name cell.scoreLabel.text = "\(data.score)" + cell.selectionStyle = .none return cell } From d4c584f895ef74fe0bf304d66645a06de0049b43 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 00:17:54 -0400 Subject: [PATCH 07/13] Delete displaying rank --- MHacks/SiMHacksViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 366292d..33df9ca 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -47,7 +47,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U private let leaderboardUser: UILabel = { let rankscore = UILabel() - rankscore.text = "Your rank: 0 | Your points: 0" + rankscore.text = "Your points: 0" rankscore.textColor = UIColor.white rankscore.numberOfLines = 0 rankscore.translatesAutoresizingMaskIntoConstraints = false @@ -202,7 +202,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Refresh the UILabel to display the user's rank and score DispatchQueue.main.async { - self.leaderboardUser.text = "Your rank: 0 | Your points: " + String(user_points) + self.leaderboardUser.text = "Your points: " + String(user_points) } } } From 0c78951b033817378bc8175259562a14823755e9 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 14:43:31 -0400 Subject: [PATCH 08/13] Add auto refresh for quests, leaderboard, and score when done scanning, update simhacks info, present apple wallet pass on main thread --- MHacks/SiMHacksInfoController.swift | 2 +- MHacks/SiMHacksViewController.swift | 42 ++++++++++++++--------------- MHacks/UserViewController.swift | 5 +++- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/MHacks/SiMHacksInfoController.swift b/MHacks/SiMHacksInfoController.swift index 769f7cc..639e971 100644 --- a/MHacks/SiMHacksInfoController.swift +++ b/MHacks/SiMHacksInfoController.swift @@ -22,7 +22,7 @@ class SiMHacksInfoController: UIViewController { let info = UITextView() info.textColor = UIColor.white info.backgroundColor = MHacksColor.backgroundDarkBlue - info.text = "SiMHacks = Sims + MHacks. A brand new way for hackers to interact and engage with each other!\n\n You will be given 5 quests at a time and once you complete a quest, you will be given a randomly generated new one.\n\n To complete a quest, you will need to find a fellow hacker who fulfills the description of the quest and scan their QR code. You also cannot scan the same hacker twice.\n\n You will have the option to refresh all quests every 3 hours in case you get stuck. \n\n Best of luck on your journey and most of all, have fun!" + info.text = "SiMHacks = Sims + MHacks. A brand new way for hackers to interact and engage with each other! The hacker with the top score at the end will receive a prize that will surely make them get their game on ;)\n\n You will be given 3 quests at a time and once you complete a quest, you will be given a randomly generated new one.\n\n To complete a quest, you will need to find a fellow hacker who's corresponding SiMHacks response fulfills the description of the quest and scan their QR code, located on their ticket. You also cannot scan the same hacker twice.\n\n Best of luck on your journey and most of all, have fun!" info.translatesAutoresizingMaskIntoConstraints = false info.textAlignment = .center info.font = UIFont(name: "AndaleMono", size: 25) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index 33df9ca..b6c221f 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -28,7 +28,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U private var peopleOnBoard: [LeaderboardPosition] = [] - private let refreshControl = UIRefreshControl() + private let leaderboardRefreshControl = UIRefreshControl() private var selectedQuest: String = "" @@ -165,30 +165,28 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Add Refresh Control to Table View if #available(iOS 10.0, *) { - leaderboard.refreshControl = refreshControl + leaderboard.refreshControl = leaderboardRefreshControl } else { - leaderboard.addSubview(refreshControl) + leaderboard.addSubview(leaderboardRefreshControl) } // Configure Refresh Control - refreshControl.addTarget(self, action: #selector(refreshLeaderboard(_:)), for: .valueChanged) - refreshControl.attributedTitle = NSAttributedString(string: "Updating leaderboard ...", attributes: [NSAttributedString.Key.font : UIFont(name: "AndaleMono", size: 12)!, NSAttributedString.Key.foregroundColor : MHacksColor.backgroundDarkBlue]) - refreshControl.tintColor = MHacksColor.backgroundDarkBlue + leaderboardRefreshControl.addTarget(self, action: #selector(refreshLeaderboard(_:)), for: .valueChanged) + leaderboardRefreshControl.attributedTitle = NSAttributedString(string: "Updating leaderboard ...", attributes: [NSAttributedString.Key.font : UIFont(name: "AndaleMono", size: 12)!, NSAttributedString.Key.foregroundColor : MHacksColor.backgroundDarkBlue]) + leaderboardRefreshControl.tintColor = MHacksColor.backgroundDarkBlue } @objc func refreshLeaderboard(_ sender: Any) { leaderboard.reloadData() getLeaderboard() getUserRankScore() - self.refreshControl.endRefreshing() + self.leaderboardRefreshControl.endRefreshing() } func getUserRankScore() { // TODO: Get user's rank from gameState when available APIManager.shared.getGameState { newState in - print(newState ?? "nothin") - guard let gState = newState?["state"] else { self.makeAlertController(title: "ERROR: could not parse state.", message: "Could not parse state from the server response.") return @@ -225,8 +223,8 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U let entry_points = e["points"] as! Int let entry_user = e["user"] as! [String: Any] let entry_user_name = entry_user["full_name"] as! String - print(entry_points) - print(entry_user_name) +// print(entry_points) +// print(entry_user_name) let entry_rank = rank new_board.append(LeaderboardPosition(position: entry_rank, name: entry_user_name, score: entry_points)) @@ -234,7 +232,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U } self.peopleOnBoard = new_board - print(self.peopleOnBoard) +// print(self.peopleOnBoard) // Refresh the leaderboard DispatchQueue.main.async { self.leaderboard.reloadData() @@ -258,7 +256,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Get data from API APIManager.shared.getGameState { newState in - print("gamestate=\(newState)"); + print("gamestate=\(newState ?? [:])") guard let gState = newState?["state"] else { self.makeAlertController(title: "ERROR: could not parse state.", message: "Could not parse state from the server response.") return @@ -271,6 +269,8 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U return } + var newQuests: [Quest] = [] + for quest in quests { guard let q = quest as? [String: Any] else { self.makeAlertController(title: "ERROR: could not parse individual quest into dictionary.", message: "Could not convert quest into dictionary.") @@ -284,11 +284,13 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Find and replace the {} with the real question content fullQuestion = fullQuestion.replacingOccurrences(of: "{}", with: answer) - self.currentQuests.append(Quest(title: fullQuestion, points: numPoints)) + newQuests.append(Quest(title: fullQuestion, points: numPoints)) self.questNames.append(questionKeyword) } + self.currentQuests = newQuests + // Refresh the collectionview to display the quests DispatchQueue.main.async { self.collectionView.reloadData() @@ -373,12 +375,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U let scannerNavigationController = UINavigationController(rootViewController: scannerViewController) scannerNavigationController.isToolbarHidden = false - present(scannerNavigationController, animated: true) { - self.currentQuests = [] - self.getQuests() - print("quests=\(self.currentQuests)") - self.getLeaderboard() - } + present(scannerNavigationController, animated: true, completion: nil) } } @@ -386,6 +383,9 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U func scannerViewControllerDidFinish(scannerViewController: ScannerViewController) { dismiss(animated: true, completion: nil) + self.getUserRankScore() + self.getLeaderboard() + self.getQuests() } // MARK: CollectionView @@ -486,7 +486,7 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U self.selectedQuest = "" } else { collectionView.selectItem(at: indexPath, animated: true, scrollPosition: []) - self.selectedQuest = questNames[indexPath.row] + self.selectedQuest = self.questNames[indexPath.row] } return false diff --git a/MHacks/UserViewController.swift b/MHacks/UserViewController.swift index 02987f7..eb3ecc9 100644 --- a/MHacks/UserViewController.swift +++ b/MHacks/UserViewController.swift @@ -285,7 +285,10 @@ final class UserViewController: UIViewController, LoginViewControllerDelegate, P let passesViewController = PKAddPassesViewController(pass: pass) passesViewController!.delegate = self - self.present(passesViewController!, animated: true, completion: nil) + + DispatchQueue.main.async { + self.present(passesViewController!, animated: true, completion: nil) + } } } From 9f2a118cc81d1b4472d7013971643b075d30d8e6 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 14:49:35 -0400 Subject: [PATCH 09/13] Update version --- MHacks.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MHacks.xcodeproj/project.pbxproj b/MHacks.xcodeproj/project.pbxproj index d262ea2..4ec128e 100644 --- a/MHacks.xcodeproj/project.pbxproj +++ b/MHacks.xcodeproj/project.pbxproj @@ -915,11 +915,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -942,11 +942,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -965,11 +965,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -989,11 +989,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -1122,7 +1122,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1131,7 +1131,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; @@ -1154,7 +1154,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1163,7 +1163,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.2; + MARKETING_VERSION = 12.3; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; From a62e92f89ef351f22433681f6dcb0ca466e0c666 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 17:06:23 -0400 Subject: [PATCH 10/13] Add NSLocationAlwaysUsageDescription to Info.plist --- MHacks/Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MHacks/Info.plist b/MHacks/Info.plist index ce73088..2f19e2d 100644 --- a/MHacks/Info.plist +++ b/MHacks/Info.plist @@ -45,6 +45,8 @@ Privileged users can use the camera to scan tickets. NSLocationWhenInUseUsageDescription Your location will be shown on the map. + NSLocationAlwaysUsageDescription + Your location will be shown on the map. UIAppFonts andalemo.TTF From a78d5d670f5b1a19f313c0227ae289103a077f07 Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 17:12:14 -0400 Subject: [PATCH 11/13] Update version --- MHacks.xcodeproj/project.pbxproj | 24 ++++++++++++------------ MHacks/Info.plist | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MHacks.xcodeproj/project.pbxproj b/MHacks.xcodeproj/project.pbxproj index 4ec128e..22e6d29 100644 --- a/MHacks.xcodeproj/project.pbxproj +++ b/MHacks.xcodeproj/project.pbxproj @@ -915,11 +915,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -942,11 +942,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -965,11 +965,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -989,11 +989,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -1122,7 +1122,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1131,7 +1131,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; @@ -1154,7 +1154,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 19; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1163,7 +1163,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.3; + MARKETING_VERSION = 12.4; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; diff --git a/MHacks/Info.plist b/MHacks/Info.plist index 2f19e2d..1ffd455 100644 --- a/MHacks/Info.plist +++ b/MHacks/Info.plist @@ -43,10 +43,10 @@ This application needs to access bluetooth for the purposes of scanning QR codes. NSCameraUsageDescription Privileged users can use the camera to scan tickets. - NSLocationWhenInUseUsageDescription - Your location will be shown on the map. NSLocationAlwaysUsageDescription Your location will be shown on the map. + NSLocationWhenInUseUsageDescription + Your location will be shown on the map. UIAppFonts andalemo.TTF From cae2c6a0c658dc164dfb1c2be8785f9fc1c3aa8c Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Thu, 10 Oct 2019 22:01:59 -0400 Subject: [PATCH 12/13] Update version --- MHacks.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MHacks.xcodeproj/project.pbxproj b/MHacks.xcodeproj/project.pbxproj index 22e6d29..33785aa 100644 --- a/MHacks.xcodeproj/project.pbxproj +++ b/MHacks.xcodeproj/project.pbxproj @@ -915,11 +915,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -942,11 +942,11 @@ CODE_SIGN_ENTITLEMENTS = MHacksWatch/MHacksWatch.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; IBSC_MODULE = MHacksWatch_Extension; INFOPLIST_FILE = MHacksWatch/Info.plist; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp; PRODUCT_NAME = MHacks; SDKROOT = watchos; @@ -965,11 +965,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -989,11 +989,11 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CODE_SIGN_ENTITLEMENTS = "MHacksWatch Extension/MHacksWatch Extension.entitlements"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; INFOPLIST_FILE = "MHacksWatch Extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -1122,7 +1122,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1131,7 +1131,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; @@ -1154,7 +1154,7 @@ CODE_SIGN_ENTITLEMENTS = MHacks/MHacks.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = 478C74MJ7T; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1163,7 +1163,7 @@ INFOPLIST_FILE = MHacks/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 12.4; + MARKETING_VERSION = 12.4.1; OTHER_SWIFT_FLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.MPowered.MHacks; PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)"; From ab4d5900fda3f57091d696d94f073d5e10eeba6f Mon Sep 17 00:00:00 2001 From: Connor Svrcek Date: Mon, 14 Oct 2019 22:00:43 -0400 Subject: [PATCH 13/13] Handle error with no game state --- MHacks/SiMHacksViewController.swift | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/MHacks/SiMHacksViewController.swift b/MHacks/SiMHacksViewController.swift index b6c221f..827d170 100644 --- a/MHacks/SiMHacksViewController.swift +++ b/MHacks/SiMHacksViewController.swift @@ -148,7 +148,9 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) let alertAction = UIAlertAction(title: "OK", style: .default, handler: nil) alert.addAction(alertAction) - self.present(alert, animated: true, completion: nil) + DispatchQueue.main.async { + self.present(alert, animated: true, completion: nil) + } } func setupCollectionview() { @@ -208,8 +210,12 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U func getLeaderboard() { APIManager.shared.getLeaderboard { newLeaderBoard in // TODO: find out the json keys for leaderboard + guard let leaderboardAndResponse = newLeaderBoard else { + self.makeAlertController(title: "ERROR: could not find game state.", message: "You must complete the SiMHacks questionnaire in order to play the game.") + return + } - guard let leaderboard = newLeaderBoard?["leaderboard"] as? NSArray else { + guard let leaderboard = leaderboardAndResponse["leaderboard"] as? NSArray else { self.makeAlertController(title: "ERROR: could not parse leaderboard.", message: "Could not parse leaderboard from state.") return } @@ -256,8 +262,13 @@ class SiMHacksViewController: UIViewController, ScannerViewControllerDelegate, U // Get data from API APIManager.shared.getGameState { newState in - print("gamestate=\(newState ?? [:])") - guard let gState = newState?["state"] else { + + guard let stateAndResponse = newState else { + self.makeAlertController(title: "ERROR: could not find game state.", message: "You must complete the SiMHacks questionnaire in order to play the game.") + return + } + + guard let gState = stateAndResponse["state"] else { self.makeAlertController(title: "ERROR: could not parse state.", message: "Could not parse state from the server response.") return }