Fixed infinite loops introduced by the last change >_>
This commit is contained in:
parent
f45568644e
commit
f976d85c27
|
@ -233,7 +233,15 @@ class MessageRequestsViewController: BaseVC, SessionUtilRespondingViewController
|
||||||
// in from a frame of CGRect.zero)
|
// in from a frame of CGRect.zero)
|
||||||
guard hasLoadedInitialThreadData else {
|
guard hasLoadedInitialThreadData else {
|
||||||
UIView.performWithoutAnimation {
|
UIView.performWithoutAnimation {
|
||||||
handleThreadUpdates(updatedData, changeset: changeset, initialLoad: true)
|
// Hide the 'loading conversations' label (now that we have received conversation data)
|
||||||
|
loadingConversationsLabel.isHidden = true
|
||||||
|
|
||||||
|
// Show the empty state if there is no data
|
||||||
|
clearAllButton.isHidden = !(updatedData.first?.elements.isEmpty == false)
|
||||||
|
emptyStateLabel.isHidden = !clearAllButton.isHidden
|
||||||
|
|
||||||
|
// Update the content
|
||||||
|
viewModel.updateThreadData(updatedData)
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
hasLoadedInitialThreadData = true
|
hasLoadedInitialThreadData = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,22 +224,28 @@ class SessionTableViewController<NavItemId: Equatable, Section: SessionTableSect
|
||||||
changeset: StagedChangeset<[SectionModel]>,
|
changeset: StagedChangeset<[SectionModel]>,
|
||||||
initialLoad: Bool = false
|
initialLoad: Bool = false
|
||||||
) {
|
) {
|
||||||
|
// Determine if we have any items for the empty state
|
||||||
|
let itemCount: Int = updatedData
|
||||||
|
.map { $0.elements.count }
|
||||||
|
.reduce(0, +)
|
||||||
|
|
||||||
// Ensure the first load runs without animations (if we don't do this the cells will animate
|
// Ensure the first load runs without animations (if we don't do this the cells will animate
|
||||||
// in from a frame of CGRect.zero)
|
// in from a frame of CGRect.zero)
|
||||||
guard hasLoadedInitialTableData else {
|
guard hasLoadedInitialTableData else {
|
||||||
UIView.performWithoutAnimation {
|
UIView.performWithoutAnimation {
|
||||||
handleDataUpdates(updatedData, changeset: changeset, initialLoad: true)
|
// Update the empty state
|
||||||
|
emptyStateLabel.isHidden = (itemCount > 0)
|
||||||
|
|
||||||
|
// Update the content
|
||||||
|
viewModel.updateTableData(updatedData)
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
hasLoadedInitialTableData = true
|
hasLoadedInitialTableData = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the empty state if there is no data
|
// Update the empty state
|
||||||
let itemCount: Int = updatedData
|
self.emptyStateLabel.isHidden = (itemCount > 0)
|
||||||
.map { $0.elements.count }
|
|
||||||
.reduce(0, +)
|
|
||||||
emptyStateLabel.isHidden = (itemCount > 0)
|
|
||||||
|
|
||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
CATransaction.setCompletionBlock { [weak self] in
|
CATransaction.setCompletionBlock { [weak self] in
|
||||||
|
|
Loading…
Reference in New Issue