Various fixes

This commit is contained in:
Ilya Laktyushin 2022-07-20 11:46:57 +02:00
parent e7316321a2
commit e1902192d4
13 changed files with 54 additions and 10 deletions

View File

@ -7890,3 +7890,5 @@ Sorry for the inconvenience.";
"Conversation.VoiceMessagesRestricted" = "%@ doesn't accept voice and video messages";
"Emoji.ClearRecent" = "Clear Recent Emoji";
"Premium.AnimatedEmoji.Proceed" = "Unlock Animated Emoji";

View File

@ -400,7 +400,7 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode {
self.arguments = arguments
self.file = file
self.targetSelectionIndex = nil
icon = nil //UIImage(bundleImageName: "Chat/Context Menu/Arrow")
icon = nil
isUserInteractionEnabled = text != nil
}

View File

@ -485,7 +485,7 @@ private final class DemoSheetContent: CombinedComponent {
self.context = context
self.subject = subject
self.source = source
self.order = order ?? [.moreUpload, .fasterDownload, .voiceToText, .noAds, .uniqueReactions, .premiumStickers, .advancedChatManagement, .profileBadge, .animatedUserpics, .appIcons]
self.order = order ?? [.moreUpload, .fasterDownload, .voiceToText, .noAds, .uniqueReactions, .premiumStickers, .animatedEmoji, .advancedChatManagement, .profileBadge, .animatedUserpics, .appIcons]
self.action = action
self.dismiss = dismiss
}
@ -994,6 +994,9 @@ private final class DemoSheetContent: CombinedComponent {
buttonAnimationName = "premium_unlock"
case .noAds:
buttonText = strings.Premium_NoAds_Proceed
case .animatedEmoji:
buttonText = strings.Premium_AnimatedEmoji_Proceed
buttonAnimationName = "premium_unlock"
default:
buttonText = strings.Common_OK
}

View File

@ -172,13 +172,19 @@ final class StickerPackEmojisItemNode: GridItemNode {
super.didLoad()
let shimmerHostView = PortalSourceView()
shimmerHostView.alpha = 0.0
shimmerHostView.frame = CGRect(origin: CGPoint(), size: self.frame.size)
self.view.addSubview(shimmerHostView)
self.shimmerHostView = shimmerHostView
let standaloneShimmerEffect = StandaloneShimmerEffect()
self.standaloneShimmerEffect = standaloneShimmerEffect
shimmerHostView.alpha = 0.0
self.view.addSubview(shimmerHostView)
if let item = self.item {
let shimmerBackgroundColor = item.theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.08)
let shimmerForegroundColor = item.theme.list.itemBlocksBackgroundColor.withMultipliedAlpha(0.15)
standaloneShimmerEffect.update(background: shimmerBackgroundColor, foreground: shimmerForegroundColor)
self.updateShimmerIfNeeded()
}
let boundsChangeTrackerLayer = SimpleLayer()
boundsChangeTrackerLayer.opacity = 0.0
@ -261,7 +267,7 @@ final class StickerPackEmojisItemNode: GridItemNode {
placeholderColor: theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.1),
blurredBadgeColor: theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.5),
pointSize: itemNativeFitSize,
onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, _ in
onUpdateDisplayPlaceholder: { [weak self] displayPlaceholder, duration in
guard let strongSelf = self else {
return
}
@ -275,7 +281,7 @@ final class StickerPackEmojisItemNode: GridItemNode {
context: context,
file: item.file,
shimmerView: strongSelf.shimmerHostView,
color: nil,
color: theme.chat.inputPanel.primaryTextColor.withMultipliedAlpha(0.08),
size: itemNativeFitSize
)
strongSelf.visibleItemPlaceholderViews[itemId] = placeholderView
@ -289,9 +295,20 @@ final class StickerPackEmojisItemNode: GridItemNode {
} else {
if let placeholderView = strongSelf.visibleItemPlaceholderViews[itemId] {
strongSelf.visibleItemPlaceholderViews.removeValue(forKey: itemId)
placeholderView.removeFromSuperview()
strongSelf.updateShimmerIfNeeded()
if duration > 0.0 {
placeholderView.layer.opacity = 0.0
placeholderView.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, completion: { [weak self, weak placeholderView] _ in
guard let strongSelf = self else {
return
}
placeholderView?.removeFromSuperview()
strongSelf.updateShimmerIfNeeded()
})
} else {
placeholderView.removeFromSuperview()
strongSelf.updateShimmerIfNeeded()
}
}
}
}
@ -324,6 +341,13 @@ final class StickerPackEmojisItemNode: GridItemNode {
itemLayer.isVisibleForAnimations = true
}
for id in self.visibleItemLayers.keys {
if !validIds.contains(id) {
self.visibleItemLayers[id]?.removeFromSuperlayer()
self.visibleItemLayers[id] = nil
}
}
}
private func updateShimmerIfNeeded() {

View File

@ -78,7 +78,7 @@ public final class TextNodeWithEntities {
context: self.context,
cache: self.cache,
renderer: self.renderer,
placeholderColor: self.placeholderColor,
placeholderColor: color,
attemptSynchronous: self.attemptSynchronous
)
}

View File

@ -3702,6 +3702,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}, cancelInteractiveKeyboardGestures: { [weak self] in
(self?.view.window as? WindowHost)?.cancelInteractiveKeyboardGestures()
self?.chatDisplayNode.cancelInteractiveKeyboardGestures()
}, dismissTextInput: { [weak self] in
self?.chatDisplayNode.dismissTextInput()
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: self.stickerSettings, presentationContext: ChatPresentationContext(context: context, backgroundNode: self.chatBackgroundNode))
self.controllerInteraction = controllerInteraction

View File

@ -141,6 +141,7 @@ public final class ChatControllerInteraction {
let requestMessageUpdate: (MessageId) -> Void
let cancelInteractiveKeyboardGestures: () -> Void
let dismissTextInput: () -> Void
var canPlayMedia: Bool = false
var hiddenMedia: [MessageId: [Media]] = [:]
@ -243,6 +244,7 @@ public final class ChatControllerInteraction {
openWebView: @escaping (String, String, Bool, Bool) -> Void,
requestMessageUpdate: @escaping (MessageId) -> Void,
cancelInteractiveKeyboardGestures: @escaping () -> Void,
dismissTextInput: @escaping () -> Void,
automaticMediaDownloadSettings: MediaAutoDownloadSettings,
pollActionState: ChatInterfacePollActionState,
stickerSettings: ChatInterfaceStickerSettings,
@ -330,6 +332,7 @@ public final class ChatControllerInteraction {
self.openWebView = openWebView
self.requestMessageUpdate = requestMessageUpdate
self.cancelInteractiveKeyboardGestures = cancelInteractiveKeyboardGestures
self.dismissTextInput = dismissTextInput
self.automaticMediaDownloadSettings = automaticMediaDownloadSettings

View File

@ -2317,6 +2317,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.view.window?.endEditing(true)
}
func dismissTextInput() {
self.view.window?.endEditing(true)
}
func collapseInput() {
if self.inputPanelContainerNode.expansionFraction != 0.0 {
self.inputPanelContainerNode.collapse()
@ -2866,6 +2870,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
guard let strongSelf = self else {
return
}
strongSelf.dismissTextInput()
var replaceImpl: ((ViewController) -> Void)?
let controller = PremiumDemoScreen(context: strongSelf.context, subject: .premiumStickers, action: {

View File

@ -537,6 +537,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
}, openWebView: { _, _, _, _ in
}, requestMessageUpdate: { _ in
}, cancelInteractiveKeyboardGestures: {
}, dismissTextInput: {
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings,
pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(context: context, backgroundNode: self.backgroundNode))
self.controllerInteraction = controllerInteraction

View File

@ -163,6 +163,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
}, openWebView: { _, _, _, _ in
}, requestMessageUpdate: { _ in
}, cancelInteractiveKeyboardGestures: {
}, dismissTextInput: {
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: true), presentationContext: ChatPresentationContext(context: context, backgroundNode: nil))

View File

@ -155,6 +155,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
}, openWebView: { _, _, _, _ in
}, requestMessageUpdate: { _ in
}, cancelInteractiveKeyboardGestures: {
}, dismissTextInput: {
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(context: context, backgroundNode: nil))
self.dimNode = ASDisplayNode()

View File

@ -2356,6 +2356,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}, openWebView: { _, _, _, _ in
}, requestMessageUpdate: { _ in
}, cancelInteractiveKeyboardGestures: {
}, dismissTextInput: {
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(context: context, backgroundNode: nil))
self.hiddenMediaDisposable = context.sharedContext.mediaManager.galleryHiddenMediaManager.hiddenIds().start(next: { [weak self] ids in

View File

@ -1334,6 +1334,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
}, openWebView: { _, _, _, _ in
}, requestMessageUpdate: { _ in
}, cancelInteractiveKeyboardGestures: {
}, dismissTextInput: {
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(context: context, backgroundNode: backgroundNode as? WallpaperBackgroundNode))