Successfully moved backend files into framework, and changed all references to the relevant files

parent b96c1aed
......@@ -4,14 +4,16 @@
platform :ios, '11.0'
use_frameworks!
def ios_pods
def important_pods
pod 'RealmSwift'
#pod 'ObjectMapper', '~> 3.2'
# TEMPORARY BECAUSE Xcode 10
pod 'ObjectMapper', :git => 'https://github.com/alecdoconnor/ObjectMapper.git', :branch => 'Swift-4.2'
pod "ObjectMapper+Realm"
end
def ios_pods
#pod 'Segmentio', '~> 2.1'
pod 'DeckTransition', '~> 2.0'
......@@ -22,13 +24,18 @@ end
target 'WhatsOpen' do
important_pods
ios_pods
end
target 'WhatsOpen - AppStore' do
important_pods
ios_pods
end
target 'WhatsOpenKit' do
important_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
......
......@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM: f77678c4bb98cdb953f0eb4226354e2455803d42
PODFILE CHECKSUM: e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0
......@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM: f77678c4bb98cdb953f0eb4226354e2455803d42
PODFILE CHECKSUM: e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_WhatsOpenKit : NSObject
@end
@implementation PodsDummy_Pods_WhatsOpenKit
@end
#!/bin/sh
set -e
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"
XCASSET_FILES=()
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
3)
TARGET_DEVICE_ARGS="--target-device tv"
;;
4)
TARGET_DEVICE_ARGS="--target-device watch"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
install_resource()
{
if [[ "$1" = /* ]] ; then
RESOURCE_PATH="$1"
else
RESOURCE_PATH="${PODS_ROOT}/$1"
fi
if [[ ! -e "$RESOURCE_PATH" ]] ; then
cat << EOM
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
EOM
exit 1
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.framework)
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*.xcdatamodel)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
;;
*.xcdatamodeld)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
;;
*.xcmappingmodel)
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
;;
*.xcassets)
ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
*)
echo "$RESOURCE_PATH" || true
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
;;
esac
}
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do
if [[ $line != "${PODS_ROOT}*" ]]; then
XCASSET_FILES+=("$line")
fi
done <<<"$OTHER_XCASSETS"
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_WhatsOpenKitVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_WhatsOpenKitVersionString[];
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm" "${PODS_CONFIGURATION_BUILD_DIR}/Realm" "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm/ObjectMapper_Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Realm/Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift/RealmSwift.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "ObjectMapper" -framework "ObjectMapper_Realm" -framework "Realm" -framework "RealmSwift"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm" "${PODS_CONFIGURATION_BUILD_DIR}/Realm" "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm/ObjectMapper_Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Realm/Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift/RealmSwift.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "ObjectMapper" -framework "ObjectMapper_Realm" -framework "Realm" -framework "RealmSwift"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
framework module Pods_WhatsOpenKit {
umbrella header "Pods-WhatsOpenKit-umbrella.h"
export *
module * { export * }
}
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm" "${PODS_CONFIGURATION_BUILD_DIR}/Realm" "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper+Realm/ObjectMapper_Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Realm/Realm.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift/RealmSwift.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -framework "ObjectMapper" -framework "ObjectMapper_Realm" -framework "Realm" -framework "RealmSwift"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
......@@ -12,25 +12,25 @@ import RealmSwift
//This may be a stupid way to handle filters, but it should work; at least for now
public class WOKFilters {
var showOpen = true
var showClosed = true
var sortBy = SortMethod.alphabetical
var openFirst = true
public var showOpen = true
public var showClosed = true
public var sortBy = WOKSortMethod.alphabetical
public var openFirst = true
var showAlerts = ["Informational":true, "Minor Alerts":true, "Major Alerts":true]
public var showAlerts = ["Informational":true, "Minor Alerts":true, "Major Alerts":true]
var onlyFromLocations = [String: Bool]() // Locations to show, could simply use Location objects instead if you wanted
var onlyFromCategories = [String: Bool]() // same as above, but for Categories, not Locations
var onlyFromCampuses = [String: Bool]() // and for campuses
public var onlyFromLocations = [String: Bool]() // Locations to show, could simply use Location objects instead if you wanted
public var onlyFromCategories = [String: Bool]() // same as above, but for Categories, not Locations
public var onlyFromCampuses = [String: Bool]() // and for campuses
init() {
public init() {
//nothing to do here
}
func applyFiltersOnFacilities(_ facilities: List<Facility>) -> List<Facility> {
public func applyFiltersOnFacilities(_ facilities: List<WOKFacility>) -> List<WOKFacility> {
//TODO: Add checks for onlyFromLocations and onlyFromCategories here before doing the rest
let specifiedFacilities = List<Facility>()
let specifiedFacilities = List<WOKFacility>()
// facility must be within both a specified location and category
for f in facilities {
if onlyFromLocations[(f.facilityLocation?.building)!.lowercased()] == true && onlyFromCategories[(f.category?.categoryName)!.lowercased()] == true {
......@@ -44,7 +44,7 @@ public class WOKFilters {
switch sortBy {
case .alphabetical:
if(openFirst) {
var returning = List<Facility>()
var returning = List<WOKFacility>()
if(showOpen) {
returning += sortAlphabetically(open)
}
......@@ -64,12 +64,12 @@ public class WOKFilters {
return sortAlphabetically(closed)
}
else {
return List<Facility>()
return List<WOKFacility>()
}
}
case .reverseAlphabetical:
if(openFirst) {
var returning = List<Facility>()
var returning = List<WOKFacility>()
if(showOpen) {
returning += sortAlphabetically(open, reverse: true)
}
......@@ -89,12 +89,12 @@ public class WOKFilters {
return sortAlphabetically(closed, reverse: true)
}
else {
return List<Facility>()
return List<WOKFacility>()
}
}
case .byLocation:
if(openFirst) {
var returning = List<Facility>()
var returning = List<WOKFacility>()
if(showOpen) {
returning += sortByLocation(open)
}
......@@ -114,23 +114,23 @@ public class WOKFilters {
return sortByLocation(closed)
}
else {
return List<Facility>()
return List<WOKFacility>()
}
}
}
}
// Takes in array of Facilities, separates them into those open and closed, returning a tuple of 2 arrays
private func separateOpenAndClosed(_ facilities: List<Facility>) -> (open: List<Facility>, closed: List<Facility>) {
let open = List<Facility>()
let closed = List<Facility>()
private func separateOpenAndClosed(_ facilities: List<WOKFacility>) -> (open: List<WOKFacility>, closed: List<WOKFacility>) {
let open = List<WOKFacility>()
let closed = List<WOKFacility>()
/*
facilities.forEach {
Utilities.isOpen(facility: $0) ? open.append($0) : closed.append($0)
}
*/
for facility in facilities {
if Utilities.isOpen(facility: facility) {
if WOKUtilities.isOpen(facility: facility) {
open.append(facility)
}
else {
......@@ -142,7 +142,7 @@ public class WOKFilters {
//TODO
// Sorts items in the given Facility array by name alphabetically (reverse if told)
private func sortAlphabetically(_ facilities: List<Facility>, reverse: Bool = false) -> List<Facility> {
private func sortAlphabetically(_ facilities: List<WOKFacility>, reverse: Bool = false) -> List<WOKFacility> {
// Convert to a swift array because the realm sorting method crashes the list object for some reason?
var facilitiesArray = facilities.asArray()
if !reverse {
......@@ -157,7 +157,7 @@ public class WOKFilters {
//TODO
// Sorts Facilities by their given location's name, and within those sorts A->Z
private func sortByLocation(_ facilities: List<Facility>) -> List<Facility> {
private func sortByLocation(_ facilities: List<WOKFacility>) -> List<WOKFacility> {
var facilitiesArray = facilities.asArray()
facilitiesArray.sort { (facility, nextFacility) in
guard let location = facility.facilityLocation else { return true }
......@@ -167,22 +167,22 @@ public class WOKFilters {
return facilitiesArray.asRealmList()
}
func setShowOpen(_ to: Bool) -> Bool {
public func setShowOpen(_ to: Bool) -> Bool {
showOpen = to
return true
}
func setShowClosed(_ to: Bool) -> Bool {
public func setShowClosed(_ to: Bool) -> Bool {
showClosed = to
return true
}
func setOpenFirst(_ to: Bool) -> Bool {
public func setOpenFirst(_ to: Bool) -> Bool {
openFirst = to
return true
}
func setCategory(_ category: String?, to: Bool) -> Bool{
public func setCategory(_ category: String?, to: Bool) -> Bool{
if(category != nil) {
onlyFromCategories[category!] = to
return true
......@@ -192,7 +192,7 @@ public class WOKFilters {
}
}
func setLocation(_ location: String?, to: Bool) -> Bool{
public func setLocation(_ location: String?, to: Bool) -> Bool{
if(location != nil) {
onlyFromLocations[location!] = to
return true
......@@ -206,21 +206,21 @@ public class WOKFilters {
}
//Is this a viable way to do this?
enum SortMethod {
case alphabetical //A -> Z
case reverseAlphabetical //Z -> A
case byLocation // A -> Z Locations, w/ A -> Z Facilities inside
public enum WOKSortMethod {
case alphabetical //A -> Z
case reverseAlphabetical //Z -> A
case byLocation // A -> Z Locations, w/ A -> Z Facilities inside
//case openLongest //Places things open longest on top; if only showing closed, shows opening soonest
//case openShortest //Places things closing soonest on top; if only showing closed, shows opening furthest from now
static var count = 3 // REMEMBER TO CHANGE THIS IF YOU ADD MORE CASES
public static var count = 3 // REMEMBER TO CHANGE THIS IF YOU ADD MORE CASES
//We should figure out how we want to allow sorting
}
extension Array where Element: RealmCollectionValue {
public extension Array where Element: RealmCollectionValue {
func asRealmList() -> List<Element> {
return self.reduce(into: List<Element>()) { (list, element) in
list.append(element)
......@@ -228,7 +228,7 @@ extension Array where Element: RealmCollectionValue {
}
}
extension List {
public extension List {
func asArray() -> [Element] {
return self.reduce(into: [Element]()) { (array, element) in
array.append(element)
......
......@@ -7,12 +7,13 @@
//
import UIKit
import WhatsOpenKit
class AlertCollectionViewCell: UICollectionViewCell {
@IBOutlet var imageView: UIImageView!
@IBOutlet var messageLabel: UILabel!
var alert: Alert!
var alert: WOKAlert!
internal let tapRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
......
......@@ -8,13 +8,14 @@
import UIKit
import QuartzCore
import WhatsOpenKit
class FacilityCollectionViewCell: UICollectionViewCell {
@IBOutlet var nameLabel: UILabel!
@IBOutlet var timeDescriptionLabel: UILabel!
@IBOutlet var openClosedLabel: PaddedUILabel!
@IBOutlet var categoryLabel: UILabel!
var facility: Facility!
var facility: WOKFacility!
internal let tapRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
override func awakeFromNib() {
......
......@@ -8,12 +8,13 @@
import UIKit
import MapKit
import WhatsOpenKit
class DetailViewButtonsViewController: UIViewController {
@IBOutlet var facilityDetailView: UIView!
var detailViewController: FacilityDetailViewController?
var facility: Facility!
var facility: WOKFacility!
@IBOutlet var favoritesButton: UIButton!
@IBOutlet var directionsButton: UIButton!
......@@ -26,11 +27,11 @@ class DetailViewButtonsViewController: UIViewController {
removes from favorites if it is a favorite.
*/
@IBAction func setFavButton(_ sender: Any) {
if(Utilities.isFavoriteFacility(facility)) { // if the facility is a favorite
_ = Utilities.removeFavoriteFacility(facility) // remove it from favorites
if(WOKUtilities.isFavoriteFacility(facility)) { // if the facility is a favorite
_ = WOKUtilities.removeFavoriteFacility(facility) // remove it from favorites
}
else { // else add it to favorites
_ = Utilities.addFavoriteFacility(facility)
_ = WOKUtilities.addFavoriteFacility(facility)
}
setFavoriteButtonText()
}
......@@ -66,7 +67,7 @@ class DetailViewButtonsViewController: UIViewController {
@IBAction func shareFacility(_ sender: Any) {
let str = "\(facility.facilityName) is \(Utilities.openOrClosedUntil(facility)!.lowercased())"
let str = "\(facility.facilityName) is \(WOKUtilities.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)
......@@ -76,7 +77,7 @@ class DetailViewButtonsViewController: UIViewController {
Change the favorite button text depending on if the facility is a favorite
*/
func setFavoriteButtonText() {
if(Utilities.isFavoriteFacility(facility)) {
if(WOKUtilities.isFavoriteFacility(facility)) {
favoritesButton.setTitle("Remove from Favorites", for: .normal)
favoritesButton.titleLabel?.text = "Remove from Favorites"
}
......
......@@ -8,6 +8,7 @@
import UIKit
import RealmSwift
import WhatsOpenKit
class FiltersTableViewController: UITableViewController {
......@@ -39,8 +40,8 @@ class FiltersTableViewController: UITableViewController {
tableView.reloadData()
updateFacilities()
}
var filters: Filters!
var facilities: List<Facility>!
var filters: WOKFilters!
var facilities: List<WOKFacility>!
//var allLocations: [Locations] = [Locations]()
//var allCategories: [Categories]! = [Categories]()
......@@ -100,7 +101,7 @@ class FiltersTableViewController: UITableViewController {
case 1:
return 1
case 2:
return SortMethod.count
return WOKSortMethod.count
case 3:
return 2
default:
......@@ -162,20 +163,20 @@ class FiltersTableViewController: UITableViewController {
}
return cell
case 2:
let method: SortMethod
let method: WOKSortMethod
let cellText: String
switch indexPath.row {
case 0:
method = SortMethod.alphabetical
method = WOKSortMethod.alphabetical
cellText = "Alphabetically (A-Z)"
case 1:
method = SortMethod.reverseAlphabetical
method = WOKSortMethod.reverseAlphabetical
cellText = "Reverse Alphabetically (Z-A)"
case 2:
method = SortMethod.byLocation
method = WOKSortMethod.byLocation
cellText = "By Location Name (A-Z)"
default:
method = SortMethod.alphabetical
method = WOKSortMethod.alphabetical
cellText = "Alphabetically (A-Z)"
}
let cell: CheckingTableViewCell
......@@ -260,7 +261,7 @@ class FiltersTableViewController: UITableViewController {
}
func onlyCheckOne(_ method: Any?) -> Bool {
filters.sortBy = method as! SortMethod // Be careful when calling this
filters.sortBy = method as! WOKSortMethod // Be careful when calling this
tableView.reloadData()
return true
}
......
......@@ -7,13 +7,14 @@
//
import UIKit
import WhatsOpenKit
class AlertDetailViewController: UIViewController {
@IBOutlet var imageView: UIImageView!