starting on notifications, among other things I forgot

parent 275c15da
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
......
......@@ -49,6 +49,7 @@ class IntentViewController: UIViewController, INUIHostedViewControlling {
let detailVC = storyboard.instantiateViewController(withIdentifier: "detailView") as! WOPFacilityDetailViewController
detailVC.facility = facility
//detailVC.preferredContentSize = CGSize(width: 300, height: 35)
attachChild(detailVC)
completion(true, parameters, self.desiredSize)
......@@ -72,6 +73,7 @@ class IntentViewController: UIViewController, INUIHostedViewControlling {
return self.extensionContext!.hostedViewMaximumAllowedSize
}
// Taken from Apple's SoupChef sample code
private func attachChild(_ viewController: UIViewController) {
addChild(viewController)
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
......
......@@ -75,6 +75,8 @@
928EC26421604DD800D8F9FE /* DownloadController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3C97481DC18AB300A84434 /* DownloadController.swift */; };
928EC26521605CD700D8F9FE /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD763A791DE24EF100ADFD6B /* Model.swift */; };
928EC26721611E5900D8F9FE /* DatabaseController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928EC26621611E5900D8F9FE /* DatabaseController.swift */; };
9296814D21CED36600FA2238 /* ViewInMapsActionActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */; };
9296814E21CEDC3E00FA2238 /* ViewInMapsActionActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9296814C21CED36600FA2238 /* ViewInMapsActionActivity.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 */; };
......@@ -232,6 +234,7 @@
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetIconTableViewController.swift; sourceTree = "<group>"; };
928EC2522160475900D8F9FE /* WhatsOpenKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WhatsOpenKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
928EC26621611E5900D8F9FE /* DatabaseController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseController.swift; sourceTree = "<group>"; };
9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewInMapsActionActivity.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>"; };
......@@ -383,6 +386,7 @@
9281AD7B2002CF1700D09203 /* SetIconTableViewController.swift */,
92A2757120C8992600E1A102 /* Primary Views */,
924E0E302085851400C1F2AF /* DetailViewButtonsViewController.swift */,
9296814C21CED36600FA2238 /* ViewInMapsActionActivity.swift */,
9265F3A21F2C0B1500A54A21 /* AboutScreenViewController.swift */,
927C80D91EB02566009079AD /* SettingsTableViewController.swift */,
9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */,
......@@ -996,7 +1000,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
9203CBA82023D51A006ACC3B /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1051,7 +1055,7 @@
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA54E21665A0000CAF0D4 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1065,7 +1069,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA54F21665A1300CAF0D4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1078,7 +1082,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92CAA55021665A1F00CAF0D4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1091,7 +1095,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
shellScript = "#!/bin/bash\n#buildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$INFOPLIST_FILE\")\n#buildNumber=$(($buildNumber + 1))\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n";
};
92FF6C7820017E1C00D836AE /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
......@@ -1178,6 +1182,7 @@
files = (
9203CB862023D51A006ACC3B /* FilterSelectionTableViewController.swift in Sources */,
9203CB892023D51A006ACC3B /* AlertCollectionViewCell.swift in Sources */,
9296814E21CEDC3E00FA2238 /* ViewInMapsActionActivity.swift in Sources */,
9203CB8A2023D51A006ACC3B /* CheckingTableViewCell.swift in Sources */,
9203CB8B2023D51A006ACC3B /* FacilitiesListViewController.swift in Sources */,
9203CB8C2023D51A006ACC3B /* AlertDetailViewController.swift in Sources */,
......@@ -1245,6 +1250,7 @@
files = (
92B2D2FF1FF8599500349E90 /* FilterSelectionTableViewController.swift in Sources */,
92FF6C731FFEEEE900D836AE /* AlertCollectionViewCell.swift in Sources */,
9296814D21CED36600FA2238 /* ViewInMapsActionActivity.swift in Sources */,
92108A331ED755F100675E16 /* CheckingTableViewCell.swift in Sources */,
92182EC01E95BD2C00192ABA /* FacilitiesListViewController.swift in Sources */,
92B89E2E20093E3600928284 /* AlertDetailViewController.swift in Sources */,
......@@ -1762,6 +1768,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
......@@ -1980,6 +1988,8 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
......@@ -2030,6 +2040,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SHARED_BUILD_NUMBER = 49;
SHARED_VERSION_NUMBER = 1.2;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
......
......@@ -7,6 +7,7 @@
//
import UIKit
import UserNotifications
import RealmSwift
import Fabric
......@@ -33,6 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
initAlerts(defaults)
initAlertNotifications(defaults)
initCampuses(defaults)
if defaults.value(forKey: "mapsApp") == nil {
defaults.set("Apple Maps", forKey: "mapsApp")
......@@ -100,6 +102,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
defaults.set(setAlerts, forKey: "alerts")
}
}
func initAlertNotifications(_ defaults: UserDefaults) {
let notifications = defaults.dictionary(forKey: "notificationDefaults")
if notifications == nil {
var setAlerts = [String: Bool]()
setAlerts.updateValue(false, forKey: "informational")
setAlerts.updateValue(false, forKey: "minor alerts")
setAlerts.updateValue(false, forKey: "major alerts")
setAlerts.updateValue(false, forKey: "emergency")
defaults.set(setAlerts, forKey: "notificationDefaults")
}
}
func initCampuses(_ defaults: UserDefaults) {
let campuses = defaults.dictionary(forKey: "campuses")
......@@ -114,6 +129,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
WOPDownloadController.performAlertsDownload(completion: { alerts in
if alerts != nil {
DispatchQueue.main.async {
// Add to Realm
let date = Date()
let realm = try! Realm(configuration: WOPDatabaseController.getConfig())
let results = realm.objects(WOPFacilitiesModel.self)
......@@ -145,6 +161,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
fromRealm.lastUpdated = date
}
}
// Notification
completionHandler(UIBackgroundFetchResult.newData)
}
} else {
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "addshortcut.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "addshortcut@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "addshortcut@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "heart_empty.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "heart_empty@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "heart_empty@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "heart_filled.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "heart_filled@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "heart_filled@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "map@2x_2.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "map@2x-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "map@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -19,5 +19,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>${SHARED_VERSION_NUMBER}</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......@@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>45</string>
<string>${SHARED_BUILD_NUMBER}</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
......
......@@ -20,7 +20,6 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
var facility: WOPFacility!
@IBOutlet var favoritesButton: UIButton!
@IBOutlet var directionsButton: UIButton!
@IBOutlet var shareButton: UIButton!
@IBOutlet var addToSiriButton: UIButton!
......@@ -42,7 +41,7 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
setFavoriteButtonText()
}
@IBAction func getDirections(_ sender: Any) {
func getDirections(_ sender: Any) {
let appToUse = WOPDatabaseController.getDefaults().value(forKey: "mapsApp") as? String
if appToUse == "Google Maps" && UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!) {
......@@ -73,8 +72,10 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
@IBAction func shareFacility(_ sender: Any) {
let str = "\(facility.facilityName) is \(WOPUtilities.openOrClosedUntil(facility)!.lowercased())"
let shareSheet = UIActivityViewController(activityItems: ["\(str) https://whatsopen.gmu.edu/"], applicationActivities: nil)
// TODO in future: add URL based on facility once web supports it
let shareSheet = UIActivityViewController(activityItems: [str, (URL(string: "https://whatsopen.gmu.edu") ?? nil), facility], applicationActivities: [ViewInMapsActionActivity()])
shareSheet.excludedActivityTypes = [.print, .openInIBooks, .addToReadingList] // Sorry you can't print a Facility
present(shareSheet, animated: true, completion: nil)
}
......@@ -84,12 +85,14 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
*/
func setFavoriteButtonText() {
if(WOPUtilities.isFavoriteFacility(facility)) {
favoritesButton.setTitle("Remove from Favorites", for: .normal)
favoritesButton.titleLabel?.text = "Remove from Favorites"
favoritesButton.accessibilityLabel = "Remove from Favorites"
favoritesButton.titleLabel?.text = ""
favoritesButton.setImage(UIImage(named: "heart_filled"), for: .normal)
}
else {
favoritesButton.setTitle("Add to Favorites", for: .normal)
favoritesButton.titleLabel?.text = "Add to Favorites"
favoritesButton.accessibilityLabel = "Add to Favorites"
favoritesButton.titleLabel?.text = ""
favoritesButton.setImage(UIImage(named: "heart_empty"), for: .normal)
}
}
......@@ -105,33 +108,20 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
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 = WOPDatabaseController.getDefaults().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)
shareButton.accessibilityLabel = "Share"
setActivityUp()
addToSiriButton.tintColor = UIColor.black
addToSiriButton.backgroundColor = UIColor.white
addToSiriButton.layer.borderWidth = 3
addToSiriButton.layer.borderColor = UIColor.black.cgColor
addToSiriButton.tintColor = UIColor.white
addToSiriButton.backgroundColor = UIColor.black
addToSiriButton.layer.cornerRadius = 10
addToSiriButton.accessibilityLabel = "Add to Siri"
let interaction = INInteraction(intent: facility.createIntent(), response: WOPViewFacilityIntentUtils.getIntentResponse(facility, userActivity: activity))
interaction.donate(completion: nil)
......
......@@ -35,11 +35,16 @@ class FilterSelectionTableViewController: UITableViewController {
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
if navigationItem.title = "Alert Notifications" {
return 2
}
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section != 0 {
return 1
}
if canSelectAll {
return 1 + getFunc().count
}
......@@ -48,7 +53,14 @@ class FilterSelectionTableViewController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "filterSelection", for: indexPath)
if indexPath.section != 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "filterSelection", for: indexPath)
cell.accessoryType = .detailButton
cell.textLabel?.text = "Open Notifications Settings"
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "filterSelection", for: indexPath)
let values = getFunc()
// Configure the cell...
......@@ -83,6 +95,10 @@ class FilterSelectionTableViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
if section != 0 {
return "The above settings will only apply if you have notifications enabled for What's Open in Settings."
}
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."
}
......@@ -93,6 +109,11 @@ class FilterSelectionTableViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section != 0 {
UIApplication.shared.open(URL(string: UIApplicationOpenSettingsURLString)!, completionHandler: nil)
return
}
if(indexPath.row == 0) {
_ = selectAllFunc()
tableView.reloadData()
......
......@@ -263,21 +263,29 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
trueDest = destination
}
if(self.view.traitCollection.horizontalSizeClass == .regular && self.view.traitCollection.verticalSizeClass == .regular) {
//do a popover here for the iPad
//iPads are cool right?
trueDest.modalPresentationStyle = .popover
let popoverController = trueDest.popoverPresentationController
popoverController?.permittedArrowDirections = .any
popoverController?.sourceView = tapped.contentView
popoverController?.sourceRect = tapped.bounds
// present the detail view over the search controller if we're searching
if searchController.isActive {
searchController.present(trueDest, animated: true, completion: nil)
}
else {
present(trueDest, animated: true, completion: nil)
}
let external = UIScreen.screens
if external.count > 1 {
var window = UIWindow(frame: external[1].bounds)
window.screen = external[1]
window.rootViewController = trueDest
window.isHidden = false
} else {
//do a popover here for the iPad
//iPads are cool right?
trueDest.modalPresentationStyle = .popover
let popoverController = trueDest.popoverPresentationController
popoverController?.permittedArrowDirections = .any
popoverController?.sourceView = tapped.contentView
popoverController?.sourceRect = tapped.bounds
// present the detail view over the search controller if we're searching
if searchController.isActive {
searchController.present(trueDest, animated: true, completion: nil)
}
else {
present(trueDest, animated: true, completion: nil)
}
}
}
else {
let finalDestination = self.storyboard?.instantiateViewController(withIdentifier: "pulling") as? PullingViewController // Fox only, no items
......
......@@ -285,6 +285,14 @@ class SettingsTableViewController: UITableViewController, MFMailComposeViewContr
destination.selectAllFunc = WOPUtilities.setAllAlertDefaults
destination.updateFacilities = updateFacilities
}
else if (sender as! UITableViewCell).textLabel?.text == "Alert Notifications" {
let destination = segue.destination as! FilterSelectionTableViewController
destination.navigationItem.title = "Alert Notifications"
destination.getFunc = WOPUtilities.getCampusDefaults
destination.selectFunc = WOPUtilities.setCampusDefaults
destination.selectAllFunc = WOPUtilities.setAllCampusDefaults
destination.updateFacilities = updateFacilities
}
else if (sender as! UITableViewCell).textLabel?.text == "Show Campuses" {
let destination = segue.destination as! FilterSelectionTableViewController
destination.navigationItem.title = "Show Campuses"
......
//
// ViewInMapsActionActivity.swift
// WhatsOpen
//
// Created by Zach Knox on 12/22/18.
// Copyright © 2018 SRCT. All rights reserved.
//
import UIKit
import MapKit
import WhatsOpenKit
class ViewInMapsActionActivity: UIActivity {
override var activityType: UIActivity.ActivityType? {
return UIActivity.ActivityType(rawValue: "maps")
}