From ab9d4748ec6329f6baa1949e616b3c724c60f7fc Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 19 Jan 2023 16:14:44 +0400 Subject: [PATCH] Various fixes --- .../Telegram-iOS/en.lproj/Localizable.strings | 2 +- .../PagerComponent/Sources/PagerComponent.swift | 14 ++++++++++++++ .../Display/Source/TextAlertController.swift | 2 +- .../EntityKeyboard/Sources/EntityKeyboard.swift | 1 + ...EntityKeyboardTopContainerPanelComponent.swift | 7 +++++++ .../Sources/EntityKeyboardTopPanelComponent.swift | 15 ++++++++++++--- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 4b4de772b8..5d23086978 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -8677,7 +8677,7 @@ Sorry for the inconvenience."; "RequestPeer.Requirement.Channel.Rights.Send" = "post messages"; "RequestPeer.Requirement.Channel.Rights.Delete" = "delete messages"; "RequestPeer.Requirement.Channel.Rights.Edit" = "edit messages"; -"RequestPeer.Requirement.Channel.Rights.Invite" = "add subscribers"; +"RequestPeer.Requirement.Channel.Rights.Invite" = "invite users via link"; "RequestPeer.Requirement.Channel.Rights.Pin" = "pin messages"; "RequestPeer.Requirement.Channel.Rights.Topics" = "manage topics"; "RequestPeer.Requirement.Channel.Rights.VideoChats" = "manage live streams"; diff --git a/submodules/Components/PagerComponent/Sources/PagerComponent.swift b/submodules/Components/PagerComponent/Sources/PagerComponent.swift index 6897e9c4a2..0c098a7635 100644 --- a/submodules/Components/PagerComponent/Sources/PagerComponent.swift +++ b/submodules/Components/PagerComponent/Sources/PagerComponent.swift @@ -67,6 +67,7 @@ public final class PagerComponentChildEnvironment: Equatable { } public final class PagerComponentPanelEnvironment: Equatable { + public let isContentInFocus: Bool public let contentOffset: CGFloat public let contentTopPanels: [AnyComponentWithIdentity] public let contentIcons: [PagerComponentContentIcon] @@ -78,6 +79,7 @@ public final class PagerComponentPanelEnvironment: Equatabl public let isExpandedUpdated: (Bool, Transition) -> Void init( + isContentInFocus: Bool, contentOffset: CGFloat, contentTopPanels: [AnyComponentWithIdentity], contentIcons: [PagerComponentContentIcon], @@ -88,6 +90,7 @@ public final class PagerComponentPanelEnvironment: Equatabl visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>, isExpandedUpdated: @escaping (Bool, Transition) -> Void ) { + self.isContentInFocus = isContentInFocus self.contentOffset = contentOffset self.contentTopPanels = contentTopPanels self.contentIcons = contentIcons @@ -100,6 +103,9 @@ public final class PagerComponentPanelEnvironment: Equatabl } public static func ==(lhs: PagerComponentPanelEnvironment, rhs: PagerComponentPanelEnvironment) -> Bool { + if lhs.isContentInFocus != rhs.isContentInFocus { + return false + } if lhs.contentOffset != rhs.contentOffset { return false } @@ -171,6 +177,7 @@ public final class PagerComponentContentIcon: Equatable { public final class PagerComponent: Component { public typealias EnvironmentType = ChildEnvironmentType + public let isContentInFocus: Bool public let contentInsets: UIEdgeInsets public let contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>] public let contentTopPanels: [AnyComponentWithIdentity] @@ -191,6 +198,7 @@ public final class PagerComponent], contentTopPanels: [AnyComponentWithIdentity], @@ -210,6 +218,7 @@ public final class PagerComponent Bool { + if lhs.isContentInFocus != rhs.isContentInFocus { + return false + } if lhs.contentInsets != rhs.contentInsets { return false } @@ -504,6 +516,7 @@ public final class PagerComponent( + isContentInFocus: component.isContentInFocus, contentOffset: 0.0, contentTopPanels: [], contentIcons: component.contentIcons, diff --git a/submodules/Display/Source/TextAlertController.swift b/submodules/Display/Source/TextAlertController.swift index 1a56b9799e..471c993101 100644 --- a/submodules/Display/Source/TextAlertController.swift +++ b/submodules/Display/Source/TextAlertController.swift @@ -190,7 +190,7 @@ public final class TextAlertContentNode: AlertContentNode { titleNode.attributedText = title titleNode.displaysAsynchronously = false titleNode.isUserInteractionEnabled = false - titleNode.maximumNumberOfLines = 2 + titleNode.maximumNumberOfLines = 4 titleNode.truncationType = .end titleNode.isAccessibilityElement = true self.titleNode = titleNode diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift index 3a6986eddb..49177bee6d 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift @@ -706,6 +706,7 @@ public final class EntityKeyboardComponent: Component { let pagerSize = self.pagerView.update( transition: transition, component: AnyComponent(PagerComponent( + isContentInFocus: component.isContentInFocus, contentInsets: component.containerInsets, contents: contents, contentTopPanels: contentTopPanels, diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift index 8d76d38cbc..5e2a9d9d36 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift @@ -8,18 +8,24 @@ import TelegramCore import Postbox public final class EntityKeyboardTopContainerPanelEnvironment: Equatable { + let isContentInFocus: Bool let visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)> let isExpandedUpdated: (Bool, Transition) -> Void init( + isContentInFocus: Bool, visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>, isExpandedUpdated: @escaping (Bool, Transition) -> Void ) { + self.isContentInFocus = isContentInFocus self.visibilityFractionUpdated = visibilityFractionUpdated self.isExpandedUpdated = isExpandedUpdated } public static func ==(lhs: EntityKeyboardTopContainerPanelEnvironment, rhs: EntityKeyboardTopContainerPanelEnvironment) -> Bool { + if lhs.isContentInFocus != rhs.isContentInFocus { + return false + } if lhs.visibilityFractionUpdated !== rhs.visibilityFractionUpdated { return false } @@ -146,6 +152,7 @@ final class EntityKeyboardTopContainerPanelComponent: Component { component: panel.component, environment: { EntityKeyboardTopContainerPanelEnvironment( + isContentInFocus: panelEnvironment.isContentInFocus, visibilityFractionUpdated: panelView.visibilityFractionUpdated, isExpandedUpdated: { [weak self] isExpanded, transition in guard let strongSelf = self else { diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift index 4f5cdf4ca0..ead8df10df 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopPanelComponent.swift @@ -167,7 +167,7 @@ final class EntityKeyboardAnimationTopPanelComponent: Component { itemLayer.layerTintColor = component.theme.list.itemAccentColor.cgColor } - itemLayer.isVisibleForAnimations = true + itemLayer.isVisibleForAnimations = itemEnvironment.isContentInFocus } if itemEnvironment.isExpanded { @@ -924,11 +924,13 @@ final class EntityKeyboardStaticStickersPanelComponent: Component { public final class EntityKeyboardTopPanelItemEnvironment: Equatable { public let isExpanded: Bool + public let isContentInFocus: Bool public let isHighlighted: Bool public let highlightedSubgroupId: AnyHashable? - public init(isExpanded: Bool, isHighlighted: Bool, highlightedSubgroupId: AnyHashable?) { + public init(isExpanded: Bool, isContentInFocus: Bool, isHighlighted: Bool, highlightedSubgroupId: AnyHashable?) { self.isExpanded = isExpanded + self.isContentInFocus = isContentInFocus self.isHighlighted = isHighlighted self.highlightedSubgroupId = highlightedSubgroupId } @@ -937,6 +939,9 @@ public final class EntityKeyboardTopPanelItemEnvironment: Equatable { if lhs.isExpanded != rhs.isExpanded { return false } + if lhs.isContentInFocus != rhs.isContentInFocus { + return false + } if lhs.isHighlighted != rhs.isHighlighted { return false } @@ -1798,7 +1803,11 @@ public final class EntityKeyboardTopPanelComponent: Component { transition: itemTransition, component: item.content, environment: { - EntityKeyboardTopPanelItemEnvironment(isExpanded: itemLayout.isExpanded, isHighlighted: self.activeContentItemId == item.id, highlightedSubgroupId: self.activeContentItemId == item.id ? self.activeSubcontentItemId : nil) + EntityKeyboardTopPanelItemEnvironment( + isExpanded: itemLayout.isExpanded, + isContentInFocus: self.environment?.isContentInFocus ?? false, + isHighlighted: self.activeContentItemId == item.id, + highlightedSubgroupId: self.activeContentItemId == item.id ? self.activeSubcontentItemId : nil) }, containerSize: itemOuterFrame.size )