Comments update

This commit is contained in:
Ali
2020-08-28 17:32:21 +01:00
parent 8c4adbd58b
commit 0e03c5e446
108 changed files with 2678 additions and 1379 deletions

View File

@@ -412,7 +412,18 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
}
}
storeMessages.append(StoreMessage(peerId: peerId, namespace: messageNamespace, globallyUniqueId: randomId, groupingKey: localGroupingKey, timestamp: effectiveTimestamp, flags: flags, tags: tags, globalTags: globalTags, localTags: localTags, forwardInfo: nil, authorId: authorId, text: text, attributes: attributes, media: mediaList))
var threadId: Int64?
if let replyToMessageId = replyToMessageId {
if let message = transaction.getMessage(replyToMessageId) {
if let threadIdValue = message.threadId {
threadId = threadIdValue
} else if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .group = channel.info {
threadId = makeMessageThreadId(replyToMessageId)
}
}
}
storeMessages.append(StoreMessage(peerId: peerId, namespace: messageNamespace, globallyUniqueId: randomId, groupingKey: localGroupingKey, threadId: threadId, timestamp: effectiveTimestamp, flags: flags, tags: tags, globalTags: globalTags, localTags: localTags, forwardInfo: nil, authorId: authorId, text: text, attributes: attributes, media: mediaList))
case let .forward(source, grouping, requestedAttributes):
let sourceMessage = transaction.getMessage(source)
if let sourceMessage = sourceMessage, let author = sourceMessage.author ?? sourceMessage.peers[sourceMessage.id.peerId] {
@@ -527,16 +538,20 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
var messageNamespace = Namespaces.Message.Local
var entitiesAttribute: TextEntitiesMessageAttribute?
var effectiveTimestamp = timestamp
var threadId: Int64?
for attribute in attributes {
if let attribute = attribute as? TextEntitiesMessageAttribute {
entitiesAttribute = attribute
}
if let attribute = attribute as? OutgoingScheduleInfoMessageAttribute {
} else if let attribute = attribute as? OutgoingScheduleInfoMessageAttribute {
if attribute.scheduleTime == scheduleWhenOnlineTimestamp, let presence = peerPresence as? TelegramUserPresence, case let .present(statusTimestamp) = presence.status, statusTimestamp >= timestamp {
} else {
messageNamespace = Namespaces.Message.ScheduledLocal
effectiveTimestamp = attribute.scheduleTime
}
} else if let attribute = attribute as? ReplyMessageAttribute {
if let threadMessageId = attribute.threadMessageId {
threadId = makeMessageThreadId(threadMessageId)
}
}
}
@@ -572,7 +587,7 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
augmentedMediaList = augmentedMediaList.map(convertForwardedMediaForSecretChat)
}
storeMessages.append(StoreMessage(peerId: peerId, namespace: messageNamespace, globallyUniqueId: randomId, groupingKey: localGroupingKey, timestamp: effectiveTimestamp, flags: flags, tags: tags, globalTags: globalTags, localTags: [], forwardInfo: forwardInfo, authorId: authorId, text: sourceMessage.text, attributes: attributes, media: augmentedMediaList))
storeMessages.append(StoreMessage(peerId: peerId, namespace: messageNamespace, globallyUniqueId: randomId, groupingKey: localGroupingKey, threadId: threadId, timestamp: effectiveTimestamp, flags: flags, tags: tags, globalTags: globalTags, localTags: [], forwardInfo: forwardInfo, authorId: authorId, text: sourceMessage.text, attributes: attributes, media: augmentedMediaList))
}
}
}