no message

This commit is contained in:
Peter 2017-09-03 18:02:11 +03:00
parent cef4c95ace
commit 7a75c39e11
4 changed files with 6 additions and 8 deletions

View File

@ -30,7 +30,7 @@ public func ==(lhs: MediaResourceStatus, rhs: MediaResourceStatus) -> Bool {
case let .Fetching(lhsProgress): case let .Fetching(lhsProgress):
switch rhs { switch rhs {
case let .Fetching(rhsProgress): case let .Fetching(rhsProgress):
return abs(lhsProgress - rhsProgress) < FLT_EPSILON return lhsProgress.isEqual(to: rhsProgress)
default: default:
return false return false
} }

View File

@ -128,6 +128,9 @@ class MessageHistoryTagsSummaryTable: Table {
if let current = self.get(key) { if let current = self.get(key) {
if !current.range.contains(id) { if !current.range.contains(id) {
self.set(key, summary: current.withAddedCount(1), updatedSummaries: &updatedSummaries) 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 { } else {
self.set(key, summary: MessageHistoryTagNamespaceSummary(version: 0, count: 1, range: MessageHistoryTagNamespaceCountValidityRange(maxId: 0)), updatedSummaries: &updatedSummaries) self.set(key, summary: MessageHistoryTagNamespaceSummary(version: 0, count: 1, range: MessageHistoryTagNamespaceCountValidityRange(maxId: 0)), updatedSummaries: &updatedSummaries)

View File

@ -6,11 +6,6 @@ import Foundation
import SwiftSignalKit import SwiftSignalKit
#endif #endif
public enum PreloadedMessageHistoryView {
case Loading
case Preloaded(MessageHistoryView)
}
public protocol PeerChatState: PostboxCoding { public protocol PeerChatState: PostboxCoding {
func equals(_ other: PeerChatState) -> Bool 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) let _ = try? FileManager.default.createDirectory(atPath: basePath, withIntermediateDirectories: true, attributes: nil)
//debugSaveState(basePath: basePath, name: "beforeHoles") //debugSaveState(basePath: basePath, name: "beforeHoles")
debugRestoreState(basePath: basePath, name: "beforeHoles") //debugRestoreState(basePath: basePath, name: "beforeHoles")
loop: while true { loop: while true {
let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue) let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue)

View File

@ -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() { for (mutableView, pipe) in self.chatListViews.copyItems() {
let context = MutableChatListViewReplayContext() let context = MutableChatListViewReplayContext()
if mutableView.replay(transaction.chatListOperations, updatedPeerNotificationSettings: transaction.currentUpdatedPeerNotificationSettings, updatedPeers: transaction.currentUpdatedPeers, transaction: transaction, context: context) { if mutableView.replay(transaction.chatListOperations, updatedPeerNotificationSettings: transaction.currentUpdatedPeerNotificationSettings, updatedPeers: transaction.currentUpdatedPeers, transaction: transaction, context: context) {