Reloading history when data changes
This commit is contained in:
parent
cd77852549
commit
cefb0143e5
@ -39,6 +39,7 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
||||
}
|
||||
|
||||
self.history.delegate = self
|
||||
NotificationCenter.default.addObserver(self, selector:#selector(self.calendarDayDidChange(_:)), name:NSNotification.Name.NSCalendarDayChanged, object:nil)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
@ -74,7 +75,6 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
||||
if let event = event {
|
||||
action = .sendSpecific(event)
|
||||
}
|
||||
//self.check(number: number, action: action).subscribe().disposed(by: self.bag)
|
||||
HUD.show(.progress)
|
||||
self.check(number: number, action: action).subscribe { vehicle in
|
||||
self.updateDetailController(with: vehicle)
|
||||
@ -100,6 +100,10 @@ class CheckController: UIViewController, UITableViewDelegate, UITextFieldDelegat
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func calendarDayDidChange(_ notification : NSNotification) {
|
||||
self.historyDataSource.reload()
|
||||
}
|
||||
|
||||
// MARK: - Checking new number
|
||||
|
||||
@IBAction func checkTapped(_ sender: UIButton) {
|
||||
|
||||
@ -101,4 +101,9 @@ class RealmSectionedDataSource<Item,Cell>: NSObject, UITableViewDataSource where
|
||||
func item(at indexPath: IndexPath) -> Item {
|
||||
return self.sections[indexPath.section].elements[indexPath.row]
|
||||
}
|
||||
|
||||
func reload() {
|
||||
self.sections = self.data.groupedByDate()
|
||||
self.tv.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user