Unverified Commit 3a0b6c5c authored by Zach Knox's avatar Zach Knox
Browse files

who needs code reuse anyway

parent 979fa063
......@@ -751,7 +751,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = edu.gmu.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
......@@ -779,7 +778,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = edu.gmu.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
......@@ -810,7 +808,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -D APPSTORE";
PRIMARYICON = appicon;
PRODUCT_BUNDLE_IDENTIFIER = edu.gmu.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "b7d91eb0-1140-4c4c-8a3e-a4b698a70a43";
PROVISIONING_PROFILE_SPECIFIER = "What's Open Development";
......@@ -892,7 +889,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -D APPSTORE";
PRIMARYICON = appicon;
PRODUCT_BUNDLE_IDENTIFIER = edu.gmu.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = space.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -1046,7 +1043,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = io.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = space.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
......@@ -1074,7 +1071,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRIMARYICON = "appicon-dev";
PRODUCT_BUNDLE_IDENTIFIER = io.srct.whatsopen;
PRODUCT_BUNDLE_IDENTIFIER = space.srct.whatsopen;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
......
......@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>What&apos;s Open</string>
<string>What's Open</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
......
......@@ -372,6 +372,74 @@ class Utilities: NSObject {
}
}
// MARK - Persistent Campuses
// Maybe we should have thought about code reuse when we made those alerts functions up there, hmm...
/**
Sets campus settings in User Defaults
- returns:
true if the campus was added correctly.
*/
static func setCampusDefaults(_ key: String, value: Bool) -> Bool {
let defaults = UserDefaults.standard
var campuses = defaults.dictionary(forKey: "campuses") as! [String: Bool]?
if campuses != nil {
campuses!.updateValue(value, forKey: key)
defaults.set(campuses, forKey: "campuses")
return true
}
else {
return false
}
}
/**
Sets all campus settings in User Defaults to true
- returns:
true if the campuses were changed correctly, false if nil was retrieved from User Defaults.
*/
static func setAllCampusDefaults() -> Bool {
let defaults = UserDefaults.standard
var campuses = defaults.dictionary(forKey: "campuses") as! [String: Bool]?
if campuses != nil {
var foundFalse = false
for a in campuses! {
if a.value == false {
foundFalse = true
break
}
}
for campus in campuses! {
campuses!.updateValue(foundFalse, forKey: campus.key)
}
defaults.set(campuses, forKey: "campuses")
return true
}
else {
return false
}
}
/**
Gets alerts settings in User Defaults
- returns:
item stored in User Defaults for key 'campuses'
*/
static func getCampusDefaults() -> [String: Bool] {
let defaults = UserDefaults.standard
let returning = defaults.dictionary(forKey: "campuses") as! [String: Bool]?
if returning == nil {
return [:]
}
else {
return returning!
}
}
}
extension DateFormatter {
......
......@@ -105,15 +105,15 @@ class SettingsTableViewController: UITableViewController, MFMailComposeViewContr
return cell
case 1:
cell.textLabel?.text = "Show Campuses"
let alerts = Utilities.getAlertDefaults()
let campuses = Utilities.getCampusDefaults()
var i = 0
for c in alerts {
for c in campuses {
if(c.value == true) {
i += 1
}
}
var detail: String
if(i == alerts.count) {
if(i == campuses.count) {
detail = "All Selected"
}
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment