Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-11-23 15:12:25 +04:00
parent 48cc049d7b
commit 4309eb36af
7 changed files with 35 additions and 20 deletions

Binary file not shown.

View File

@ -240,7 +240,8 @@ public func legacyAttachmentMenu(context: AccountContext, peer: Peer, chatLocati
allItems.append(currentItem)
}
for item in allItems {
if let asset = item as? TGMediaAsset, asset.uniformTypeIdentifier.contains("heic") {
if item is TGCameraCapturedVideo {
} else if let asset = item as? TGMediaAsset, asset.uniformTypeIdentifier.contains("heic") {
hasHeic = true
break
}

View File

@ -316,7 +316,7 @@ private enum RecentSessionsEntry: ItemListNodeEntry {
let arguments = arguments as! RecentSessionsControllerArguments
switch self {
case let .header(_, text):
return RecentSessionsHeaderItem(context: arguments.context, theme: presentationData.theme, text: text, animationName: "Requests", sectionId: self.section, buttonAction: {
return RecentSessionsHeaderItem(context: arguments.context, theme: presentationData.theme, text: text, animationName: "Devices", sectionId: self.section, buttonAction: {
arguments.addDevice()
}, linkAction: { action in
if case let .tap(link) = action {

View File

@ -139,7 +139,7 @@ class RecentSessionsHeaderItemNode: ListViewItemNode {
return (layout, { [weak self] in
if let strongSelf = self {
if strongSelf.item == nil {
strongSelf.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: item.animationName), width: 192, height: 192, playbackMode: .loop, mode: .direct(cachePathPrefix: nil))
strongSelf.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(name: item.animationName), width: 192, height: 192, playbackMode: .once, mode: .direct(cachePathPrefix: nil))
strongSelf.animationNode.visibility = true
}
strongSelf.item = item

View File

@ -682,23 +682,11 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
} else {
attributes.append(contentsOf: filterMessageAttributesForOutgoingMessage(sourceMessage.attributes))
}
let authorId: PeerId?
if let peer = peer as? TelegramChannel {
if case .broadcast = peer.info {
authorId = peer.id
} else if case .group = peer.info, peer.hasPermission(.canBeAnonymous) {
authorId = peer.id
} else {
authorId = account.peerId
}
} else {
authorId = account.peerId
}
var messageNamespace = Namespaces.Message.Local
var entitiesAttribute: TextEntitiesMessageAttribute?
var effectiveTimestamp = timestamp
var sendAsPeer: Peer?
var threadId: Int64?
for attribute in attributes {
if let attribute = attribute as? TextEntitiesMessageAttribute {
@ -713,9 +701,28 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
if let threadMessageId = attribute.threadMessageId {
threadId = makeMessageThreadId(threadMessageId)
}
} else if let attribute = attribute as? SendAsMessageAttribute {
if let peer = transaction.getPeer(attribute.peerId) {
sendAsPeer = peer
}
}
}
let authorId: PeerId?
if let sendAsPeer = sendAsPeer {
authorId = sendAsPeer.id
} else if let peer = peer as? TelegramChannel {
if case .broadcast = peer.info {
authorId = peer.id
} else if case .group = peer.info, peer.hasPermission(.canBeAnonymous) {
authorId = peer.id
} else {
authorId = account.peerId
}
} else {
authorId = account.peerId
}
if messageNamespace != Namespaces.Message.ScheduledLocal {
attributes.removeAll(where: { $0 is OutgoingScheduleInfoMessageAttribute })
}

View File

@ -57,6 +57,8 @@ private func canEditMessage(accountPeerId: PeerId, limitsConfiguration: LimitsCo
}
} else if message.id.peerId.namespace == Namespaces.Peer.SecretChat || message.id.namespace != Namespaces.Message.Cloud {
hasEditRights = false
} else if let author = message.author, author.id.namespace == Namespaces.Peer.CloudChannel && message.id.peerId.namespace == Namespaces.Peer.CloudChannel, !message.flags.contains(.Incoming) {
hasEditRights = true
} else if let author = message.author, author.id == accountPeerId, let peer = message.peers[message.id.peerId] {
hasEditRights = true
if let peer = peer as? TelegramChannel {

View File

@ -993,7 +993,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
var allowAuthor = incoming
if let author = firstMessage.author, author is TelegramChannel, author.id == firstMessage.id.peerId, !incoming {
if let author = firstMessage.author, author is TelegramChannel, !incoming {
allowAuthor = true
}
@ -2168,14 +2168,19 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
if let nameNode = nameNodeSizeApply.1() {
strongSelf.nameNode = nameNode
nameNode.displaysAsynchronously = !item.presentationData.isPreview && !item.presentationData.theme.theme.forceSync
let previousNameNodeFrame = nameNode.frame
let nameNodeFrame = CGRect(origin: CGPoint(x: contentOrigin.x + layoutConstants.text.bubbleInsets.left, y: layoutConstants.bubble.contentInsets.top + nameNodeOriginY), size: nameNodeSizeApply.0)
nameNode.frame = nameNodeFrame
if nameNode.supernode == nil {
if !nameNode.isNodeLoaded {
nameNode.isUserInteractionEnabled = false
}
strongSelf.clippingNode.addSubnode(nameNode)
} else {
transition.animatePositionAdditive(node: nameNode, offset: CGPoint(x: previousNameNodeFrame.maxX - nameNodeFrame.maxX, y: 0.0))
}
nameNode.frame = CGRect(origin: CGPoint(x: contentOrigin.x + layoutConstants.text.bubbleInsets.left, y: layoutConstants.bubble.contentInsets.top + nameNodeOriginY), size: nameNodeSizeApply.0)
nameNode.displaysAsynchronously = !item.presentationData.isPreview && !item.presentationData.theme.theme.forceSync
if let credibilityIconImage = currentCredibilityIconImage {
let credibilityIconNode: ASImageNode