Various fixes

This commit is contained in:
Ilya Laktyushin 2021-01-25 01:40:42 +03:00
parent afe969b901
commit f17b0f6795
11 changed files with 3667 additions and 3609 deletions

View File

@ -5929,3 +5929,6 @@ Sorry for the inconvenience.";
"CallList.DeleteAllForMe" = "Delete for me";
"CallList.DeleteAllForEveryone" = "Delete for me and Others";
"Conversation.ImportProgress" = "Importing Messages... %@%";
"Conversation.AudioRateTooltipSpeedUp" = "The audio will now play 2 times faster.";
"Conversation.AudioRateTooltipNormal" = "The audio will now play at normal speed.";

View File

@ -13,6 +13,7 @@ import AccountContext
import OverlayStatusController
import PresentationDataUtils
import TelegramCallsUI
import UndoUI
public enum MediaAccessoryPanelVisibility {
case none
@ -676,6 +677,33 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
return
}
strongSelf.context.sharedContext.mediaManager.playlistControl(.setBaseRate(baseRate), type: type)
var hasTooltip = false
strongSelf.forEachController({ controller in
if let controller = controller as? UndoOverlayController {
hasTooltip = true
controller.dismissWithCommitAction()
}
return true
})
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
let slowdown = baseRate == .x1
strongSelf.present(
UndoOverlayController(
presentationData: strongSelf.presentationData,
content: .audioRate(
slowdown: slowdown,
text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp
),
elevatedLayout: false,
animateInAsReplacement: hasTooltip,
action: { action in
return true
}
),
in: .current
)
})
}
mediaAccessoryPanel.togglePlayPause = { [weak self] in

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6301,7 +6301,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
if strongSelf.shouldDisplayChecksTooltip {
strongSelf.displayChecksTooltip()
Queue.mainQueue().after(1.0) {
strongSelf.displayChecksTooltip()
}
strongSelf.shouldDisplayChecksTooltip = false
strongSelf.checksTooltipDisposable.set(dismissServerProvidedSuggestion(account: strongSelf.context.account, suggestion: .newcomerTicks).start())
}

View File

@ -547,6 +547,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
strongSelf.didDisplayEmptyGreeting = true
}
}
} else if case .messages = loadState {
strongSelf.didDisplayEmptyGreeting = true
}
strongSelf.updateIsEmpty(emptyType, animated: animated)
}

View File

@ -149,6 +149,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
private var didSetUpAnimationNode = false
private var isPlaying = false
private var animateGreeting = false
private var animatingGreeting = false
private weak var greetingStickerParentNode: ASDisplayNode?
private weak var greetingStickerListNode: ASDisplayNode?
private var greetingCompletion: (() -> Void)?
@ -242,7 +243,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
return
}
if image != nil {
if firstTime && !strongSelf.placeholderNode.isEmpty {
if firstTime && !strongSelf.placeholderNode.isEmpty && !strongSelf.animateGreeting && !strongSelf.animatingGreeting {
strongSelf.animationNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
strongSelf.removePlaceholder(animated: true)
} else {
@ -965,6 +966,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
if let animationNode = strongSelf.animationNode, let parentNode = strongSelf.greetingStickerParentNode, strongSelf.animateGreeting {
strongSelf.animateGreeting = false
strongSelf.animatingGreeting = true
let initialFrame = animationNode.view.convert(animationNode.bounds, to: parentNode.view)
parentNode.addSubnode(animationNode)
@ -991,6 +993,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
strongSelf.dateAndStatusNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
strongSelf.greetingCompletion?()
strongSelf.animatingGreeting = false
}
})

View File

@ -27,6 +27,7 @@ public enum UndoOverlayContent {
case linkCopied(text: String)
case banned(text: String)
case importedMessage(text: String)
case audioRate(slowdown: Bool, text: String)
}
public enum UndoOverlayAction {

View File

@ -477,6 +477,21 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
self.avatarNode?.setPeer(context: context, theme: presentationData.theme, peer: peer, overrideImage: nil, emptyColor: presentationData.theme.list.mediaPlaceholderColor, synchronousLoad: true)
displayUndo = false
self.originalRemainingSeconds = 3
case let .audioRate(slowdown, text):
self.avatarNode = nil
self.iconNode = nil
self.iconCheckNode = nil
self.animationNode = AnimationNode(animation: slowdown ? "anim_voicespeedstop" : "anim_voicespeed", colors: [:], scale: 0.066)
self.animatedStickerNode = nil
let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white)
let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white)
let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .natural)
self.textNode.attributedText = attributedText
self.textNode.maximumNumberOfLines = 2
displayUndo = false
self.originalRemainingSeconds = 3
}
@ -507,7 +522,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
switch content {
case .removedChat:
self.panelWrapperNode.addSubnode(self.timerTextNode)
case .archivedChat, .hidArchive, .revealedArchive, .succeed, .emoji, .swipeToReply, .actionSucceeded, .stickersModified, .chatAddedToFolder, .chatRemovedFromFolder, .messagesUnpinned, .setProximityAlert, .invitedToVoiceChat, .linkCopied, .banned, .importedMessage:
case .archivedChat, .hidArchive, .revealedArchive, .succeed, .emoji, .swipeToReply, .actionSucceeded, .stickersModified, .chatAddedToFolder, .chatRemovedFromFolder, .messagesUnpinned, .setProximityAlert, .invitedToVoiceChat, .linkCopied, .banned, .importedMessage, .audioRate:
break
case .dice:
self.panelWrapperNode.clipsToBounds = true