mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various UI fixes
This commit is contained in:
parent
3ae0ae5dae
commit
21c012ab92
@ -340,8 +340,9 @@ private final class LegacyComponentsGlobalsProviderImpl: NSObject, LegacyCompone
|
||||
|
||||
let theme = presentationTheme.list
|
||||
let navigationBar = presentationTheme.rootController.navigationBar
|
||||
let tabBar = presentationTheme.rootController.tabBar
|
||||
|
||||
return TGMediaAssetsPallete(dark: presentationTheme.overallDarkAppearance, backgroundColor: theme.plainBackgroundColor, selectionColor: theme.itemHighlightedBackgroundColor, separatorColor: theme.itemPlainSeparatorColor, textColor: theme.itemPrimaryTextColor, secondaryTextColor: theme.controlSecondaryColor, accentColor: theme.itemAccentColor, barBackgroundColor: navigationBar.backgroundColor, barSeparatorColor: navigationBar.separatorColor, navigationTitleColor: navigationBar.primaryTextColor, badge: generateStretchableFilledCircleImage(diameter: 22.0, color: navigationBar.accentTextColor), badgeTextColor: navigationBar.backgroundColor, sendIconImage: PresentationResourcesChat.chatInputPanelSendButtonImage(presentationTheme), maybeAccentColor: navigationBar.accentTextColor)
|
||||
return TGMediaAssetsPallete(dark: presentationTheme.overallDarkAppearance, backgroundColor: theme.plainBackgroundColor, selectionColor: theme.itemHighlightedBackgroundColor, separatorColor: theme.itemPlainSeparatorColor, textColor: theme.itemPrimaryTextColor, secondaryTextColor: theme.controlSecondaryColor, accentColor: theme.itemAccentColor, barBackgroundColor: tabBar.backgroundColor, barSeparatorColor: tabBar.separatorColor, navigationTitleColor: navigationBar.primaryTextColor, badge: generateStretchableFilledCircleImage(diameter: 22.0, color: navigationBar.accentTextColor), badgeTextColor: navigationBar.backgroundColor, sendIconImage: PresentationResourcesChat.chatInputPanelSendButtonImage(presentationTheme), maybeAccentColor: navigationBar.accentTextColor)
|
||||
}
|
||||
|
||||
func checkButtonPallete() -> TGCheckButtonPallete! {
|
||||
|
@ -101,7 +101,7 @@ private final class ThemeAutoNightTimeSelectionActionSheetItemNode: ActionSheetI
|
||||
self.pickerView.datePickerMode = .time
|
||||
self.pickerView.timeZone = TimeZone(secondsFromGMT: 0)
|
||||
self.pickerView.date = Date(timeIntervalSince1970: Double(currentValue))
|
||||
self.pickerView.locale = localeWithStrings(strings)
|
||||
self.pickerView.locale = Locale.current
|
||||
|
||||
self.pickerView.setValue(theme.primaryTextColor, forKey: "textColor")
|
||||
|
||||
|
@ -24,13 +24,12 @@ public final class ThemePreviewController: ViewController {
|
||||
private let previewTheme: PresentationTheme
|
||||
private let source: ThemePreviewSource
|
||||
private let theme = Promise<TelegramTheme?>()
|
||||
private let presentationTheme = Promise<PresentationTheme>()
|
||||
|
||||
private var controllerNode: ThemePreviewControllerNode {
|
||||
return self.displayNode as! ThemePreviewControllerNode
|
||||
}
|
||||
|
||||
private let titleView: CounterContollerTitleView
|
||||
|
||||
|
||||
private var didPlayPresentationAnimation = false
|
||||
|
||||
private var presentationData: PresentationData
|
||||
@ -45,8 +44,11 @@ public final class ThemePreviewController: ViewController {
|
||||
self.source = source
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self.presentationTheme.set(.single(previewTheme))
|
||||
|
||||
self.titleView = CounterContollerTitleView(theme: self.previewTheme)
|
||||
let titleView = CounterContollerTitleView(theme: self.previewTheme)
|
||||
titleView.title = CounterContollerTitle(title: themeName, counter: " ")
|
||||
strongSelf.titleView = titleView
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationTheme: self.previewTheme, presentationStrings: self.presentationData.strings))
|
||||
|
||||
@ -61,12 +63,29 @@ public final class ThemePreviewController: ViewController {
|
||||
return .single(nil)
|
||||
})
|
||||
themeName = previewTheme.name.string
|
||||
|
||||
self.presentationTheme.set(.single(self.previewTheme)
|
||||
|> then(
|
||||
self.theme.get()
|
||||
|> mapToSignal { theme in
|
||||
if let file = theme?.file {
|
||||
return telegramThemeData(account: context.account, accountManager: context.sharedContext.accountManager, resource: file.resource)
|
||||
|> mapToSignal { data -> Signal<PresentationTheme, NoError> in
|
||||
guard let data = data, let presentationTheme = makePresentationTheme(data: data) else {
|
||||
return .complete()
|
||||
}
|
||||
return .single(presentationTheme)
|
||||
}
|
||||
} else {
|
||||
return .complete()
|
||||
}
|
||||
}
|
||||
))
|
||||
} else {
|
||||
self.theme.set(.single(nil))
|
||||
themeName = previewTheme.name.string
|
||||
}
|
||||
|
||||
self.titleView.title = CounterContollerTitle(title: themeName, counter: " ")
|
||||
self.navigationItem.titleView = titleView
|
||||
|
||||
self.statusBar.statusBarStyle = self.previewTheme.rootController.statusBarStyle.style
|
||||
@ -74,10 +93,14 @@ public final class ThemePreviewController: ViewController {
|
||||
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionAction"), color: self.previewTheme.rootController.navigationBar.accentTextColor), style: .plain, target: self, action: #selector(self.actionPressed))
|
||||
|
||||
self.disposable = (self.theme.get()
|
||||
|> deliverOnMainQueue).start(next: { [weak self] theme in
|
||||
self.disposable = (combineLatest(self.theme.get(), self.presentationTheme.get())
|
||||
|> deliverOnMainQueue).start(next: { [weak self] theme, presentationTheme in
|
||||
if let strongSelf = self, let theme = theme {
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: themeName, counter: strongSelf.presentationData.strings.Theme_UsersCount(max(1, theme.installCount)))
|
||||
let titleView = CounterContollerTitleView(theme: strongSelf.previewTheme)
|
||||
titleView.title = CounterContollerTitle(title: themeName, counter: strongSelf.presentationData.strings.Theme_UsersCount(max(1, theme.installCount)))
|
||||
strongSelf.titleView = titleView
|
||||
strongSelf.navigationItem.titleView = titleView
|
||||
strongSelf.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationTheme: presentationTheme, presentationStrings: strongSelf.presentationData.strings))
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -29,7 +29,7 @@ private func generateMaskImage(color: UIColor) -> UIImage? {
|
||||
|
||||
final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
private let context: AccountContext
|
||||
private let previewTheme: PresentationTheme
|
||||
private var previewTheme: PresentationTheme
|
||||
private var presentationData: PresentationData
|
||||
|
||||
public let wallpaperPromise = Promise<TelegramWallpaper>()
|
||||
@ -266,6 +266,23 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.pageControlNode.setPage(0.0)
|
||||
}
|
||||
|
||||
func updateTheme(_ theme: PresentationTheme) {
|
||||
self.previewTheme = theme
|
||||
|
||||
self.backgroundColor = self.previewTheme.list.plainBackgroundColor
|
||||
self.chatListBackgroundNode.backgroundColor = self.previewTheme.chatList.backgroundColor
|
||||
self.maskNode.image = generateMaskImage(color: self.previewTheme.chatList.backgroundColor)
|
||||
if case let .color(value) = self.previewTheme.chat.defaultWallpaper {
|
||||
self.instantChatBackgroundNode.backgroundColor = UIColor(rgb: UInt32(bitPattern: value))
|
||||
}
|
||||
|
||||
self.toolbarNode.updateThemeAndStrings(theme: self.previewTheme, strings: self.presentationData.strings)
|
||||
|
||||
if let (layout, navigationBarHeight) = self.validLayout {
|
||||
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
let bounds = scrollView.bounds
|
||||
if !bounds.width.isZero {
|
||||
|
@ -125,7 +125,7 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
||||
let pickerView = UIDatePicker()
|
||||
pickerView.timeZone = TimeZone(secondsFromGMT: 0)
|
||||
pickerView.datePickerMode = .dateAndTime
|
||||
pickerView.locale = localeWithStrings(self.presentationData.strings)
|
||||
pickerView.locale = Locale.current
|
||||
pickerView.timeZone = TimeZone.current
|
||||
pickerView.minuteInterval = 1
|
||||
pickerView.setValue(self.presentationData.theme.actionSheet.primaryTextColor, forKey: "textColor")
|
||||
|
Loading…
x
Reference in New Issue
Block a user