mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-05 10:50:54 +00:00
Various Fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -167,13 +167,13 @@ private enum ThemePickerControllerEntry: ItemListNodeEntry {
|
||||
case let .chatPreview(theme, wallpaper, fontSize, chatBubbleCorners, strings, dateTimeFormat, nameDisplayOrder, items):
|
||||
return ThemeSettingsChatPreviewItem(context: arguments.context, theme: theme, componentTheme: theme, strings: strings, sectionId: self.section, fontSize: fontSize, chatBubbleCorners: chatBubbleCorners, wallpaper: wallpaper, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, messageItems: items)
|
||||
case let .theme(theme, strings, themes, allThemes, currentTheme, themeSpecificAccentColors, themeSpecificChatWallpapers, _, themePreferredBaseTheme):
|
||||
return ThemeSettingsThemeItem(context: arguments.context, theme: theme, strings: strings, sectionId: self.section, themes: themes, allThemes: allThemes, displayUnsupported: true, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themePreferredBaseTheme: themePreferredBaseTheme, currentTheme: currentTheme, updatedTheme: { theme in
|
||||
return ThemeSettingsThemeItem(context: arguments.context, theme: theme, strings: strings, sectionId: self.section, themes: themes, allThemes: allThemes, displayUnsupported: true, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, themePreferredBaseTheme: themePreferredBaseTheme, currentTheme: currentTheme, updatedTheme: { theme in
|
||||
if case let .cloud(theme) = theme, theme.theme.file == nil && theme.theme.settings == nil {
|
||||
if theme.theme.isCreator {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
presentationData = presentationData.withUpdated(theme: darkTheme).withUpdated(chatWallpaper: darkWallpaper)
|
||||
}
|
||||
|
||||
let themeReference: PresentationThemeReference
|
||||
// if presentationData.autoNightModeTriggered {
|
||||
// if case .emoticon = settings.theme {
|
||||
// themeReference = settings.theme
|
||||
// } else {
|
||||
// themeReference = settings.automaticThemeSwitchSetting.theme
|
||||
// }
|
||||
// } else {
|
||||
themeReference = settings.theme
|
||||
// }
|
||||
var themeReference = settings.theme
|
||||
if presentationData.autoNightModeTriggered {
|
||||
themeReference = settings.automaticThemeSwitchSetting.theme
|
||||
}
|
||||
|
||||
let 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)
|
||||
})
|
||||
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
|
||||
}
|
||||
|
||||
@@ -50,6 +50,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
|
||||
@@ -121,7 +123,11 @@ public final class ThemePreviewController: ViewController {
|
||||
}
|
||||
} else {
|
||||
self.theme.set(.single(nil))
|
||||
themeName = previewTheme.name.string
|
||||
if [.builtin(.dayClassic), .builtin(.night)].contains(themeReference) {
|
||||
themeName = "🏠"
|
||||
} else {
|
||||
themeName = previewTheme.name.string
|
||||
}
|
||||
}
|
||||
default:
|
||||
self.theme.set(.single(nil))
|
||||
@@ -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) {
|
||||
updatedAutomaticThemeSwitchSetting.theme = .builtin(.night)
|
||||
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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user