Commit 01c7112a authored by Jose Blaya's avatar Jose Blaya
Browse files

Show No Results image when filtered servers array is empty

parent 531f4e22
This diff is collapsed.
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "group4Copy2.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "group2Copy.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
import UIKit
import PIALibrary
import DZNEmptyDataSet
class RegionsViewController: AutolayoutViewController {
private struct Cells {
......@@ -40,6 +41,9 @@ class RegionsViewController: AutolayoutViewController {
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
setupSearchBarController()
tableView.emptyDataSetSource = self
tableView.emptyDataSetDelegate = self
}
private func setupSearchBarController() {
......@@ -202,3 +206,22 @@ extension RegionsViewController: UISearchResultsUpdating {
return searchController.isActive && !searchBarIsEmpty()
}
}
extension RegionsViewController: DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! {
return Theme.current.noResultsImage()
}
func emptyDataSetWillAppear(_ scrollView: UIScrollView!) {
tableView.separatorStyle = .none
}
func emptyDataSetWillDisappear(_ scrollView: UIScrollView!) {
tableView.separatorStyle = .singleLine
}
func emptyDataSet(_ scrollView: UIScrollView!, didTap view: UIView!) {
searchController.searchBar.resignFirstResponder()
}
}
......@@ -59,6 +59,10 @@ enum Asset {
static let scrollableMapDark = ImageAsset(name: "scrollableMap-dark")
static let scrollableMapLight = ImageAsset(name: "scrollableMap-light")
}
enum Regions {
static let noResultsDark = ImageAsset(name: "no-results-dark")
static let noResultsLight = ImageAsset(name: "no-results-light")
}
enum Splash {
static let darkSplash = ImageAsset(name: "dark-splash")
static let lightSplash = ImageAsset(name: "light-splash")
......@@ -332,6 +336,8 @@ enum Asset {
Piax.Global.regionSelected,
Piax.Global.scrollableMapDark,
Piax.Global.scrollableMapLight,
Piax.Regions.noResultsDark,
Piax.Regions.noResultsLight,
Piax.Splash.darkSplash,
Piax.Splash.lightSplash,
accessoryExpire,
......
......@@ -154,4 +154,10 @@ extension Theme {
}
}
public func noResultsImage() -> UIImage {
return palette.appearance == .dark ?
Asset.Piax.Regions.noResultsDark.image :
Asset.Piax.Regions.noResultsLight.image
}
}
......@@ -64,6 +64,7 @@ def app_pods
pod 'SideMenu', '= 3.1.5'
pod 'FXPageControl'
pod 'MBProgressHUD'
pod 'DZNEmptyDataSet'
end
def tunnel_pods
......
......@@ -4,6 +4,7 @@ PODS:
- Alamofire (~> 4.7)
- Crashlytics (3.11.1):
- Fabric (~> 1.8.1)
- DZNEmptyDataSet (1.8.1)
- Fabric (1.8.1)
- Firebase/Core (5.11.0):
- Firebase/CoreOnly
......@@ -104,6 +105,7 @@ PODS:
DEPENDENCIES:
- AlamofireImage
- Crashlytics
- DZNEmptyDataSet
- Fabric
- Firebase/Core
- FXPageControl
......@@ -123,6 +125,7 @@ SPEC REPOS:
- Alamofire
- AlamofireImage
- Crashlytics
- DZNEmptyDataSet
- Fabric
- Firebase
- FirebaseAnalytics
......@@ -155,6 +158,7 @@ SPEC CHECKSUMS:
Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568
AlamofireImage: 78d67ccbb763d87ba44b21583d2153500a195630
Crashlytics: ca7ab4bc304aa216bdc2e4c1a96389ee77252203
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
Fabric: 43ed7bac010f588f63ee23ab1a0276b296db5e17
Firebase: b48f9e653da971ecce5b8c749684bc8bb2d26bd3
FirebaseAnalytics: 63202d2665de4e6adcbdce189135255d8b5962ba
......@@ -179,6 +183,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: 3e857e96f910e963b7a2a6ed0f4b0968875616f1
PODFILE CHECKSUM: 9e29df2214344b5d516bad51a27ea901dccf51fe
COCOAPODS: 1.5.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment