Minor refactoring
This commit is contained in:
parent
3075e82d8a
commit
010a399ee7
|
@ -16,9 +16,9 @@ final class NotificationServiceExtension : UNNotificationServiceExtension {
|
|||
self.contentHandler = contentHandler
|
||||
notificationContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
||||
|
||||
// The code using DispatchQueue.main.async { self.setUpIfNecessary(){ Modify the notification content } } will somehow cause a freezing when the second PN comes
|
||||
// The code using DispatchQueue.main.async { self.setUpIfNecessary() { Modify the notification content } } will somehow cause a freeze when a second PN comes
|
||||
|
||||
DispatchQueue.main.sync { self.setUpIfNecessary(){} }
|
||||
DispatchQueue.main.sync { self.setUpIfNecessary() {} }
|
||||
|
||||
AppReadiness.runNowOrWhenAppDidBecomeReady {
|
||||
if let notificationContent = self.notificationContent {
|
||||
|
|
|
@ -212,7 +212,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
isObservingDatabase = isViewVisible && CurrentAppContext().isAppForegroundAndActive()
|
||||
}
|
||||
|
||||
private func updateThreadMapping() {
|
||||
private func updateYDBThreadMapping() {
|
||||
uiDatabaseConnection.beginLongLivedReadTransaction()
|
||||
uiDatabaseConnection.read { transaction in
|
||||
self.threads.update(with: transaction)
|
||||
|
@ -221,7 +221,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
|
||||
private func reload() {
|
||||
AssertIsOnMainThread()
|
||||
updateThreadMapping()
|
||||
updateYDBThreadMapping()
|
||||
threadViewModelCache.removeAll()
|
||||
tableView.reloadData()
|
||||
emptyStateView.isHidden = (threadCount != 0)
|
||||
|
@ -253,7 +253,6 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sectionChanges = NSArray()
|
||||
var rowChanges = NSArray()
|
||||
ext.getSectionChanges(§ionChanges, rowChanges: &rowChanges, for: notifications, with: threads)
|
||||
|
@ -280,7 +279,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
|
||||
@objc private func handleApplicationDidBecomeActiveNotification(_ notification: Notification) {
|
||||
updateIsObservingDatabase()
|
||||
updateThreadMapping()
|
||||
updateYDBThreadMapping()
|
||||
}
|
||||
|
||||
@objc private func handleApplicationWillResignActiveNotification(_ notification: Notification) {
|
||||
|
|
Loading…
Reference in New Issue