mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-10 00:01:44 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
fd60c76855
@ -81,6 +81,7 @@ final class MessageHistoryMetadataTable: Table {
|
||||
private func peerThreadHoleIndexInitializedKey(peerId: PeerId, threadId: Int64) -> ValueBoxKey {
|
||||
self.sharedPeerThreadHoleIndexInitializedKey.setInt64(0, value: peerId.toInt64())
|
||||
self.sharedPeerThreadHoleIndexInitializedKey.setInt8(8, value: MetadataPrefix.PeerHistoryThreadHoleIndexInitialized.rawValue)
|
||||
self.sharedPeerThreadHoleIndexInitializedKey.setInt64(0, value: threadId)
|
||||
return self.sharedPeerThreadHoleIndexInitializedKey
|
||||
}
|
||||
|
||||
|
||||
@ -110,6 +110,7 @@ final class MessageHistoryThreadHoleIndexTable: Table {
|
||||
|
||||
private func ensureInitialized(peerId: PeerId, threadId: Int64) {
|
||||
if !self.metadataTable.isThreadHoleIndexInitialized(peerId: peerId, threadId: threadId) {
|
||||
postboxLog("MessageHistoryThreadHoleIndexTable: Initializing \(peerId) \(threadId)")
|
||||
self.metadataTable.setIsThreadHoleIndexInitialized(peerId: peerId, threadId: threadId)
|
||||
|
||||
if let messageNamespaces = self.seedConfiguration.messageThreadHoles[peerId.namespace] {
|
||||
|
||||
@ -162,7 +162,7 @@ func mergeChannel(lhs: TelegramChannel?, rhs: TelegramChannel) -> TelegramChanne
|
||||
return rhs
|
||||
}
|
||||
|
||||
if case .personal = rhs.accessHash {
|
||||
if case .personal? = rhs.accessHash {
|
||||
return rhs
|
||||
}
|
||||
|
||||
@ -185,9 +185,9 @@ func mergeChannel(lhs: TelegramChannel?, rhs: TelegramChannel) -> TelegramChanne
|
||||
if let rhsAccessHashValue = lhs.accessHash, case .personal = rhsAccessHashValue {
|
||||
accessHash = rhsAccessHashValue
|
||||
} else {
|
||||
accessHash = lhs.accessHash ?? rhs.accessHash
|
||||
accessHash = rhs.accessHash ?? lhs.accessHash
|
||||
}
|
||||
|
||||
return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: lhs.creationDate, version: lhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: lhs.restrictionInfo, adminRights: lhs.adminRights, bannedRights: lhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights)
|
||||
return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: rhs.creationDate, version: rhs.version, participationStatus: rhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: rhs.restrictionInfo, adminRights: rhs.adminRights, bannedRights: rhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights)
|
||||
}
|
||||
|
||||
|
||||
@ -219,15 +219,17 @@ public final class BlockedPeersContext {
|
||||
}
|
||||
|> mapToSignal { value in
|
||||
return postbox.transaction { transaction -> Peer? in
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
let previous: CachedUserData
|
||||
if let current = current as? CachedUserData {
|
||||
previous = current
|
||||
} else {
|
||||
previous = CachedUserData()
|
||||
}
|
||||
return previous.withUpdatedIsBlocked(false)
|
||||
})
|
||||
if peerId.namespace == Namespaces.Peer.CloudUser {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
let previous: CachedUserData
|
||||
if let current = current as? CachedUserData {
|
||||
previous = current
|
||||
} else {
|
||||
previous = CachedUserData()
|
||||
}
|
||||
return previous.withUpdatedIsBlocked(false)
|
||||
})
|
||||
}
|
||||
return transaction.getPeer(peerId)
|
||||
}
|
||||
|> castError(BlockedPeersContextRemoveError.self)
|
||||
|
||||
@ -574,6 +574,8 @@ private final class CallSessionManagerContext {
|
||||
self.ringingStatesUpdated()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.contextUpdated(internalId: internalId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -479,7 +479,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
|
||||
let key = SharedContextStore.Key(accountId: accountId)
|
||||
|
||||
let context: MTContext
|
||||
if let current = store.contexts[key] {
|
||||
if false, let current = store.contexts[key] {
|
||||
context = current
|
||||
context.updateApiEnvironment({ _ in return apiEnvironment})
|
||||
} else {
|
||||
|
||||
@ -143,7 +143,7 @@ extension TelegramUser {
|
||||
guard let lhs = lhs else {
|
||||
return rhs
|
||||
}
|
||||
if case .personal = rhs.accessHash {
|
||||
if case .personal? = rhs.accessHash {
|
||||
return rhs
|
||||
} else {
|
||||
var userFlags: UserInfoFlags = []
|
||||
|
||||
@ -85,14 +85,14 @@ private func updateMessageThreadStatsInternal(transaction: Transaction, threadMe
|
||||
let count = max(0, attribute.count + countDifference)
|
||||
var maxMessageId = attribute.maxMessageId
|
||||
var maxReadMessageId = attribute.maxReadMessageId
|
||||
if let maxAddedId = addedMessagePeers.map(\.messageId.id).max() {
|
||||
if let maxAddedId = addedMessagePeers.map({ $0.messageId.id }).max() {
|
||||
if let currentMaxMessageId = maxMessageId {
|
||||
maxMessageId = max(currentMaxMessageId, maxAddedId)
|
||||
} else {
|
||||
maxMessageId = maxAddedId
|
||||
}
|
||||
}
|
||||
if let maxAddedReadId = addedMessagePeers.filter(\.isOutgoing).map(\.messageId.id).max() {
|
||||
if let maxAddedReadId = addedMessagePeers.filter({ $0.isOutgoing }).map({ $0.messageId.id }).max() {
|
||||
if let currentMaxMessageId = maxReadMessageId {
|
||||
maxReadMessageId = max(currentMaxMessageId, maxAddedReadId)
|
||||
} else {
|
||||
@ -100,7 +100,7 @@ private func updateMessageThreadStatsInternal(transaction: Transaction, threadMe
|
||||
}
|
||||
}
|
||||
|
||||
attributes[j] = ReplyThreadMessageAttribute(count: count, latestUsers: mergeLatestUsers(current: attribute.latestUsers, added: addedMessagePeers.map(\.id), isGroup: isGroup, isEmpty: count == 0), commentsPeerId: attribute.commentsPeerId, maxMessageId: maxMessageId, maxReadMessageId: maxReadMessageId)
|
||||
attributes[j] = ReplyThreadMessageAttribute(count: count, latestUsers: mergeLatestUsers(current: attribute.latestUsers, added: addedMessagePeers.map({ $0.id }), isGroup: isGroup, isEmpty: count == 0), commentsPeerId: attribute.commentsPeerId, maxMessageId: maxMessageId, maxReadMessageId: maxReadMessageId)
|
||||
} else if let attribute = attributes[j] as? SourceReferenceMessageAttribute {
|
||||
channelThreadMessageId = attribute.messageId
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user