Various fixes

This commit is contained in:
Ilya Laktyushin 2023-02-07 05:09:34 +04:00
parent f56320215b
commit f1f4eefcbf
12 changed files with 14 additions and 27 deletions

View File

@ -8895,5 +8895,3 @@ Sorry for the inconvenience.";
"Premium.Purchase.OnlyOneSubscriptionAllowed" = "You have already purchased Telegram Premium for another account. You can only have one Telegram Premium subscription on one Apple ID.";
"Call.VoiceOver.Minimize" = "Minimize Call";
"VoiceOver.Tab" = "Tab";

View File

@ -93,12 +93,10 @@ public final class NavigationBarTheme {
public final class NavigationBarStrings {
public let back: String
public let close: String
public let tab: String
public init(back: String, close: String, tab: String) {
public init(back: String, close: String) {
self.back = back
self.close = close
self.tab = tab
}
}

View File

@ -73,7 +73,7 @@ public final class TwoFactorDataInputScreen: ViewController {
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close, tab: self.presentationData.strings.VoiceOver_Tab)))
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
self.navigationPresentation = presentation

View File

@ -56,7 +56,7 @@ public final class TwoFactorAuthSplashScreen: ViewController {
let defaultTheme = NavigationBarTheme(rootControllerTheme: self.presentationData.theme)
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultTheme.buttonColor, disabledButtonColor: defaultTheme.disabledButtonColor, primaryTextColor: defaultTheme.primaryTextColor, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: defaultTheme.badgeBackgroundColor, badgeStrokeColor: defaultTheme.badgeStrokeColor, badgeTextColor: defaultTheme.badgeTextColor)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close, tab: self.presentationData.strings.VoiceOver_Tab)))
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
self.navigationPresentation = presentation

View File

@ -81,7 +81,7 @@ public final class PageIndicatorComponent: Component {
private final class PageIndicatorView: UIView {
var displayCount: Int {
return min(11, self.pageCount)
return min(12, self.pageCount)
}
var dotSize: CGFloat = 8.0
var dotSpace: CGFloat = 10.0
@ -403,5 +403,3 @@ private class ItemView: UIView {
})
}
}

View File

@ -836,7 +836,7 @@ public class PremiumLimitsListScreen: ViewController {
} else {
topInset = max(0.0, panInitialTopInset + min(0.0, panOffset))
}
} else if let dismissOffset = self.dismissOffset {
} else if let dismissOffset = self.dismissOffset, !dismissOffset.isZero {
topInset = edgeTopInset * dismissOffset
} else {
topInset = effectiveExpanded ? 0.0 : edgeTopInset

View File

@ -112,7 +112,7 @@ public final class QrCodeScanScreen: ViewController {
let navigationBarTheme = NavigationBarTheme(buttonColor: .white, disabledButtonColor: .white, primaryTextColor: .white, backgroundColor: .clear, enableBackgroundBlur: false, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close, tab: self.presentationData.strings.VoiceOver_Tab)))
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: NavigationBarStrings(back: self.presentationData.strings.Common_Back, close: self.presentationData.strings.Common_Close)))
self.statusBar.statusBarStyle = .White

View File

@ -78,7 +78,7 @@ public class TermsOfServiceController: ViewController, StandalonePresentableCont
self.decline = decline
self.openUrl = openUrl
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(back: presentationData.strings.Common_Back, close: presentationData.strings.Common_Close, tab: presentationData.strings.VoiceOver_Tab)))
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(back: presentationData.strings.Common_Back, close: presentationData.strings.Common_Close)))
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style

View File

@ -31,7 +31,7 @@ final class TabBarControllerNode: ASDisplayNode {
init(theme: TabBarControllerTheme, navigationBarPresentationData: NavigationBarPresentationData, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingNode, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void, toolbarActionSelected: @escaping (ToolbarActionOption) -> Void, disabledPressed: @escaping () -> Void) {
self.theme = theme
self.navigationBarPresentationData = navigationBarPresentationData
self.tabBarNode = TabBarNode(theme: theme, tabString: navigationBarPresentationData.strings.tab, itemSelected: itemSelected, contextAction: contextAction, swipeAction: swipeAction)
self.tabBarNode = TabBarNode(theme: theme, itemSelected: itemSelected, contextAction: contextAction, swipeAction: swipeAction)
self.disabledOverlayNode = ASDisplayNode()
self.disabledOverlayNode.backgroundColor = theme.backgroundColor.withAlphaComponent(0.5)
self.disabledOverlayNode.alpha = 0.0
@ -67,7 +67,7 @@ final class TabBarControllerNode: ASDisplayNode {
self.navigationBarPresentationData = navigationBarPresentationData
self.backgroundColor = theme.backgroundColor
self.tabBarNode.updateTheme(theme, tabString: navigationBarPresentationData.strings.tab)
self.tabBarNode.updateTheme(theme)
self.disabledOverlayNode.backgroundColor = theme.backgroundColor.withAlphaComponent(0.5)
self.toolbarNode?.updateTheme(ToolbarTheme(tabBarTheme: theme))
}

View File

@ -344,7 +344,6 @@ class TabBarNode: ASDisplayNode {
private let swipeAction: (Int, TabBarItemSwipeDirection) -> Void
private var theme: TabBarControllerTheme
private var tabString: String
private var validLayout: (CGSize, CGFloat, CGFloat, UIEdgeInsets, CGFloat)?
private var horizontal: Bool = false
private var centered: Bool = false
@ -357,12 +356,11 @@ class TabBarNode: ASDisplayNode {
private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer?
init(theme: TabBarControllerTheme, tabString: String, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingNode, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void) {
init(theme: TabBarControllerTheme, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingNode, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void) {
self.itemSelected = itemSelected
self.contextAction = contextAction
self.swipeAction = swipeAction
self.theme = theme
self.tabString = tabString
self.backgroundNode = NavigationBackgroundNode(color: theme.tabBarBackgroundColor)
@ -409,10 +407,9 @@ class TabBarNode: ASDisplayNode {
}
}
func updateTheme(_ theme: TabBarControllerTheme, tabString: String) {
func updateTheme(_ theme: TabBarControllerTheme) {
if self.theme !== theme {
self.theme = theme
self.tabString = tabString
self.separatorNode.backgroundColor = theme.tabBarSeparatorColor
self.backgroundNode.updateColor(color: theme.tabBarBackgroundColor, transition: .immediate)
@ -507,7 +504,6 @@ class TabBarNode: ASDisplayNode {
node.contextImageNode.image = contextImage
node.accessibilityLabel = item.item.title
node.accessibilityTraits = [.button, .selected]
node.accessibilityHint = self.tabString
node.contentWidth = max(contentWidth, imageContentWidth)
node.isSelected = true
} else {
@ -522,7 +518,6 @@ class TabBarNode: ASDisplayNode {
node.textImageNode.image = textImage
node.accessibilityLabel = item.item.title
node.accessibilityTraits = [.button]
node.accessibilityHint = self.tabString
node.imageNode.image = image
node.contextTextImageNode.image = contextTextImage
node.contextImageNode.image = contextImage
@ -585,7 +580,6 @@ class TabBarNode: ASDisplayNode {
node.textImageNode.image = textImage
node.accessibilityLabel = item.item.title
node.accessibilityTraits = [.button, .selected]
node.accessibilityHint = self.tabString
node.imageNode.image = image
node.contextTextImageNode.image = contextTextImage
node.contextImageNode.image = contextImage
@ -619,7 +613,6 @@ class TabBarNode: ASDisplayNode {
node.textImageNode.image = textImage
node.accessibilityLabel = item.item.title
node.accessibilityTraits = [.button]
node.accessibilityHint = self.tabString
node.imageNode.image = image
node.contextTextImageNode.image = contextTextImage
node.contextImageNode.image = contextImage

View File

@ -54,7 +54,7 @@ public extension NavigationBarTheme {
public extension NavigationBarStrings {
convenience init(presentationStrings: PresentationStrings) {
self.init(back: presentationStrings.Common_Back, close: presentationStrings.Common_Close, tab: presentationStrings.VoiceOver_Tab)
self.init(back: presentationStrings.Common_Back, close: presentationStrings.Common_Close)
}
}

View File

@ -1056,7 +1056,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
self.moreButtonNode = MoreButtonNode(theme: self.presentationData.theme)
self.moreButtonNode.iconNode.enqueueState(.more, animated: false)
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme), strings: NavigationBarStrings(back: "", close: "", tab: ""))
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme), strings: NavigationBarStrings(back: "", close: ""))
super.init(navigationBarPresentationData: navigationBarPresentationData)
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
@ -1087,7 +1087,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
if let strongSelf = self {
strongSelf.presentationData = presentationData
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(back: "", close: "", tab: ""))
let navigationBarPresentationData = NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(back: "", close: ""))
strongSelf.navigationBar?.updatePresentationData(navigationBarPresentationData)
strongSelf.titleView?.theme = presentationData.theme