From d465b1279096b9508ccfe8562953ac052a4302fd Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 22 Jun 2020 10:52:01 +1000 Subject: [PATCH] Minor refactoring --- Signal/src/Loki/View Controllers/HomeVC.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index 4376dfb1b..ad350b263 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -173,8 +173,8 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol } override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) isViewVisible = false + super.viewWillDisappear(animated) } deinit { @@ -213,8 +213,9 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol @objc private func handleYapDatabaseModifiedNotification(_ notification: Notification) { guard isObservingDatabase else { return } - let transaction = uiDatabaseConnection.beginLongLivedReadTransaction() - let hasChanges = (uiDatabaseConnection.ext(TSThreadDatabaseViewExtensionName) as! YapDatabaseViewConnection).hasChanges(forGroup: TSInboxGroup, in: transaction) + let notifications = uiDatabaseConnection.beginLongLivedReadTransaction() + let ext = uiDatabaseConnection.ext(TSThreadDatabaseViewExtensionName) as! YapDatabaseViewConnection + let hasChanges = ext.hasChanges(forGroup: TSInboxGroup, in: notifications) guard hasChanges else { uiDatabaseConnection.read { transaction in self.threads.update(with: transaction) @@ -223,7 +224,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol } var sectionChanges = NSArray() var rowChanges = NSArray() - (uiDatabaseConnection.ext(TSThreadDatabaseViewExtensionName) as! YapDatabaseViewConnection).getSectionChanges(§ionChanges, rowChanges: &rowChanges, for: transaction, with: threads) + ext.getSectionChanges(§ionChanges, rowChanges: &rowChanges, for: notifications, with: threads) guard sectionChanges.count > 0 || rowChanges.count > 0 else { return } tableView.beginUpdates() rowChanges.forEach { rowChange in