mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 01:10:09 +00:00
Various fixes
This commit is contained in:
parent
8a9a557870
commit
84bbf58e88
@ -8535,3 +8535,6 @@ Sorry for the inconvenience.";
|
||||
|
||||
"Privacy.Exceptions.DeleteAll" = "Delete All";
|
||||
"Privacy.Exceptions.DeleteAllConfirmation" = "Are you sure you want to delete all exceptions?";
|
||||
|
||||
"Attachment.EnableSpoiler" = "Hide With Spoiler";
|
||||
"Attachment.DisableSpoiler" = "Disable Spoiler";
|
||||
|
||||
@ -169,9 +169,13 @@ public final class AnimationNode : ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public func loop() {
|
||||
public func loop(count: Int? = nil) {
|
||||
if let animationView = self.animationView() {
|
||||
if let count = count {
|
||||
animationView.loopMode = .repeat(Float(count))
|
||||
} else {
|
||||
animationView.loopMode = .loop
|
||||
}
|
||||
animationView.play()
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,6 +187,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
public let isTopPanelExpandedUpdated: (Bool, Transition) -> Void
|
||||
public let isTopPanelHiddenUpdated: (Bool, Transition) -> Void
|
||||
public let panelHideBehavior: PagerComponentPanelHideBehavior
|
||||
public let clipContentToTopPanel: Bool
|
||||
|
||||
public init(
|
||||
contentInsets: UIEdgeInsets,
|
||||
@ -204,7 +205,8 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
panelStateUpdated: ((PagerComponentPanelState, Transition) -> Void)?,
|
||||
isTopPanelExpandedUpdated: @escaping (Bool, Transition) -> Void,
|
||||
isTopPanelHiddenUpdated: @escaping (Bool, Transition) -> Void,
|
||||
panelHideBehavior: PagerComponentPanelHideBehavior
|
||||
panelHideBehavior: PagerComponentPanelHideBehavior,
|
||||
clipContentToTopPanel: Bool
|
||||
) {
|
||||
self.contentInsets = contentInsets
|
||||
self.contents = contents
|
||||
@ -222,6 +224,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
self.isTopPanelExpandedUpdated = isTopPanelExpandedUpdated
|
||||
self.isTopPanelHiddenUpdated = isTopPanelHiddenUpdated
|
||||
self.panelHideBehavior = panelHideBehavior
|
||||
self.clipContentToTopPanel = clipContentToTopPanel
|
||||
}
|
||||
|
||||
public static func ==(lhs: PagerComponent, rhs: PagerComponent) -> Bool {
|
||||
@ -258,6 +261,9 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
if lhs.panelHideBehavior != rhs.panelHideBehavior {
|
||||
return false
|
||||
}
|
||||
if lhs.clipContentToTopPanel != rhs.clipContentToTopPanel {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@ -282,6 +288,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
var fraction: CGFloat = 0.0
|
||||
}
|
||||
|
||||
private var contentClippingView: UIView
|
||||
private var contentViews: [AnyHashable: ContentView] = [:]
|
||||
private var contentBackgroundView: ComponentHostView<Empty>?
|
||||
private let topPanelVisibilityFractionUpdated = ActionSlot<(CGFloat, Transition)>()
|
||||
@ -307,8 +314,13 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
self.contentClippingView = UIView()
|
||||
self.contentClippingView.clipsToBounds = true
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.addSubview(self.contentClippingView)
|
||||
|
||||
self.disablesInteractiveTransitionGestureRecognizer = true
|
||||
|
||||
let panRecognizer = PagerPanGestureRecognizerImpl(target: self, action: #selector(self.panGesture(_:)))
|
||||
@ -444,6 +456,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
self.centralId = centralId
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: availableSize.width, height: availableSize.height)
|
||||
var contentInsets = component.contentInsets
|
||||
contentInsets.bottom = 0.0
|
||||
var contentInsetTopPanelValue: CGFloat = 0.0
|
||||
@ -530,6 +543,10 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
panelStateTransition.setFrame(view: topPanelView, frame: CGRect(origin: CGPoint(), size: CGSize(width: topPanelSize.width, height: visibleTopPanelHeight)))
|
||||
} else {
|
||||
panelStateTransition.setFrame(view: topPanelView, frame: CGRect(origin: CGPoint(x: 0.0, y: -topPanelOffset), size: topPanelSize))
|
||||
|
||||
let clippingOffset: CGFloat = component.clipContentToTopPanel ? topPanelSize.height - topPanelOffset : 0.0
|
||||
panelStateTransition.setFrame(view: self.contentClippingView, frame: CGRect(origin: CGPoint(x: 0.0, y: clippingOffset), size: contentSize))
|
||||
panelStateTransition.setBounds(view: self.contentClippingView, bounds: CGRect(origin: CGPoint(x: 0.0, y: clippingOffset), size: contentSize))
|
||||
}
|
||||
|
||||
contentInsetTopPanelValue = topPanelSize.height
|
||||
@ -623,7 +640,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
contentBackgroundTransition = .immediate
|
||||
contentBackgroundView = ComponentHostView<Empty>()
|
||||
self.contentBackgroundView = contentBackgroundView
|
||||
self.insertSubview(contentBackgroundView, at: 0)
|
||||
self.contentClippingView.insertSubview(contentBackgroundView, at: 0)
|
||||
}
|
||||
let _ = contentBackgroundView.update(
|
||||
transition: contentBackgroundTransition,
|
||||
@ -641,8 +658,6 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
|
||||
var validIds: [AnyHashable] = []
|
||||
if let centralId = self.centralId, let centralIndex = component.contents.firstIndex(where: { $0.id == centralId }) {
|
||||
let contentSize = CGSize(width: availableSize.width, height: availableSize.height)
|
||||
|
||||
var referenceFrames: [AnyHashable: CGRect] = [:]
|
||||
if case .none = transition.animation {
|
||||
} else {
|
||||
@ -686,9 +701,9 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
|
||||
contentTransition = transition.withAnimation(.none)
|
||||
self.contentViews[content.id] = contentView
|
||||
if let contentBackgroundView = self.contentBackgroundView {
|
||||
self.insertSubview(contentView.view, aboveSubview: contentBackgroundView)
|
||||
self.contentClippingView.insertSubview(contentView.view, aboveSubview: contentBackgroundView)
|
||||
} else {
|
||||
self.insertSubview(contentView.view, at: 0)
|
||||
self.contentClippingView.insertSubview(contentView.view, at: 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
|
||||
} else if let animationName = self.item.animationName {
|
||||
if self.animationNode == nil {
|
||||
let animationNode = AnimationNode(animation: animationName, colors: ["__allcolors__": titleColor], scale: 1.0)
|
||||
animationNode.loop()
|
||||
animationNode.loop(count: 3)
|
||||
self.addSubnode(animationNode)
|
||||
self.animationNode = animationNode
|
||||
}
|
||||
|
||||
@ -156,7 +156,8 @@ private final class StickerSelectionComponent: Component {
|
||||
hiddenInputHeight: 0.0,
|
||||
inputHeight: 0.0,
|
||||
displayBottomPanel: true,
|
||||
isExpanded: true
|
||||
isExpanded: true,
|
||||
clipContentToTopPanel: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: availableSize
|
||||
|
||||
@ -1567,7 +1567,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
if !items.isEmpty {
|
||||
items.append(.separator)
|
||||
}
|
||||
items.append(.action(ContextMenuActionItem(text: hasSpoilers ? "Disable Spoiler Effect" : "Spoiler Effect", icon: { _ in return nil }, animationName: "anim_spoiler", action: { [weak self] _, f in
|
||||
items.append(.action(ContextMenuActionItem(text: hasSpoilers ? strings.Attachment_DisableSpoiler : strings.Attachment_EnableSpoiler, icon: { _ in return nil }, animationName: "anim_spoiler", action: { [weak self] _, f in
|
||||
f(.default)
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
||||
@ -256,6 +256,8 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate var clipContentToTopPanel: Bool = false
|
||||
|
||||
var externalTopPanelContainerImpl: PagerExternalTopPanelContainer?
|
||||
public override var externalTopPanelContainer: UIView? {
|
||||
return self.externalTopPanelContainerImpl
|
||||
@ -1417,7 +1419,8 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
hiddenInputHeight: hiddenInputHeight,
|
||||
inputHeight: inputHeight,
|
||||
displayBottomPanel: true,
|
||||
isExpanded: isExpanded && !self.isEmojiSearchActive
|
||||
isExpanded: isExpanded && !self.isEmojiSearchActive,
|
||||
clipContentToTopPanel: self.clipContentToTopPanel
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: width, height: expandedHeight)
|
||||
@ -1895,6 +1898,7 @@ public final class EntityInputView: UIInputView, AttachmentTextInputPanelInputVi
|
||||
chatPeerId: nil
|
||||
)
|
||||
self.inputNode = inputNode
|
||||
inputNode.clipContentToTopPanel = hideBackground
|
||||
inputNode.emojiInputInteraction = inputInteraction
|
||||
inputNode.externalTopPanelContainerImpl = nil
|
||||
inputNode.switchToTextInput = { [weak self] in
|
||||
|
||||
@ -189,7 +189,8 @@ public final class EmojiStatusSelectionComponent: Component {
|
||||
hiddenInputHeight: 0.0,
|
||||
inputHeight: 0.0,
|
||||
displayBottomPanel: false,
|
||||
isExpanded: false
|
||||
isExpanded: false,
|
||||
clipContentToTopPanel: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: availableSize
|
||||
|
||||
@ -113,6 +113,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
public let inputHeight: CGFloat
|
||||
public let displayBottomPanel: Bool
|
||||
public let isExpanded: Bool
|
||||
public let clipContentToTopPanel: Bool
|
||||
|
||||
public init(
|
||||
theme: PresentationTheme,
|
||||
@ -141,7 +142,8 @@ public final class EntityKeyboardComponent: Component {
|
||||
hiddenInputHeight: CGFloat,
|
||||
inputHeight: CGFloat,
|
||||
displayBottomPanel: Bool,
|
||||
isExpanded: Bool
|
||||
isExpanded: Bool,
|
||||
clipContentToTopPanel: Bool
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
@ -170,6 +172,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
self.inputHeight = inputHeight
|
||||
self.displayBottomPanel = displayBottomPanel
|
||||
self.isExpanded = isExpanded
|
||||
self.clipContentToTopPanel = clipContentToTopPanel
|
||||
}
|
||||
|
||||
public static func ==(lhs: EntityKeyboardComponent, rhs: EntityKeyboardComponent) -> Bool {
|
||||
@ -230,6 +233,9 @@ public final class EntityKeyboardComponent: Component {
|
||||
if lhs.isExpanded != rhs.isExpanded {
|
||||
return false
|
||||
}
|
||||
if lhs.clipContentToTopPanel != rhs.clipContentToTopPanel {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@ -738,7 +744,8 @@ public final class EntityKeyboardComponent: Component {
|
||||
}
|
||||
strongSelf.isTopPanelHiddenUpdated(isTopPanelHidden: isTopPanelHidden, transition: transition)
|
||||
},
|
||||
panelHideBehavior: panelHideBehavior
|
||||
panelHideBehavior: panelHideBehavior,
|
||||
clipContentToTopPanel: component.clipContentToTopPanel
|
||||
)),
|
||||
environment: {
|
||||
EntityKeyboardChildEnvironment(
|
||||
|
||||
@ -420,7 +420,8 @@ private final class TopicIconSelectionComponent: Component {
|
||||
hiddenInputHeight: 0.0,
|
||||
inputHeight: 0.0,
|
||||
displayBottomPanel: false,
|
||||
isExpanded: true
|
||||
isExpanded: true,
|
||||
clipContentToTopPanel: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: availableSize
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user