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

new, smaller alert; alert detail view; and pull down indicator for cards

more things still to be done
parent f15d974b
......@@ -22,6 +22,8 @@
9281AD7C2002CF1700D09203 /* SetIconTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */; };
929157221FF4662F00ED63C7 /* PickingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929157211FF4662F00ED63C7 /* PickingTableViewCell.swift */; };
92B2D2FF1FF8599500349E90 /* FilterSelectionTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B2D2FE1FF8599500349E90 /* FilterSelectionTableViewController.swift */; };
92B89E2E20093E3600928284 /* AlertDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B89E2D20093E3600928284 /* AlertDetailViewController.swift */; };
92B89E302009444E00928284 /* PullingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B89E2F2009444E00928284 /* PullingViewController.swift */; };
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 */; };
......@@ -68,6 +70,8 @@
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetIconTableViewController.swift; sourceTree = "<group>"; };
929157211FF4662F00ED63C7 /* PickingTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickingTableViewCell.swift; sourceTree = "<group>"; };
92B2D2FE1FF8599500349E90 /* FilterSelectionTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterSelectionTableViewController.swift; sourceTree = "<group>"; };
92B89E2D20093E3600928284 /* AlertDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertDetailViewController.swift; sourceTree = "<group>"; };
92B89E2F2009444E00928284 /* PullingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PullingViewController.swift; sourceTree = "<group>"; };
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>"; };
......@@ -118,6 +122,8 @@
920D17961F6C5CD200D63295 /* Views */ = {
isa = PBXGroup;
children = (
92B89E2F2009444E00928284 /* PullingViewController.swift */,
92B89E2D20093E3600928284 /* AlertDetailViewController.swift */,
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */,
92182EC31E95C38400192ABA /* FacilityDetailViewController.swift */,
9265F3A21F2C0B1500A54A21 /* AboutScreenViewController.swift */,
......@@ -418,6 +424,7 @@
92FF6C731FFEEEE900D836AE /* AlertCollectionViewCell.swift in Sources */,
92108A331ED755F100675E16 /* CheckingTableViewCell.swift in Sources */,
92182EC01E95BD2C00192ABA /* FacilitiesListViewController.swift in Sources */,
92B89E2E20093E3600928284 /* AlertDetailViewController.swift in Sources */,
CD763A7A1DE24EF100ADFD6B /* examplejson.swift in Sources */,
9265F3A31F2C0B1500A54A21 /* AboutScreenViewController.swift in Sources */,
92EA81971FB7D1B500B1F6E3 /* PaddedUILabel.swift in Sources */,
......@@ -427,6 +434,7 @@
9265F3A11F2969E500A54A21 /* SettingTableViewCell.swift in Sources */,
9270A4DD1EC0010300DFBDA3 /* Filters.swift in Sources */,
927C80DC1EB18B89009079AD /* FiltersTableViewController.swift in Sources */,
92B89E302009444E00928284 /* PullingViewController.swift in Sources */,
CD763A7E1DE253B900ADFD6B /* SRCTUtilities.swift in Sources */,
927C80DA1EB02566009079AD /* SettingsTableViewController.swift in Sources */,
CD3C97491DC18AB300A84434 /* SRCTNetworkController.swift in Sources */,
......
......@@ -12,9 +12,10 @@ class AlertCollectionViewCell: UICollectionViewCell {
@IBOutlet var imageView: UIImageView!
@IBOutlet var messageLabel: UILabel!
var alert: Alert!
internal let tapRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
@IBOutlet var containingView: UIView!
@IBOutlet var containingViewWidth: NSLayoutConstraint!
var viewWidth: CGFloat!
override func awakeFromNib() {
......@@ -25,24 +26,4 @@ class AlertCollectionViewCell: UICollectionViewCell {
setNeedsLayout()
}
override func layoutSubviews() {
super.layoutSubviews()
if(viewWidth < 640) {
containingViewWidth.constant = -30
//cell.containingView.widthAnchor.constraint(equalTo: cell.widthAnchor, multiplier: 1, constant: -10)
}
else if(viewWidth >= 640 && viewWidth < 1024) {
containingViewWidth.constant = -100
//cell.containingView.widthAnchor.constraint(equalTo: cell.widthAnchor, multiplier: 1, constant: -100)
}
else if(viewWidth >= 1024) {
containingViewWidth.constant = -300
//cell.containingView.widthAnchor.constraint(equalTo: cell.widthAnchor, multiplier: 1, constant: -150)
}
else {
containingViewWidth.constant = -10
//cell.containingView.widthAnchor.constraint(equalTo: cell.widthAnchor, multiplier: 1, constant: -10)
}
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "detailIndicator.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "detailIndicator@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "detailIndicator@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "downPull.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "downPull@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "downPull@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// AlertDetailViewController.swift
// WhatsOpen
//
// Created by Zach Knox on 1/12/18.
// Copyright © 2018 SRCT. All rights reserved.
//
import UIKit
class AlertDetailViewController: UIViewController {
@IBOutlet var imageView: UIImageView!
@IBOutlet var nameLabel: UILabel!
@IBOutlet var messageView: UITextView!
var alert: Alert!
override func viewDidLoad() {
super.viewDidLoad()
switch alert.urgency {
case "info":
self.imageView.image = #imageLiteral(resourceName: "info")
self.nameLabel.text = "Information"
case "minor":
self.imageView.image = #imageLiteral(resourceName: "minor")
self.nameLabel.text = "Minor Alert"
case "major":
self.imageView.image = #imageLiteral(resourceName: "major")
self.nameLabel.text = "Major Alert"
case "emergency":
self.imageView.image = #imageLiteral(resourceName: "emergency")
self.nameLabel.text = "Emergency Alert"
default:
self.imageView.image = #imageLiteral(resourceName: "major")
self.nameLabel.text = "Alert"
}
self.messageView.text = alert.message
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
......@@ -177,16 +177,27 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
let tapLocation = sender.location(in: LocationsList)
let indexPath = LocationsList.indexPathForItem(at: tapLocation)
if((indexPath) != nil) {
let destination = self.storyboard?.instantiateViewController(withIdentifier: "detailView") as? FacilityDetailViewController
let tapped = self.LocationsList.cellForItem(at: indexPath!) as! FacilityCollectionViewCell
destination!.facility = tapped.facility
self.presentDetailView(destination!)
if(indexPath != nil) {
if(indexPath?.section == 1 || currentAlerts.count == 0) {
let destination = self.storyboard?.instantiateViewController(withIdentifier: "pulling") as? PullingViewController
destination?.currentViewController = self.storyboard?.instantiateViewController(withIdentifier: "detailView") as? FacilityDetailViewController
let tapped = self.LocationsList.cellForItem(at: indexPath!) as! FacilityCollectionViewCell
(destination?.currentViewController as? FacilityDetailViewController)?.facility = tapped.facility
self.presentDetailView(destination!)
}
else {
let destination = self.storyboard?.instantiateViewController(withIdentifier: "pulling") as? PullingViewController
destination?.currentViewController = self.storyboard?.instantiateViewController(withIdentifier: "alertDetail") as? AlertDetailViewController
let tapped = self.LocationsList.cellForItem(at: indexPath!) as! AlertCollectionViewCell
(destination?.currentViewController as? AlertDetailViewController)?.alert = tapped.alert
self.presentDetailView(destination!)
}
}
}
func presentDetailView(_ destination: FacilityDetailViewController) {
func presentDetailView(_ destination: PullingViewController) {
if(self.view.traitCollection.horizontalSizeClass == .regular && self.view.traitCollection.verticalSizeClass == .regular) {
//do a popover here for the iPad
//iPads are cool right?
......@@ -614,6 +625,10 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
// Do Alerts things here
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Alert Cell", for: indexPath) as! AlertCollectionViewCell
cell.viewWidth = self.view.frame.width
cell.alert = currentAlerts[indexPath.row]
cell.tapRecognizer.addTarget(self, action: #selector(FacilitiesListViewController.tapRecognizer(_:)))
cell.gestureRecognizers = []
cell.gestureRecognizers?.append(cell.tapRecognizer)
switch currentAlerts[indexPath.row].urgency {
case "info":
......@@ -633,7 +648,6 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
cell.imageView.accessibilityLabel = "Alert"
}
cell.messageLabel.text = currentAlerts[indexPath.row].message
return cell
......@@ -664,7 +678,7 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
return CGSize(width: width, height: height)
}
else {
return CGSize(width: self.view.frame.size.width, height: LocationsListLayout.itemSize.height)
return CGSize(width: self.view.frame.size.width, height: 43)
}
}
......@@ -733,11 +747,13 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
if(segue.identifier == "toDetailView") {
let destination = segue.destination as! FacilityDetailViewController
let destination = segue.destination as! PullingViewController
var destChild = destination.childViewControllers[0] as! FacilityDetailViewController
destChild = self.storyboard?.instantiateViewController(withIdentifier: "detailView") as! FacilityDetailViewController
let destDelegate = DeckTransitioningDelegate()
destination.transitioningDelegate = destDelegate
let tapped = sender as! FacilityCollectionViewCell //this is probably a bad idea just FYI future me
destination.facility = tapped.facility
destChild.facility = tapped.facility
// if we're in the search view, present on its controller
if searchController.isActive {
......
//
// PullingViewController.swift
// WhatsOpen
//
// Created by Zach Knox on 1/12/18.
// Copyright © 2018 SRCT. All rights reserved.
//
import UIKit
class PullingViewController: UIViewController {
@IBOutlet var containerView: UIView!
weak var currentViewController: UIViewController?
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func viewDidLoad() {
modalPresentationCapturesStatusBarAppearance = true
// Dealing with container views and subviews
// https://spin.atomicobject.com/2015/10/13/switching-child-view-controllers-ios-auto-layout/
self.currentViewController!.view.translatesAutoresizingMaskIntoConstraints = false
self.addChildViewController(self.currentViewController!)
self.addSubview(self.currentViewController!.view, toView: self.containerView)
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func addSubview(_ subView: UIView, toView parentView: UIView) {
parentView.addSubview(subView)
var viewBindingsDict = [String: AnyObject]()
viewBindingsDict["subView"] = subView
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[subView]|",
options: [], metrics: nil, views: viewBindingsDict))
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[subView]|",
options: [], metrics: nil, views: viewBindingsDict))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
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