diff --git a/Postbox/MediaResourceStatus.swift b/Postbox/MediaResourceStatus.swift index 84e844b283..f1bf1a385e 100644 --- a/Postbox/MediaResourceStatus.swift +++ b/Postbox/MediaResourceStatus.swift @@ -30,7 +30,7 @@ public func ==(lhs: MediaResourceStatus, rhs: MediaResourceStatus) -> Bool { case let .Fetching(lhsProgress): switch rhs { case let .Fetching(rhsProgress): - return abs(lhsProgress - rhsProgress) < FLT_EPSILON + return lhsProgress.isEqual(to: rhsProgress) default: return false } diff --git a/Postbox/MessageHistoryTagsSummaryTable.swift b/Postbox/MessageHistoryTagsSummaryTable.swift index 81e822be9d..f39bfaa5cb 100644 --- a/Postbox/MessageHistoryTagsSummaryTable.swift +++ b/Postbox/MessageHistoryTagsSummaryTable.swift @@ -128,6 +128,9 @@ class MessageHistoryTagsSummaryTable: Table { if let current = self.get(key) { if !current.range.contains(id) { self.set(key, summary: current.withAddedCount(1), updatedSummaries: &updatedSummaries) + if current.range.maxId == 0 { + self.invalidateTable.insert(InvalidatedMessageHistoryTagsSummaryKey(peerId: key.peerId, namespace: key.namespace, tagMask: key.tag), operations: &invalidateSummaries) + } } } else { self.set(key, summary: MessageHistoryTagNamespaceSummary(version: 0, count: 1, range: MessageHistoryTagNamespaceCountValidityRange(maxId: 0)), updatedSummaries: &updatedSummaries) diff --git a/Postbox/Postbox.swift b/Postbox/Postbox.swift index c98fdfb9af..be360ebdad 100644 --- a/Postbox/Postbox.swift +++ b/Postbox/Postbox.swift @@ -6,11 +6,6 @@ import Foundation import SwiftSignalKit #endif -public enum PreloadedMessageHistoryView { - case Loading - case Preloaded(MessageHistoryView) -} - public protocol PeerChatState: PostboxCoding { func equals(_ other: PeerChatState) -> Bool } @@ -735,7 +730,7 @@ public func openPostbox(basePath: String, globalMessageIdsNamespace: MessageId.N let _ = try? FileManager.default.createDirectory(atPath: basePath, withIntermediateDirectories: true, attributes: nil) //debugSaveState(basePath: basePath, name: "beforeHoles") - debugRestoreState(basePath: basePath, name: "beforeHoles") + //debugRestoreState(basePath: basePath, name: "beforeHoles") loop: while true { let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue) diff --git a/Postbox/ViewTracker.swift b/Postbox/ViewTracker.swift index 5eb1519b92..b6d1979273 100644 --- a/Postbox/ViewTracker.swift +++ b/Postbox/ViewTracker.swift @@ -400,7 +400,7 @@ final class ViewTracker { } } - if !transaction.chatListOperations.isEmpty || !transaction.currentUpdatedPeerNotificationSettings.isEmpty || !transaction.currentUpdatedPeers.isEmpty { + if !transaction.chatListOperations.isEmpty || !transaction.currentUpdatedPeerNotificationSettings.isEmpty || !transaction.currentUpdatedPeers.isEmpty || !transaction.currentInvalidateMessageTagSummaries.isEmpty || !transaction.currentUpdatedMessageTagSummaries.isEmpty { for (mutableView, pipe) in self.chatListViews.copyItems() { let context = MutableChatListViewReplayContext() if mutableView.replay(transaction.chatListOperations, updatedPeerNotificationSettings: transaction.currentUpdatedPeerNotificationSettings, updatedPeers: transaction.currentUpdatedPeers, transaction: transaction, context: context) {