Various fixes

This commit is contained in:
Ilya Laktyushin 2022-09-30 02:11:34 +03:00
parent 45128a87b9
commit 4b8bc5896e
6 changed files with 132 additions and 10 deletions

View File

@ -649,7 +649,6 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
iconNode.isLayerBacked = true
iconNode.displaysAsynchronously = false
iconNode.displayWithoutProcessing = true
strongSelf.containerNode.addSubnode(iconNode)
strongSelf.credibilityIconNode = iconNode
}
iconNode.image = currentCredibilityIconImage

View File

@ -965,6 +965,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
}
}
private var delayLayoutUpdate = false
func animateOut(result initialResult: ContextMenuActionResult, completion: @escaping () -> Void) {
self.isUserInteractionEnabled = false
@ -973,12 +974,16 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
if let _ = self.presentationNode {
self.currentPresentationStateTransition = .animateOut(result: initialResult, completion: completion)
if let validLayout = self.validLayout {
self.delayLayoutUpdate = true
Queue.mainQueue().after(0.05) {
self.delayLayoutUpdate = false
self.updateLayout(
layout: validLayout,
transition: .animated(duration: 0.35, curve: .easeInOut),
previousActionsContainerNode: nil
)
}
}
return
}
@ -1520,7 +1525,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
}
func updateLayout(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition, previousActionsContainerNode: ContextActionsContainerNode?, previousActionsContainerFrame: CGRect? = nil, previousActionsTransition: ContextController.PreviousActionsTransition = .scale) {
if self.isAnimatingOut {
if self.isAnimatingOut || self.delayLayoutUpdate {
return
}

View File

@ -1206,7 +1206,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
for message in messages {
let currentKind = messageContentKind(contentSettings: strongSelf.context.currentContentSettings.with { $0 }, message: message, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder, dateTimeFormat: presentationData.dateTimeFormat, accountPeerId: strongSelf.context.account.peerId)
if beganContentKindScanning && currentKind != generalMessageContentKind {
if beganContentKindScanning, let messageContentKind = generalMessageContentKind, !messageContentKind.isSemanticallyEqual(to: currentKind) {
generalMessageContentKind = nil
} else if !beganContentKindScanning || currentKind == generalMessageContentKind {
beganContentKindScanning = true
@ -1225,6 +1225,8 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
case .video:
preferredAction = .saveToCameraRoll
actionCompletionText = strongSelf.presentationData.strings.Gallery_VideoSaved
case .file:
preferredAction = .saveToCameraRoll
default:
break
}

View File

@ -2255,10 +2255,12 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
return nil
})
var loadedEmojiPack: LoadedStickerPack?
var highlightableLinks = false
let secondaryTitleText: String
if let otherPeerName = state.otherPeerName {
if case let .emojiStatus(_, _, file, maybeEmojiPack) = context.component.source, let emojiPack = maybeEmojiPack, case let .result(info, _, _) = emojiPack {
loadedEmojiPack = maybeEmojiPack
highlightableLinks = true
var packReference: StickerPackReference?
@ -2337,7 +2339,7 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
if let emojiFile = state?.emojiFile, let controller = environment?.controller() as? PremiumIntroScreen, let navigationController = controller.navigationController as? NavigationController {
for attribute in emojiFile.attributes {
if case let .CustomEmoji(_, _, packReference) = attribute, let packReference = packReference {
let controller = accountContext.sharedContext.makeStickerPackScreen(context: accountContext, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], parentNavigationController: navigationController, sendSticker: { _, _, _ in
let controller = accountContext.sharedContext.makeStickerPackScreen(context: accountContext, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: loadedEmojiPack.flatMap { [$0] } ?? [], parentNavigationController: navigationController, sendSticker: { _, _, _ in
return false
})
presentController(controller)

View File

@ -47,6 +47,119 @@ public enum MessageContentKind: Equatable {
case dice(String)
case invoice(String)
public func isSemanticallyEqual(to other: MessageContentKind) -> Bool {
switch self {
case .text:
if case .text = other {
return true
} else {
return false
}
case .image:
if case .image = other {
return true
} else {
return false
}
case .video:
if case .video = other {
return true
} else {
return false
}
case .videoMessage:
if case .videoMessage = other {
return true
} else {
return false
}
case .audioMessage:
if case .audioMessage = other {
return true
} else {
return false
}
case .sticker:
if case .sticker = other {
return true
} else {
return false
}
case .animation:
if case .animation = other {
return true
} else {
return false
}
case .file:
if case .file = other {
return true
} else {
return false
}
case .contact:
if case .contact = other {
return true
} else {
return false
}
case .game:
if case .game = other {
return true
} else {
return false
}
case .location:
if case .location = other {
return true
} else {
return false
}
case .liveLocation:
if case .liveLocation = other {
return true
} else {
return false
}
case .expiredImage:
if case .expiredImage = other {
return true
} else {
return false
}
case .expiredVideo:
if case .expiredVideo = other {
return true
} else {
return false
}
case .poll:
if case .poll = other {
return true
} else {
return false
}
case .restricted:
if case .restricted = other {
return true
} else {
return false
}
case .dice:
if case .dice = other {
return true
} else {
return false
}
case .invoice:
if case .invoice = other {
return true
} else {
return false
}
}
}
public var key: MessageContentKindKey {
switch self {
case .text:

View File

@ -80,6 +80,7 @@ final class ChatTextInputActionButtonsNode: ASDisplayNode {
}
}
self.micButton.layer.allowsGroupOpacity = true
self.view.addSubview(self.micButton)
self.addSubnode(self.sendContainerNode)