Unverified Commit 44862e28 authored by Zach Knox's avatar Zach Knox
Browse files

started UI work on alerts

not nearly done
parent eb8df7a1
......@@ -24,6 +24,7 @@
92EA81971FB7D1B500B1F6E3 /* PaddedUILabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EA81961FB7D1B500B1F6E3 /* PaddedUILabel.swift */; };
92F681581FC1353700393DF4 /* Pods-WhatsOpen-acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 92F681571FC1353700393DF4 /* Pods-WhatsOpen-acknowledgements.plist */; };
92F6815A1FC137CF00393DF4 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 92F681591FC137CF00393DF4 /* Settings.bundle */; };
92FF6C731FFEEEE900D836AE /* AlertCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92FF6C721FFEEEE900D836AE /* AlertCollectionViewCell.swift */; };
CD3C97491DC18AB300A84434 /* SRCTNetworkController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3C97481DC18AB300A84434 /* SRCTNetworkController.swift */; };
CD466DD21DC12E1200E44DF5 /* MainTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD466DD11DC12E1200E44DF5 /* MainTableViewController.swift */; };
CD763A7A1DE24EF100ADFD6B /* examplejson.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD763A791DE24EF100ADFD6B /* examplejson.swift */; };
......@@ -67,6 +68,7 @@
92EA81961FB7D1B500B1F6E3 /* PaddedUILabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PaddedUILabel.swift; path = WhatsOpen/PaddedUILabel.swift; sourceTree = SOURCE_ROOT; };
92F681571FC1353700393DF4 /* Pods-WhatsOpen-acknowledgements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Pods-WhatsOpen-acknowledgements.plist"; path = "Pods/Target Support Files/Pods-WhatsOpen/Pods-WhatsOpen-acknowledgements.plist"; sourceTree = SOURCE_ROOT; };
92F681591FC137CF00393DF4 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
92FF6C721FFEEEE900D836AE /* AlertCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AlertCollectionViewCell.swift; path = WhatsOpen/AlertCollectionViewCell.swift; sourceTree = SOURCE_ROOT; };
CD3C97481DC18AB300A84434 /* SRCTNetworkController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SRCTNetworkController.swift; sourceTree = "<group>"; };
CD466DD11DC12E1200E44DF5 /* MainTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainTableViewController.swift; sourceTree = "<group>"; };
CD763A791DE24EF100ADFD6B /* examplejson.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = examplejson.swift; path = "Object Model/examplejson.swift"; sourceTree = "<group>"; };
......@@ -166,6 +168,7 @@
92EA81961FB7D1B500B1F6E3 /* PaddedUILabel.swift */,
CD81F5201DC0334600009FBD /* Main.storyboard */,
929157211FF4662F00ED63C7 /* PickingTableViewCell.swift */,
92FF6C721FFEEEE900D836AE /* AlertCollectionViewCell.swift */,
920D17961F6C5CD200D63295 /* Views */,
CD81F5231DC0334600009FBD /* Assets.xcassets */,
CD81F5251DC0334600009FBD /* LaunchScreen.storyboard */,
......@@ -253,7 +256,7 @@
};
CD81F5181DC0334600009FBD = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = K5MMVK2UFR;
DevelopmentTeam = N5GM564QWL;
LastSwiftMigration = 0910;
ProvisioningStyle = Automatic;
};
......@@ -376,6 +379,7 @@
92B2D2FF1FF8599500349E90 /* FilterSelectionTableViewController.swift in Sources */,
92182EC41E95C38400192ABA /* FacilityDetailViewController.swift in Sources */,
929157221FF4662F00ED63C7 /* PickingTableViewCell.swift in Sources */,
92FF6C731FFEEEE900D836AE /* AlertCollectionViewCell.swift in Sources */,
92108A331ED755F100675E16 /* CheckingTableViewCell.swift in Sources */,
92182EC01E95BD2C00192ABA /* FacilitiesListViewController.swift in Sources */,
CD763A7A1DE24EF100ADFD6B /* examplejson.swift in Sources */,
......
//
// AlertCollectionViewCell.swift
// WhatsOpen
//
// Created by Zach Knox on 1/4/18.
// Copyright © 2018 SRCT. All rights reserved.
//
import UIKit
class AlertCollectionViewCell: UICollectionViewCell {
@IBOutlet var imageView: UIImageView!
@IBOutlet var messageLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
//TODO
}
}
......@@ -234,6 +234,43 @@
<outlet property="timeDescriptionLabel" destination="o7N-To-w50" id="gAW-xD-mws"/>
</connections>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="Alert Cell" id="RlS-h3-WtZ" customClass="AlertCollectionViewCell" customModule="WhatsOpen" customModuleProvider="target">
<rect key="frame" x="37.5" y="148" width="300" height="131"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
<rect key="frame" x="0.0" y="0.0" width="300" height="131"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Oab-U6-xpF">
<rect key="frame" x="8" y="33" width="64" height="64"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="66B-Ym-t5O"/>
<constraint firstAttribute="width" constant="64" id="u3D-mk-VoY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Alert Text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="5" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Ns-M7-OG1">
<rect key="frame" x="76" y="9" width="217" height="113"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<color key="backgroundColor" white="0.21742078993055555" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Oab-U6-xpF" firstAttribute="centerY" secondItem="RlS-h3-WtZ" secondAttribute="centerY" id="0Gm-3d-NZV"/>
<constraint firstAttribute="bottom" secondItem="2Ns-M7-OG1" secondAttribute="bottom" constant="9" id="1LV-oj-Rfc"/>
<constraint firstItem="2Ns-M7-OG1" firstAttribute="centerY" secondItem="RlS-h3-WtZ" secondAttribute="centerY" id="3e1-Vz-z7i"/>
<constraint firstItem="Oab-U6-xpF" firstAttribute="leading" secondItem="RlS-h3-WtZ" secondAttribute="leading" constant="8" id="HjX-L1-EAY"/>
<constraint firstItem="2Ns-M7-OG1" firstAttribute="leading" secondItem="Oab-U6-xpF" secondAttribute="trailing" constant="4" id="OfY-Bd-5U7"/>
<constraint firstAttribute="trailing" secondItem="2Ns-M7-OG1" secondAttribute="trailing" constant="7" id="eSX-e8-2qc"/>
<constraint firstItem="2Ns-M7-OG1" firstAttribute="top" secondItem="RlS-h3-WtZ" secondAttribute="top" constant="9" id="xBI-iS-rEV"/>
</constraints>
<connections>
<outlet property="imageView" destination="Oab-U6-xpF" id="zUI-Ac-2nk"/>
<outlet property="messageLabel" destination="2Ns-M7-OG1" id="ubW-8f-ewB"/>
</connections>
</collectionViewCell>
</cells>
<connections>
<outlet property="dataSource" destination="aaB-Go-aWd" id="bX7-L2-MmS"/>
......
......@@ -414,7 +414,6 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
if results.count > 0 {
let model = results[0]
let alertsFromDB = model.alerts
let lastUpdated = model.lastUpdated
self.alertsList = alertsFromDB
}
......@@ -462,79 +461,99 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
if alertsList.count > 0 {
return 2
}
else {
return 1
}
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return shownFacilities.count
if(section == 1 || alertsList.count == 0) {
return shownFacilities.count
}
else {
// TODO: get current alerts, not just any alerts
return alertsList.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionCell", for: indexPath) as! FacilityCollectionViewCell
/*
let windowRect = self.view.window!.frame
let windowWidth = windowRect.size.width
if(windowWidth <= 320) {
if (indexPath.section == 1 || alertsList.count == 0) {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionCell", for: indexPath) as! FacilityCollectionViewCell
/*
let windowRect = self.view.window!.frame
let windowWidth = windowRect.size.width
if(windowWidth <= 320) {
cell.frame.size.width = 280
}
*/
//Get tap of the cell
cell.tapRecognizer.addTarget(self, action: #selector(FacilitiesListViewController.tapRecognizer(_:)))
cell.gestureRecognizers = []
cell.gestureRecognizers?.append(cell.tapRecognizer)
let facility: Facility
//let dataArray: [Facility]
/*
// if something has been searched for, we want to use the filtered array as the data source
if isSearching() || showFavorites {
dataArray = placeOpenFacilitiesFirstInArray(filteredFacilities)
} else {
dataArray = placeOpenFacilitiesFirstInArray(facilitiesArray)
}
*/
facility = shownFacilities[indexPath.row]
cell.facility = facility
//set labels
cell.nameLabel.text = facility.facilityName
cell.categoryLabel.text = facility.category?.categoryName.uppercased()
cell.openClosedLabel.text = Utilities.openOrClosedUntil(facility)
cell.timeDescriptionLabel.text = facility.facilityLocation?.building
//change appearence based on open state
let open = Utilities.isOpen(facility: facility)
if(open == true) {
//cell.openClosedLabel.text = "Open"
cell.openClosedLabel.textColor = UIColor.black
cell.openClosedLabel.backgroundColor = UIColor.white
//cell.openClosedLabel.backgroundColor = UIColor(red:0.00, green:0.40, blue:0.20, alpha:1.0)
cell.backgroundColor = UIColor(red:0.00, green:0.40, blue:0.20, alpha:1.0)
} else {
//cell.openClosedLabel.text = "Closed"
cell.openClosedLabel.textColor = UIColor.white
cell.openClosedLabel.backgroundColor = UIColor.black
//cell.openClosedLabel.backgroundColor = UIColor.red
cell.backgroundColor = UIColor.red
}
//Accessibility
//TODO: FIX THIS
cell.accessibilityLabel = cell.nameLabel.text! + ", Currently " + cell.openClosedLabel.text! + "." + cell.timeDescriptionLabel.text!
cell.accessibilityHint = "Double Tap to view details"
self.reloadInputViews()
return cell
}
*/
//Get tap of the cell
cell.tapRecognizer.addTarget(self, action: #selector(FacilitiesListViewController.tapRecognizer(_:)))
cell.gestureRecognizers = []
cell.gestureRecognizers?.append(cell.tapRecognizer)
let facility: Facility
//let dataArray: [Facility]
/*
// if something has been searched for, we want to use the filtered array as the data source
if isSearching() || showFavorites {
dataArray = placeOpenFacilitiesFirstInArray(filteredFacilities)
} else {
dataArray = placeOpenFacilitiesFirstInArray(facilitiesArray)
}
*/
facility = shownFacilities[indexPath.row]
cell.facility = facility
//set labels
cell.nameLabel.text = facility.facilityName
cell.categoryLabel.text = facility.category?.categoryName.uppercased()
cell.openClosedLabel.text = Utilities.openOrClosedUntil(facility)
cell.timeDescriptionLabel.text = facility.facilityLocation?.building
//change appearence based on open state
let open = Utilities.isOpen(facility: facility)
if(open == true) {
//cell.openClosedLabel.text = "Open"
cell.openClosedLabel.textColor = UIColor.black
cell.openClosedLabel.backgroundColor = UIColor.white
//cell.openClosedLabel.backgroundColor = UIColor(red:0.00, green:0.40, blue:0.20, alpha:1.0)
cell.backgroundColor = UIColor(red:0.00, green:0.40, blue:0.20, alpha:1.0)
} else {
//cell.openClosedLabel.text = "Closed"
cell.openClosedLabel.textColor = UIColor.white
cell.openClosedLabel.backgroundColor = UIColor.black
//cell.openClosedLabel.backgroundColor = UIColor.red
cell.backgroundColor = UIColor.red
else {
// Do Alerts things here
return UICollectionViewCell() //This is bad
}
//Accessibility
//TODO: FIX THIS
cell.accessibilityLabel = cell.nameLabel.text! + ", Currently " + cell.openClosedLabel.text! + "." + cell.timeDescriptionLabel.text!
cell.accessibilityHint = "Double Tap to view details"
self.reloadInputViews()
return cell
}
......
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