mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '2c364e913f0452ae65160146dfcdcb480027e377'
This commit is contained in:
commit
483bcedad0
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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