Various fixes

This commit is contained in:
Ilya Laktyushin 2023-01-19 16:14:44 +04:00
parent 50a789e9ed
commit ab9d4748ec
6 changed files with 36 additions and 5 deletions

View File

@ -8677,7 +8677,7 @@ Sorry for the inconvenience.";
"RequestPeer.Requirement.Channel.Rights.Send" = "post messages"; "RequestPeer.Requirement.Channel.Rights.Send" = "post messages";
"RequestPeer.Requirement.Channel.Rights.Delete" = "delete messages"; "RequestPeer.Requirement.Channel.Rights.Delete" = "delete messages";
"RequestPeer.Requirement.Channel.Rights.Edit" = "edit 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.Pin" = "pin messages";
"RequestPeer.Requirement.Channel.Rights.Topics" = "manage topics"; "RequestPeer.Requirement.Channel.Rights.Topics" = "manage topics";
"RequestPeer.Requirement.Channel.Rights.VideoChats" = "manage live streams"; "RequestPeer.Requirement.Channel.Rights.VideoChats" = "manage live streams";

View File

@ -67,6 +67,7 @@ public final class PagerComponentChildEnvironment: Equatable {
} }
public final class PagerComponentPanelEnvironment<TopPanelEnvironment>: Equatable { public final class PagerComponentPanelEnvironment<TopPanelEnvironment>: Equatable {
public let isContentInFocus: Bool
public let contentOffset: CGFloat public let contentOffset: CGFloat
public let contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>] public let contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>]
public let contentIcons: [PagerComponentContentIcon] public let contentIcons: [PagerComponentContentIcon]
@ -78,6 +79,7 @@ public final class PagerComponentPanelEnvironment<TopPanelEnvironment>: Equatabl
public let isExpandedUpdated: (Bool, Transition) -> Void public let isExpandedUpdated: (Bool, Transition) -> Void
init( init(
isContentInFocus: Bool,
contentOffset: CGFloat, contentOffset: CGFloat,
contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>], contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>],
contentIcons: [PagerComponentContentIcon], contentIcons: [PagerComponentContentIcon],
@ -88,6 +90,7 @@ public final class PagerComponentPanelEnvironment<TopPanelEnvironment>: Equatabl
visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>, visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>,
isExpandedUpdated: @escaping (Bool, Transition) -> Void isExpandedUpdated: @escaping (Bool, Transition) -> Void
) { ) {
self.isContentInFocus = isContentInFocus
self.contentOffset = contentOffset self.contentOffset = contentOffset
self.contentTopPanels = contentTopPanels self.contentTopPanels = contentTopPanels
self.contentIcons = contentIcons self.contentIcons = contentIcons
@ -100,6 +103,9 @@ public final class PagerComponentPanelEnvironment<TopPanelEnvironment>: Equatabl
} }
public static func ==(lhs: PagerComponentPanelEnvironment, rhs: PagerComponentPanelEnvironment) -> Bool { public static func ==(lhs: PagerComponentPanelEnvironment, rhs: PagerComponentPanelEnvironment) -> Bool {
if lhs.isContentInFocus != rhs.isContentInFocus {
return false
}
if lhs.contentOffset != rhs.contentOffset { if lhs.contentOffset != rhs.contentOffset {
return false return false
} }
@ -171,6 +177,7 @@ public final class PagerComponentContentIcon: Equatable {
public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvironment: Equatable>: Component { public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvironment: Equatable>: Component {
public typealias EnvironmentType = ChildEnvironmentType public typealias EnvironmentType = ChildEnvironmentType
public let isContentInFocus: Bool
public let contentInsets: UIEdgeInsets public let contentInsets: UIEdgeInsets
public let contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>] public let contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>]
public let contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>] public let contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>]
@ -191,6 +198,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
public let clipContentToTopPanel: Bool public let clipContentToTopPanel: Bool
public init( public init(
isContentInFocus: Bool,
contentInsets: UIEdgeInsets, contentInsets: UIEdgeInsets,
contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>], contents: [AnyComponentWithIdentity<(ChildEnvironmentType, PagerComponentChildEnvironment)>],
contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>], contentTopPanels: [AnyComponentWithIdentity<TopPanelEnvironment>],
@ -210,6 +218,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
panelHideBehavior: PagerComponentPanelHideBehavior, panelHideBehavior: PagerComponentPanelHideBehavior,
clipContentToTopPanel: Bool clipContentToTopPanel: Bool
) { ) {
self.isContentInFocus = isContentInFocus
self.contentInsets = contentInsets self.contentInsets = contentInsets
self.contents = contents self.contents = contents
self.contentTopPanels = contentTopPanels self.contentTopPanels = contentTopPanels
@ -231,6 +240,9 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
} }
public static func ==(lhs: PagerComponent, rhs: PagerComponent) -> Bool { public static func ==(lhs: PagerComponent, rhs: PagerComponent) -> Bool {
if lhs.isContentInFocus != rhs.isContentInFocus {
return false
}
if lhs.contentInsets != rhs.contentInsets { if lhs.contentInsets != rhs.contentInsets {
return false return false
} }
@ -504,6 +516,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
component: topPanel, component: topPanel,
environment: { environment: {
PagerComponentPanelEnvironment( PagerComponentPanelEnvironment(
isContentInFocus: component.isContentInFocus,
contentOffset: 0.0, contentOffset: 0.0,
contentTopPanels: component.contentTopPanels, contentTopPanels: component.contentTopPanels,
contentIcons: [], contentIcons: [],
@ -596,6 +609,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
component: bottomPanel, component: bottomPanel,
environment: { environment: {
PagerComponentPanelEnvironment<TopPanelEnvironment>( PagerComponentPanelEnvironment<TopPanelEnvironment>(
isContentInFocus: component.isContentInFocus,
contentOffset: 0.0, contentOffset: 0.0,
contentTopPanels: [], contentTopPanels: [],
contentIcons: component.contentIcons, contentIcons: component.contentIcons,

View File

@ -190,7 +190,7 @@ public final class TextAlertContentNode: AlertContentNode {
titleNode.attributedText = title titleNode.attributedText = title
titleNode.displaysAsynchronously = false titleNode.displaysAsynchronously = false
titleNode.isUserInteractionEnabled = false titleNode.isUserInteractionEnabled = false
titleNode.maximumNumberOfLines = 2 titleNode.maximumNumberOfLines = 4
titleNode.truncationType = .end titleNode.truncationType = .end
titleNode.isAccessibilityElement = true titleNode.isAccessibilityElement = true
self.titleNode = titleNode self.titleNode = titleNode

View File

@ -706,6 +706,7 @@ public final class EntityKeyboardComponent: Component {
let pagerSize = self.pagerView.update( let pagerSize = self.pagerView.update(
transition: transition, transition: transition,
component: AnyComponent(PagerComponent( component: AnyComponent(PagerComponent(
isContentInFocus: component.isContentInFocus,
contentInsets: component.containerInsets, contentInsets: component.containerInsets,
contents: contents, contents: contents,
contentTopPanels: contentTopPanels, contentTopPanels: contentTopPanels,

View File

@ -8,18 +8,24 @@ import TelegramCore
import Postbox import Postbox
public final class EntityKeyboardTopContainerPanelEnvironment: Equatable { public final class EntityKeyboardTopContainerPanelEnvironment: Equatable {
let isContentInFocus: Bool
let visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)> let visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>
let isExpandedUpdated: (Bool, Transition) -> Void let isExpandedUpdated: (Bool, Transition) -> Void
init( init(
isContentInFocus: Bool,
visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>, visibilityFractionUpdated: ActionSlot<(CGFloat, Transition)>,
isExpandedUpdated: @escaping (Bool, Transition) -> Void isExpandedUpdated: @escaping (Bool, Transition) -> Void
) { ) {
self.isContentInFocus = isContentInFocus
self.visibilityFractionUpdated = visibilityFractionUpdated self.visibilityFractionUpdated = visibilityFractionUpdated
self.isExpandedUpdated = isExpandedUpdated self.isExpandedUpdated = isExpandedUpdated
} }
public static func ==(lhs: EntityKeyboardTopContainerPanelEnvironment, rhs: EntityKeyboardTopContainerPanelEnvironment) -> Bool { public static func ==(lhs: EntityKeyboardTopContainerPanelEnvironment, rhs: EntityKeyboardTopContainerPanelEnvironment) -> Bool {
if lhs.isContentInFocus != rhs.isContentInFocus {
return false
}
if lhs.visibilityFractionUpdated !== rhs.visibilityFractionUpdated { if lhs.visibilityFractionUpdated !== rhs.visibilityFractionUpdated {
return false return false
} }
@ -146,6 +152,7 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
component: panel.component, component: panel.component,
environment: { environment: {
EntityKeyboardTopContainerPanelEnvironment( EntityKeyboardTopContainerPanelEnvironment(
isContentInFocus: panelEnvironment.isContentInFocus,
visibilityFractionUpdated: panelView.visibilityFractionUpdated, visibilityFractionUpdated: panelView.visibilityFractionUpdated,
isExpandedUpdated: { [weak self] isExpanded, transition in isExpandedUpdated: { [weak self] isExpanded, transition in
guard let strongSelf = self else { guard let strongSelf = self else {

View File

@ -167,7 +167,7 @@ final class EntityKeyboardAnimationTopPanelComponent: Component {
itemLayer.layerTintColor = component.theme.list.itemAccentColor.cgColor itemLayer.layerTintColor = component.theme.list.itemAccentColor.cgColor
} }
itemLayer.isVisibleForAnimations = true itemLayer.isVisibleForAnimations = itemEnvironment.isContentInFocus
} }
if itemEnvironment.isExpanded { if itemEnvironment.isExpanded {
@ -924,11 +924,13 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
public final class EntityKeyboardTopPanelItemEnvironment: Equatable { public final class EntityKeyboardTopPanelItemEnvironment: Equatable {
public let isExpanded: Bool public let isExpanded: Bool
public let isContentInFocus: Bool
public let isHighlighted: Bool public let isHighlighted: Bool
public let highlightedSubgroupId: AnyHashable? 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.isExpanded = isExpanded
self.isContentInFocus = isContentInFocus
self.isHighlighted = isHighlighted self.isHighlighted = isHighlighted
self.highlightedSubgroupId = highlightedSubgroupId self.highlightedSubgroupId = highlightedSubgroupId
} }
@ -937,6 +939,9 @@ public final class EntityKeyboardTopPanelItemEnvironment: Equatable {
if lhs.isExpanded != rhs.isExpanded { if lhs.isExpanded != rhs.isExpanded {
return false return false
} }
if lhs.isContentInFocus != rhs.isContentInFocus {
return false
}
if lhs.isHighlighted != rhs.isHighlighted { if lhs.isHighlighted != rhs.isHighlighted {
return false return false
} }
@ -1798,7 +1803,11 @@ public final class EntityKeyboardTopPanelComponent: Component {
transition: itemTransition, transition: itemTransition,
component: item.content, component: item.content,
environment: { 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 containerSize: itemOuterFrame.size
) )