Commit 93afa53c authored by Zach Knox's avatar Zach Knox
Browse files

Merge branch '28-29-more-buttons' into 'dev-1.0.1'

Resolve "Share button in Detail view" and "Add button to get directions via Maps.app to detail view"

See merge request !29
parents 52168ad9 8db99625
......@@ -43,6 +43,7 @@
92182EC01E95BD2C00192ABA /* FacilitiesListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92182EBF1E95BD2C00192ABA /* FacilitiesListViewController.swift */; };
92182EC41E95C38400192ABA /* FacilityDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92182EC31E95C38400192ABA /* FacilityDetailViewController.swift */; };
924840F81EA915F200DBFF4E /* FacilityCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924840F71EA915F200DBFF4E /* FacilityCollectionViewCell.swift */; };
9259134520784D66002E50B1 /* SelectOneDefaultTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */; };
9265F3A11F2969E500A54A21 /* SettingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9265F3A01F2969E500A54A21 /* SettingTableViewCell.swift */; };
9265F3A31F2C0B1500A54A21 /* AboutScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9265F3A21F2C0B1500A54A21 /* AboutScreenViewController.swift */; };
9270A4DB1EB5565400DFBDA3 /* SwitchingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9270A4DA1EB5565400DFBDA3 /* SwitchingTableViewCell.swift */; };
......@@ -93,6 +94,7 @@
92182EBF1E95BD2C00192ABA /* FacilitiesListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilitiesListViewController.swift; sourceTree = "<group>"; };
92182EC31E95C38400192ABA /* FacilityDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityDetailViewController.swift; sourceTree = "<group>"; };
924840F71EA915F200DBFF4E /* FacilityCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityCollectionViewCell.swift; sourceTree = "<group>"; };
9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectOneDefaultTableViewController.swift; sourceTree = "<group>"; };
9265F3A01F2969E500A54A21 /* SettingTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingTableViewCell.swift; sourceTree = "<group>"; };
9265F3A21F2C0B1500A54A21 /* AboutScreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutScreenViewController.swift; sourceTree = "<group>"; };
9270A4DA1EB5565400DFBDA3 /* SwitchingTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchingTableViewCell.swift; sourceTree = "<group>"; };
......@@ -178,6 +180,7 @@
927C80D91EB02566009079AD /* SettingsTableViewController.swift */,
927C80DB1EB18B89009079AD /* FiltersTableViewController.swift */,
92B2D2FE1FF8599500349E90 /* FilterSelectionTableViewController.swift */,
9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */,
92182EBF1E95BD2C00192ABA /* FacilitiesListViewController.swift */,
);
path = Views;
......@@ -673,6 +676,7 @@
927C80DC1EB18B89009079AD /* FiltersTableViewController.swift in Sources */,
92B89E302009444E00928284 /* PullingViewController.swift in Sources */,
CD763A7E1DE253B900ADFD6B /* SRCTUtilities.swift in Sources */,
9259134520784D66002E50B1 /* SelectOneDefaultTableViewController.swift in Sources */,
927C80DA1EB02566009079AD /* SettingsTableViewController.swift in Sources */,
CD3C97491DC18AB300A84434 /* SRCTNetworkController.swift in Sources */,
CD763A7C1DE251C400ADFD6B /* SRCTSimpleTableViewCell.swift in Sources */,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
......@@ -28,6 +28,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let defaults = UserDefaults.standard
initAlerts(defaults)
initCampuses(defaults)
if defaults.value(forKey: "mapsApp") == nil {
defaults.set("Apple Maps", forKey: "mapsApp")
}
return true
}
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "shareIcon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "shareIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "shareIcon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
......@@ -137,6 +138,35 @@
</objects>
<point key="canvasLocation" x="-8153" y="448"/>
</scene>
<!--Select One Default Table View Controller-->
<scene sceneID="XVT-Zz-bv3">
<objects>
<tableViewController id="irm-NL-2LQ" customClass="SelectOneDefaultTableViewController" customModule="WhatsOpen" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="OEx-Rt-9S3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="thereCanOnlyBeOne" id="Hzs-zq-KNQ">
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Hzs-zq-KNQ" id="U3O-ey-kO0">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="irm-NL-2LQ" id="TS4-il-abg"/>
<outlet property="delegate" destination="irm-NL-2LQ" id="8zp-cD-0dG"/>
</connections>
</tableView>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="v6f-sy-cSe" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-7343" y="448"/>
</scene>
<!--What's Open-->
<scene sceneID="w5e-Fb-rsR">
<objects>
......@@ -393,6 +423,33 @@
<segue destination="yIT-AR-gdn" kind="show" identifier="settingSelection" id="FRf-a6-Dgs"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="settingDefaultCell" textLabel="thC-fo-X1p" detailTextLabel="yaK-Xw-Fsi" style="IBUITableViewCellStyleValue1" id="EKX-GL-oCV">
<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="EKX-GL-oCV" id="b50-wo-rdD">
<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" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="thC-fo-X1p">
<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" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="yaK-Xw-Fsi">
<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="irm-NL-2LQ" kind="show" identifier="settingDefault" id="wTS-KZ-Irl"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Lhp-lE-ieb" id="B56-3p-ltP"/>
......@@ -616,7 +673,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="OPEN" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LmU-tN-3Nq">
<rect key="frame" x="8" y="117.5" width="359" height="38"/>
<rect key="frame" x="8" y="118" width="359" height="38"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="38" id="9W6-hU-MSZ"/>
......@@ -626,13 +683,13 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Johnson Center" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2ce-lS-NfW">
<rect key="frame" x="8" y="82" width="359" height="27.5"/>
<rect key="frame" x="8" y="82" width="359" height="28"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="23"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RESTAURANT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SCx-pT-eVq">
<rect key="frame" x="8" y="22" width="359" height="19.5"/>
<rect key="frame" x="8" y="22" width="359" height="20"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="16"/>
<color key="textColor" white="0.13039822049999999" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
......@@ -644,7 +701,7 @@
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="EFr-sK-Oua">
<rect key="frame" x="0.0" y="163.5" width="375" height="432.5"/>
<rect key="frame" x="0.0" y="164" width="375" height="373"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="LocationDetailCell" textLabel="ZON-E8-nep" detailTextLabel="mCu-om-Ac6" style="IBUITableViewCellStyleValue1" id="7ju-Kj-S2Y">
......@@ -691,30 +748,62 @@
<action selector="setFavButton:" destination="40z-Tl-yYT" eventType="touchUpInside" id="bOT-kV-nhh"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x1k-8h-a45" userLabel="Directions Button">
<rect key="frame" x="16" y="545" width="266" height="51"/>
<color key="backgroundColor" red="0.0" green="0.47934520244598389" blue="0.99908632040023804" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="266" id="91y-4v-zGH"/>
<constraint firstAttribute="height" constant="51" id="c2j-rB-cTK"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="19"/>
<state key="normal" title="Button">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="getDirections:" destination="40z-Tl-yYT" eventType="touchUpInside" id="E0t-VO-unA"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QR7-u9-Lw1" userLabel="Share Button">
<rect key="frame" x="290" y="545" width="69" height="51"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="19"/>
<state key="normal" title="Button">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="shareFacility:" destination="40z-Tl-yYT" eventType="touchUpInside" id="SSJ-rl-saS"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="QR7-u9-Lw1" firstAttribute="firstBaseline" secondItem="x1k-8h-a45" secondAttribute="baseline" id="0d8-Hh-KTR"/>
<constraint firstItem="wYH-df-pb5" firstAttribute="leading" secondItem="0iA-yA-TUz" secondAttribute="leading" constant="16" id="4qH-Qs-2Nu"/>
<constraint firstItem="SCx-pT-eVq" firstAttribute="top" secondItem="0iA-yA-TUz" secondAttribute="top" constant="2" id="7tl-O1-iS3"/>
<constraint firstItem="x1k-8h-a45" firstAttribute="top" secondItem="EFr-sK-Oua" secondAttribute="bottom" constant="8" symbolic="YES" id="8hI-3o-eer"/>
<constraint firstItem="SCx-pT-eVq" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="Akz-sy-WAt"/>
<constraint firstItem="QR7-u9-Lw1" firstAttribute="top" secondItem="x1k-8h-a45" secondAttribute="top" id="BGf-1R-2P5"/>
<constraint firstItem="LmU-tN-3Nq" firstAttribute="width" secondItem="hPi-Bj-D4L" secondAttribute="width" id="DUR-R6-939"/>
<constraint firstItem="EFr-sK-Oua" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="Ezv-za-EcD"/>
<constraint firstItem="EFr-sK-Oua" firstAttribute="top" secondItem="LmU-tN-3Nq" secondAttribute="bottom" constant="8" id="H5o-yK-bUj"/>
<constraint firstItem="EFr-sK-Oua" firstAttribute="width" secondItem="vOM-a7-AE3" secondAttribute="width" id="HPb-Hd-ULg"/>
<constraint firstItem="wYH-df-pb5" firstAttribute="top" secondItem="x1k-8h-a45" secondAttribute="bottom" constant="8" symbolic="YES" id="ID4-Ld-Mg1"/>
<constraint firstItem="LmU-tN-3Nq" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="MAY-TR-6W9"/>
<constraint firstItem="hPi-Bj-D4L" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="NV5-11-lY8"/>
<constraint firstItem="2ce-lS-NfW" firstAttribute="top" secondItem="hPi-Bj-D4L" secondAttribute="bottom" constant="-4" id="SIh-tP-Vwb"/>
<constraint firstItem="x1k-8h-a45" firstAttribute="leading" secondItem="wYH-df-pb5" secondAttribute="leading" id="UUx-Sp-bhy"/>
<constraint firstItem="hPi-Bj-D4L" firstAttribute="leading" secondItem="0iA-yA-TUz" secondAttribute="leading" constant="8" id="XdB-Nv-hr4"/>
<constraint firstItem="wYH-df-pb5" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="Zrf-ek-B8e"/>
<constraint firstItem="wYH-df-pb5" firstAttribute="top" secondItem="EFr-sK-Oua" secondAttribute="bottom" constant="8" id="aZn-qA-7kZ"/>
<constraint firstItem="hPi-Bj-D4L" firstAttribute="top" secondItem="SCx-pT-eVq" secondAttribute="bottom" constant="-4.5" id="arY-iF-Gnx"/>
<constraint firstItem="2ce-lS-NfW" firstAttribute="width" secondItem="hPi-Bj-D4L" secondAttribute="width" id="ceM-fT-kDM"/>
<constraint firstItem="0iA-yA-TUz" firstAttribute="bottom" secondItem="wYH-df-pb5" secondAttribute="bottom" constant="12" id="e47-BL-fWF"/>
<constraint firstItem="SCx-pT-eVq" firstAttribute="width" secondItem="hPi-Bj-D4L" secondAttribute="width" id="exI-g2-Tec"/>
<constraint firstItem="LmU-tN-3Nq" firstAttribute="top" secondItem="2ce-lS-NfW" secondAttribute="bottom" constant="8" id="fSq-dp-y4o"/>
<constraint firstItem="QR7-u9-Lw1" firstAttribute="leading" secondItem="x1k-8h-a45" secondAttribute="trailing" constant="8" symbolic="YES" id="fc7-zd-F8t"/>
<constraint firstItem="0iA-yA-TUz" firstAttribute="trailing" secondItem="hPi-Bj-D4L" secondAttribute="trailing" constant="8" id="fuT-qT-1IL"/>
<constraint firstItem="0iA-yA-TUz" firstAttribute="trailing" secondItem="wYH-df-pb5" secondAttribute="trailing" constant="16" id="okf-v7-GSs"/>
<constraint firstItem="2ce-lS-NfW" firstAttribute="centerX" secondItem="0iA-yA-TUz" secondAttribute="centerX" id="wwG-8O-tQ7"/>
<constraint firstItem="QR7-u9-Lw1" firstAttribute="trailing" secondItem="wYH-df-pb5" secondAttribute="trailing" id="xIa-4K-ECo"/>
</constraints>
<viewLayoutGuide key="safeArea" id="0iA-yA-TUz"/>
</view>
......@@ -724,7 +813,9 @@
<outlet property="OpenLabel" destination="LmU-tN-3Nq" id="3i1-Xg-FtQ"/>
<outlet property="OpenTimesList" destination="EFr-sK-Oua" id="uTF-US-Oh4"/>
<outlet property="PlaceLabel" destination="2ce-lS-NfW" id="rkF-DE-fAD"/>
<outlet property="directionsButton" destination="x1k-8h-a45" id="JoP-Yp-4Ky"/>
<outlet property="favoritesButton" destination="wYH-df-pb5" id="7oH-Qd-dEg"/>
<outlet property="shareButton" destination="QR7-u9-Lw1" id="9ym-ZZ-QDl"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Hze-Fg-ydT" userLabel="First Responder" sceneMemberID="firstResponder"/>
......
......@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>What's Open</string>
<string>What&apos;s Open</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
......@@ -63,5 +63,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
<string>waze</string>
</array>
</dict>
</plist>
......@@ -63,6 +63,7 @@ class Locations: Object, Mappable {
@objc dynamic var campus = ""
@objc dynamic var onCampus = false
@objc dynamic var abbreviation = ""
@objc dynamic var coordinates: Coordinates? = Coordinates()
required convenience init?(map: Map){
self.init()
......@@ -77,6 +78,7 @@ class Locations: Object, Mappable {
campus <- map["campus_region"]
onCampus <- map["on_campus"]
abbreviation <- map["friendly_building"]
coordinates <- map["coordinate_location"]
}
func equals(_ another: Locations) -> Bool {
......@@ -93,6 +95,20 @@ class Locations: Object, Mappable {
}
class Coordinates: Object, Mappable {
var coords: List<Double>? = List<Double>()
@objc dynamic var type = ""
required convenience init?(map: Map){
self.init()
}
func mapping(map: Map) {
coords <- (map["coordinates"], CoordTransform())
type <- map["type"]
}
}
class Categories: Object, Mappable {
@objc dynamic var id = 0
@objc dynamic var created = ""
......@@ -273,6 +289,34 @@ class TagTransform : TransformType {
}
}
class CoordTransform: TransformType {
typealias Object = List<Double>
typealias JSON = [String]
func transformFromJSON(_ value: Any?) -> List<Double>? {
let result = List<Double>()
if let tempArr = value as! [Double]? {
var count = 0
for entry in tempArr {
result.insert(entry, at: count)
count += 1
}
}
return result
}
func transformToJSON(_ value: List<Double>?) -> [String]? {
if (value!.count > 0) {
var result = [String]()
for entry in value! {
result.append("\(entry)")
}
return result
}
return nil
}
}
/**struct OpenTimes: CreatableFromJSON { // TODO: Rename this struct
......
......@@ -178,7 +178,7 @@ class Utilities: NSObject {
let viewingFormatter = DateFormatter.easternCoastTimeFormatForViewing
let startEnd = getStartEndDates(facility)
if facility.mainSchedule!.twentyFourHours {
if isMainSchedule(facility: facility) && facility.mainSchedule!.twentyFourHours {
return "Open all day"
}
if(Utilities.isOpen(facility: facility)) {
......
......@@ -8,6 +8,7 @@
import UIKit
import StoreKit
import MapKit
class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
......@@ -17,7 +18,9 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
@IBOutlet var CategoryLabel: UILabel!
@IBOutlet var OpenTimesList: UITableView!
@IBOutlet var favoritesButton: UIButton!
@IBOutlet var directionsButton: UIButton!
@IBOutlet var shareButton: UIButton!
var facility: Facility!
override var previewActionItems: [UIPreviewActionItem] {
......@@ -48,7 +51,44 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
setFavoriteButtonText()
}
/**
@IBAction func getDirections(_ sender: Any) {
let appToUse = UserDefaults.standard.value(forKey: "mapsApp") as? String
if appToUse == "Google Maps" && UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!) {
if let url = URL(string: "comgooglemaps://?q=\((facility.facilityLocation?.coordinates?.coords?.last)!)),\((facility.facilityLocation?.coordinates?.coords?.first)!)") {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
else if appToUse == "Waze" && UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!) {
if let url = URL(string: "https://waze.com/ul?ll=\((facility.facilityLocation?.coordinates?.coords?.last)!)),\((facility.facilityLocation?.coordinates?.coords?.first)!))") {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
else {
let regionDistance:CLLocationDistance = 100
let coordinates = CLLocationCoordinate2DMake((facility.facilityLocation?.coordinates?.coords?.last)!, (facility.facilityLocation?.coordinates?.coords?.first)!)
dump(coordinates)
let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance)
let options = [
MKLaunchOptionsMapCenterKey: NSValue(mkCoordinate: regionSpan.center),
MKLaunchOptionsMapSpanKey: NSValue(mkCoordinateSpan: regionSpan.span)
]
let placemark = MKPlacemark(coordinate: coordinates, addressDictionary: nil)
let mapItem = MKMapItem(placemark: placemark)
mapItem.name = facility.facilityName
mapItem.openInMaps(launchOptions: options)
}
}
@IBAction func shareFacility(_ sender: Any) {
let str = "\(facility.facilityName) is \(Utilities.openOrClosedUntil(facility)!.lowercased())"
let shareSheet = UIActivityViewController(activityItems: ["\(str) https://whatsopen.gmu.edu/"], applicationActivities: nil)
shareSheet.excludedActivityTypes = [.print, .openInIBooks, .addToReadingList] // Sorry you can't print a Facility
present(shareSheet, animated: true, completion: nil)
}
/**
Change the favorite button text depending on if the facility is a favorite
*/
func setFavoriteButtonText() {
......@@ -73,7 +113,7 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
super.viewDidDisappear(true)
// MARK - Begging for App Reviews
let prompt = UserDefaults.standard.integer(forKey: "reviewPrompt")
if(arc4random_uniform(100) > 85 && prompt >= 4) {
if(arc4random_uniform(100) > 90 && prompt >= 4) {
SKStoreReviewController.requestReview()
UserDefaults.standard.set(0, forKey: "reviewPrompt")
}
......@@ -112,6 +152,25 @@ class FacilityDetailViewController: UIViewController, UITableViewDelegate, UITab
favoritesButton.tintColor = UIColor.white
favoritesButton.backgroundColor = UIColor(red:0.00, green:0.40, blue:0.20, alpha:1.0)
favoritesButton.layer.cornerRadius = 10
directionsButton.tintColor = UIColor.white
directionsButton.backgroundColor = #colorLiteral(red: 0, green: 0.4793452024, blue: 0.9990863204, alpha: 1)
directionsButton.layer.cornerRadius = 10
let appToUse = UserDefaults.standard.value(forKey: "mapsApp") as? String
if appToUse == "Google Maps" && UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!) {
directionsButton.setTitle("View in Google Maps", for: .normal)
}
else if appToUse == "Waze" && UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!) {
directionsButton.setTitle("View in Waze", for: .normal)
}
else {
directionsButton.setTitle("View in Maps", for: .normal)
}
shareButton.tintColor = UIColor.white
shareButton.backgroundColor = UIColor.orange
shareButton.layer.cornerRadius = 10
shareButton.setImage(#imageLiteral(resourceName: "shareIcon"), for: .normal)
shareButton.setTitle("", for: .normal)
OpenTimesList.bounces = false
......
......@@ -15,6 +15,7 @@ class FilterSelectionTableViewController: UITableViewController {
var selectFunc: ((String, Bool) -> Bool)!
var selectAllFunc: (() -> Bool)!
var updateFacilities: (() -> Void)!
var canSelectAll = true
override func viewDidLoad() {
super.viewDidLoad()
......@@ -39,8 +40,10 @@ class FilterSelectionTableViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 1 + getFunc().count
if canSelectAll {
return 1 + getFunc().count
}
return getFunc().count
}
......@@ -49,12 +52,18 @@ class FilterSelectionTableViewController: UITableViewController {
let values = getFunc()
// Configure the cell...
if(indexPath.row == 0) {
if(indexPath.row == 0 && canSelectAll) {
cell.textLabel?.text = "Select All/None"
cell.accessoryType = .none
}
else {
var i = 1
var i: Int
if canSelectAll {
i = 1
}
else {
i = 0
}
for v in values {
if i == indexPath.row {
cell.textLabel?.text = v.key.capitalized
......@@ -77,6 +86,9 @@ class FilterSelectionTableViewController: UITableViewController {
if navigationItem.title == "Show Alerts" {
return "Emergency Alerts are always enabled in the app for your safety. We will never send a notification to your device without your consent."
}
else if navigationItem.title == "Select Maps App" {
return "The app selected here will be used when opening a map from a facility's detail page."
}
return nil
}
......
//
// SelectOneDefaultTableViewController.swift
// WhatsOpen
//
// Created by Zach Knox on 4/6/18.
// Copyright © 2018 SRCT. All rights reserved.
//
import UIKit
class SelectOneDefaultTableViewController: UITableViewController {
// Passing functions rather than direct objects to make this class reusable
var options: [String]!
var defaultKey: String!
let defaults = UserDefaults.standard
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return options.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "thereCanOnlyBeOne", for: indexPath)
cell.textLabel?.text = options[indexPath.row]
if defaults.value(forKey: defaultKey) as! String == options[indexPath.row] {