Commit b4898327 authored by Jose Blaya's avatar Jose Blaya
Browse files

Add pull to refresh action to update the latency value for the available servers

parent 46bbab98
This diff is collapsed.
......@@ -17,11 +17,12 @@ class RegionsViewController: AutolayoutViewController {
}
@IBOutlet private weak var tableView: UITableView!
private var servers: [Server] = []
private var filteredServers = [Server]()
private var selectedServer: Server!
private var refreshControl = UIRefreshControl()
let searchController = UISearchController(searchResultsController: nil)
deinit {
......@@ -53,8 +54,24 @@ class RegionsViewController: AutolayoutViewController {
tableView.emptyDataSetSource = self
tableView.emptyDataSetDelegate = self
setupPullToRefresh()
}
private func setupPullToRefresh() {
refreshControl.addTarget(self, action: #selector(refreshLatency), for: .valueChanged)
tableView.addSubview(refreshControl)
}
@objc func refreshLatency(_ sender: Any) {
Client.ping(servers: self.servers)
refreshControl.endRefreshing()
Macros.dispatch(after: .milliseconds(400)) { [weak self] in
self?.filterServers()
}
}
private func setupRightBarButton() {
navigationItem.rightBarButtonItem = UIBarButtonItem(
image: Asset.Piax.Global.iconFilter.image,
......@@ -218,6 +235,7 @@ class RegionsViewController: AutolayoutViewController {
Theme.current.applyRegionSolidLightBackground(tableView)
Theme.current.applyDividerToSeparator(tableView)
Theme.current.applySearchBarStyle(searchController.searchBar)
Theme.current.applyRefreshControlStyle(refreshControl)
let bgView = UIView()
bgView.backgroundColor = .clear
......
......@@ -56,7 +56,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('2459561')
library_by_git('def6db7')
#library_by_version('~> 1.1.3')
end
......
......@@ -114,10 +114,10 @@ DEPENDENCIES:
- FXPageControl
- HockeySDK
- iRate
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `2459561`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `2459561`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `2459561`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `2459561`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `def6db7`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `def6db7`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `def6db7`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `def6db7`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `257296c`)
- PopupDialog
- SideMenu (= 3.1.5)
......@@ -154,7 +154,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: '2459561'
:commit: def6db7
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -162,7 +162,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: '2459561'
:commit: def6db7
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 257296c
......@@ -198,6 +198,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: 197ae73cb4566720d7596d95200052a08a02535a
PODFILE CHECKSUM: 53b9dc714b3c7fedf37ec60de615cbf8539877ec
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