mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Add more logs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
public struct TimestampBasedMessageAttributesEntry {
|
||||
public struct TimestampBasedMessageAttributesEntry: CustomStringConvertible {
|
||||
public let tag: UInt16
|
||||
public let timestamp: Int32
|
||||
public let messageId: MessageId
|
||||
@@ -8,6 +8,10 @@ public struct TimestampBasedMessageAttributesEntry {
|
||||
public var index: MessageIndex {
|
||||
return MessageIndex(id: self.messageId, timestamp: timestamp)
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return "(tag: \(self.tag), timestamp: \(self.timestamp), messageId: \(self.messageId))"
|
||||
}
|
||||
}
|
||||
|
||||
enum TimestampBasedMessageAttributesOperation {
|
||||
@@ -53,7 +57,11 @@ final class TimestampBasedMessageAttributesTable: Table {
|
||||
}
|
||||
|
||||
func set(tag: UInt16, id: MessageId, timestamp: Int32, operations: inout [TimestampBasedMessageAttributesOperation]) {
|
||||
if let previousTimestamp = self.indexTable.get(tag: tag, id: id) {
|
||||
let previousTimestamp = self.indexTable.get(tag: tag, id: id)
|
||||
|
||||
postboxLog("TimestampBasedMessageAttributesTable set(tag: \(tag), id: \(id), timestamp: \(timestamp)) previousTimestamp: \(String(describing: previousTimestamp))")
|
||||
|
||||
if let previousTimestamp = previousTimestamp {
|
||||
if previousTimestamp == timestamp {
|
||||
return
|
||||
} else {
|
||||
@@ -67,7 +75,11 @@ final class TimestampBasedMessageAttributesTable: Table {
|
||||
}
|
||||
|
||||
func remove(tag: UInt16, id: MessageId, operations: inout [TimestampBasedMessageAttributesOperation]) {
|
||||
if let previousTimestamp = self.indexTable.get(tag: tag, id: id) {
|
||||
let previousTimestamp = self.indexTable.get(tag: tag, id: id)
|
||||
|
||||
postboxLog("TimestampBasedMessageAttributesTable remove(tag: \(tag), id: \(id)) previousTimestamp: \(String(describing: previousTimestamp))")
|
||||
|
||||
if let previousTimestamp = previousTimestamp {
|
||||
self.valueBox.remove(self.table, key: self.key(tag: tag, timestamp: previousTimestamp, id: id), secure: false)
|
||||
self.indexTable.remove(tag: tag, id: id)
|
||||
operations.append(.remove(TimestampBasedMessageAttributesEntry(tag: tag, timestamp: previousTimestamp, messageId: id)))
|
||||
|
||||
@@ -7,6 +7,8 @@ final class MutableTimestampBasedMessageAttributesView {
|
||||
init(postbox: Postbox, tag: UInt16) {
|
||||
self.tag = tag
|
||||
self.head = postbox.timestampBasedMessageAttributesTable.head(tag: tag)
|
||||
|
||||
postboxLog("MutableTimestampBasedMessageAttributesView: tag: \(tag) head: \(String(describing: self.head))")
|
||||
}
|
||||
|
||||
func replay(postbox: Postbox, operations: [TimestampBasedMessageAttributesOperation]) -> Bool {
|
||||
|
||||
@@ -63,6 +63,8 @@ func managedAutoremoveMessageOperations(network: Network, postbox: Postbox, isRe
|
||||
|
||||
let timeOffset: Signal<Double, NoError> = .single(0.0)
|
||||
|
||||
Logger.shared.log("Autoremove", "starting isRemove: \(isRemove)")
|
||||
|
||||
let disposable = combineLatest(timeOffset, postbox.timestampBasedMessageAttributesView(tag: isRemove ? 0 : 1)).start(next: { timeOffset, view in
|
||||
let (disposeOperations, beginOperations) = helper.with { helper -> (disposeOperations: [Disposable], beginOperations: [(TimestampBasedMessageAttributesEntry, MetaDisposable)]) in
|
||||
return helper.update(view.head)
|
||||
|
||||
Reference in New Issue
Block a user