mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '93a0e16d987e01fcbbd564c6f63e3a2d5949cd0a'
This commit is contained in:
commit
2cc30f2db0
@ -236,7 +236,6 @@ public class ItemListSwitchItemNode: ListViewItemNode, ItemListItemNode {
|
||||
if !item.enabled {
|
||||
if currentDisabledOverlayNode == nil {
|
||||
currentDisabledOverlayNode = ASDisplayNode()
|
||||
currentDisabledOverlayNode?.backgroundColor = itemBackgroundColor.withAlphaComponent(0.6)
|
||||
}
|
||||
} else {
|
||||
currentDisabledOverlayNode = nil
|
||||
@ -278,6 +277,7 @@ public class ItemListSwitchItemNode: ListViewItemNode, ItemListItemNode {
|
||||
} else {
|
||||
transition.updateFrame(node: currentDisabledOverlayNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: layout.contentSize.width, height: layout.contentSize.height - separatorHeight)))
|
||||
}
|
||||
currentDisabledOverlayNode.backgroundColor = itemBackgroundColor.withAlphaComponent(0.6)
|
||||
} else if let disabledOverlayNode = strongSelf.disabledOverlayNode {
|
||||
transition.updateAlpha(node: disabledOverlayNode, alpha: 0.0, completion: { [weak disabledOverlayNode] _ in
|
||||
disabledOverlayNode?.removeFromSupernode()
|
||||
|
@ -501,7 +501,7 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
|
||||
transition.updateFrame(node: strongSelf.appNode, frame: CGRect(origin: CGPoint(x: leftInset + revealOffset + editingOffset, y: strongSelf.titleNode.frame.maxY + titleSpacing), size: appLayout.size))
|
||||
transition.updateFrame(node: strongSelf.locationNode, frame: CGRect(origin: CGPoint(x: leftInset + revealOffset + editingOffset, y: strongSelf.appNode.frame.maxY + textSpacing), size: locationLayout.size))
|
||||
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
|
||||
strongSelf.updateLayout(size: layout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
|
||||
|
||||
|
@ -401,7 +401,7 @@ class ItemListWebsiteItemNode: ItemListRevealOptionsItemNode {
|
||||
transition.updateFrame(node: strongSelf.appNode, frame: CGRect(origin: CGPoint(x: leftInset + revealOffset + editingOffset, y: 30.0), size: appLayout.size))
|
||||
transition.updateFrame(node: strongSelf.locationNode, frame: CGRect(origin: CGPoint(x: leftInset + revealOffset + editingOffset, y: 50.0), size: locationLayout.size))
|
||||
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
|
||||
strongSelf.updateLayout(size: layout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
|
||||
|
||||
|
@ -133,6 +133,7 @@ class BubbleSettingsRadiusItemNode: ListViewItemNode, ItemListItemNode {
|
||||
sliderView.maximumValue = 4.0
|
||||
sliderView.startValue = 0.0
|
||||
sliderView.positionsCount = 5
|
||||
sliderView.useLinesForPositions = true
|
||||
sliderView.disablesInteractiveTransitionGestureRecognizer = true
|
||||
if let item = self.item, let params = self.layoutParams {
|
||||
sliderView.isUserInteractionEnabled = item.enabled
|
||||
|
@ -781,7 +781,7 @@ class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
strongSelf.tapping = true
|
||||
strongSelf.item?.updatedTheme(themeReference)
|
||||
let _ = ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
Queue.mainQueue().after(0.4) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ import AnimationUI
|
||||
|
||||
private final class ThemePickerControllerArguments {
|
||||
let context: AccountContext
|
||||
let selectTheme: (TelegramBaseTheme?, PresentationThemeReference) -> Void
|
||||
let previewTheme: (PresentationThemeReference, Bool) -> Void
|
||||
let selectTheme: (TelegramBaseTheme?, PresentationThemeReference, Bool) -> Void
|
||||
let previewTheme: (PresentationThemeReference, Bool, Bool) -> Void
|
||||
let selectAccentColor: (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void
|
||||
let openAccentColorPicker: (PresentationThemeReference, Bool) -> Void
|
||||
let editTheme: (PresentationCloudTheme) -> Void
|
||||
@ -32,7 +32,7 @@ private final class ThemePickerControllerArguments {
|
||||
let themeContextAction: (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void
|
||||
let colorContextAction: (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void
|
||||
|
||||
init(context: AccountContext, selectTheme: @escaping (TelegramBaseTheme?, PresentationThemeReference) -> Void, previewTheme: @escaping (PresentationThemeReference, Bool) -> Void, selectAccentColor: @escaping (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void, openAccentColorPicker: @escaping (PresentationThemeReference, Bool) -> Void, editTheme: @escaping (PresentationCloudTheme) -> Void, editCurrentTheme: @escaping () -> Void, createNewTheme: @escaping () -> Void, themeContextAction: @escaping (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void, colorContextAction: @escaping (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void) {
|
||||
init(context: AccountContext, selectTheme: @escaping (TelegramBaseTheme?, PresentationThemeReference, Bool) -> Void, previewTheme: @escaping (PresentationThemeReference, Bool, Bool) -> Void, selectAccentColor: @escaping (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void, openAccentColorPicker: @escaping (PresentationThemeReference, Bool) -> Void, editTheme: @escaping (PresentationCloudTheme) -> Void, editCurrentTheme: @escaping () -> Void, createNewTheme: @escaping () -> Void, themeContextAction: @escaping (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void, colorContextAction: @escaping (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void) {
|
||||
self.context = context
|
||||
self.selectTheme = selectTheme
|
||||
self.previewTheme = previewTheme
|
||||
@ -158,7 +158,7 @@ private enum ThemePickerControllerEntry: ItemListNodeEntry {
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .themes(theme, strings, themes, currentTheme, nightMode, animatedEmojiStickers):
|
||||
return ThemeGridThemeItem(context: arguments.context, theme: theme, strings: strings, sectionId: self.section, themes: themes, animatedEmojiStickers: animatedEmojiStickers, themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], nightMode: nightMode, currentTheme: currentTheme, updatedTheme: { theme in
|
||||
arguments.previewTheme(theme, nightMode)
|
||||
arguments.previewTheme(theme, nightMode, true)
|
||||
}, contextAction: { theme, node, gesture in
|
||||
arguments.themeContextAction(false, theme, node, gesture)
|
||||
}, tag: nil)
|
||||
@ -173,7 +173,7 @@ private enum ThemePickerControllerEntry: ItemListNodeEntry {
|
||||
arguments.editTheme(theme)
|
||||
}
|
||||
} else {
|
||||
arguments.selectTheme(nil, theme)
|
||||
arguments.selectTheme(nil, theme, false)
|
||||
}
|
||||
}, contextAction: { theme, node, gesture in
|
||||
arguments.themeContextAction(theme.index == currentTheme.index, theme, node, gesture)
|
||||
@ -260,7 +260,7 @@ private enum ThemePickerControllerEntry: ItemListNodeEntry {
|
||||
case let .accentColor(color):
|
||||
arguments.selectAccentColor(baseTheme, color)
|
||||
case let .theme(theme):
|
||||
arguments.selectTheme(baseTheme, theme)
|
||||
arguments.selectTheme(baseTheme, theme, false)
|
||||
}
|
||||
} else {
|
||||
arguments.selectAccentColor(nil, nil)
|
||||
@ -358,7 +358,7 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
var getNavigationControllerImpl: (() -> NavigationController?)?
|
||||
var presentCrossfadeControllerImpl: ((Bool) -> Void)?
|
||||
|
||||
var selectThemeImpl: ((TelegramBaseTheme?, PresentationThemeReference) -> Void)?
|
||||
var selectThemeImpl: ((TelegramBaseTheme?, PresentationThemeReference, Bool) -> Void)?
|
||||
var selectAccentColorImpl: ((TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void)?
|
||||
var openAccentColorPickerImpl: ((PresentationThemeReference, Bool) -> Void)?
|
||||
|
||||
@ -393,11 +393,16 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
|
||||
let nightModePreviewPromise = ValuePromise<Bool>(false)
|
||||
|
||||
let arguments = ThemePickerControllerArguments(context: context, selectTheme: { baseTheme, theme in
|
||||
selectThemeImpl?(baseTheme, theme)
|
||||
}, previewTheme: { themeReference, nightMode in
|
||||
let arguments = ThemePickerControllerArguments(context: context, selectTheme: { baseTheme, theme, preset in
|
||||
selectThemeImpl?(baseTheme, theme, preset)
|
||||
}, previewTheme: { themeReference, nightMode, custom in
|
||||
if let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: themeReference, baseTheme: nightMode ? .night : .classic ) {
|
||||
let controller = ThemePreviewController(context: context, previewTheme: theme, source: .settings(themeReference, nil, false))
|
||||
if custom {
|
||||
controller.customApply = {
|
||||
selectThemeImpl?(nil, themeReference, true)
|
||||
}
|
||||
}
|
||||
pushControllerImpl?(controller)
|
||||
}
|
||||
}, selectAccentColor: { currentBaseTheme, accentColor in
|
||||
@ -610,7 +615,7 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
} else {
|
||||
newTheme = .builtin(.nightAccent)
|
||||
}
|
||||
selectThemeImpl?(nil, newTheme)
|
||||
selectThemeImpl?(nil, newTheme, false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,7 +853,7 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
let previousThemeIndex = themes.prefix(upTo: currentThemeIndex).reversed().firstIndex(where: { $0.file != nil })
|
||||
if let previousThemeIndex = previousThemeIndex {
|
||||
let theme = themes[themes.index(before: previousThemeIndex.base)]
|
||||
selectThemeImpl?(nil, .cloud(PresentationCloudTheme(theme: theme, resolvedWallpaper: nil, creatorAccountId: theme.isCreator ? context.account.id : nil)))
|
||||
selectThemeImpl?(nil, .cloud(PresentationCloudTheme(theme: theme, resolvedWallpaper: nil, creatorAccountId: theme.isCreator ? context.account.id : nil)), false)
|
||||
} else {
|
||||
if settings.baseTheme == .night {
|
||||
selectAccentColorImpl?(nil, PresentationThemeAccentColor(baseColor: .blue))
|
||||
@ -887,27 +892,49 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
var presentationData = presentationData
|
||||
if nightModePreview {
|
||||
let preferredBaseTheme: TelegramBaseTheme = .night
|
||||
if let darkTheme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: settings.automaticThemeSwitchSetting.theme, baseTheme: preferredBaseTheme) {
|
||||
presentationData = presentationData.withUpdated(theme: darkTheme)
|
||||
|
||||
let automaticTheme = settings.automaticThemeSwitchSetting.theme
|
||||
var effectiveColors = settings.themeSpecificAccentColors[automaticTheme.index]
|
||||
if automaticTheme == .builtin(.night) && effectiveColors == nil {
|
||||
effectiveColors = PresentationThemeAccentColor(baseColor: .blue)
|
||||
}
|
||||
let themeSpecificWallpaper = (settings.themeSpecificChatWallpapers[coloredThemeIndex(reference: automaticTheme, accentColor: effectiveColors)] ?? settings.themeSpecificChatWallpapers[automaticTheme.index])
|
||||
|
||||
let darkTheme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: automaticTheme, baseTheme: preferredBaseTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors ?? [], wallpaper: effectiveColors?.wallpaper, baseColor: effectiveColors?.baseColor, serviceBackgroundColor: defaultServiceBackgroundColor) ?? defaultPresentationTheme
|
||||
var darkWallpaper = presentationData.chatWallpaper
|
||||
if let themeSpecificWallpaper = themeSpecificWallpaper {
|
||||
darkWallpaper = themeSpecificWallpaper
|
||||
} else {
|
||||
switch darkWallpaper {
|
||||
case .builtin, .color, .gradient:
|
||||
darkWallpaper = darkTheme.chat.defaultWallpaper
|
||||
case .file:
|
||||
if darkWallpaper.isPattern {
|
||||
darkWallpaper = darkTheme.chat.defaultWallpaper
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let themeReference: PresentationThemeReference
|
||||
// if presentationData.autoNightModeTriggered {
|
||||
// if case .emoticon = settings.theme {
|
||||
// themeReference = settings.theme
|
||||
// } else {
|
||||
// themeReference = settings.automaticThemeSwitchSetting.theme
|
||||
// }
|
||||
// } else {
|
||||
themeReference = settings.theme
|
||||
// }
|
||||
presentationData = presentationData.withUpdated(theme: darkTheme).withUpdated(chatWallpaper: darkWallpaper)
|
||||
}
|
||||
|
||||
let rightNavigationButton = ItemListNavigationButton(content: .node(switchNode), style: .regular, enabled: true, action: { [weak switchNode] in
|
||||
var themeReference = settings.theme
|
||||
if presentationData.autoNightModeTriggered {
|
||||
themeReference = settings.automaticThemeSwitchSetting.theme
|
||||
}
|
||||
|
||||
let rightNavigationButton: ItemListNavigationButton?
|
||||
if !presentationData.autoNightModeTriggered {
|
||||
rightNavigationButton = ItemListNavigationButton(content: .node(switchNode), style: .regular, enabled: true, action: { [weak switchNode] in
|
||||
nightModePreviewPromise.set(!nightModePreview)
|
||||
switchNode?.play(isDark: presentationData.theme.overallDarkAppearance, theme: presentationData.theme)
|
||||
presentCrossfadeControllerImpl?(false)
|
||||
})
|
||||
} else {
|
||||
rightNavigationButton = nil
|
||||
}
|
||||
|
||||
var defaultThemes: [PresentationThemeReference] = []
|
||||
if presentationData.autoNightModeTriggered {
|
||||
@ -1027,7 +1054,7 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
||||
context.sharedContext.presentGlobalController(crossfadeController, nil)
|
||||
}
|
||||
}
|
||||
selectThemeImpl = { baseTheme, theme in
|
||||
selectThemeImpl = { baseTheme, theme, preset in
|
||||
guard let presentationTheme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: theme) else {
|
||||
return
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ public final class ThemePreviewController: ViewController {
|
||||
private var disposable: Disposable?
|
||||
private var applyDisposable = MetaDisposable()
|
||||
|
||||
var customApply: (() -> Void)?
|
||||
|
||||
public init(context: AccountContext, previewTheme: PresentationTheme, source: ThemePreviewSource) {
|
||||
self.context = context
|
||||
self.previewTheme = previewTheme
|
||||
@ -121,8 +123,12 @@ public final class ThemePreviewController: ViewController {
|
||||
}
|
||||
} else {
|
||||
self.theme.set(.single(nil))
|
||||
if [.builtin(.dayClassic), .builtin(.night)].contains(themeReference) {
|
||||
themeName = "🏠"
|
||||
} else {
|
||||
themeName = previewTheme.name.string
|
||||
}
|
||||
}
|
||||
default:
|
||||
self.theme.set(.single(nil))
|
||||
themeName = previewTheme.name.string
|
||||
@ -223,6 +229,14 @@ public final class ThemePreviewController: ViewController {
|
||||
}
|
||||
|
||||
private func apply() {
|
||||
if let customApply = self.customApply {
|
||||
customApply()
|
||||
Queue.mainQueue().after(0.2) {
|
||||
self.dismiss()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
let previewTheme = self.previewTheme
|
||||
let theme: Signal<PresentationThemeReference?, NoError>
|
||||
let context = self.context
|
||||
|
@ -916,7 +916,7 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
|
||||
} else {
|
||||
strongSelf.tapping = true
|
||||
item.updated(color)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
Queue.mainQueue().after(0.4) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
||||
entries.append(.themeListHeader(presentationData.theme, title))
|
||||
entries.append(.chatPreview(presentationData.theme, presentationData.chatWallpaper, presentationData.chatFontSize, presentationData.chatBubbleCorners, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, [ChatPreviewMessageItem(outgoing: false, reply: (presentationData.strings.Appearance_PreviewReplyAuthor, presentationData.strings.Appearance_PreviewReplyText), text: presentationData.strings.Appearance_PreviewIncomingText), ChatPreviewMessageItem(outgoing: true, reply: nil, text: presentationData.strings.Appearance_PreviewOutgoingText)]))
|
||||
|
||||
entries.append(.themes(presentationData.theme, presentationData.strings, chatThemes, themeReference, presentationThemeSettings.automaticThemeSwitchSetting.force, animatedEmojiStickers))
|
||||
entries.append(.themes(presentationData.theme, presentationData.strings, chatThemes, themeReference, presentationThemeSettings.automaticThemeSwitchSetting.force || presentationData.autoNightModeTriggered, animatedEmojiStickers))
|
||||
entries.append(.chatTheme(presentationData.theme, strings.Settings_ChatThemes))
|
||||
entries.append(.wallpaper(presentationData.theme, strings.Settings_ChatBackground))
|
||||
|
||||
@ -1102,27 +1102,31 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
var updatedAutomaticThemeSwitchSetting = current.automaticThemeSwitchSetting
|
||||
if case let .cloud(info) = updatedTheme, info.theme.settings?.contains(where: { $0.baseTheme == .night || $0.baseTheme == .tinted }) ?? false {
|
||||
updatedAutomaticThemeSwitchSetting.theme = updatedTheme
|
||||
} else if autoNightModeTriggered {
|
||||
var updatedThemeSpecificAccentColors = current.themeSpecificAccentColors
|
||||
if let baseThemeIndex = baseThemeIndex {
|
||||
updatedThemeSpecificAccentColors[baseThemeIndex] = PresentationThemeAccentColor(themeIndex: updatedTheme.index)
|
||||
}
|
||||
|
||||
if autoNightModeTriggered {
|
||||
var updatedAutomaticThemeSwitchSetting = current.automaticThemeSwitchSetting
|
||||
updatedAutomaticThemeSwitchSetting.theme = updatedTheme
|
||||
|
||||
return current.withUpdatedAutomaticThemeSwitchSetting(updatedAutomaticThemeSwitchSetting).withUpdatedThemeSpecificAccentColors(updatedThemeSpecificAccentColors)
|
||||
} else {
|
||||
return current.withUpdatedTheme(updatedTheme).withUpdatedThemeSpecificAccentColors(updatedThemeSpecificAccentColors)
|
||||
}
|
||||
} else if case let .builtin(theme) = updatedTheme {
|
||||
if [.day, .dayClassic].contains(theme) {
|
||||
if updatedAutomaticThemeSwitchSetting.theme.emoticon != nil || [.builtin(.dayClassic), .builtin(.day)].contains(updatedAutomaticThemeSwitchSetting.theme.generalThemeReference) {
|
||||
updatedAutomaticThemeSwitchSetting.theme = .builtin(.night)
|
||||
}
|
||||
} else {
|
||||
updatedAutomaticThemeSwitchSetting.theme = updatedTheme
|
||||
}
|
||||
}
|
||||
return current.withUpdatedTheme(updatedTheme).withUpdatedAutomaticThemeSwitchSetting(updatedAutomaticThemeSwitchSetting)
|
||||
// var updatedThemeSpecificAccentColors = current.themeSpecificAccentColors
|
||||
// if let baseThemeIndex = baseThemeIndex {
|
||||
// updatedThemeSpecificAccentColors[baseThemeIndex] = PresentationThemeAccentColor(themeIndex: updatedTheme.index)
|
||||
// }
|
||||
//
|
||||
// if autoNightModeTriggered {
|
||||
// var updatedAutomaticThemeSwitchSetting = current.automaticThemeSwitchSetting
|
||||
// updatedAutomaticThemeSwitchSetting.theme = updatedTheme
|
||||
//
|
||||
// return current.withUpdatedAutomaticThemeSwitchSetting(updatedAutomaticThemeSwitchSetting).withUpdatedThemeSpecificAccentColors(updatedThemeSpecificAccentColors)
|
||||
// } else {
|
||||
// return current.withUpdatedTheme(updatedTheme).withUpdatedThemeSpecificAccentColors(updatedThemeSpecificAccentColors)
|
||||
// }
|
||||
|
||||
}).start()
|
||||
|
||||
return currentThemeBaseIndex != updatedThemeBaseIndex
|
||||
|
@ -131,6 +131,7 @@ class ThemeSettingsFontSizeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
sliderView.maximumValue = 6.0
|
||||
sliderView.startValue = 0.0
|
||||
sliderView.positionsCount = 7
|
||||
sliderView.useLinesForPositions = true
|
||||
sliderView.disablesInteractiveTransitionGestureRecognizer = true
|
||||
if let item = self.item, let params = self.layoutParams {
|
||||
sliderView.isUserInteractionEnabled = item.enabled
|
||||
|
@ -655,7 +655,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
strongSelf.tapping = true
|
||||
strongSelf.item?.updatedTheme(themeReference)
|
||||
let _ = ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
Queue.mainQueue().after(0.4) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +398,9 @@ public func automaticThemeShouldSwitchNow(settings: AutomaticThemeSwitchSetting,
|
||||
}
|
||||
|
||||
private func automaticThemeShouldSwitch(_ settings: AutomaticThemeSwitchSetting, systemUserInterfaceStyle: WindowUserInterfaceStyle) -> Signal<Bool, NoError> {
|
||||
if case .explicitNone = settings.trigger {
|
||||
if settings.force {
|
||||
return .single(true)
|
||||
} else if case .explicitNone = settings.trigger {
|
||||
return .single(false)
|
||||
} else {
|
||||
return Signal { subscriber in
|
||||
@ -616,6 +618,11 @@ public func updatedPresentationData(accountManager: AccountManager<TelegramAccou
|
||||
if autoNightModeTriggered {
|
||||
let automaticTheme = themeSettings.automaticThemeSwitchSetting.theme
|
||||
effectiveColors = themeSettings.themeSpecificAccentColors[automaticTheme.index]
|
||||
|
||||
if automaticTheme == .builtin(.night) && effectiveColors == nil {
|
||||
effectiveColors = PresentationThemeAccentColor(baseColor: .blue)
|
||||
}
|
||||
|
||||
let themeSpecificWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: automaticTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[automaticTheme.index])
|
||||
|
||||
if let themeSpecificWallpaper = themeSpecificWallpaper {
|
||||
|
@ -2089,7 +2089,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
if self.isSettings {
|
||||
titleString = NSAttributedString(string: title, font: Font.semibold(26.0), textColor: presentationData.theme.list.itemPrimaryTextColor)
|
||||
titleString = NSAttributedString(string: title, font: Font.medium(29.0), textColor: presentationData.theme.list.itemPrimaryTextColor)
|
||||
smallTitleString = NSAttributedString(string: title, font: Font.semibold(28.0), textColor: .white)
|
||||
} else {
|
||||
titleString = NSAttributedString(string: title, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor)
|
||||
@ -2200,7 +2200,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
let minTitleSize = CGSize(width: titleSize.width * 0.7, height: titleSize.height * 0.7)
|
||||
let minTitleFrame: CGRect
|
||||
if self.isSettings {
|
||||
minTitleFrame = CGRect(origin: CGPoint(x: 16.0, y: expandedAvatarHeight - 58.0 + (subtitleSize.height.isZero ? 10.0 : 0.0)), size: minTitleSize)
|
||||
minTitleFrame = CGRect(origin: CGPoint(x: 16.0, y: expandedAvatarHeight - 58.0 - UIScreenPixel + (subtitleSize.height.isZero ? 10.0 : 0.0)), size: minTitleSize)
|
||||
} else {
|
||||
minTitleFrame = CGRect(origin: CGPoint(x: 16.0, y: expandedAvatarHeight - expandedAvatarControlsHeight + 9.0 + (subtitleSize.height.isZero ? 10.0 : 0.0)), size: minTitleSize)
|
||||
}
|
||||
@ -2214,7 +2214,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
} else {
|
||||
titleFrame = CGRect(origin: CGPoint(x: floor((width - titleSize.width) / 2.0), y: avatarFrame.maxY + 7.0 + (subtitleSize.height.isZero ? 11.0 : 0.0)), size: titleSize)
|
||||
if self.isSettings {
|
||||
titleFrame = titleFrame.offsetBy(dx: 0.0, dy: 13.0)
|
||||
titleFrame = titleFrame.offsetBy(dx: 0.0, dy: 11.0)
|
||||
}
|
||||
let totalSubtitleWidth = subtitleSize.width + usernameSpacing + usernameSize.width
|
||||
twoLineInfo = false
|
||||
@ -2236,7 +2236,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
let titleOffset = -min(titleCollapseOffset, contentOffset)
|
||||
let titleCollapseFraction = max(0.0, min(1.0, contentOffset / titleCollapseOffset))
|
||||
|
||||
let titleMinScale: CGFloat = 0.7
|
||||
let titleMinScale: CGFloat = self.isSettings ? 0.6 : 0.7
|
||||
let subtitleMinScale: CGFloat = 0.8
|
||||
let avatarMinScale: CGFloat = 0.7
|
||||
|
||||
|
@ -239,7 +239,7 @@ public enum PresentationThemeReference: PostboxCoding, Equatable {
|
||||
|
||||
public var emoticon: String? {
|
||||
switch self {
|
||||
case .builtin:
|
||||
case .builtin(.dayClassic):
|
||||
return "🏠"
|
||||
case let .cloud(theme):
|
||||
return theme.theme.emoticon
|
||||
|
Loading…
x
Reference in New Issue
Block a user