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

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

parent b96c1aed
...@@ -4,14 +4,16 @@ ...@@ -4,14 +4,16 @@
platform :ios, '11.0' platform :ios, '11.0'
use_frameworks! use_frameworks!
def ios_pods def important_pods
pod 'RealmSwift' pod 'RealmSwift'
#pod 'ObjectMapper', '~> 3.2' #pod 'ObjectMapper', '~> 3.2'
# TEMPORARY BECAUSE Xcode 10 # TEMPORARY BECAUSE Xcode 10
pod 'ObjectMapper', :git => 'https://github.com/alecdoconnor/ObjectMapper.git', :branch => 'Swift-4.2' pod 'ObjectMapper', :git => 'https://github.com/alecdoconnor/ObjectMapper.git', :branch => 'Swift-4.2'
pod "ObjectMapper+Realm" pod "ObjectMapper+Realm"
end
def ios_pods
#pod 'Segmentio', '~> 2.1' #pod 'Segmentio', '~> 2.1'
pod 'DeckTransition', '~> 2.0' pod 'DeckTransition', '~> 2.0'
...@@ -22,13 +24,18 @@ end ...@@ -22,13 +24,18 @@ end
target 'WhatsOpen' do target 'WhatsOpen' do
important_pods
ios_pods ios_pods
end end
target 'WhatsOpen - AppStore' do target 'WhatsOpen - AppStore' do
important_pods
ios_pods ios_pods
end end
target 'WhatsOpenKit' do
important_pods
end
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
......
...@@ -40,6 +40,6 @@ SPEC CHECKSUMS: ...@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5 Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM: f77678c4bb98cdb953f0eb4226354e2455803d42 PODFILE CHECKSUM: e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0 COCOAPODS: 1.4.0
...@@ -40,6 +40,6 @@ SPEC CHECKSUMS: ...@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5 Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM: f77678c4bb98cdb953f0eb4226354e2455803d42 PODFILE CHECKSUM: e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0 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 ...@@ -12,25 +12,25 @@ import RealmSwift
//This may be a stupid way to handle filters, but it should work; at least for now //This may be a stupid way to handle filters, but it should work; at least for now
public class WOKFilters { public class WOKFilters {
var showOpen = true public var showOpen = true
var showClosed = true public var showClosed = true
var sortBy = SortMethod.alphabetical public var sortBy = WOKSortMethod.alphabetical
var openFirst = true 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 public 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 public var onlyFromCategories = [String: Bool]() // same as above, but for Categories, not Locations
var onlyFromCampuses = [String: Bool]() // and for campuses public var onlyFromCampuses = [String: Bool]() // and for campuses
init() { public init() {
//nothing to do here //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 //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 // facility must be within both a specified location and category
for f in facilities { for f in facilities {
if onlyFromLocations[(f.facilityLocation?.building)!.lowercased()] == true && onlyFromCategories[(f.category?.categoryName)!.lowercased()] == true { if onlyFromLocations[(f.facilityLocation?.building)!.lowercased()] == true && onlyFromCategories[(f.category?.categoryName)!.lowercased()] == true {
...@@ -44,7 +44,7 @@ public class WOKFilters { ...@@ -44,7 +44,7 @@ public class WOKFilters {
switch sortBy { switch sortBy {
case .alphabetical: case .alphabetical:
if(openFirst) { if(openFirst) {
var returning = List<Facility>() var returning = List<WOKFacility>()
if(showOpen) { if(showOpen) {
returning += sortAlphabetically(open) returning += sortAlphabetically(open)
} }
...@@ -64,12 +64,12 @@ public class WOKFilters { ...@@ -64,12 +64,12 @@ public class WOKFilters {
return sortAlphabetically(closed) return sortAlphabetically(closed)
} }
else { else {
return List<Facility>() return List<WOKFacility>()
} }
} }
case .reverseAlphabetical: case .reverseAlphabetical:
if(openFirst) { if(openFirst) {
var returning = List<Facility>() var returning = List<WOKFacility>()
if(showOpen) { if(showOpen) {
returning += sortAlphabetically(open, reverse: true) returning += sortAlphabetically(open, reverse: true)
} }
...@@ -89,12 +89,12 @@ public class WOKFilters { ...@@ -89,12 +89,12 @@ public class WOKFilters {
return sortAlphabetically(closed, reverse: true) return sortAlphabetically(closed, reverse: true)
} }
else { else {
return List<Facility>() return List<WOKFacility>()
} }
} }
case .byLocation: case .byLocation:
if(openFirst) { if(openFirst) {
var returning = List<Facility>() var returning = List<WOKFacility>()
if(showOpen) { if(showOpen) {
returning += sortByLocation(open) returning += sortByLocation(open)
} }
...@@ -114,23 +114,23 @@ public class WOKFilters { ...@@ -114,23 +114,23 @@ public class WOKFilters {
return sortByLocation(closed) return sortByLocation(closed)
} }
else { 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 // 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>) { private func separateOpenAndClosed(_ facilities: List<WOKFacility>) -> (open: List<WOKFacility>, closed: List<WOKFacility>) {
let open = List<Facility>() let open = List<WOKFacility>()
let closed = List<Facility>() let closed = List<WOKFacility>()
/* /*
facilities.forEach { facilities.forEach {
Utilities.isOpen(facility: $0) ? open.append($0) : closed.append($0) Utilities.isOpen(facility: $0) ? open.append($0) : closed.append($0)
} }
*/ */
for facility in facilities { for facility in facilities {
if Utilities.isOpen(facility: facility) { if WOKUtilities.isOpen(facility: facility) {
open.append(facility) open.append(facility)
} }
else { else {
...@@ -142,7 +142,7 @@ public class WOKFilters { ...@@ -142,7 +142,7 @@ public class WOKFilters {
//TODO //TODO
// Sorts items in the given Facility array by name alphabetically (reverse if told) // 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? // Convert to a swift array because the realm sorting method crashes the list object for some reason?
var facilitiesArray = facilities.asArray() var facilitiesArray = facilities.asArray()
if !reverse { if !reverse {
...@@ -157,7 +157,7 @@ public class WOKFilters { ...@@ -157,7 +157,7 @@ public class WOKFilters {
//TODO //TODO
// Sorts Facilities by their given location's name, and within those sorts A->Z // 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() var facilitiesArray = facilities.asArray()
facilitiesArray.sort { (facility, nextFacility) in facilitiesArray.sort { (facility, nextFacility) in
guard let location = facility.facilityLocation else { return true } guard let location = facility.facilityLocation else { return true }
...@@ -167,22 +167,22 @@ public class WOKFilters { ...@@ -167,22 +167,22 @@ public class WOKFilters {
return facilitiesArray.asRealmList() return facilitiesArray.asRealmList()
} }
func setShowOpen(_ to: Bool) -> Bool { public func setShowOpen(_ to: Bool) -> Bool {
showOpen = to showOpen = to
return true return true
} }
func setShowClosed(_ to: Bool) -> Bool { public func setShowClosed(_ to: Bool) -> Bool {
showClosed = to showClosed = to
return true return true
} }
func setOpenFirst(_ to: Bool) -> Bool { public func setOpenFirst(_ to: Bool) -> Bool {
openFirst = to openFirst = to
return true return true
} }
func setCategory(_ category: String?, to: Bool) -> Bool{ public func setCategory(_ category: String?, to: Bool) -> Bool{
if(category != nil) { if(category != nil) {
onlyFromCategories[category!] = to onlyFromCategories[category!] = to
return true return true
...@@ -192,7 +192,7 @@ public class WOKFilters { ...@@ -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) { if(location != nil) {
onlyFromLocations[location!] = to onlyFromLocations[location!] = to
return true return true
...@@ -206,21 +206,21 @@ public class WOKFilters { ...@@ -206,21 +206,21 @@ public class WOKFilters {
} }
//Is this a viable way to do this? //Is this a viable way to do this?
enum SortMethod { public enum WOKSortMethod {
case alphabetical //A -> Z case alphabetical //A -> Z
case reverseAlphabetical //Z -> A case reverseAlphabetical //Z -> A
case byLocation // A -> Z Locations, w/ A -> Z Facilities inside 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 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 //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 //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> { func asRealmList() -> List<Element> {
return self.reduce(into: List<Element>()) { (list, element) in return self.reduce(into: List<Element>()) { (list, element) in
list.append(element) list.append(element)
...@@ -228,7 +228,7 @@ extension Array where Element: RealmCollectionValue { ...@@ -228,7 +228,7 @@ extension Array where Element: RealmCollectionValue {
} }
} }
extension List { public extension List {
func asArray() -> [Element] { func asArray() -> [Element] {
return self.reduce(into: [Element]()) { (array, element) in return self.reduce(into: [Element]()) { (array, element) in
array.append(element) array.append(element)
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
// //
import UIKit import UIKit
import WhatsOpenKit
class AlertCollectionViewCell: UICollectionViewCell { class AlertCollectionViewCell: UICollectionViewCell {
@IBOutlet var imageView: UIImageView! @IBOutlet var imageView: UIImageView!
@IBOutlet var messageLabel: UILabel!