Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-ios
Commits
cf60071c
Unverified
Commit
cf60071c
authored
Sep 29, 2018
by
Zach Knox
Browse files
Successfully moved backend files into framework, and changed all references to the relevant files
parent
b96c1aed
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/Podfile
View file @
cf60071c
...
...
@@ -4,14 +4,16 @@
platform
:ios
,
'11.0'
use_frameworks!
def
i
os
_pods
def
i
mportant
_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
|
...
...
WhatsOpen/Podfile.lock
View file @
cf60071c
...
...
@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM:
f77678c4bb98cdb953f0eb4226354e2455803d42
PODFILE CHECKSUM:
e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0
WhatsOpen/Pods/Manifest.lock
View file @
cf60071c
...
...
@@ -40,6 +40,6 @@ SPEC CHECKSUMS:
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
PODFILE CHECKSUM:
f77678c4bb98cdb953f0eb4226354e2455803d42
PODFILE CHECKSUM:
e1ae138745b0d518c7488e802643bd623dfb68f1
COCOAPODS: 1.4.0
WhatsOpen/Pods/Pods.xcodeproj/project.pbxproj
View file @
cf60071c
This diff is collapsed.
Click to expand it.
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Info.plist
0 → 100644
View file @
cf60071c
<?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>
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit-acknowledgements.markdown
0 → 100644
View file @
cf60071c
This diff is collapsed.
Click to expand it.
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit-acknowledgements.plist
0 → 100644
View file @
cf60071c
This diff is collapsed.
Click to expand it.
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit-dummy.m
0 → 100644
View file @
cf60071c
#import <Foundation/Foundation.h>
@interface
PodsDummy_Pods_WhatsOpenKit
:
NSObject
@end
@implementation
PodsDummy_Pods_WhatsOpenKit
@end
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit-resources.sh
0 → 100755
View file @
cf60071c
#!/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
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit-umbrella.h
0 → 100644
View file @
cf60071c
#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
[];
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit.app store.xcconfig
0 → 100644
View file @
cf60071c
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
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit.debug.xcconfig
0 → 100644
View file @
cf60071c
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
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit.modulemap
0 → 100644
View file @
cf60071c
framework module Pods_WhatsOpenKit {
umbrella header "Pods-WhatsOpenKit-umbrella.h"
export *
module * { export * }
}
WhatsOpen/Pods/Target Support Files/Pods-WhatsOpenKit/Pods-WhatsOpenKit.release.xcconfig
0 → 100644
View file @
cf60071c
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
WhatsOpen/WhatsOpen.xcodeproj/project.pbxproj
View file @
cf60071c
This diff is collapsed.
Click to expand it.
WhatsOpen/WhatsOpen/Filters.swift
View file @
cf60071c
...
...
@@ -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
=
WOK
SortMethod
.
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
<
WOK
Facility
>
)
->
List
<
WOK
Facility
>
{
//TODO: Add checks for onlyFromLocations and onlyFromCategories here before doing the rest
let
specifiedFacilities
=
List
<
Facility
>
()
let
specifiedFacilities
=
List
<
WOK
Facility
>
()
// 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
<
WOK
Facility
>
()
if
(
showOpen
)
{
returning
+=
sortAlphabetically
(
open
)
}
...
...
@@ -64,12 +64,12 @@ public class WOKFilters {
return
sortAlphabetically
(
closed
)
}
else
{
return
List
<
Facility
>
()
return
List
<
WOK
Facility
>
()
}
}
case
.
reverseAlphabetical
:
if
(
openFirst
)
{
var
returning
=
List
<
Facility
>
()
var
returning
=
List
<
WOK
Facility
>
()
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
<
WOK
Facility
>
()
}
}
case
.
byLocation
:
if
(
openFirst
)
{
var
returning
=
List
<
Facility
>
()
var
returning
=
List
<
WOK
Facility
>
()
if
(
showOpen
)
{
returning
+=
sortByLocation
(
open
)
}
...
...
@@ -114,23 +114,23 @@ public class WOKFilters {
return
sortByLocation
(
closed
)
}
else
{
return
List
<
Facility
>
()
return
List
<
WOK
Facility
>
()
}
}
}
}
// 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
<
WOK
Facility
>
)
->
(
open
:
List
<
WOK
Facility
>
,
closed
:
List
<
WOK
Facility
>
)
{
let
open
=
List
<
WOK
Facility
>
()
let
closed
=
List
<
WOK
Facility
>
()
/*
facilities.forEach {
Utilities.isOpen(facility: $0) ? open.append($0) : closed.append($0)
}
*/
for
facility
in
facilities
{
if
Utilities
.
isOpen
(
facility
:
facility
)
{
if
WOK
Utilities
.
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
<
WOK
Facility
>
,
reverse
:
Bool
=
false
)
->
List
<
WOK
Facility
>
{
// 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
<
WOK
Facility
>
)
->
List
<
WOK
Facility
>
{
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
WOK
SortMethod
{
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
)
...
...
WhatsOpen/WhatsOpen/Views/CollectionViewCells/AlertCollectionViewCell.swift
View file @
cf60071c
...
...
@@ -7,12 +7,13 @@
//
import
UIKit
import
WhatsOpenKit
class
AlertCollectionViewCell
:
UICollectionViewCell
{
@IBOutlet
var
imageView
:
UIImageView
!
@IBOutlet
var
messageLabel
:
UILabel
!
var
alert
:
Alert
!
var
alert
:
WOK
Alert
!
internal
let
tapRecognizer
:
UITapGestureRecognizer
=
UITapGestureRecognizer
()
...
...
WhatsOpen/WhatsOpen/Views/CollectionViewCells/FacilityCollectionViewCell.swift
View file @
cf60071c
...
...
@@ -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
:
WOK
Facility
!
internal
let
tapRecognizer
:
UITapGestureRecognizer
=
UITapGestureRecognizer
()
override
func
awakeFromNib
()
{
...
...
WhatsOpen/WhatsOpen/Views/DetailViewButtonsViewController.swift
View file @
cf60071c
...
...
@@ -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
:
WOK
Facility
!
@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
(
WOK
Utilities
.
isFavoriteFacility
(
facility
))
{
// if the facility is a favorite
_
=
WOK
Utilities
.
removeFavoriteFacility
(
facility
)
// remove it from favorites
}
else
{
// else add it to favorites
_
=
Utilities
.
addFavoriteFacility
(
facility
)
_
=
WOK
Utilities
.
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
\(
WOK
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
)
...
...
@@ -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
(
WOK
Utilities
.
isFavoriteFacility
(
facility
))
{
favoritesButton
.
setTitle
(
"Remove from Favorites"
,
for
:
.
normal
)
favoritesButton
.
titleLabel
?
.
text
=
"Remove from Favorites"
}
...
...
WhatsOpen/WhatsOpen/Views/Filters Views/FiltersTableViewController.swift
View file @
cf60071c
...
...
@@ -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
:
WOK
Filters
!
var
facilities
:
List
<
WOK
Facility
>!
//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
WOK
SortMethod
.
count
case
3
:
return
2
default
:
...
...
@@ -162,20 +163,20 @@ class FiltersTableViewController: UITableViewController {
}
return
cell
case
2
:
let
method
:
SortMethod
let
method
:
WOK
SortMethod
let
cellText
:
String
switch
indexPath
.
row
{
case
0
:
method
=
SortMethod
.
alphabetical
method
=
WOK
SortMethod
.
alphabetical
cellText
=
"Alphabetically (A-Z)"
case
1
:
method
=
SortMethod
.
reverseAlphabetical
method
=
WOK
SortMethod
.
reverseAlphabetical
cellText
=
"Reverse Alphabetically (Z-A)"
case
2
:
method
=
SortMethod
.
byLocation
method
=
WOK
SortMethod
.
byLocation
cellText
=
"By Location Name (A-Z)"