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
95497c7a
Unverified
Commit
95497c7a
authored
Jun 30, 2018
by
Zach Knox
Browse files
oops didn't commit these like a week ago
parent
80192890
Changes
3
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen - AppStore.entitlements
View file @
95497c7a
...
...
@@ -3,6 +3,8 @@
<plist
version=
"1.0"
>
<dict>
<key>
com.apple.developer.associated-domains
</key>
<array/>
<array>
<string>
applinks:whatsopen.gmu.io
</string>
</array>
</dict>
</plist>
WhatsOpen/WhatsOpen/Info.plist
View file @
95497c7a
...
...
@@ -23,7 +23,7 @@
<key>
CFBundleShortVersionString
</key>
<string>
1.1
</string>
<key>
CFBundleVersion
</key>
<string>
3
3
</string>
<string>
3
6
</string>
<key>
Fabric
</key>
<dict>
<key>
APIKey
</key>
...
...
WhatsOpen/WhatsOpen/Views/Primary Views/FacilitiesListViewController.swift
View file @
95497c7a
...
...
@@ -180,40 +180,46 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
var
goodToGo
=
false
@objc
func
toDetailFromSearch
(
_
notification
:
Notification
)
{
let
dest
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"detailView"
)
as!
FacilityDetailViewController
let
userActivity
=
notification
.
object
as?
NSUserActivity
if
(
userActivity
==
nil
)
{
return
// don't do anything
}
while
(
facilitiesArray
.
count
==
0
)
{
// because I'm too lazy to have the downloader post a notification here
sleep
(
1
)
}
let
facility
=
facilitiesArray
.
filter
(
NSPredicate
(
format
:
"facilityName = '"
+
(
userActivity
?
.
title
)
!
+
"'"
))
.
first
if
(
facility
==
nil
)
{
return
// don't do anything
func
toDetailCompletion
()
{
let
dest
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"detailView"
)
as!
FacilityDetailViewController
let
userActivity
=
notification
.
object
as?
NSUserActivity
if
(
userActivity
==
nil
)
{
return
// don't do anything
}
let
facility
=
realm
.
objects
(
FacilitiesModel
.
self
)[
0
]
.
facilities
.
filter
(
NSPredicate
(
format
:
"facilityName = '"
+
(
userActivity
?
.
title
)
!
+
"'"
))
.
first
if
(
facility
==
nil
)
{
return
// don't do anything
}
dest
.
facility
=
facility
!
let
detailViewWithButtons
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"detailViewButtons"
)
as?
DetailViewButtonsViewController
detailViewWithButtons
?
.
detailViewController
=
dest
detailViewWithButtons
?
.
facility
=
dest
.
facility
let
buttonDest
=
detailViewWithButtons
!
let
finalDestination
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"pulling"
)
as?
PullingViewController
// Fox only, no items
finalDestination
?
.
currentViewController
=
buttonDest
let
destDelegate
=
DeckTransitioningDelegate
(
isSwipeToDismissEnabled
:
true
,
dismissCompletion
:
begForReviews
)
finalDestination
?
.
modalPresentationStyle
=
.
custom
finalDestination
?
.
transitioningDelegate
=
destDelegate
// present the detail view over the search controller if we're searching
if
searchController
.
isActive
{
searchController
.
present
(
finalDestination
!
,
animated
:
true
,
completion
:
nil
)
}
else
{
present
(
finalDestination
!
,
animated
:
true
,
completion
:
nil
)
}
}
dest
.
facility
=
facility
!
let
detailViewWithButtons
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"detailViewButtons"
)
as?
DetailViewButtonsViewController
detailViewWithButtons
?
.
detailViewController
=
dest
detailViewWithButtons
?
.
facility
=
dest
.
facility
let
buttonDest
=
detailViewWithButtons
!
let
finalDestination
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"pulling"
)
as?
PullingViewController
// Fox only, no items
finalDestination
?
.
currentViewController
=
buttonDest
let
destDelegate
=
DeckTransitioningDelegate
(
isSwipeToDismissEnabled
:
true
,
dismissCompletion
:
begForReviews
)
finalDestination
?
.
modalPresentationStyle
=
.
custom
finalDestination
?
.
transitioningDelegate
=
destDelegate
// present the detail view over the search controller if we're searching
if
searchController
.
isActive
{
searchController
.
present
(
finalDestination
!
,
animated
:
true
,
completion
:
nil
)
}
else
{
present
(
finalDestination
!
,
animated
:
true
,
completion
:
nil
)
if
(
goodToGo
)
{
toDetailCompletion
()
}
else
{
sleep
(
1
)
update
(
notification
,
completion
:
toDetailCompletion
)
}
}
func
presentDetailView
(
_
destination
:
UIViewController
,
tapped
:
UICollectionViewCell
)
{
var
trueDest
:
UIViewController
...
...
@@ -469,13 +475,15 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
let
alerts
=
model
.
alerts
let
lastUpdated
=
model
.
lastUpdated
if
((
facilities
.
isEmpty
&&
alerts
.
isEmpty
)
||
lastUpdated
.
isLessThanDate
(
dateToCompare
:
Date
(
timeIntervalSinceNow
:
-
43200.0
)))
{
if
((
facilities
.
isEmpty
&&
alerts
.
isEmpty
)
||
lastUpdated
.
isLessThanDate
(
dateToCompare
:
Date
(
timeIntervalSinceNow
:
-
43200.0
)))
{
update
(
sender
)
}
else
{
facilitiesArray
=
facilities
alertsList
=
alerts
self
.
refreshControl
.
attributedTitle
=
NSAttributedString
(
string
:
"Last Updated: "
+
self
.
shortDateFormat
(
lastUpdated
))
goodToGo
=
true
}
}
else
{
...
...
@@ -513,7 +521,7 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
* Attempts to update facilitiesArray from the network
* and place that new information into Realm
*/
func
update
(
_
sender
:
Any
)
{
func
update
(
_
sender
:
Any
,
completion
:
(()
->
())?
=
nil
)
{
DownloadController
.
performDownload
{
(
facilities
)
in
if
(
facilities
==
nil
)
{
DispatchQueue
.
main
.
async
{
...
...
@@ -528,6 +536,10 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
self
.
reloadWithFilters
()
self
.
refreshControl
.
attributedTitle
=
NSAttributedString
(
string
:
"Last Updated: "
+
self
.
shortDateFormat
(
lastUpdated
))
self
.
refreshControl
.
endRefreshing
()
self
.
goodToGo
=
true
if
(
completion
!=
nil
)
{
completion
!
()
}
}
else
{
self
.
facilitiesArray
=
List
<
Facility
>
()
...
...
@@ -551,6 +563,10 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
try!
self
.
realm
.
write
{
self
.
realm
.
add
(
model
)
}
self
.
goodToGo
=
true
if
(
completion
!=
nil
)
{
completion
!
()
}
}
else
{
let
fromRealm
=
results
[
0
]
...
...
@@ -565,6 +581,10 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
self
.
updateFiltersLists
()
self
.
reloadWithFilters
()
self
.
refreshControl
.
endRefreshing
()
self
.
goodToGo
=
true
if
(
completion
!=
nil
)
{
completion
!
()
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment