Skip to content
Snippets Groups Projects
Commit 48e6988f authored by lazarog98's avatar lazarog98
Browse files

#238 remove ios version checks

parent 54e9ce5e
No related branches found
No related tags found
1 merge request!27Resolve "Improve searching"
...@@ -253,18 +253,22 @@ class InboxViewController: UITableViewController, InboxCellDelegator { ...@@ -253,18 +253,22 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
return searchController.isActive && !searchBarIsEmpty return searchController.isActive && !searchBarIsEmpty
} }
/// searches a given string with a delay so that the entire client doesn't lag if the inbox is very big /**
// TODO: Perhaps think of a better name searches a given string with a delay so that the entire client doesn't lag if the inbox is very big
- parameters:
- searchText: srtring to look for
- scope: where to search (look at _filterContentForSearchText)
*/
func startSearch(searchText: String, scope: Int = 0) { func startSearch(searchText: String, scope: Int = 0) {
if #available(iOS 10.0, *) { // check if a search has been scheduled already and stop it to prevent multiple searches
if let searchBarTimer: Timer = self.searchBarTimer { if let searchBarTimer: Timer = self.searchBarTimer {
searchBarTimer.invalidate() searchBarTimer.invalidate()
}
self.searchBarTimer = Timer.scheduledTimer(withTimeInterval: searchDelay, repeats: false, block: { _ in
self._filterContentForSearchText(searchText, scope: scope)
})
} }
self.searchBarTimer = Timer.scheduledTimer(withTimeInterval: searchDelay, repeats: false, block: { _ in
self._filterContentForSearchText(searchText, scope: scope)
})
} }
/** /**
......
...@@ -110,14 +110,14 @@ class ListViewController: UITableViewController { ...@@ -110,14 +110,14 @@ class ListViewController: UITableViewController {
} }
func startSearch(searchText: String, scope: Int = 0) { func startSearch(searchText: String, scope: Int = 0) {
if #available(iOS 10.0, *) { // check if a search has been scheduled already and stop it to prevent multiple searches
if let searchBarTimer: Timer = self.searchTimer { if let searchBarTimer: Timer = self.searchTimer {
searchBarTimer.invalidate() searchBarTimer.invalidate()
}
self.searchTimer = Timer.scheduledTimer(withTimeInterval: searchDelay, repeats: false, block: { _ in
self.filterContentForSearchText(searchText, scope: scope)
})
} }
self.searchTimer = Timer.scheduledTimer(withTimeInterval: searchDelay, repeats: false, block: { _ in
self.filterContentForSearchText(searchText, scope: scope)
})
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment