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,10 +253,15 @@ class InboxViewController: UITableViewController, InboxCellDelegator { ...@@ -253,10 +253,15 @@ 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()
} }
...@@ -265,7 +270,6 @@ class InboxViewController: UITableViewController, InboxCellDelegator { ...@@ -265,7 +270,6 @@ class InboxViewController: UITableViewController, InboxCellDelegator {
self._filterContentForSearchText(searchText, scope: scope) self._filterContentForSearchText(searchText, scope: scope)
}) })
} }
}
/** /**
Filters emails by a user input string and scope Filters emails by a user input string and scope
......
...@@ -110,15 +110,15 @@ class ListViewController: UITableViewController { ...@@ -110,15 +110,15 @@ 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.searchTimer = Timer.scheduledTimer(withTimeInterval: searchDelay, repeats: false, block: { _ in
self.filterContentForSearchText(searchText, scope: scope) self.filterContentForSearchText(searchText, scope: scope)
}) })
} }
}
/** /**
- parameters: - parameters:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment