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
0cfa1772
Commit
0cfa1772
authored
Feb 16, 2018
by
Zach Knox
Browse files
Merge branch 'ipad-filters-fix' into 'dev-0.0'
iPad Filters Fix See merge request
!25
parents
c663803d
6386ca1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
WhatsOpen/WhatsOpen/Views/FacilitiesListViewController.swift
View file @
0cfa1772
...
...
@@ -404,11 +404,10 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
}
}
updateFiltersLists
()
reloadWithFilters
()
refreshControl
.
endRefreshing
()
}
...
...
@@ -812,6 +811,9 @@ class FacilitiesListViewController: UIViewController, UICollectionViewDelegate,
let
filterView
=
destination
.
topViewController
as!
FiltersTableViewController
filterView
.
facilities
=
self
.
facilitiesArray
filterView
.
filters
=
self
.
filters
filterView
.
updateFacilities
=
{
[
weak
self
]
in
self
?
.
reloadWithFilters
()
}
}
// Pass the selected object to the new view controller.
...
...
WhatsOpen/WhatsOpen/Views/FilterSelectionTableViewController.swift
View file @
0cfa1772
...
...
@@ -14,6 +14,7 @@ class FilterSelectionTableViewController: UITableViewController {
var
getFunc
:
(()
->
[
String
:
Bool
])
!
var
selectFunc
:
((
String
,
Bool
)
->
Bool
)
!
var
selectAllFunc
:
(()
->
Bool
)
!
var
updateFacilities
:
(()
->
Void
)
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -96,6 +97,7 @@ class FilterSelectionTableViewController: UITableViewController {
_
=
selectFunc
((
tableCell
?
.
textLabel
?
.
text
)
!.
lowercased
(),
res
)
tableView
.
reloadData
()
}
updateFacilities
()
}
...
...
WhatsOpen/WhatsOpen/Views/FiltersTableViewController.swift
View file @
0cfa1772
...
...
@@ -11,6 +11,8 @@ import RealmSwift
class
FiltersTableViewController
:
UITableViewController
{
var
updateFacilities
:
(()
->
Void
)
!
override
var
preferredStatusBarStyle
:
UIStatusBarStyle
{
return
.
default
}
...
...
@@ -35,6 +37,7 @@ class FiltersTableViewController: UITableViewController {
filters
.
onlyFromCategories
=
c
filters
.
onlyFromLocations
=
l
tableView
.
reloadData
()
updateFacilities
()
}
var
filters
:
Filters
!
var
facilities
:
List
<
Facility
>!
...
...
@@ -52,6 +55,7 @@ class FiltersTableViewController: UITableViewController {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
tableView
.
estimatedRowHeight
=
50
tableView
.
rowHeight
=
UITableViewAutomaticDimension
/*
...
...
@@ -71,7 +75,11 @@ class FiltersTableViewController: UITableViewController {
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
super
.
viewWillDisappear
(
animated
)
updateFacilities
?()
}
override
func
didReceiveMemoryWarning
()
{
super
.
didReceiveMemoryWarning
()
// Dispose of any resources that can be recreated.
...
...
@@ -122,13 +130,21 @@ class FiltersTableViewController: UITableViewController {
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"Switching"
,
for
:
indexPath
)
as!
SwitchingTableViewCell
cell
.
textLabel
!.
text
=
"Show Open Locations"
cell
.
switchControl
.
isOn
=
filters
.
showOpen
cell
.
toggleFunc
=
updateOpenFirstEnabledState
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
updateOpenFirstEnabledState
(
isOn
)
self
.
updateFacilities
()
return
result
}
//self.showOpen = cell
case
1
:
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"Switching"
,
for
:
indexPath
)
as!
SwitchingTableViewCell
cell
.
textLabel
!.
text
=
"Show Closed Locations"
cell
.
switchControl
.
isOn
=
filters
.
showClosed
cell
.
toggleFunc
=
filters
.
setShowClosed
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
filters
.
setShowClosed
(
isOn
)
self
.
updateFacilities
()
return
result
}
//self.showClosed = cell
default
:
cell
=
UITableViewCell
()
as!
SwitchingTableViewCell
//this is bad don't let this happen
...
...
@@ -139,7 +155,11 @@ class FiltersTableViewController: UITableViewController {
cell
.
textLabel
!.
text
=
"Show Open Facilities First"
cell
.
switchControl
.
isEnabled
=
filters
.
showOpen
cell
.
switchControl
.
isOn
=
filters
.
openFirst
cell
.
toggleFunc
=
filters
.
setOpenFirst
cell
.
toggleFunc
=
{
[
unowned
self
]
isOn
in
let
result
=
self
.
filters
.
setOpenFirst
(
isOn
)
self
.
updateFacilities
()
return
result
}
return
cell
case
2
:
let
method
:
SortMethod
...
...
@@ -242,6 +262,7 @@ class FiltersTableViewController: UITableViewController {
let
cell
=
tableView
.
cellForRow
(
at
:
indexPath
)
cell
?
.
isSelected
=
false
updateFacilities
()
//nothing is selected forever
}
...
...
@@ -307,11 +328,12 @@ class FiltersTableViewController: UITableViewController {
if
(
segue
.
identifier
==
"toFilters"
)
{
let
destination
=
segue
.
destination
as!
FacilitiesListViewController
destination
.
filters
=
self
.
filters
updateFacilities
()
}
else
if
(
segue
.
identifier
==
"toSelection"
)
{
let
destination
=
segue
.
destination
as!
FilterSelectionTableViewController
destination
.
navigationItem
.
title
=
(
sender
as!
UITableViewCell
)
.
textLabel
?
.
text
!
destination
.
updateFacilities
=
updateFacilities
func
get
()
->
[
String
:
Bool
]
{
if
((
sender
as!
UITableViewCell
)
.
textLabel
?
.
text
!
==
"Categories"
)
{
...
...
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