Various fixes

This commit is contained in:
Ilya Laktyushin 2021-03-02 22:40:22 +04:00
parent fbc8212ee8
commit 52f9e9b42f
6 changed files with 3367 additions and 3307 deletions

View File

@ -6184,3 +6184,22 @@ Sorry for the inconvenience.";
"InstantPage.VoiceOver.ResetFontSize" = "Reset Font Size";
"Contacts.VoiceOver.AddContact" = "Add Contact";
"VoiceChat.InviteLinks.Speaker" = "Speaker";
"VoiceChat.InviteLinks.Listener" = "Listener";
"VoiceChat.InviteLinks.CopySpeakerLink" = "Copy Speaker Link";
"VoiceChat.InviteLinks.CopyListenerLink" = "Copy Listener Link";
"VoiceChat.InviteLink.InviteSpeakers_0" = "[%@] Invite Speakers";
"VoiceChat.InviteLink.InviteSpeakers_1" = "[%@] Invite Speaker";
"VoiceChat.InviteLink.InviteSpeakers_2" = "[%@] Invite Speakers";
"VoiceChat.InviteLink.InviteSpeakers_3_10" = "[%@] Invite Speakers";
"VoiceChat.InviteLink.InviteSpeakers_many" = "[%@] Invite Speakers";
"VoiceChat.InviteLink.InviteSpeakers_any" = "[%@] Invite Speakers";
"VoiceChat.InviteLink.InviteListeners_0" = "[%@] Invite Listeners";
"VoiceChat.InviteLink.InviteListeners_1" = "[%@] Invite Listener";
"VoiceChat.InviteLink.InviteListeners_2" = "[%@] Invite Listeners";
"VoiceChat.InviteLink.InviteListeners_3_10" = "[%@] Invite Listeners";
"VoiceChat.InviteLink.InviteListeners_many" = "[%@] Invite Listeners";
"VoiceChat.InviteLink.InviteListeners_any" = "[%@] Invite Listeners";

View File

@ -59,7 +59,16 @@ final class ContextActionNode: ASDisplayNode, ContextActionNodeProtocol {
case .destructive:
textColor = presentationData.theme.contextMenu.destructiveColor
}
self.textNode.attributedText = NSAttributedString(string: action.text, font: textFont, textColor: textColor)
let titleFont: UIFont
switch action.textFont {
case .regular:
titleFont = textFont
case let .custom(customFont):
titleFont = customFont
}
self.textNode.attributedText = NSAttributedString(string: action.text, font: titleFont, textColor: textColor)
switch action.textLayout {
case .singleLine:
@ -260,8 +269,15 @@ final class ContextActionNode: ASDisplayNode, ContextActionNodeProtocol {
}
let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize)
let titleFont: UIFont
switch self.action.textFont {
case .regular:
titleFont = textFont
case let .custom(customFont):
titleFont = customFont
}
self.textNode.attributedText = NSAttributedString(string: self.action.text, font: textFont, textColor: textColor)
self.textNode.attributedText = NSAttributedString(string: self.action.text, font: titleFont, textColor: textColor)
switch self.action.textLayout {
case let .secondLineWithValue(value):

View File

@ -28,6 +28,11 @@ public enum ContextMenuActionResult {
case custom(ContainedViewLayoutTransition)
}
public enum ContextMenuActionItemFont {
case regular
case custom(UIFont)
}
public struct ContextMenuActionItemIconSource {
public let size: CGSize
public let signal: Signal<UIImage?, NoError>
@ -56,15 +61,17 @@ public struct ContextMenuActionBadge {
public final class ContextMenuActionItem {
public let text: String
public let textColor: ContextMenuActionItemTextColor
public let textFont: ContextMenuActionItemFont
public let textLayout: ContextMenuActionItemTextLayout
public let badge: ContextMenuActionBadge?
public let icon: (PresentationTheme) -> UIImage?
public let iconSource: ContextMenuActionItemIconSource?
public let action: (ContextController, @escaping (ContextMenuActionResult) -> Void) -> Void
public init(text: String, textColor: ContextMenuActionItemTextColor = .primary, textLayout: ContextMenuActionItemTextLayout = .twoLinesMax, badge: ContextMenuActionBadge? = nil, icon: @escaping (PresentationTheme) -> UIImage?, iconSource: ContextMenuActionItemIconSource? = nil, action: @escaping (ContextController, @escaping (ContextMenuActionResult) -> Void) -> Void) {
public init(text: String, textColor: ContextMenuActionItemTextColor = .primary, textLayout: ContextMenuActionItemTextLayout = .twoLinesMax, textFont: ContextMenuActionItemFont = .regular, badge: ContextMenuActionBadge? = nil, icon: @escaping (PresentationTheme) -> UIImage?, iconSource: ContextMenuActionItemIconSource? = nil, action: @escaping (ContextController, @escaping (ContextMenuActionResult) -> Void) -> Void) {
self.text = text
self.textColor = textColor
self.textFont = textFont
self.textLayout = textLayout
self.badge = badge
self.icon = icon

View File

@ -73,6 +73,10 @@ public struct ContainerViewLayout: Equatable {
return ContainerViewLayout(size: size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: self.intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: self.inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
}
public func withUpdatedIntrinsicInsets(_ intrinsicInsets: UIEdgeInsets) -> ContainerViewLayout {
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: self.inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
}
public func withUpdatedInputHeight(_ inputHeight: CGFloat?) -> ContainerViewLayout {
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: self.intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
}