Unverified Commit b5a9f637 authored by Zach Knox's avatar Zach Knox
Browse files

fully working persistent alerts

parent 5b298bce
......@@ -29,9 +29,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let alerts = defaults.dictionary(forKey: "alerts")
if alerts == nil {
var setAlerts = [String: Bool]()
setAlerts.updateValue(true, forKey: "Informational")
setAlerts.updateValue(true, forKey: "Minor Alerts")
setAlerts.updateValue(true, forKey: "Major Alerts")
setAlerts.updateValue(true, forKey: "informational")
setAlerts.updateValue(true, forKey: "minor alerts")
setAlerts.updateValue(true, forKey: "major alerts")
defaults.set(setAlerts, forKey: "alerts")
}
......
......@@ -28,26 +28,27 @@
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Checkbox Filter" textLabel="rYu-5q-2u8" style="IBUITableViewCellStyleDefault" id="x5H-BH-cVX" customClass="CheckingTableViewCell" customModule="WhatsOpen" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Checkbox Filter" id="acT-0Y-66n" customClass="CheckingTableViewCell" customModule="WhatsOpen" customModuleProvider="target">
<rect key="frame" x="0.0" y="99.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="x5H-BH-cVX" id="xf1-yc-ynP">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="acT-0Y-66n" id="eyW-ce-b3u">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Sort By x" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="rYu-5q-2u8">
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="tintColor" red="0.0" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="toSelection" id="AYg-3T-fMg">
<rect key="frame" x="0.0" y="143.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="AYg-3T-fMg" id="b0b-tc-t8O">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
<connections>
<segue destination="yIT-AR-gdn" kind="show" identifier="toSelection" id="lwF-fe-hI5"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="picking" rowHeight="157" id="Qzo-pS-g9l" customClass="PickingTableViewCell" customModule="WhatsOpen" customModuleProvider="target">
<rect key="frame" x="0.0" y="143.5" width="375" height="157"/>
<rect key="frame" x="0.0" y="187.5" width="375" height="157"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Qzo-pS-g9l" id="gyt-MF-bQ2">
<rect key="frame" x="0.0" y="0.0" width="375" height="156.5"/>
......@@ -68,33 +69,6 @@
<outlet property="pickerView" destination="Rpt-Of-2BY" id="ek7-I8-MFW"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="toSelection" textLabel="1gJ-n6-QQk" detailTextLabel="gbn-2b-WZh" style="IBUITableViewCellStyleValue1" id="HkW-HK-Uqf">
<rect key="frame" x="0.0" y="300.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="HkW-HK-Uqf" id="3BF-KX-2nF">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1gJ-n6-QQk">
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gbn-2b-WZh">
<rect key="frame" x="296" y="12" width="44" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="yIT-AR-gdn" kind="show" identifier="toSelection" id="86R-Fz-PuY"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="jkQ-vu-LQa" id="DbO-38-R86"/>
......@@ -376,31 +350,15 @@
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="settingSelection" textLabel="uld-Wy-NHl" detailTextLabel="D5h-89-67A" style="IBUITableViewCellStyleValue1" id="tdz-HQ-rmz">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="settingSelection" id="fc0-pe-nJl">
<rect key="frame" x="0.0" y="99.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="tdz-HQ-rmz" id="H43-kY-wZi">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fc0-pe-nJl" id="dQS-VU-1IK">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="uld-Wy-NHl">
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="D5h-89-67A">
<rect key="frame" x="296" y="12" width="44" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="yIT-AR-gdn" kind="show" identifier="settingSelection" id="b6G-Gf-D4M"/>
<segue destination="yIT-AR-gdn" kind="show" identifier="settingSelection" id="FRf-a6-Dgs"/>
</connections>
</tableViewCell>
</prototypes>
......@@ -872,7 +830,7 @@
<image name="major" width="266" height="266"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="b6G-Gf-D4M"/>
<segue reference="FRf-a6-Dgs"/>
</inferredMetricsTieBreakers>
<color key="tintColor" red="0.0" green="0.40000000000000002" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
</document>
......@@ -345,7 +345,7 @@ class Utilities: NSObject {
}
}
for alert in alerts! {
alerts!.updateValue(!foundFalse, forKey: alert.key)
alerts!.updateValue(foundFalse, forKey: alert.key)
}
defaults.set(alerts, forKey: "alerts")
return true
......
......@@ -278,15 +278,15 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
if now.isGreaterThanDate(dateToCompare: formatter.date(from: alert.startDate)!) && now.isLessThanDate(dateToCompare: formatter.date(from: alert.endDate)!) {
switch alert.urgency {
case "info":
if(alertFilers!["Informational"])! {
if(alertFilers!["informational"])! {
shown.append(alert)
}
case "minor":
if(alertFilers!["Minor Alerts"])! {
if(alertFilers!["minor alerts"])! {
shown.append(alert)
}
case "major":
if(alertFilers!["Major Alerts"])! {
if(alertFilers!["major alerts"])! {
shown.append(alert)
}
default:
......@@ -718,9 +718,12 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
var sectionInsets = LocationsListLayout.sectionInset
if(section != 1 && alertsList.count != 0) {
if(section != 1 && currentAlerts.count != 0) {
sectionInsets.top = 0
}
else if currentAlerts.count == 0 {
sectionInsets.top = 15
}
return sectionInsets
}
......
......@@ -21,6 +21,10 @@ class SettingsTableViewController: UITableViewController, MFMailComposeViewContr
self.dismiss(animated: true, completion: nil)
}
override func viewWillAppear(_ animated: Bool) {
tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
......
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