mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Use separate font settings for chat and the rest of the UI
This commit is contained in:
parent
722ce97e9a
commit
db5737346c
@ -306,7 +306,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
if case .root = groupId, checkProxy {
|
if case .root = groupId, checkProxy {
|
||||||
if strongSelf.proxyUnavailableTooltipController == nil && !strongSelf.didShowProxyUnavailableTooltipController && strongSelf.isNodeLoaded && strongSelf.displayNode.view.window != nil {
|
if strongSelf.proxyUnavailableTooltipController == nil && !strongSelf.didShowProxyUnavailableTooltipController && strongSelf.isNodeLoaded && strongSelf.displayNode.view.window != nil {
|
||||||
strongSelf.didShowProxyUnavailableTooltipController = true
|
strongSelf.didShowProxyUnavailableTooltipController = true
|
||||||
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.Proxy_TooltipUnavailable), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize, timeout: 60.0, dismissByTapOutside: true)
|
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.Proxy_TooltipUnavailable), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize, timeout: 60.0, dismissByTapOutside: true)
|
||||||
strongSelf.proxyUnavailableTooltipController = tooltipController
|
strongSelf.proxyUnavailableTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.proxyUnavailableTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.proxyUnavailableTooltipController === tooltipController {
|
||||||
@ -785,7 +785,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
if hasPasscode {
|
if hasPasscode {
|
||||||
let _ = ApplicationSpecificNotice.setPasscodeLockTips(accountManager: strongSelf.context.sharedContext.accountManager).start()
|
let _ = ApplicationSpecificNotice.setPasscodeLockTips(accountManager: strongSelf.context.sharedContext.accountManager).start()
|
||||||
|
|
||||||
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.DialogList_PasscodeLockHelp), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize, dismissByTapOutside: true)
|
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.DialogList_PasscodeLockHelp), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize, dismissByTapOutside: true)
|
||||||
strongSelf.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceViewAndRect: { [weak self] in
|
strongSelf.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceViewAndRect: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
return (strongSelf.titleView, lockViewFrame.offsetBy(dx: 4.0, dy: 14.0))
|
return (strongSelf.titleView, lockViewFrame.offsetBy(dx: 4.0, dy: 14.0))
|
||||||
@ -955,7 +955,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
|
|
||||||
public func activateSearch() {
|
public func activateSearch() {
|
||||||
if self.displayNavigationBar {
|
if self.displayNavigationBar {
|
||||||
let _ = (self.chatListDisplayNode.chatListNode.ready
|
let _ = (self.chatListDisplayNode.chatListNode.contentsReady
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue).start(completed: { [weak self] in
|
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
|
@ -77,7 +77,7 @@ final class ChatListControllerNode: ASDisplayNode {
|
|||||||
self.groupId = groupId
|
self.groupId = groupId
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
|
|
||||||
self.chatListNode = ChatListNode(context: context, groupId: groupId, controlsHistoryPreload: controlsHistoryPreload, mode: .chatList, theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)
|
self.chatListNode = ChatListNode(context: context, groupId: groupId, controlsHistoryPreload: controlsHistoryPreload, mode: .chatList, theme: presentationData.theme, fontSize: presentationData.listsFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)
|
||||||
|
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ final class ChatListControllerNode: ASDisplayNode {
|
|||||||
|
|
||||||
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
||||||
|
|
||||||
self.chatListNode.updateThemeAndStrings(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
self.chatListNode.updateThemeAndStrings(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
||||||
self.searchDisplayController?.updatePresentationData(presentationData)
|
self.searchDisplayController?.updatePresentationData(presentationData)
|
||||||
self.chatListEmptyNode?.updateThemeAndStrings(theme: self.presentationData.theme, strings: self.presentationData.strings)
|
self.chatListEmptyNode?.updateThemeAndStrings(theme: self.presentationData.theme, strings: self.presentationData.strings)
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations))
|
self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations))
|
||||||
|
|
||||||
self.recentListNode = ListView()
|
self.recentListNode = ListView()
|
||||||
self.recentListNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor
|
self.recentListNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor
|
||||||
@ -1142,7 +1142,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let previousTheme = strongSelf.presentationData.theme
|
let previousTheme = strongSelf.presentationData.theme
|
||||||
strongSelf.presentationData = presentationData
|
strongSelf.presentationData = presentationData
|
||||||
strongSelf.presentationDataPromise.set(.single(ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)))
|
strongSelf.presentationDataPromise.set(.single(ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.listsFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)))
|
||||||
|
|
||||||
if previousTheme !== presentationData.theme {
|
if previousTheme !== presentationData.theme {
|
||||||
strongSelf.updateTheme(theme: presentationData.theme)
|
strongSelf.updateTheme(theme: presentationData.theme)
|
||||||
|
@ -311,6 +311,12 @@ public final class ChatListNode: ListView {
|
|||||||
return _ready.get()
|
return _ready.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private let _contentsReady = ValuePromise<Bool>()
|
||||||
|
private var didSetContentsReady = false
|
||||||
|
public var contentsReady: Signal<Bool, NoError> {
|
||||||
|
return _contentsReady.get()
|
||||||
|
}
|
||||||
|
|
||||||
public var peerSelected: ((PeerId, Bool, Bool) -> Void)?
|
public var peerSelected: ((PeerId, Bool, Bool) -> Void)?
|
||||||
public var groupSelected: ((PeerGroupId) -> Void)?
|
public var groupSelected: ((PeerGroupId) -> Void)?
|
||||||
public var addContact: ((String) -> Void)?
|
public var addContact: ((String) -> Void)?
|
||||||
@ -1158,6 +1164,10 @@ public final class ChatListNode: ListView {
|
|||||||
strongSelf.didSetReady = true
|
strongSelf.didSetReady = true
|
||||||
strongSelf._ready.set(true)
|
strongSelf._ready.set(true)
|
||||||
}
|
}
|
||||||
|
if !strongSelf.didSetContentsReady {
|
||||||
|
strongSelf.didSetContentsReady = true
|
||||||
|
strongSelf._contentsReady.set(true)
|
||||||
|
}
|
||||||
|
|
||||||
var isEmpty = false
|
var isEmpty = false
|
||||||
if transition.chatListView.filteredEntries.isEmpty {
|
if transition.chatListView.filteredEntries.isEmpty {
|
||||||
|
@ -26,7 +26,7 @@ final class ContextActionNode: ASDisplayNode {
|
|||||||
self.getController = getController
|
self.getController = getController
|
||||||
self.actionSelected = actionSelected
|
self.actionSelected = actionSelected
|
||||||
|
|
||||||
let textFont = Font.regular(presentationData.fontSize.baseDisplaySize)
|
let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize)
|
||||||
|
|
||||||
self.backgroundNode = ASDisplayNode()
|
self.backgroundNode = ASDisplayNode()
|
||||||
self.backgroundNode.isAccessibilityElement = false
|
self.backgroundNode.isAccessibilityElement = false
|
||||||
@ -161,7 +161,7 @@ final class ContextActionNode: ASDisplayNode {
|
|||||||
textColor = presentationData.theme.contextMenu.destructiveColor
|
textColor = presentationData.theme.contextMenu.destructiveColor
|
||||||
}
|
}
|
||||||
|
|
||||||
let textFont = Font.regular(presentationData.fontSize.baseDisplaySize)
|
let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize)
|
||||||
|
|
||||||
self.textNode.attributedText = NSAttributedString(string: self.action.text, font: textFont, textColor: textColor)
|
self.textNode.attributedText = NSAttributedString(string: self.action.text, font: textFont, textColor: textColor)
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ private final class InnerTextSelectionTipContainerNode: ASDisplayNode {
|
|||||||
let standardIconWidth: CGFloat = 32.0
|
let standardIconWidth: CGFloat = 32.0
|
||||||
let iconSideInset: CGFloat = 12.0
|
let iconSideInset: CGFloat = 12.0
|
||||||
|
|
||||||
let textFont = Font.regular(floor(presentationData.fontSize.baseDisplaySize * 14.0 / 17.0))
|
let textFont = Font.regular(floor(presentationData.listsFontSize.baseDisplaySize * 14.0 / 17.0))
|
||||||
|
|
||||||
let iconSize = self.iconNode.image?.size ?? CGSize(width: 16.0, height: 16.0)
|
let iconSize = self.iconNode.image?.size ?? CGSize(width: 16.0, height: 16.0)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public final class HashtagSearchController: TelegramBaseController {
|
|||||||
self.title = query
|
self.title = query
|
||||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||||
|
|
||||||
let chatListPresentationData = ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
let chatListPresentationData = ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
||||||
|
|
||||||
let location: SearchMessagesLocation = .general
|
let location: SearchMessagesLocation = .general
|
||||||
let search = searchMessages(account: context.account, location: location, query: query, state: nil)
|
let search = searchMessages(account: context.account, location: location, query: query, state: nil)
|
||||||
|
@ -222,6 +222,6 @@ public extension PresentationFontSize {
|
|||||||
|
|
||||||
public extension ItemListPresentationData {
|
public extension ItemListPresentationData {
|
||||||
convenience init(_ presentationData: PresentationData) {
|
convenience init(_ presentationData: PresentationData) {
|
||||||
self.init(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings)
|
self.init(theme: presentationData.theme, fontSize: presentationData.listsFontSize, strings: presentationData.strings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,11 +221,11 @@ private final class LanguageSuggestionAlertContentNode: AlertContentNode {
|
|||||||
let selectedLocalization = ValuePromise(suggestedLocalization.languageCode, ignoreRepeated: true)
|
let selectedLocalization = ValuePromise(suggestedLocalization.languageCode, ignoreRepeated: true)
|
||||||
|
|
||||||
self.titleNode = ASTextNode()
|
self.titleNode = ASTextNode()
|
||||||
self.titleNode.attributedText = NSAttributedString(string: strings.ChooseLanguage, font: Font.bold(presentationData.fontSize.baseDisplaySize), textColor: presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
|
self.titleNode.attributedText = NSAttributedString(string: strings.ChooseLanguage, font: Font.bold(presentationData.listsFontSize.baseDisplaySize), textColor: presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
|
||||||
self.titleNode.maximumNumberOfLines = 2
|
self.titleNode.maximumNumberOfLines = 2
|
||||||
|
|
||||||
self.subtitleNode = ASTextNode()
|
self.subtitleNode = ASTextNode()
|
||||||
self.subtitleNode.attributedText = NSAttributedString(string: englishStrings.ChooseLanguage, font: Font.regular(floor(presentationData.fontSize.baseDisplaySize * 14.0 / 17.0)), textColor: presentationData.theme.actionSheet.secondaryTextColor, paragraphAlignment: .center)
|
self.subtitleNode.attributedText = NSAttributedString(string: englishStrings.ChooseLanguage, font: Font.regular(floor(presentationData.listsFontSize.baseDisplaySize * 14.0 / 17.0)), textColor: presentationData.theme.actionSheet.secondaryTextColor, paragraphAlignment: .center)
|
||||||
self.subtitleNode.maximumNumberOfLines = 2
|
self.subtitleNode.maximumNumberOfLines = 2
|
||||||
|
|
||||||
self.titleSeparatorNode = ASDisplayNode()
|
self.titleSeparatorNode = ASDisplayNode()
|
||||||
|
@ -218,7 +218,6 @@ final class LocationActionListItemNode: ListViewItemNode {
|
|||||||
let iconLayout = self.venueIconNode.asyncLayout()
|
let iconLayout = self.venueIconNode.asyncLayout()
|
||||||
|
|
||||||
return { [weak self] item, params, hasSeparator in
|
return { [weak self] item, params, hasSeparator in
|
||||||
|
|
||||||
let leftInset: CGFloat = 65.0 + params.leftInset
|
let leftInset: CGFloat = 65.0 + params.leftInset
|
||||||
let rightInset: CGFloat = params.rightInset
|
let rightInset: CGFloat = params.rightInset
|
||||||
let verticalInset: CGFloat = 8.0
|
let verticalInset: CGFloat = 8.0
|
||||||
|
@ -557,7 +557,7 @@ func channelOwnershipTransferController(context: AccountContext, peer: Peer, mem
|
|||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let theme = AlertControllerTheme(presentationData: presentationData)
|
let theme = AlertControllerTheme(presentationData: presentationData)
|
||||||
|
|
||||||
var title: NSAttributedString? = NSAttributedString(string: presentationData.strings.OwnershipTransfer_SecurityCheck, font: Font.medium(presentationData.fontSize.itemListBaseFontSize), textColor: theme.primaryColor, paragraphAlignment: .center)
|
var title: NSAttributedString? = NSAttributedString(string: presentationData.strings.OwnershipTransfer_SecurityCheck, font: Font.medium(presentationData.listsFontSize.itemListBaseFontSize), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||||
|
|
||||||
var text = presentationData.strings.OwnershipTransfer_SecurityRequirements
|
var text = presentationData.strings.OwnershipTransfer_SecurityRequirements
|
||||||
var isGroup = true
|
var isGroup = true
|
||||||
|
@ -1589,7 +1589,7 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Pe
|
|||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let text: String = presentationData.strings.UserInfo_TapToCall
|
let text: String = presentationData.strings.UserInfo_TapToCall
|
||||||
|
|
||||||
let tooltipController = TooltipController(content: .text(text), baseFontSize: presentationData.fontSize.baseDisplaySize, dismissByTapOutside: true)
|
let tooltipController = TooltipController(content: .text(text), baseFontSize: presentationData.listsFontSize.baseDisplaySize, dismissByTapOutside: true)
|
||||||
controller.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: { [weak resultItemNode] in
|
controller.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: { [weak resultItemNode] in
|
||||||
if let resultItemNode = resultItemNode {
|
if let resultItemNode = resultItemNode {
|
||||||
return (resultItemNode, callButtonFrame)
|
return (resultItemNode, callButtonFrame)
|
||||||
|
@ -148,6 +148,12 @@ public func combineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, E>(queue: Que
|
|||||||
}, initialValues: [:], queue: queue)
|
}, initialValues: [:], queue: queue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func combineLatest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, E>(queue: Queue? = nil, _ s1: Signal<T1, E>, _ s2: Signal<T2, E>, _ s3: Signal<T3, E>, _ s4: Signal<T4, E>, _ s5: Signal<T5, E>, _ s6: Signal<T6, E>, _ s7: Signal<T7, E>, _ s8: Signal<T8, E>, _ s9: Signal<T9, E>, _ s10: Signal<T10, E>, _ s11: Signal<T11, E>) -> Signal<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11), E> {
|
||||||
|
return combineLatestAny([signalOfAny(s1), signalOfAny(s2), signalOfAny(s3), signalOfAny(s4), signalOfAny(s5), signalOfAny(s6), signalOfAny(s7), signalOfAny(s8), signalOfAny(s9), signalOfAny(s10), signalOfAny(s11)], combine: { values in
|
||||||
|
return (values[0] as! T1, values[1] as! T2, values[2] as! T3, values[3] as! T4, values[4] as! T5, values[5] as! T6, values[6] as! T7, values[7] as! T8, values[8] as! T9, values[9] as! T10, values[10] as! T11)
|
||||||
|
}, initialValues: [:], queue: queue)
|
||||||
|
}
|
||||||
|
|
||||||
public func combineLatest<T, E>(queue: Queue? = nil, _ signals: [Signal<T, E>]) -> Signal<[T], E> {
|
public func combineLatest<T, E>(queue: Queue? = nil, _ signals: [Signal<T, E>]) -> Signal<[T], E> {
|
||||||
if signals.count == 0 {
|
if signals.count == 0 {
|
||||||
return single([T](), E.self)
|
return single([T](), E.self)
|
||||||
|
@ -591,7 +591,7 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
|
|||||||
linkEnabled = false
|
linkEnabled = false
|
||||||
}
|
}
|
||||||
entries.append(.forwardsPreviewHeader(presentationData.theme, presentationData.strings.Privacy_Forwards_Preview))
|
entries.append(.forwardsPreviewHeader(presentationData.theme, presentationData.strings.Privacy_Forwards_Preview))
|
||||||
entries.append(.forwardsPreview(presentationData.theme, presentationData.chatWallpaper, presentationData.fontSize, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, peerName, linkEnabled, tootipText))
|
entries.append(.forwardsPreview(presentationData.theme, presentationData.chatWallpaper, presentationData.chatFontSize, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, peerName, linkEnabled, tootipText))
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.append(.settingHeader(presentationData.theme, settingTitle))
|
entries.append(.settingHeader(presentationData.theme, settingTitle))
|
||||||
|
@ -76,12 +76,14 @@ final class SettingsSearchItem: ItemListControllerSearch {
|
|||||||
let archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>
|
let archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>
|
||||||
let privacySettings: Signal<AccountPrivacySettings?, NoError>
|
let privacySettings: Signal<AccountPrivacySettings?, NoError>
|
||||||
let hasWallet: Signal<Bool, NoError>
|
let hasWallet: Signal<Bool, NoError>
|
||||||
|
let activeSessionsContext: Signal<ActiveSessionsContext?, NoError>
|
||||||
|
let webSessionsContext: Signal<WebSessionsContext?, NoError>
|
||||||
|
|
||||||
private var updateActivity: ((Bool) -> Void)?
|
private var updateActivity: ((Bool) -> Void)?
|
||||||
private var activity: ValuePromise<Bool> = ValuePromise(ignoreRepeated: false)
|
private var activity: ValuePromise<Bool> = ValuePromise(ignoreRepeated: false)
|
||||||
private let activityDisposable = MetaDisposable()
|
private let activityDisposable = MetaDisposable()
|
||||||
|
|
||||||
init(context: AccountContext, theme: PresentationTheme, placeholder: String, activated: Bool, updateActivated: @escaping (Bool) -> Void, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>) {
|
init(context: AccountContext, theme: PresentationTheme, placeholder: String, activated: Bool, updateActivated: @escaping (Bool) -> Void, presentController: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>, activeSessionsContext: Signal<ActiveSessionsContext?, NoError>, webSessionsContext: Signal<WebSessionsContext?, NoError>) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.placeholder = placeholder
|
self.placeholder = placeholder
|
||||||
@ -94,6 +96,8 @@ final class SettingsSearchItem: ItemListControllerSearch {
|
|||||||
self.archivedStickerPacks = archivedStickerPacks
|
self.archivedStickerPacks = archivedStickerPacks
|
||||||
self.privacySettings = privacySettings
|
self.privacySettings = privacySettings
|
||||||
self.hasWallet = hasWallet
|
self.hasWallet = hasWallet
|
||||||
|
self.activeSessionsContext = activeSessionsContext
|
||||||
|
self.webSessionsContext = webSessionsContext
|
||||||
self.activityDisposable.set((activity.get() |> mapToSignal { value -> Signal<Bool, NoError> in
|
self.activityDisposable.set((activity.get() |> mapToSignal { value -> Signal<Bool, NoError> in
|
||||||
if value {
|
if value {
|
||||||
return .single(value) |> delay(0.2, queue: Queue.mainQueue())
|
return .single(value) |> delay(0.2, queue: Queue.mainQueue())
|
||||||
@ -157,7 +161,7 @@ final class SettingsSearchItem: ItemListControllerSearch {
|
|||||||
pushController(c)
|
pushController(c)
|
||||||
}, presentController: { c, a in
|
}, presentController: { c, a in
|
||||||
presentController(c, a)
|
presentController(c, a)
|
||||||
}, getNavigationController: self.getNavigationController, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasWallet: self.hasWallet)
|
}, getNavigationController: self.getNavigationController, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasWallet: self.hasWallet, activeSessionsContext: self.activeSessionsContext, webSessionsContext: self.webSessionsContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +335,7 @@ private final class SettingsSearchContainerNode: SearchDisplayControllerContentN
|
|||||||
private var presentationDataDisposable: Disposable?
|
private var presentationDataDisposable: Disposable?
|
||||||
private let presentationDataPromise: Promise<PresentationData>
|
private let presentationDataPromise: Promise<PresentationData>
|
||||||
|
|
||||||
init(context: AccountContext, openResult: @escaping (SettingsSearchableItem) -> Void, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>) {
|
init(context: AccountContext, openResult: @escaping (SettingsSearchableItem) -> Void, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>, activeSessionsContext: Signal<ActiveSessionsContext?, NoError>, webSessionsContext: Signal<WebSessionsContext?, NoError>) {
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.presentationDataPromise = Promise(self.presentationData)
|
self.presentationDataPromise = Promise(self.presentationData)
|
||||||
|
|
||||||
@ -355,7 +359,7 @@ private final class SettingsSearchContainerNode: SearchDisplayControllerContentN
|
|||||||
})
|
})
|
||||||
|
|
||||||
let searchableItems = Promise<[SettingsSearchableItem]>()
|
let searchableItems = Promise<[SettingsSearchableItem]>()
|
||||||
searchableItems.set(settingsSearchableItems(context: context, notificationExceptionsList: exceptionsList, archivedStickerPacks: archivedStickerPacks, privacySettings: privacySettings, hasWallet: hasWallet))
|
searchableItems.set(settingsSearchableItems(context: context, notificationExceptionsList: exceptionsList, archivedStickerPacks: archivedStickerPacks, privacySettings: privacySettings, hasWallet: hasWallet, activeSessionsContext: activeSessionsContext, webSessionsContext: webSessionsContext))
|
||||||
|
|
||||||
let queryAndFoundItems = combineLatest(searchableItems.get(), faqSearchableItems(context: context))
|
let queryAndFoundItems = combineLatest(searchableItems.get(), faqSearchableItems(context: context))
|
||||||
|> mapToSignal { searchableItems, faqSearchableItems -> Signal<(String, [SettingsSearchableItem])?, NoError> in
|
|> mapToSignal { searchableItems, faqSearchableItems -> Signal<(String, [SettingsSearchableItem])?, NoError> in
|
||||||
@ -619,10 +623,12 @@ private final class SettingsSearchItemNode: ItemListControllerSearchNode {
|
|||||||
let archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>
|
let archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>
|
||||||
let privacySettings: Signal<AccountPrivacySettings?, NoError>
|
let privacySettings: Signal<AccountPrivacySettings?, NoError>
|
||||||
let hasWallet: Signal<Bool, NoError>
|
let hasWallet: Signal<Bool, NoError>
|
||||||
|
let activeSessionsContext: Signal<ActiveSessionsContext?, NoError>
|
||||||
|
let webSessionsContext: Signal<WebSessionsContext?, NoError>
|
||||||
|
|
||||||
var cancel: () -> Void
|
var cancel: () -> Void
|
||||||
|
|
||||||
init(context: AccountContext, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>) {
|
init(context: AccountContext, cancel: @escaping () -> Void, updateActivity: @escaping(Bool) -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: (() -> NavigationController?)?, exceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>, activeSessionsContext: Signal<ActiveSessionsContext?, NoError>, webSessionsContext: Signal<WebSessionsContext?, NoError>) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.cancel = cancel
|
self.cancel = cancel
|
||||||
@ -633,6 +639,8 @@ private final class SettingsSearchItemNode: ItemListControllerSearchNode {
|
|||||||
self.archivedStickerPacks = archivedStickerPacks
|
self.archivedStickerPacks = archivedStickerPacks
|
||||||
self.privacySettings = privacySettings
|
self.privacySettings = privacySettings
|
||||||
self.hasWallet = hasWallet
|
self.hasWallet = hasWallet
|
||||||
|
self.activeSessionsContext = activeSessionsContext
|
||||||
|
self.webSessionsContext = webSessionsContext
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
@ -674,7 +682,7 @@ private final class SettingsSearchItemNode: ItemListControllerSearchNode {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasWallet: self.hasWallet), cancel: { [weak self] in
|
}, exceptionsList: self.exceptionsList, archivedStickerPacks: self.archivedStickerPacks, privacySettings: self.privacySettings, hasWallet: self.hasWallet, activeSessionsContext: self.activeSessionsContext, webSessionsContext: self.webSessionsContext), cancel: { [weak self] in
|
||||||
self?.cancel()
|
self?.cancel()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ private func notificationSearchableItems(context: AccountContext, settings: Glob
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
private func privacySearchableItems(context: AccountContext, privacySettings: AccountPrivacySettings?) -> [SettingsSearchableItem] {
|
private func privacySearchableItems(context: AccountContext, privacySettings: AccountPrivacySettings?, activeSessionsContext: ActiveSessionsContext?, webSessionsContext: WebSessionsContext?) -> [SettingsSearchableItem] {
|
||||||
let icon: SettingsSearchableItemIcon = .privacy
|
let icon: SettingsSearchableItemIcon = .privacy
|
||||||
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ private func privacySearchableItems(context: AccountContext, privacySettings: Ac
|
|||||||
passcodeAlternate = synonyms(strings.SettingsSearch_Synonyms_Privacy_Passcode)
|
passcodeAlternate = synonyms(strings.SettingsSearch_Synonyms_Privacy_Passcode)
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return ([
|
||||||
SettingsSearchableItem(id: .privacy(0), title: strings.Settings_PrivacySettings, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Title), icon: icon, breadcrumbs: [], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(0), title: strings.Settings_PrivacySettings, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Title), icon: icon, breadcrumbs: [], present: { context, _, present in
|
||||||
presentPrivacySettings(context, present, nil)
|
presentPrivacySettings(context, present, nil)
|
||||||
}),
|
}),
|
||||||
@ -544,34 +544,37 @@ private func privacySearchableItems(context: AccountContext, privacySettings: Ac
|
|||||||
SettingsSearchableItem(id: .privacy(8), title: strings.PrivacySettings_TwoStepAuth, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_TwoStepAuth), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(8), title: strings.PrivacySettings_TwoStepAuth, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_TwoStepAuth), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
||||||
present(.push, twoStepVerificationUnlockSettingsController(context: context, mode: .access(intro: true, data: nil)))
|
present(.push, twoStepVerificationUnlockSettingsController(context: context, mode: .access(intro: true, data: nil)))
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(9), title: strings.PrivacySettings_WebSessions, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_AuthSessions), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
activeSessionsContext == nil ? nil : SettingsSearchableItem(id: .privacy(9), title: strings.Settings_Devices, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_AuthSessions) + [strings.PrivacySettings_AuthSessions], icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
||||||
present(.push, recentSessionsController(context: context, activeSessionsContext: ActiveSessionsContext(account: context.account), webSessionsContext: WebSessionsContext(account: context.account), websitesOnly: true))
|
present(.push, recentSessionsController(context: context, activeSessionsContext: activeSessionsContext!, webSessionsContext: webSessionsContext ?? WebSessionsContext(account: context.account), websitesOnly: false))
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(10), title: strings.PrivacySettings_DeleteAccountTitle, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_DeleteAccountIfAwayFor), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
webSessionsContext == nil ? nil : SettingsSearchableItem(id: .privacy(10), title: strings.PrivacySettings_WebSessions, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_AuthSessions), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
||||||
|
present(.push, recentSessionsController(context: context, activeSessionsContext: activeSessionsContext ?? ActiveSessionsContext(account: context.account), webSessionsContext: webSessionsContext ?? WebSessionsContext(account: context.account), websitesOnly: true))
|
||||||
|
}),
|
||||||
|
SettingsSearchableItem(id: .privacy(11), title: strings.PrivacySettings_DeleteAccountTitle, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_DeleteAccountIfAwayFor), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
||||||
presentPrivacySettings(context, present, .accountTimeout)
|
presentPrivacySettings(context, present, .accountTimeout)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(11), title: strings.PrivacySettings_DataSettings, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_Title), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(12), title: strings.PrivacySettings_DataSettings, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_Title), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(12), title: strings.Privacy_ContactsReset, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ContactsReset), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(13), title: strings.Privacy_ContactsReset, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ContactsReset), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(13), title: strings.Privacy_ContactsSync, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ContactsSync), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(14), title: strings.Privacy_ContactsSync, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ContactsSync), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(14), title: strings.Privacy_TopPeers, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_TopPeers), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(15), title: strings.Privacy_TopPeers, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_TopPeers), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(15), title: strings.Privacy_DeleteDrafts, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_DeleteDrafts), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(16), title: strings.Privacy_DeleteDrafts, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_DeleteDrafts), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(16), title: strings.Privacy_PaymentsClearInfo, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ClearPaymentsInfo), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(17), title: strings.Privacy_PaymentsClearInfo, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_ClearPaymentsInfo), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
}),
|
}),
|
||||||
SettingsSearchableItem(id: .privacy(17), title: strings.Privacy_SecretChatsLinkPreviews, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_SecretChatLinkPreview), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings, strings.Privacy_SecretChatsTitle], present: { context, _, present in
|
SettingsSearchableItem(id: .privacy(18), title: strings.Privacy_SecretChatsLinkPreviews, alternate: synonyms(strings.SettingsSearch_Synonyms_Privacy_Data_SecretChatLinkPreview), icon: icon, breadcrumbs: [strings.Settings_PrivacySettings, strings.PrivacySettings_DataSettings, strings.Privacy_SecretChatsTitle], present: { context, _, present in
|
||||||
presentDataPrivacySettings(context, present)
|
presentDataPrivacySettings(context, present)
|
||||||
})
|
})
|
||||||
]
|
] as [SettingsSearchableItem?]).compactMap { $0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
private func dataSearchableItems(context: AccountContext) -> [SettingsSearchableItem] {
|
private func dataSearchableItems(context: AccountContext) -> [SettingsSearchableItem] {
|
||||||
@ -733,7 +736,7 @@ private func languageSearchableItems(context: AccountContext, localizations: [Lo
|
|||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
func settingsSearchableItems(context: AccountContext, notificationExceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>) -> Signal<[SettingsSearchableItem], NoError> {
|
func settingsSearchableItems(context: AccountContext, notificationExceptionsList: Signal<NotificationExceptionsList?, NoError>, archivedStickerPacks: Signal<[ArchivedStickerPackItem]?, NoError>, privacySettings: Signal<AccountPrivacySettings?, NoError>, hasWallet: Signal<Bool, NoError>, activeSessionsContext: Signal<ActiveSessionsContext?, NoError>, webSessionsContext: Signal<WebSessionsContext?, NoError>) -> Signal<[SettingsSearchableItem], NoError> {
|
||||||
let watchAppInstalled = (context.watchManager?.watchAppInstalled ?? .single(false))
|
let watchAppInstalled = (context.watchManager?.watchAppInstalled ?? .single(false))
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|
|
||||||
@ -810,8 +813,27 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return combineLatest(watchAppInstalled, canAddAccount, localizations, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers, privacySettings, hasWallet)
|
let activeWebSessionsContext = webSessionsContext
|
||||||
|> map { watchAppInstalled, canAddAccount, localizations, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers, privacySettings, hasWallet in
|
|> mapToSignal { webSessionsContext -> Signal<WebSessionsContext?, NoError> in
|
||||||
|
if let webSessionsContext = webSessionsContext {
|
||||||
|
return webSessionsContext.state
|
||||||
|
|> map { state -> WebSessionsContext? in
|
||||||
|
if !state.sessions.isEmpty {
|
||||||
|
return webSessionsContext
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|> distinctUntilChanged(isEqual: { lhs, rhs in
|
||||||
|
return lhs !== rhs
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return .single(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return combineLatest(watchAppInstalled, canAddAccount, localizations, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers, privacySettings, hasWallet, activeSessionsContext, activeWebSessionsContext)
|
||||||
|
|> map { watchAppInstalled, canAddAccount, localizations, notificationSettings, notificationExceptionsList, archivedStickerPacks, proxyServers, privacySettings, hasWallet, activeSessionsContext, activeWebSessionsContext in
|
||||||
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
||||||
|
|
||||||
var allItems: [SettingsSearchableItem] = []
|
var allItems: [SettingsSearchableItem] = []
|
||||||
@ -833,7 +855,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
|
|||||||
let notificationItems = notificationSearchableItems(context: context, settings: notificationSettings, exceptionsList: notificationExceptionsList)
|
let notificationItems = notificationSearchableItems(context: context, settings: notificationSettings, exceptionsList: notificationExceptionsList)
|
||||||
allItems.append(contentsOf: notificationItems)
|
allItems.append(contentsOf: notificationItems)
|
||||||
|
|
||||||
let privacyItems = privacySearchableItems(context: context, privacySettings: privacySettings)
|
let privacyItems = privacySearchableItems(context: context, privacySettings: privacySettings, activeSessionsContext: activeSessionsContext, webSessionsContext: activeWebSessionsContext)
|
||||||
allItems.append(contentsOf: privacyItems)
|
allItems.append(contentsOf: privacyItems)
|
||||||
|
|
||||||
let dataItems = dataSearchableItems(context: context)
|
let dataItems = dataSearchableItems(context: context)
|
||||||
|
@ -1417,7 +1417,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
|
|||||||
presentControllerImpl?(c, a)
|
presentControllerImpl?(c, a)
|
||||||
}, pushController: { c in
|
}, pushController: { c in
|
||||||
pushControllerImpl?(c)
|
pushControllerImpl?(c)
|
||||||
}, getNavigationController: getNavigationControllerImpl, exceptionsList: notifyExceptions.get(), archivedStickerPacks: archivedPacks.get(), privacySettings: privacySettings.get(), hasWallet: hasWallet)
|
}, getNavigationController: getNavigationControllerImpl, exceptionsList: notifyExceptions.get(), archivedStickerPacks: archivedPacks.get(), privacySettings: privacySettings.get(), hasWallet: hasWallet, activeSessionsContext: activeSessionsContextAndCountSignal |> map { $0.0 } |> distinctUntilChanged(isEqual: { $0 === $1 }), webSessionsContext: activeSessionsContextAndCountSignal |> map { $0.2 } |> distinctUntilChanged(isEqual: { $0 === $1 }))
|
||||||
|
|
||||||
let (hasWallet, hasPassport, hasWatchApp, enableQRLogin) = hasWalletPassportAndWatch
|
let (hasWallet, hasPassport, hasWatchApp, enableQRLogin) = hasWalletPassportAndWatch
|
||||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: settingsEntries(account: context.account, presentationData: presentationData, state: state, view: view, proxySettings: proxySettings, notifyExceptions: preferencesAndExceptions.1, notificationsAuthorizationStatus: preferencesAndExceptions.2, notificationsWarningSuppressed: preferencesAndExceptions.3, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedPacks: featuredAndArchived.1, privacySettings: preferencesAndExceptions.4, hasWallet: hasWallet, hasPassport: hasPassport, hasWatchApp: hasWatchApp, accountsAndPeers: accountsAndPeers.1, inAppNotificationSettings: inAppNotificationSettings, experimentalUISettings: experimentalUISettings, displayPhoneNumberConfirmation: preferencesAndExceptions.5, otherSessionCount: otherSessionCount, enableQRLogin: enableQRLogin), style: .blocks, searchItem: searchItem, initialScrollToItem: ListViewScrollToItem(index: 0, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: 0.0), directionHint: .Up))
|
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: settingsEntries(account: context.account, presentationData: presentationData, state: state, view: view, proxySettings: proxySettings, notifyExceptions: preferencesAndExceptions.1, notificationsAuthorizationStatus: preferencesAndExceptions.2, notificationsWarningSuppressed: preferencesAndExceptions.3, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedPacks: featuredAndArchived.1, privacySettings: preferencesAndExceptions.4, hasWallet: hasWallet, hasPassport: hasPassport, hasWatchApp: hasWatchApp, accountsAndPeers: accountsAndPeers.1, inAppNotificationSettings: inAppNotificationSettings, experimentalUISettings: experimentalUISettings, displayPhoneNumberConfirmation: preferencesAndExceptions.5, otherSessionCount: otherSessionCount, enableQRLogin: enableQRLogin), style: .blocks, searchItem: searchItem, initialScrollToItem: ListViewScrollToItem(index: 0, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: 0.0), directionHint: .Up))
|
||||||
|
@ -58,7 +58,7 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode {
|
|||||||
self.contentTextNode.displaysAsynchronously = false
|
self.contentTextNode.displaysAsynchronously = false
|
||||||
self.contentTextNode.maximumNumberOfLines = 0
|
self.contentTextNode.maximumNumberOfLines = 0
|
||||||
|
|
||||||
let fontSize = floor(presentationData.fontSize.baseDisplaySize * 15.0 / 17.0)
|
let fontSize = floor(presentationData.listsFontSize.baseDisplaySize * 15.0 / 17.0)
|
||||||
|
|
||||||
self.contentTextNode.attributedText = stringWithAppliedEntities(text, entities: entities, baseColor: presentationData.theme.list.itemPrimaryTextColor, linkColor: presentationData.theme.list.itemAccentColor, baseFont: Font.regular(fontSize), linkFont: Font.regular(fontSize), boldFont: Font.semibold(fontSize), italicFont: Font.italic(fontSize), boldItalicFont: Font.semiboldItalic(fontSize), fixedFont: Font.monospace(fontSize), blockQuoteFont: Font.regular(fontSize))
|
self.contentTextNode.attributedText = stringWithAppliedEntities(text, entities: entities, baseColor: presentationData.theme.list.itemPrimaryTextColor, linkColor: presentationData.theme.list.itemAccentColor, baseFont: Font.regular(fontSize), linkFont: Font.regular(fontSize), boldFont: Font.semibold(fontSize), italicFont: Font.italic(fontSize), boldItalicFont: Font.semiboldItalic(fontSize), fixedFont: Font.monospace(fontSize), blockQuoteFont: Font.regular(fontSize))
|
||||||
|
|
||||||
@ -68,12 +68,12 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode {
|
|||||||
self.leftActionTextNode = ImmediateTextNode()
|
self.leftActionTextNode = ImmediateTextNode()
|
||||||
self.leftActionTextNode.displaysAsynchronously = false
|
self.leftActionTextNode.displaysAsynchronously = false
|
||||||
self.leftActionTextNode.isUserInteractionEnabled = false
|
self.leftActionTextNode.isUserInteractionEnabled = false
|
||||||
self.leftActionTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.PrivacyPolicy_Decline, font: Font.regular(presentationData.fontSize.baseDisplaySize), textColor: self.presentationData.theme.list.itemAccentColor)
|
self.leftActionTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.PrivacyPolicy_Decline, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: self.presentationData.theme.list.itemAccentColor)
|
||||||
self.rightActionNode = HighlightableButtonNode()
|
self.rightActionNode = HighlightableButtonNode()
|
||||||
self.rightActionTextNode = ImmediateTextNode()
|
self.rightActionTextNode = ImmediateTextNode()
|
||||||
self.rightActionTextNode.displaysAsynchronously = false
|
self.rightActionTextNode.displaysAsynchronously = false
|
||||||
self.rightActionTextNode.isUserInteractionEnabled = false
|
self.rightActionTextNode.isUserInteractionEnabled = false
|
||||||
self.rightActionTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.PrivacyPolicy_Accept, font: Font.semibold(presentationData.fontSize.baseDisplaySize), textColor: self.presentationData.theme.list.itemAccentColor)
|
self.rightActionTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.PrivacyPolicy_Accept, font: Font.semibold(presentationData.listsFontSize.baseDisplaySize), textColor: self.presentationData.theme.list.itemAccentColor)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
|
@ -147,7 +147,12 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
strongSelf.presentationThemeSettings.fontSize = value
|
switch strongSelf.toolbarNode.customMode {
|
||||||
|
case .chat:
|
||||||
|
strongSelf.presentationThemeSettings.fontSize = value
|
||||||
|
case .list:
|
||||||
|
strongSelf.presentationThemeSettings.listsFontSize = value
|
||||||
|
}
|
||||||
strongSelf.updatePresentationThemeSettings(strongSelf.presentationThemeSettings)
|
strongSelf.updatePresentationThemeSettings(strongSelf.presentationThemeSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +182,15 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
let bounds = scrollView.bounds
|
let bounds = scrollView.bounds
|
||||||
if !bounds.width.isZero {
|
if !bounds.width.isZero {
|
||||||
self.pageControlNode.setPage(scrollView.contentOffset.x / bounds.width)
|
self.pageControlNode.setPage(scrollView.contentOffset.x / bounds.width)
|
||||||
|
let pageIndex = Int(round(scrollView.contentOffset.x / bounds.width))
|
||||||
|
let customMode: TextSelectionCustomMode = pageIndex >= 1 ? .list : .chat
|
||||||
|
if customMode != self.toolbarNode.customMode {
|
||||||
|
self.toolbarNode.setCustomMode(customMode)
|
||||||
|
if let (layout, navigationBarHeight) = self.validLayout {
|
||||||
|
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||||
|
self.recursivelyEnsureDisplaySynchronously(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +216,7 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
})
|
})
|
||||||
let chatListPresentationData = ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
let chatListPresentationData = ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
||||||
|
|
||||||
let peers = SimpleDictionary<PeerId, Peer>()
|
let peers = SimpleDictionary<PeerId, Peer>()
|
||||||
let messages = SimpleDictionary<MessageId, Message>()
|
let messages = SimpleDictionary<MessageId, Message>()
|
||||||
@ -289,7 +303,7 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
var items: [ListViewItem] = []
|
var items: [ListViewItem] = []
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
||||||
@ -303,20 +317,20 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
messages[replyMessageId] = Message(stableId: 3, stableVersion: 0, id: replyMessageId, globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66000, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
messages[replyMessageId] = Message(stableId: 3, stableVersion: 0, id: replyMessageId, globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66000, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
|
||||||
|
|
||||||
let message1 = Message(stableId: 4, stableVersion: 0, id: MessageId(peerId: otherPeerId, namespace: 0, id: 4), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66003, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_3_Text, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message1 = Message(stableId: 4, stableVersion: 0, id: MessageId(peerId: otherPeerId, namespace: 0, id: 4), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66003, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_3_Text, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message1, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message1, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let message2 = Message(stableId: 3, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 3), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66002, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_2_Text, attributes: [ReplyMessageAttribute(messageId: replyMessageId)], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message2 = Message(stableId: 3, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 3), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66002, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_2_Text, attributes: [ReplyMessageAttribute(messageId: replyMessageId)], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message2, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message2, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let waveformBase64 = "DAAOAAkACQAGAAwADwAMABAADQAPABsAGAALAA0AGAAfABoAHgATABgAGQAYABQADAAVABEAHwANAA0ACQAWABkACQAOAAwACQAfAAAAGQAVAAAAEwATAAAACAAfAAAAHAAAABwAHwAAABcAGQAAABQADgAAABQAHwAAAB8AHwAAAAwADwAAAB8AEwAAABoAFwAAAB8AFAAAAAAAHwAAAAAAHgAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAAAA="
|
let waveformBase64 = "DAAOAAkACQAGAAwADwAMABAADQAPABsAGAALAA0AGAAfABoAHgATABgAGQAYABQADAAVABEAHwANAA0ACQAWABkACQAOAAwACQAfAAAAGQAVAAAAEwATAAAACAAfAAAAHAAAABwAHwAAABcAGQAAABQADgAAABQAHwAAAB8AHwAAAAwADwAAAB8AEwAAABoAFwAAAB8AFAAAAAAAHwAAAAAAHgAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAHwAAAAAAAAA="
|
||||||
let voiceAttributes: [TelegramMediaFileAttribute] = [.Audio(isVoice: true, duration: 23, title: nil, performer: nil, waveform: MemoryBuffer(data: Data(base64Encoded: waveformBase64)!))]
|
let voiceAttributes: [TelegramMediaFileAttribute] = [.Audio(isVoice: true, duration: 23, title: nil, performer: nil, waveform: MemoryBuffer(data: Data(base64Encoded: waveformBase64)!))]
|
||||||
let voiceMedia = TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: LocalFileMediaResource(fileId: 0), previewRepresentations: [], immediateThumbnailData: nil, mimeType: "audio/ogg", size: 0, attributes: voiceAttributes)
|
let voiceMedia = TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: LocalFileMediaResource(fileId: 0), previewRepresentations: [], immediateThumbnailData: nil, mimeType: "audio/ogg", size: 0, attributes: voiceAttributes)
|
||||||
|
|
||||||
let message3 = Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: "", attributes: [], media: [voiceMedia], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message3 = Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: "", attributes: [], media: [voiceMedia], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message3, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local), tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message3, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local), tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let message4 = Message(stableId: 2, stableVersion: 0, id: MessageId(peerId: otherPeerId, namespace: 0, id: 2), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message4 = Message(stableId: 2, stableVersion: 0, id: MessageId(peerId: otherPeerId, namespace: 0, id: 2), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message4, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message4, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let width: CGFloat
|
let width: CGFloat
|
||||||
if case .regular = layout.metrics.widthClass {
|
if case .regular = layout.metrics.widthClass {
|
||||||
@ -384,13 +398,16 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
|
|
||||||
func updatePresentationThemeSettings(_ presentationThemeSettings: PresentationThemeSettings) {
|
func updatePresentationThemeSettings(_ presentationThemeSettings: PresentationThemeSettings) {
|
||||||
let fontSize: PresentationFontSize
|
let fontSize: PresentationFontSize
|
||||||
|
let listsFontSize: PresentationFontSize
|
||||||
if presentationThemeSettings.useSystemFont {
|
if presentationThemeSettings.useSystemFont {
|
||||||
let pointSize = UIFont.preferredFont(forTextStyle: .body).pointSize
|
let pointSize = UIFont.preferredFont(forTextStyle: .body).pointSize
|
||||||
fontSize = PresentationFontSize(systemFontSize: pointSize)
|
fontSize = PresentationFontSize(systemFontSize: pointSize)
|
||||||
|
listsFontSize = fontSize
|
||||||
} else {
|
} else {
|
||||||
fontSize = presentationThemeSettings.fontSize
|
fontSize = presentationThemeSettings.fontSize
|
||||||
|
listsFontSize = presentationThemeSettings.listsFontSize
|
||||||
}
|
}
|
||||||
self.presentationData = self.presentationData.withFontSize(fontSize)
|
self.presentationData = self.presentationData.withFontSizes(chatFontSize: fontSize, listsFontSize: listsFontSize)
|
||||||
self.toolbarNode.updatePresentationData(presentationData: self.presentationData)
|
self.toolbarNode.updatePresentationData(presentationData: self.presentationData)
|
||||||
self.toolbarNode.updatePresentationThemeSettings(presentationThemeSettings: self.presentationThemeSettings)
|
self.toolbarNode.updatePresentationThemeSettings(presentationThemeSettings: self.presentationThemeSettings)
|
||||||
if let (layout, navigationBarHeight) = self.validLayout {
|
if let (layout, navigationBarHeight) = self.validLayout {
|
||||||
@ -552,6 +569,11 @@ final class TextSizeSelectionController: ViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum TextSelectionCustomMode {
|
||||||
|
case list
|
||||||
|
case chat
|
||||||
|
}
|
||||||
|
|
||||||
private final class TextSelectionToolbarNode: ASDisplayNode {
|
private final class TextSelectionToolbarNode: ASDisplayNode {
|
||||||
private var presentationThemeSettings: PresentationThemeSettings
|
private var presentationThemeSettings: PresentationThemeSettings
|
||||||
private var presentationData: PresentationData
|
private var presentationData: PresentationData
|
||||||
@ -564,6 +586,8 @@ private final class TextSelectionToolbarNode: ASDisplayNode {
|
|||||||
private var switchItemNode: ItemListSwitchItemNode
|
private var switchItemNode: ItemListSwitchItemNode
|
||||||
private var fontSizeItemNode: ThemeSettingsFontSizeItemNode
|
private var fontSizeItemNode: ThemeSettingsFontSizeItemNode
|
||||||
|
|
||||||
|
private(set) var customMode: TextSelectionCustomMode = .chat
|
||||||
|
|
||||||
var cancel: (() -> Void)?
|
var cancel: (() -> Void)?
|
||||||
var done: (() -> Void)?
|
var done: (() -> Void)?
|
||||||
|
|
||||||
@ -621,6 +645,10 @@ private final class TextSelectionToolbarNode: ASDisplayNode {
|
|||||||
self.doneButton.isUserInteractionEnabled = enabled
|
self.doneButton.isUserInteractionEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setCustomMode(_ customMode: TextSelectionCustomMode) {
|
||||||
|
self.customMode = customMode
|
||||||
|
}
|
||||||
|
|
||||||
func updatePresentationData(presentationData: PresentationData) {
|
func updatePresentationData(presentationData: PresentationData) {
|
||||||
self.backgroundColor = presentationData.theme.rootController.tabBar.backgroundColor
|
self.backgroundColor = presentationData.theme.rootController.tabBar.backgroundColor
|
||||||
self.separatorNode.backgroundColor = presentationData.theme.rootController.tabBar.separatorColor
|
self.separatorNode.backgroundColor = presentationData.theme.rootController.tabBar.separatorColor
|
||||||
@ -640,7 +668,7 @@ private final class TextSelectionToolbarNode: ASDisplayNode {
|
|||||||
let switchItem = ItemListSwitchItem(presentationData: ItemListPresentationData(self.presentationData), title: self.presentationData.strings.Appearance_TextSize_UseSystem, value: self.presentationThemeSettings.useSystemFont, disableLeadingInset: true, sectionId: 0, style: .blocks, updated: { [weak self] value in
|
let switchItem = ItemListSwitchItem(presentationData: ItemListPresentationData(self.presentationData), title: self.presentationData.strings.Appearance_TextSize_UseSystem, value: self.presentationThemeSettings.useSystemFont, disableLeadingInset: true, sectionId: 0, style: .blocks, updated: { [weak self] value in
|
||||||
self?.updateUseSystemFont?(value)
|
self?.updateUseSystemFont?(value)
|
||||||
})
|
})
|
||||||
let fontSizeItem = ThemeSettingsFontSizeItem(theme: self.presentationData.theme, fontSize: self.presentationThemeSettings.fontSize, enabled: !self.presentationThemeSettings.useSystemFont, disableLeadingInset: true, sectionId: 0, updated: { [weak self] value in
|
let fontSizeItem = ThemeSettingsFontSizeItem(theme: self.presentationData.theme, fontSize: self.customMode == .chat ? self.presentationThemeSettings.fontSize : self.presentationThemeSettings.listsFontSize, enabled: !self.presentationThemeSettings.useSystemFont, disableLeadingInset: true, force: true, sectionId: 0, updated: { [weak self] value in
|
||||||
self?.updateCustomFontSize?(value)
|
self?.updateCustomFontSize?(value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ private func editThemeControllerEntries(presentationData: PresentationData, stat
|
|||||||
entries.append(.slugInfo(presentationData.theme, infoText))
|
entries.append(.slugInfo(presentationData.theme, infoText))
|
||||||
|
|
||||||
entries.append(.chatPreviewHeader(presentationData.theme, presentationData.strings.EditTheme_Preview.uppercased()))
|
entries.append(.chatPreviewHeader(presentationData.theme, presentationData.strings.EditTheme_Preview.uppercased()))
|
||||||
entries.append(.chatPreview(presentationData.theme, previewTheme, previewTheme.chat.defaultWallpaper, presentationData.fontSize, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, [ChatPreviewMessageItem(outgoing: false, reply: (previewIncomingReplyName, previewIncomingReplyText), text: previewIncomingText), ChatPreviewMessageItem(outgoing: true, reply: nil, text: previewOutgoingText)]))
|
entries.append(.chatPreview(presentationData.theme, previewTheme, previewTheme.chat.defaultWallpaper, presentationData.chatFontSize, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, [ChatPreviewMessageItem(outgoing: false, reply: (previewIncomingReplyName, previewIncomingReplyText), text: previewIncomingText), ChatPreviewMessageItem(outgoing: true, reply: nil, text: previewOutgoingText)]))
|
||||||
|
|
||||||
entries.append(.changeColors(presentationData.theme, presentationData.strings.EditTheme_ChangeColors))
|
entries.append(.changeColors(presentationData.theme, presentationData.strings.EditTheme_ChangeColors))
|
||||||
if !hasSettings {
|
if !hasSettings {
|
||||||
@ -556,7 +556,7 @@ public func editThemeController(context: AccountContext, mode: EditThemeControll
|
|||||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||||
themeSpecificChatWallpapers[themeReference.index] = nil
|
themeSpecificChatWallpapers[themeReference.index] = nil
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: themeReference, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: themeReference, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
}) |> deliverOnMainQueue).start(completed: {
|
}) |> deliverOnMainQueue).start(completed: {
|
||||||
if !hasCustomFile {
|
if !hasCustomFile {
|
||||||
saveThemeTemplateFile(state.title, themeResource, {
|
saveThemeTemplateFile(state.title, themeResource, {
|
||||||
@ -590,7 +590,7 @@ public func editThemeController(context: AccountContext, mode: EditThemeControll
|
|||||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||||
themeSpecificChatWallpapers[themeReference.index] = nil
|
themeSpecificChatWallpapers[themeReference.index] = nil
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: themeReference, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: themeReference, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
}) |> deliverOnMainQueue).start(completed: {
|
}) |> deliverOnMainQueue).start(completed: {
|
||||||
if let themeResource = themeResource, !hasCustomFile {
|
if let themeResource = themeResource, !hasCustomFile {
|
||||||
saveThemeTemplateFile(state.title, themeResource, {
|
saveThemeTemplateFile(state.title, themeResource, {
|
||||||
|
@ -280,7 +280,7 @@ final class ThemeAccentColorController: ViewController {
|
|||||||
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
||||||
themeSpecificAccentColors[baseThemeReference.index] = PresentationThemeAccentColor(themeIndex: themeReference.index)
|
themeSpecificAccentColors[baseThemeReference.index] = PresentationThemeAccentColor(themeIndex: themeReference.index)
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
})
|
})
|
||||||
|> castError(CreateThemeError.self)
|
|> castError(CreateThemeError.self)
|
||||||
} else {
|
} else {
|
||||||
@ -313,7 +313,7 @@ final class ThemeAccentColorController: ViewController {
|
|||||||
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
||||||
themeSpecificAccentColors[baseThemeReference.index] = PresentationThemeAccentColor(themeIndex: themeReference.index)
|
themeSpecificAccentColors[baseThemeReference.index] = PresentationThemeAccentColor(themeIndex: themeReference.index)
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
})
|
})
|
||||||
|> castError(CreateThemeError.self)
|
|> castError(CreateThemeError.self)
|
||||||
} else {
|
} else {
|
||||||
|
@ -768,7 +768,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
})
|
})
|
||||||
let chatListPresentationData = ChatListPresentationData(theme: self.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
let chatListPresentationData = ChatListPresentationData(theme: self.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
||||||
|
|
||||||
let peers = SimpleDictionary<PeerId, Peer>()
|
let peers = SimpleDictionary<PeerId, Peer>()
|
||||||
let messages = SimpleDictionary<MessageId, Message>()
|
let messages = SimpleDictionary<MessageId, Message>()
|
||||||
@ -836,7 +836,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
var items: [ListViewItem] = []
|
var items: [ListViewItem] = []
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
||||||
@ -878,7 +878,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
sampleMessages.append(message8)
|
sampleMessages.append(message8)
|
||||||
|
|
||||||
items = sampleMessages.reversed().map { message in
|
items = sampleMessages.reversed().map { message in
|
||||||
let item = self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: !message.media.isEmpty ? FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local) : nil, tapMessage: { [weak self] message in
|
let item = self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: !message.media.isEmpty ? FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local) : nil, tapMessage: { [weak self] message in
|
||||||
if message.flags.contains(.Incoming) {
|
if message.flags.contains(.Incoming) {
|
||||||
self?.updateSection(.accent)
|
self?.updateSection(.accent)
|
||||||
self?.requestSectionUpdate?(.accent)
|
self?.requestSectionUpdate?(.accent)
|
||||||
|
@ -353,7 +353,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, togglePeerSelected: { _ in }, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
})
|
})
|
||||||
let chatListPresentationData = ChatListPresentationData(theme: self.previewTheme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
let chatListPresentationData = ChatListPresentationData(theme: self.previewTheme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: true)
|
||||||
|
|
||||||
let peers = SimpleDictionary<PeerId, Peer>()
|
let peers = SimpleDictionary<PeerId, Peer>()
|
||||||
let messages = SimpleDictionary<MessageId, Message>()
|
let messages = SimpleDictionary<MessageId, Message>()
|
||||||
@ -442,7 +442,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateMessagesLayout(layout: ContainerViewLayout, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
var items: [ListViewItem] = []
|
var items: [ListViewItem] = []
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: 1)
|
||||||
@ -484,7 +484,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
sampleMessages.append(message8)
|
sampleMessages.append(message8)
|
||||||
|
|
||||||
items = sampleMessages.reversed().map { message in
|
items = sampleMessages.reversed().map { message in
|
||||||
self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.previewTheme.chat.defaultWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: !message.media.isEmpty ? FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local) : nil, tapMessage: nil, clickThroughMessage: nil)
|
self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.previewTheme.chat.defaultWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: !message.media.isEmpty ? FileMediaResourceStatus(mediaStatus: .playbackStatus(.paused), fetchStatus: .Local) : nil, tapMessage: nil, clickThroughMessage: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
let width: CGFloat
|
let width: CGFloat
|
||||||
|
@ -429,7 +429,7 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
|||||||
let strings = presentationData.strings
|
let strings = presentationData.strings
|
||||||
let title = presentationData.autoNightModeTriggered ? strings.Appearance_ColorThemeNight.uppercased() : strings.Appearance_ColorTheme.uppercased()
|
let title = presentationData.autoNightModeTriggered ? strings.Appearance_ColorThemeNight.uppercased() : strings.Appearance_ColorTheme.uppercased()
|
||||||
entries.append(.themeListHeader(presentationData.theme, title))
|
entries.append(.themeListHeader(presentationData.theme, title))
|
||||||
entries.append(.chatPreview(presentationData.theme, presentationData.chatWallpaper, presentationData.fontSize, 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(.chatPreview(presentationData.theme, presentationData.chatWallpaper, presentationData.chatFontSize, 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)]))
|
||||||
|
|
||||||
let generalThemes: [PresentationThemeReference] = availableThemes.filter { reference in
|
let generalThemes: [PresentationThemeReference] = availableThemes.filter { reference in
|
||||||
if case let .cloud(theme) = reference {
|
if case let .cloud(theme) = reference {
|
||||||
@ -490,7 +490,11 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
|||||||
if presentationThemeSettings.useSystemFont {
|
if presentationThemeSettings.useSystemFont {
|
||||||
textSizeValue = strings.Appearance_TextSize_Automatic
|
textSizeValue = strings.Appearance_TextSize_Automatic
|
||||||
} else {
|
} else {
|
||||||
textSizeValue = "\(Int(presentationThemeSettings.fontSize.baseDisplaySize))pt"
|
if presentationThemeSettings.fontSize.baseDisplaySize == presentationThemeSettings.listsFontSize.baseDisplaySize {
|
||||||
|
textSizeValue = "\(Int(presentationThemeSettings.fontSize.baseDisplaySize))pt"
|
||||||
|
} else {
|
||||||
|
textSizeValue = "\(Int(presentationThemeSettings.fontSize.baseDisplaySize))pt/\(Int(presentationThemeSettings.listsFontSize.baseDisplaySize))pt"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
entries.append(.textSize(presentationData.theme, strings.Appearance_TextSizeSetting, textSizeValue))
|
entries.append(.textSize(presentationData.theme, strings.Appearance_TextSizeSetting, textSizeValue))
|
||||||
|
|
||||||
@ -550,10 +554,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||||||
|
|
||||||
let arguments = ThemeSettingsControllerArguments(context: context, selectTheme: { theme in
|
let arguments = ThemeSettingsControllerArguments(context: context, selectTheme: { theme in
|
||||||
selectThemeImpl?(theme)
|
selectThemeImpl?(theme)
|
||||||
}, selectFontSize: { fontSize in
|
}, selectFontSize: { _ in
|
||||||
let _ = updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
|
|
||||||
return current.withUpdatedFontSize(fontSize)
|
|
||||||
}).start()
|
|
||||||
}, openWallpaperSettings: {
|
}, openWallpaperSettings: {
|
||||||
pushControllerImpl?(ThemeGridController(context: context))
|
pushControllerImpl?(ThemeGridController(context: context))
|
||||||
}, selectAccentColor: { accentColor in
|
}, selectAccentColor: { accentColor in
|
||||||
@ -989,7 +990,6 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||||||
|> map { presentationData, sharedData, cloudThemes, availableAppIcons, currentAppIconName, removedThemeIndexes -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
|> map { presentationData, sharedData, cloudThemes, availableAppIcons, currentAppIconName, removedThemeIndexes -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||||
let settings = (sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings] as? PresentationThemeSettings) ?? PresentationThemeSettings.defaultSettings
|
let settings = (sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings] as? PresentationThemeSettings) ?? PresentationThemeSettings.defaultSettings
|
||||||
|
|
||||||
let fontSize = presentationData.fontSize
|
|
||||||
let dateTimeFormat = presentationData.dateTimeFormat
|
let dateTimeFormat = presentationData.dateTimeFormat
|
||||||
let largeEmoji = presentationData.largeEmoji
|
let largeEmoji = presentationData.largeEmoji
|
||||||
let disableAnimations = presentationData.disableAnimations
|
let disableAnimations = presentationData.disableAnimations
|
||||||
@ -1271,7 +1271,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: updatedTheme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: updatedAutomaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
}).start()
|
}).start()
|
||||||
|
|
||||||
presentCrossfadeControllerImpl?(true)
|
presentCrossfadeControllerImpl?(true)
|
||||||
|
@ -16,16 +16,18 @@ class ThemeSettingsFontSizeItem: ListViewItem, ItemListItem {
|
|||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
let fontSize: PresentationFontSize
|
let fontSize: PresentationFontSize
|
||||||
let disableLeadingInset: Bool
|
let disableLeadingInset: Bool
|
||||||
|
let force: Bool
|
||||||
let enabled: Bool
|
let enabled: Bool
|
||||||
let sectionId: ItemListSectionId
|
let sectionId: ItemListSectionId
|
||||||
let updated: (PresentationFontSize) -> Void
|
let updated: (PresentationFontSize) -> Void
|
||||||
let tag: ItemListItemTag?
|
let tag: ItemListItemTag?
|
||||||
|
|
||||||
init(theme: PresentationTheme, fontSize: PresentationFontSize, enabled: Bool = true, disableLeadingInset: Bool = false, sectionId: ItemListSectionId, updated: @escaping (PresentationFontSize) -> Void, tag: ItemListItemTag? = nil) {
|
init(theme: PresentationTheme, fontSize: PresentationFontSize, enabled: Bool = true, disableLeadingInset: Bool = false, force: Bool = false, sectionId: ItemListSectionId, updated: @escaping (PresentationFontSize) -> Void, tag: ItemListItemTag? = nil) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.fontSize = fontSize
|
self.fontSize = fontSize
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
self.disableLeadingInset = disableLeadingInset
|
self.disableLeadingInset = disableLeadingInset
|
||||||
|
self.force = force
|
||||||
self.sectionId = sectionId
|
self.sectionId = sectionId
|
||||||
self.updated = updated
|
self.updated = updated
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
@ -201,7 +203,7 @@ class ThemeSettingsFontSizeItemNode: ListViewItemNode, ItemListItemNode {
|
|||||||
|
|
||||||
return (layout, { [weak self] in
|
return (layout, { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let firstTime = strongSelf.item == nil
|
let firstTime = strongSelf.item == nil || item.force
|
||||||
strongSelf.item = item
|
strongSelf.item = item
|
||||||
strongSelf.layoutParams = params
|
strongSelf.layoutParams = params
|
||||||
|
|
||||||
|
@ -832,10 +832,10 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
|
|||||||
let theme = self.presentationData.theme.withUpdated(preview: true)
|
let theme = self.presentationData.theme.withUpdated(preview: true)
|
||||||
|
|
||||||
let message1 = Message(stableId: 2, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 2), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: bottomMessageText, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message1 = Message(stableId: 2, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 2), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66001, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: bottomMessageText, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message1, theme: theme, strings: self.presentationData.strings, wallpaper: currentWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message1, theme: theme, strings: self.presentationData.strings, wallpaper: currentWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let message2 = Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66000, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: topMessageText, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
let message2 = Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: peerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, timestamp: 66000, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: topMessageText, attributes: [], media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [])
|
||||||
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message2, theme: theme, strings: self.presentationData.strings, wallpaper: currentWallpaper, fontSize: self.presentationData.fontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
items.append(self.context.sharedContext.makeChatMessagePreviewItem(context: self.context, message: message2, theme: theme, strings: self.presentationData.strings, wallpaper: currentWallpaper, fontSize: self.presentationData.chatFontSize, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil))
|
||||||
|
|
||||||
let params = ListViewItemLayoutParams(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, availableHeight: layout.size.height)
|
let params = ListViewItemLayoutParams(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, availableHeight: layout.size.height)
|
||||||
if let messageNodes = self.messageNodes {
|
if let messageNodes = self.messageNodes {
|
||||||
|
@ -72,7 +72,7 @@ public extension ActionSheetControllerTheme {
|
|||||||
let presentationTheme = presentationData.theme
|
let presentationTheme = presentationData.theme
|
||||||
|
|
||||||
let actionSheet = presentationTheme.actionSheet
|
let actionSheet = presentationTheme.actionSheet
|
||||||
self.init(dimColor: actionSheet.dimColor, backgroundType: actionSheet.backgroundType == .light ? .light : .dark, itemBackgroundColor: actionSheet.itemBackgroundColor, itemHighlightedBackgroundColor: actionSheet.itemHighlightedBackgroundColor, standardActionTextColor: actionSheet.standardActionTextColor, destructiveActionTextColor: actionSheet.destructiveActionTextColor, disabledActionTextColor: actionSheet.disabledActionTextColor, primaryTextColor: actionSheet.primaryTextColor, secondaryTextColor: actionSheet.secondaryTextColor, controlAccentColor: actionSheet.controlAccentColor, controlColor: presentationTheme.list.disclosureArrowColor, switchFrameColor: presentationTheme.list.itemSwitchColors.frameColor, switchContentColor: presentationTheme.list.itemSwitchColors.contentColor, switchHandleColor: presentationTheme.list.itemSwitchColors.handleColor, baseFontSize: presentationData.fontSize.baseDisplaySize)
|
self.init(dimColor: actionSheet.dimColor, backgroundType: actionSheet.backgroundType == .light ? .light : .dark, itemBackgroundColor: actionSheet.itemBackgroundColor, itemHighlightedBackgroundColor: actionSheet.itemHighlightedBackgroundColor, standardActionTextColor: actionSheet.standardActionTextColor, destructiveActionTextColor: actionSheet.destructiveActionTextColor, disabledActionTextColor: actionSheet.disabledActionTextColor, primaryTextColor: actionSheet.primaryTextColor, secondaryTextColor: actionSheet.secondaryTextColor, controlAccentColor: actionSheet.controlAccentColor, controlColor: presentationTheme.list.disclosureArrowColor, switchFrameColor: presentationTheme.list.itemSwitchColors.frameColor, switchContentColor: presentationTheme.list.itemSwitchColors.contentColor, switchHandleColor: presentationTheme.list.itemSwitchColors.handleColor, baseFontSize: presentationData.listsFontSize.baseDisplaySize)
|
||||||
}
|
}
|
||||||
|
|
||||||
convenience init(presentationTheme: PresentationTheme, fontSize: PresentationFontSize) {
|
convenience init(presentationTheme: PresentationTheme, fontSize: PresentationFontSize) {
|
||||||
@ -96,7 +96,7 @@ public extension AlertControllerTheme {
|
|||||||
convenience init(presentationData: PresentationData) {
|
convenience init(presentationData: PresentationData) {
|
||||||
let presentationTheme = presentationData.theme
|
let presentationTheme = presentationData.theme
|
||||||
let actionSheet = presentationTheme.actionSheet
|
let actionSheet = presentationTheme.actionSheet
|
||||||
self.init(backgroundType: actionSheet.backgroundType == .light ? .light : .dark, backgroundColor: actionSheet.itemBackgroundColor, separatorColor: actionSheet.itemHighlightedBackgroundColor, highlightedItemColor: actionSheet.itemHighlightedBackgroundColor, primaryColor: actionSheet.primaryTextColor, secondaryColor: actionSheet.secondaryTextColor, accentColor: actionSheet.controlAccentColor, destructiveColor: actionSheet.destructiveActionTextColor, disabledColor: actionSheet.disabledActionTextColor, baseFontSize: presentationData.fontSize.baseDisplaySize)
|
self.init(backgroundType: actionSheet.backgroundType == .light ? .light : .dark, backgroundColor: actionSheet.itemBackgroundColor, separatorColor: actionSheet.itemHighlightedBackgroundColor, highlightedItemColor: actionSheet.itemHighlightedBackgroundColor, primaryColor: actionSheet.primaryTextColor, secondaryColor: actionSheet.secondaryTextColor, accentColor: actionSheet.controlAccentColor, destructiveColor: actionSheet.destructiveActionTextColor, disabledColor: actionSheet.disabledActionTextColor, baseFontSize: presentationData.listsFontSize.baseDisplaySize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,19 +53,21 @@ public final class PresentationData: Equatable {
|
|||||||
public let theme: PresentationTheme
|
public let theme: PresentationTheme
|
||||||
public let autoNightModeTriggered: Bool
|
public let autoNightModeTriggered: Bool
|
||||||
public let chatWallpaper: TelegramWallpaper
|
public let chatWallpaper: TelegramWallpaper
|
||||||
public let fontSize: PresentationFontSize
|
public let chatFontSize: PresentationFontSize
|
||||||
|
public let listsFontSize: PresentationFontSize
|
||||||
public let dateTimeFormat: PresentationDateTimeFormat
|
public let dateTimeFormat: PresentationDateTimeFormat
|
||||||
public let nameDisplayOrder: PresentationPersonNameOrder
|
public let nameDisplayOrder: PresentationPersonNameOrder
|
||||||
public let nameSortOrder: PresentationPersonNameOrder
|
public let nameSortOrder: PresentationPersonNameOrder
|
||||||
public let disableAnimations: Bool
|
public let disableAnimations: Bool
|
||||||
public let largeEmoji: Bool
|
public let largeEmoji: Bool
|
||||||
|
|
||||||
public init(strings: PresentationStrings, theme: PresentationTheme, autoNightModeTriggered: Bool, chatWallpaper: TelegramWallpaper, fontSize: PresentationFontSize, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, nameSortOrder: PresentationPersonNameOrder, disableAnimations: Bool, largeEmoji: Bool) {
|
public init(strings: PresentationStrings, theme: PresentationTheme, autoNightModeTriggered: Bool, chatWallpaper: TelegramWallpaper, chatFontSize: PresentationFontSize, listsFontSize: PresentationFontSize, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, nameSortOrder: PresentationPersonNameOrder, disableAnimations: Bool, largeEmoji: Bool) {
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.autoNightModeTriggered = autoNightModeTriggered
|
self.autoNightModeTriggered = autoNightModeTriggered
|
||||||
self.chatWallpaper = chatWallpaper
|
self.chatWallpaper = chatWallpaper
|
||||||
self.fontSize = fontSize
|
self.chatFontSize = chatFontSize
|
||||||
|
self.listsFontSize = listsFontSize
|
||||||
self.dateTimeFormat = dateTimeFormat
|
self.dateTimeFormat = dateTimeFormat
|
||||||
self.nameDisplayOrder = nameDisplayOrder
|
self.nameDisplayOrder = nameDisplayOrder
|
||||||
self.nameSortOrder = nameSortOrder
|
self.nameSortOrder = nameSortOrder
|
||||||
@ -74,7 +76,7 @@ public final class PresentationData: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: PresentationData, rhs: PresentationData) -> Bool {
|
public static func ==(lhs: PresentationData, rhs: PresentationData) -> Bool {
|
||||||
return lhs.strings === rhs.strings && lhs.theme === rhs.theme && lhs.autoNightModeTriggered == rhs.autoNightModeTriggered && lhs.chatWallpaper == rhs.chatWallpaper && lhs.fontSize == rhs.fontSize && lhs.dateTimeFormat == rhs.dateTimeFormat && lhs.disableAnimations == rhs.disableAnimations && lhs.largeEmoji == rhs.largeEmoji
|
return lhs.strings === rhs.strings && lhs.theme === rhs.theme && lhs.autoNightModeTriggered == rhs.autoNightModeTriggered && lhs.chatWallpaper == rhs.chatWallpaper && lhs.chatFontSize == rhs.chatFontSize && lhs.listsFontSize == rhs.listsFontSize && lhs.dateTimeFormat == rhs.dateTimeFormat && lhs.disableAnimations == rhs.disableAnimations && lhs.largeEmoji == rhs.largeEmoji
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +265,10 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager, s
|
|||||||
}
|
}
|
||||||
let nameDisplayOrder = contactSettings.nameDisplayOrder
|
let nameDisplayOrder = contactSettings.nameDisplayOrder
|
||||||
let nameSortOrder = currentPersonNameSortOrder()
|
let nameSortOrder = currentPersonNameSortOrder()
|
||||||
return InitialPresentationDataAndSettings(presentationData: PresentationData(strings: stringsValue, theme: theme, autoNightModeTriggered: autoNightModeTriggered, chatWallpaper: effectiveChatWallpaper, fontSize: resolveFontSize(settings: themeSettings), dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji), automaticMediaDownloadSettings: automaticMediaDownloadSettings, autodownloadSettings: autodownloadSettings, callListSettings: callListSettings, inAppNotificationSettings: inAppNotificationSettings, mediaInputSettings: mediaInputSettings, experimentalUISettings: experimentalUISettings)
|
|
||||||
|
let (chatFontSize, listsFontSize) = resolveFontSize(settings: themeSettings)
|
||||||
|
|
||||||
|
return InitialPresentationDataAndSettings(presentationData: PresentationData(strings: stringsValue, theme: theme, autoNightModeTriggered: autoNightModeTriggered, chatWallpaper: effectiveChatWallpaper, chatFontSize: chatFontSize, listsFontSize: listsFontSize, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji), automaticMediaDownloadSettings: automaticMediaDownloadSettings, autodownloadSettings: autodownloadSettings, callListSettings: callListSettings, inAppNotificationSettings: inAppNotificationSettings, mediaInputSettings: mediaInputSettings, experimentalUISettings: experimentalUISettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +599,9 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
|||||||
let nameDisplayOrder = contactSettings.nameDisplayOrder
|
let nameDisplayOrder = contactSettings.nameDisplayOrder
|
||||||
let nameSortOrder = currentPersonNameSortOrder()
|
let nameSortOrder = currentPersonNameSortOrder()
|
||||||
|
|
||||||
return PresentationData(strings: stringsValue, theme: themeValue, autoNightModeTriggered: autoNightModeTriggered, chatWallpaper: effectiveChatWallpaper, fontSize: resolveFontSize(settings: themeSettings), dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji)
|
let (chatFontSize, listsFontSize) = resolveFontSize(settings: themeSettings)
|
||||||
|
|
||||||
|
return PresentationData(strings: stringsValue, theme: themeValue, autoNightModeTriggered: autoNightModeTriggered, chatWallpaper: effectiveChatWallpaper, chatFontSize: chatFontSize, listsFontSize: listsFontSize, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return .complete()
|
return .complete()
|
||||||
@ -604,15 +611,18 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func resolveFontSize(settings: PresentationThemeSettings) -> PresentationFontSize {
|
private func resolveFontSize(settings: PresentationThemeSettings) -> (chat: PresentationFontSize, lists: PresentationFontSize) {
|
||||||
let fontSize: PresentationFontSize
|
let fontSize: PresentationFontSize
|
||||||
|
let listsFontSize: PresentationFontSize
|
||||||
if settings.useSystemFont {
|
if settings.useSystemFont {
|
||||||
let pointSize = UIFont.preferredFont(forTextStyle: .body).pointSize
|
let pointSize = UIFont.preferredFont(forTextStyle: .body).pointSize
|
||||||
fontSize = PresentationFontSize(systemFontSize: pointSize)
|
fontSize = PresentationFontSize(systemFontSize: pointSize)
|
||||||
|
listsFontSize = fontSize
|
||||||
} else {
|
} else {
|
||||||
fontSize = settings.fontSize
|
fontSize = settings.fontSize
|
||||||
|
listsFontSize = settings.listsFontSize
|
||||||
}
|
}
|
||||||
return fontSize
|
return (fontSize, listsFontSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func defaultPresentationData() -> PresentationData {
|
public func defaultPresentationData() -> PresentationData {
|
||||||
@ -621,15 +631,18 @@ public func defaultPresentationData() -> PresentationData {
|
|||||||
let nameSortOrder = currentPersonNameSortOrder()
|
let nameSortOrder = currentPersonNameSortOrder()
|
||||||
|
|
||||||
let themeSettings = PresentationThemeSettings.defaultSettings
|
let themeSettings = PresentationThemeSettings.defaultSettings
|
||||||
return PresentationData(strings: defaultPresentationStrings, theme: defaultPresentationTheme, autoNightModeTriggered: false, chatWallpaper: .builtin(WallpaperSettings()), fontSize: resolveFontSize(settings: themeSettings), dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji)
|
|
||||||
|
let (chatFontSize, listsFontSize) = resolveFontSize(settings: themeSettings)
|
||||||
|
|
||||||
|
return PresentationData(strings: defaultPresentationStrings, theme: defaultPresentationTheme, autoNightModeTriggered: false, chatWallpaper: .builtin(WallpaperSettings()), chatFontSize: chatFontSize, listsFontSize: listsFontSize, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations, largeEmoji: themeSettings.largeEmoji)
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension PresentationData {
|
public extension PresentationData {
|
||||||
func withFontSize(_ fontSize: PresentationFontSize) -> PresentationData {
|
func withFontSizes(chatFontSize: PresentationFontSize, listsFontSize: PresentationFontSize) -> PresentationData {
|
||||||
return PresentationData(strings: self.strings, theme: self.theme, autoNightModeTriggered: self.autoNightModeTriggered, chatWallpaper: self.chatWallpaper, fontSize: fontSize, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, nameSortOrder: self.nameSortOrder, disableAnimations: self.disableAnimations, largeEmoji: self.largeEmoji)
|
return PresentationData(strings: self.strings, theme: self.theme, autoNightModeTriggered: self.autoNightModeTriggered, chatWallpaper: self.chatWallpaper, chatFontSize: chatFontSize, listsFontSize: listsFontSize, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, nameSortOrder: self.nameSortOrder, disableAnimations: self.disableAnimations, largeEmoji: self.largeEmoji)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withStrings(_ strings: PresentationStrings) -> PresentationData {
|
func withStrings(_ strings: PresentationStrings) -> PresentationData {
|
||||||
return PresentationData(strings: strings, theme: self.theme, autoNightModeTriggered: self.autoNightModeTriggered, chatWallpaper: self.chatWallpaper, fontSize: self.fontSize, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, nameSortOrder: self.nameSortOrder, disableAnimations: self.disableAnimations, largeEmoji: self.largeEmoji)
|
return PresentationData(strings: strings, theme: self.theme, autoNightModeTriggered: self.autoNightModeTriggered, chatWallpaper: self.chatWallpaper, chatFontSize: self.chatFontSize, listsFontSize: self.listsFontSize, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, nameSortOrder: self.nameSortOrder, disableAnimations: self.disableAnimations, largeEmoji: self.largeEmoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ private func isTopmostChatController(_ controller: ChatControllerImpl) -> Bool {
|
|||||||
if let _ = controller.navigationController {
|
if let _ = controller.navigationController {
|
||||||
var hasOther = false
|
var hasOther = false
|
||||||
controller.window?.forEachController({ c in
|
controller.window?.forEachController({ c in
|
||||||
if c is ChatControllerImpl {
|
if c is ChatControllerImpl && controller !== c {
|
||||||
hasOther = true
|
hasOther = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -346,7 +346,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
isScheduledMessages = true
|
isScheduledMessages = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.presentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: context.currentLimitsConfiguration.with { $0 }, fontSize: self.presentationData.fontSize, accountPeerId: context.account.peerId, mode: mode, chatLocation: chatLocation, isScheduledMessages: isScheduledMessages)
|
self.presentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: context.currentLimitsConfiguration.with { $0 }, fontSize: self.presentationData.chatFontSize, accountPeerId: context.account.peerId, mode: mode, chatLocation: chatLocation, isScheduledMessages: isScheduledMessages)
|
||||||
|
|
||||||
var mediaAccessoryPanelVisibility = MediaAccessoryPanelVisibility.none
|
var mediaAccessoryPanelVisibility = MediaAccessoryPanelVisibility.none
|
||||||
if case .standard = mode {
|
if case .standard = mode {
|
||||||
@ -1582,7 +1582,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let node = node {
|
if let node = node {
|
||||||
strongSelf.messageTooltipController?.dismiss()
|
strongSelf.messageTooltipController?.dismiss()
|
||||||
let tooltipController = TooltipController(content: .text(text), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
let tooltipController = TooltipController(content: .text(text), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
||||||
strongSelf.messageTooltipController = tooltipController
|
strongSelf.messageTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.messageTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.messageTooltipController === tooltipController {
|
||||||
@ -3631,7 +3631,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
tooltipController.updateContent(.text(banDescription), animated: true, extendTimer: true)
|
tooltipController.updateContent(.text(banDescription), animated: true, extendTimer: true)
|
||||||
} else if let rect = rect {
|
} else if let rect = rect {
|
||||||
strongSelf.mediaRestrictedTooltipController?.dismiss()
|
strongSelf.mediaRestrictedTooltipController?.dismiss()
|
||||||
let tooltipController = TooltipController(content: .text(banDescription), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize)
|
let tooltipController = TooltipController(content: .text(banDescription), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize)
|
||||||
strongSelf.mediaRestrictedTooltipController = tooltipController
|
strongSelf.mediaRestrictedTooltipController = tooltipController
|
||||||
strongSelf.mediaRestrictedTooltipControllerMode = isStickers
|
strongSelf.mediaRestrictedTooltipControllerMode = isStickers
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
@ -3667,7 +3667,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
if let location = location, let icon = icon {
|
if let location = location, let icon = icon {
|
||||||
strongSelf.videoUnmuteTooltipController?.dismiss()
|
strongSelf.videoUnmuteTooltipController?.dismiss()
|
||||||
let tooltipController = TooltipController(content: .iconAndText(icon, strongSelf.presentationInterfaceState.strings.Conversation_PressVolumeButtonForSound), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize, timeout: 3.5, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
let tooltipController = TooltipController(content: .iconAndText(icon, strongSelf.presentationInterfaceState.strings.Conversation_PressVolumeButtonForSound), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize, timeout: 3.5, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
||||||
strongSelf.videoUnmuteTooltipController = tooltipController
|
strongSelf.videoUnmuteTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.videoUnmuteTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.videoUnmuteTooltipController === tooltipController {
|
||||||
@ -3922,7 +3922,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let tooltipController = strongSelf.silentPostTooltipController {
|
if let tooltipController = strongSelf.silentPostTooltipController {
|
||||||
tooltipController.updateContent(.text(text), animated: true, extendTimer: true)
|
tooltipController.updateContent(.text(text), animated: true, extendTimer: true)
|
||||||
} else if let rect = rect {
|
} else if let rect = rect {
|
||||||
let tooltipController = TooltipController(content: .text(text), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize)
|
let tooltipController = TooltipController(content: .text(text), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize)
|
||||||
strongSelf.silentPostTooltipController = tooltipController
|
strongSelf.silentPostTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.silentPostTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.silentPostTooltipController === tooltipController {
|
||||||
@ -4156,7 +4156,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}, displaySearchResultsTooltip: { [weak self] node, nodeRect in
|
}, displaySearchResultsTooltip: { [weak self] node, nodeRect in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.searchResultsTooltipController?.dismiss()
|
strongSelf.searchResultsTooltipController?.dismiss()
|
||||||
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.ChatSearch_ResultsTooltip), baseFontSize: strongSelf.presentationData.fontSize.baseDisplaySize, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.ChatSearch_ResultsTooltip), baseFontSize: strongSelf.presentationData.listsFontSize.baseDisplaySize, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
||||||
strongSelf.searchResultsTooltipController = tooltipController
|
strongSelf.searchResultsTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak tooltipController] _ in
|
tooltipController.dismissed = { [weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.searchResultsTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.searchResultsTooltipController === tooltipController {
|
||||||
@ -7911,7 +7911,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let tooltipController = self.mediaRecordingModeTooltipController {
|
if let tooltipController = self.mediaRecordingModeTooltipController {
|
||||||
tooltipController.updateContent(.text(text), animated: true, extendTimer: true)
|
tooltipController.updateContent(.text(text), animated: true, extendTimer: true)
|
||||||
} else if let rect = rect {
|
} else if let rect = rect {
|
||||||
let tooltipController = TooltipController(content: .text(text), baseFontSize: self.presentationData.fontSize.baseDisplaySize)
|
let tooltipController = TooltipController(content: .text(text), baseFontSize: self.presentationData.listsFontSize.baseDisplaySize)
|
||||||
self.mediaRecordingModeTooltipController = tooltipController
|
self.mediaRecordingModeTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak self, weak tooltipController] _ in
|
tooltipController.dismissed = { [weak self, weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.mediaRecordingModeTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.mediaRecordingModeTooltipController === tooltipController {
|
||||||
@ -7932,7 +7932,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.sendingOptionsTooltipController?.dismiss()
|
self.sendingOptionsTooltipController?.dismiss()
|
||||||
let tooltipController = TooltipController(content: .text(self.presentationData.strings.Conversation_SendingOptionsTooltip), baseFontSize: self.presentationData.fontSize.baseDisplaySize, timeout: 3.0, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
let tooltipController = TooltipController(content: .text(self.presentationData.strings.Conversation_SendingOptionsTooltip), baseFontSize: self.presentationData.listsFontSize.baseDisplaySize, timeout: 3.0, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true)
|
||||||
self.sendingOptionsTooltipController = tooltipController
|
self.sendingOptionsTooltipController = tooltipController
|
||||||
tooltipController.dismissed = { [weak self, weak tooltipController] _ in
|
tooltipController.dismissed = { [weak self, weak tooltipController] _ in
|
||||||
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.sendingOptionsTooltipController === tooltipController {
|
if let strongSelf = self, let tooltipController = tooltipController, strongSelf.sendingOptionsTooltipController === tooltipController {
|
||||||
|
@ -251,7 +251,7 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode {
|
|||||||
|
|
||||||
self.chatPresentationDataPromise.set(context.sharedContext.presentationData
|
self.chatPresentationDataPromise.set(context.sharedContext.presentationData
|
||||||
|> map { presentationData in
|
|> map { presentationData in
|
||||||
return ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji)
|
return ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji)
|
||||||
})
|
})
|
||||||
|
|
||||||
self.floatingSections = true
|
self.floatingSections = true
|
||||||
|
@ -505,7 +505,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.currentPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji, animatedEmojiScale: 1.0)
|
self.currentPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji, animatedEmojiScale: 1.0)
|
||||||
|
|
||||||
self.chatPresentationDataPromise = Promise(self.currentPresentationData)
|
self.chatPresentationDataPromise = Promise(self.currentPresentationData)
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings || previousWallpaper != presentationData.chatWallpaper || previousDisableAnimations != presentationData.disableAnimations || previousAnimatedEmojiScale != animatedEmojiConfig.scale {
|
if previousTheme !== presentationData.theme || previousStrings !== presentationData.strings || previousWallpaper != presentationData.chatWallpaper || previousDisableAnimations != presentationData.disableAnimations || previousAnimatedEmojiScale != animatedEmojiConfig.scale {
|
||||||
let themeData = ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper)
|
let themeData = ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper)
|
||||||
let chatPresentationData = ChatPresentationData(theme: themeData, fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji, animatedEmojiScale: animatedEmojiConfig.scale)
|
let chatPresentationData = ChatPresentationData(theme: themeData, fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji, animatedEmojiScale: animatedEmojiConfig.scale)
|
||||||
|
|
||||||
strongSelf.currentPresentationData = chatPresentationData
|
strongSelf.currentPresentationData = chatPresentationData
|
||||||
strongSelf.dynamicBounceEnabled = !presentationData.disableAnimations
|
strongSelf.dynamicBounceEnabled = !presentationData.disableAnimations
|
||||||
@ -1194,14 +1194,18 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
if let visibleRange = self.displayedItemRange.loadedRange {
|
if let visibleRange = self.displayedItemRange.loadedRange {
|
||||||
var index = historyView.filteredEntries.count - 1
|
var index = historyView.filteredEntries.count - 1
|
||||||
loop: for entry in historyView.filteredEntries {
|
loop: for entry in historyView.filteredEntries {
|
||||||
if index >= visibleRange.firstIndex && index <= visibleRange.lastIndex {
|
let isVisible = index >= visibleRange.firstIndex && index <= visibleRange.lastIndex
|
||||||
if case let .MessageEntry(message, _, _, _, _, _) = entry {
|
if case let .MessageEntry(message, _, _, _, _, _) = entry {
|
||||||
|
if !isVisible || currentMessage == nil {
|
||||||
currentMessage = message
|
currentMessage = message
|
||||||
break loop
|
|
||||||
} else if case let .MessageGroupEntry(_, messages, _) = entry {
|
|
||||||
currentMessage = messages.first?.0
|
|
||||||
break loop
|
|
||||||
}
|
}
|
||||||
|
} else if case let .MessageGroupEntry(_, messages, _) = entry {
|
||||||
|
if !isVisible || currentMessage == nil {
|
||||||
|
currentMessage = messages.first?.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if isVisible {
|
||||||
|
break loop
|
||||||
}
|
}
|
||||||
index -= 1
|
index -= 1
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ final class ChatHistorySearchContainerNode: SearchDisplayControllerContentNode {
|
|||||||
|
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings, self.presentationData.dateTimeFormat, self.presentationData.fontSize))
|
self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings, self.presentationData.dateTimeFormat, self.presentationData.listsFontSize))
|
||||||
|
|
||||||
self.dimNode = ASDisplayNode()
|
self.dimNode = ASDisplayNode()
|
||||||
self.dimNode.backgroundColor = UIColor.black.withAlphaComponent(0.5)
|
self.dimNode.backgroundColor = UIColor.black.withAlphaComponent(0.5)
|
||||||
@ -228,7 +228,7 @@ final class ChatHistorySearchContainerNode: SearchDisplayControllerContentNode {
|
|||||||
|
|
||||||
self.presentationDataDisposable = context.sharedContext.presentationData.start(next: { [weak self] presentationData in
|
self.presentationDataDisposable = context.sharedContext.presentationData.start(next: { [weak self] presentationData in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.themeAndStringsPromise.set(.single((presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, presentationData.fontSize)))
|
strongSelf.themeAndStringsPromise.set(.single((presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, presentationData.listsFontSize)))
|
||||||
|
|
||||||
strongSelf.emptyResultsTitleNode.attributedText = NSAttributedString(string: presentationData.strings.SharedMedia_SearchNoResults, font: Font.semibold(17.0), textColor: presentationData.theme.list.freeTextColor, paragraphAlignment: .center)
|
strongSelf.emptyResultsTitleNode.attributedText = NSAttributedString(string: presentationData.strings.SharedMedia_SearchNoResults, font: Font.semibold(17.0), textColor: presentationData.theme.list.freeTextColor, paragraphAlignment: .center)
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ enum ChatMediaInputMode {
|
|||||||
enum ChatMediaInputSearchMode {
|
enum ChatMediaInputSearchMode {
|
||||||
case gif
|
case gif
|
||||||
case sticker
|
case sticker
|
||||||
|
case trending
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ChatMediaInputExpanded: Equatable {
|
enum ChatMediaInputExpanded: Equatable {
|
||||||
|
@ -111,9 +111,9 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper)
|
self.emptyNode = ChatRecentActionsEmptyNode(theme: self.presentationData.theme, chatWallpaper: self.presentationData.chatWallpaper)
|
||||||
self.emptyNode.alpha = 0.0
|
self.emptyNode.alpha = 0.0
|
||||||
|
|
||||||
self.state = ChatRecentActionsControllerState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, fontSize: self.presentationData.fontSize)
|
self.state = ChatRecentActionsControllerState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, fontSize: self.presentationData.chatFontSize)
|
||||||
|
|
||||||
self.chatPresentationDataPromise = Promise(ChatPresentationData(theme: ChatPresentationThemeData(theme: self.presentationData.theme, wallpaper: self.presentationData.chatWallpaper), fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations, largeEmoji: self.presentationData.largeEmoji))
|
self.chatPresentationDataPromise = Promise(ChatPresentationData(theme: ChatPresentationThemeData(theme: self.presentationData.theme, wallpaper: self.presentationData.chatWallpaper), fontSize: self.presentationData.chatFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations, largeEmoji: self.presentationData.largeEmoji))
|
||||||
|
|
||||||
self.eventLogContext = ChannelAdminEventLogContext(postbox: self.context.account.postbox, network: self.context.account.network, peerId: self.peer.id)
|
self.eventLogContext = ChannelAdminEventLogContext(postbox: self.context.account.postbox, network: self.context.account.network, peerId: self.peer.id)
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
|
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.presentationData = presentationData
|
strongSelf.presentationData = presentationData
|
||||||
strongSelf.chatPresentationDataPromise.set(.single(ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji)))
|
strongSelf.chatPresentationDataPromise.set(.single(ChatPresentationData(theme: ChatPresentationThemeData(theme: presentationData.theme, wallpaper: presentationData.chatWallpaper), fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations, largeEmoji: presentationData.largeEmoji)))
|
||||||
|
|
||||||
strongSelf.updateThemeAndStrings(theme: presentationData.theme, strings: presentationData.strings)
|
strongSelf.updateThemeAndStrings(theme: presentationData.theme, strings: presentationData.strings)
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDe
|
|||||||
self.searchResult = searchResult
|
self.searchResult = searchResult
|
||||||
self.searchState = searchState
|
self.searchState = searchState
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations))
|
self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations))
|
||||||
|
|
||||||
self.listNode = ListView()
|
self.listNode = ListView()
|
||||||
self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor
|
self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor
|
||||||
@ -291,7 +291,7 @@ class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDe
|
|||||||
func updatePresentationData(_ presentationData: PresentationData) {
|
func updatePresentationData(_ presentationData: PresentationData) {
|
||||||
let previousTheme = self.presentationData.theme
|
let previousTheme = self.presentationData.theme
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
self.presentationDataPromise.set(.single(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)))
|
self.presentationDataPromise.set(.single(ChatListPresentationData(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func enqueueTransition(_ transition: ChatListSearchContainerTransition, firstTime: Bool) {
|
private func enqueueTransition(_ transition: ChatListSearchContainerTransition, firstTime: Bool) {
|
||||||
|
@ -265,9 +265,9 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
|
|||||||
self.toMessageTextNode.attributedText = toAttributedText
|
self.toMessageTextNode.attributedText = toAttributedText
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.fromMessageTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.Conversation_InputTextPlaceholder, attributes: [NSAttributedString.Key.foregroundColor: self.presentationData.theme.chat.inputPanel.inputPlaceholderColor, NSAttributedString.Key.font: Font.regular(self.presentationData.fontSize.baseDisplaySize)])
|
self.fromMessageTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.Conversation_InputTextPlaceholder, attributes: [NSAttributedString.Key.foregroundColor: self.presentationData.theme.chat.inputPanel.inputPlaceholderColor, NSAttributedString.Key.font: Font.regular(self.presentationData.chatFontSize.baseDisplaySize)])
|
||||||
|
|
||||||
self.toMessageTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.ForwardedMessages(Int32(forwardedCount ?? 0)), attributes: [NSAttributedString.Key.foregroundColor: self.presentationData.theme.chat.message.outgoing.primaryTextColor, NSAttributedString.Key.font: Font.regular(self.presentationData.fontSize.baseDisplaySize)])
|
self.toMessageTextNode.attributedText = NSAttributedString(string: self.presentationData.strings.ForwardedMessages(Int32(forwardedCount ?? 0)), attributes: [NSAttributedString.Key.foregroundColor: self.presentationData.theme.chat.message.outgoing.primaryTextColor, NSAttributedString.Key.font: Font.regular(self.presentationData.chatFontSize.baseDisplaySize)])
|
||||||
}
|
}
|
||||||
self.messageBackgroundNode.contentMode = .scaleToFill
|
self.messageBackgroundNode.contentMode = .scaleToFill
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ final class ChatSlowmodeHintController: TooltipController {
|
|||||||
init(presentationData: PresentationData, slowmodeState: ChatSlowmodeState) {
|
init(presentationData: PresentationData, slowmodeState: ChatSlowmodeState) {
|
||||||
self.strings = presentationData.strings
|
self.strings = presentationData.strings
|
||||||
self.slowmodeState = slowmodeState
|
self.slowmodeState = slowmodeState
|
||||||
super.init(content: .text(timeoutValue(strings: presentationData.strings, slowmodeState: slowmodeState)), baseFontSize: presentationData.fontSize.baseDisplaySize, timeout: 2.0, dismissByTapOutside: false, dismissByTapOutsideSource: true)
|
super.init(content: .text(timeoutValue(strings: presentationData.strings, slowmodeState: slowmodeState)), baseFontSize: presentationData.listsFontSize.baseDisplaySize, timeout: 2.0, dismissByTapOutside: false, dismissByTapOutsideSource: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init(coder aDecoder: NSCoder) {
|
required init(coder aDecoder: NSCoder) {
|
||||||
|
@ -339,12 +339,7 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
|
|||||||
let controller = ShareController(context: params.context, subject: .media(.standalone(media: file)), immediateExternalShare: true)
|
let controller = ShareController(context: params.context, subject: .media(.standalone(media: file)), immediateExternalShare: true)
|
||||||
params.present(controller, nil)
|
params.present(controller, nil)
|
||||||
} else if let rootController = params.navigationController?.view.window?.rootViewController {
|
} else if let rootController = params.navigationController?.view.window?.rootViewController {
|
||||||
if let fileName = file.fileName, fileName.hasSuffix(".svgbg") {
|
presentDocumentPreviewController(rootController: rootController, theme: presentationData.theme, strings: presentationData.strings, postbox: params.context.account.postbox, file: file)
|
||||||
let controller = WallpaperGalleryController(context: params.context, source: .wallpaper(.file(id: 0, accessHash: 0, isCreator: false, isDefault: false, isPattern: true, isDark: false, slug: "", file: file, settings: WallpaperSettings()), nil, nil, nil, nil, nil, nil))
|
|
||||||
params.present(controller, nil)
|
|
||||||
} else {
|
|
||||||
presentDocumentPreviewController(rootController: rootController, theme: presentationData.theme, strings: presentationData.strings, postbox: params.context.account.postbox, file: file)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
case let .audio(file):
|
case let .audio(file):
|
||||||
|
@ -155,7 +155,7 @@ class PeerMediaCollectionControllerNode: ASDisplayNode {
|
|||||||
self.historyEmptyNode = PeerMediaCollectionEmptyNode(mode: self.mediaCollectionInterfaceState.mode, theme: self.presentationData.theme, strings: self.presentationData.strings)
|
self.historyEmptyNode = PeerMediaCollectionEmptyNode(mode: self.mediaCollectionInterfaceState.mode, theme: self.presentationData.theme, strings: self.presentationData.strings)
|
||||||
self.historyEmptyNode.isHidden = true
|
self.historyEmptyNode.isHidden = true
|
||||||
|
|
||||||
self.chatPresentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: .defaultValue, fontSize: self.presentationData.fontSize, accountPeerId: context.account.peerId, mode: .standard(previewing: false), chatLocation: .peer(self.peerId), isScheduledMessages: false)
|
self.chatPresentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: self.presentationData.chatWallpaper, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, limitsConfiguration: .defaultValue, fontSize: self.presentationData.listsFontSize, accountPeerId: context.account.peerId, mode: .standard(previewing: false), chatLocation: .peer(self.peerId), isScheduledMessages: false)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
self.chatListNode = ChatListNode(context: context, groupId: .root, controlsHistoryPreload: false, mode: .peers(filter: filter), theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)
|
self.chatListNode = ChatListNode(context: context, groupId: .root, controlsHistoryPreload: false, mode: .peers(filter: filter), theme: presentationData.theme, fontSize: presentationData.listsFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: presentationData.disableAnimations)
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
|||||||
private func updateThemeAndStrings() {
|
private func updateThemeAndStrings() {
|
||||||
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
self.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
||||||
self.searchDisplayController?.updatePresentationData(self.presentationData)
|
self.searchDisplayController?.updatePresentationData(self.presentationData)
|
||||||
self.chatListNode.updateThemeAndStrings(theme: self.presentationData.theme, fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
self.chatListNode.updateThemeAndStrings(theme: self.presentationData.theme, fontSize: self.presentationData.listsFontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)
|
||||||
|
|
||||||
self.toolbarBackgroundNode?.backgroundColor = self.presentationData.theme.rootController.navigationBar.backgroundColor
|
self.toolbarBackgroundNode?.backgroundColor = self.presentationData.theme.rootController.navigationBar.backgroundColor
|
||||||
self.toolbarSeparatorNode?.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
|
self.toolbarSeparatorNode?.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
|
||||||
|
@ -139,7 +139,7 @@ final class ThemeUpdateManagerImpl: ThemeUpdateManager {
|
|||||||
theme = updatedTheme
|
theme = updatedTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
return PresentationThemeSettings(theme: theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: current.themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
})
|
})
|
||||||
}).start()
|
}).start()
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ final class WallpaperUploadManagerImpl: WallpaperUploadManager {
|
|||||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||||
themeSpecificChatWallpapers[themeReference.index] = updatedWallpaper
|
themeSpecificChatWallpapers[themeReference.index] = updatedWallpaper
|
||||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: current.themeSpecificAccentColors[themeReference.index])] = updatedWallpaper
|
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: current.themeSpecificAccentColors[themeReference.index])] = updatedWallpaper
|
||||||
return PresentationThemeSettings(theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
return PresentationThemeSettings(theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, listsFontSize: current.listsFontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||||
})).start()
|
})).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,6 +529,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
|||||||
public var themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
public var themeSpecificChatWallpapers: [Int64: TelegramWallpaper]
|
||||||
public var useSystemFont: Bool
|
public var useSystemFont: Bool
|
||||||
public var fontSize: PresentationFontSize
|
public var fontSize: PresentationFontSize
|
||||||
|
public var listsFontSize: PresentationFontSize
|
||||||
public var automaticThemeSwitchSetting: AutomaticThemeSwitchSetting
|
public var automaticThemeSwitchSetting: AutomaticThemeSwitchSetting
|
||||||
public var largeEmoji: Bool
|
public var largeEmoji: Bool
|
||||||
public var disableAnimations: Bool
|
public var disableAnimations: Bool
|
||||||
@ -569,15 +570,16 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static var defaultSettings: PresentationThemeSettings {
|
public static var defaultSettings: PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: .builtin(.dayClassic), themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], useSystemFont: true, fontSize: .regular, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting(trigger: .system, theme: .builtin(.night)), largeEmoji: true, disableAnimations: true)
|
return PresentationThemeSettings(theme: .builtin(.dayClassic), themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], useSystemFont: true, fontSize: .regular, listsFontSize: .regular, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting(trigger: .system, theme: .builtin(.night)), largeEmoji: true, disableAnimations: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(theme: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], useSystemFont: Bool, fontSize: PresentationFontSize, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting, largeEmoji: Bool, disableAnimations: Bool) {
|
public init(theme: PresentationThemeReference, themeSpecificAccentColors: [Int64: PresentationThemeAccentColor], themeSpecificChatWallpapers: [Int64: TelegramWallpaper], useSystemFont: Bool, fontSize: PresentationFontSize, listsFontSize: PresentationFontSize, automaticThemeSwitchSetting: AutomaticThemeSwitchSetting, largeEmoji: Bool, disableAnimations: Bool) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.themeSpecificAccentColors = themeSpecificAccentColors
|
self.themeSpecificAccentColors = themeSpecificAccentColors
|
||||||
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
|
self.themeSpecificChatWallpapers = themeSpecificChatWallpapers
|
||||||
self.useSystemFont = useSystemFont
|
self.useSystemFont = useSystemFont
|
||||||
self.fontSize = fontSize
|
self.fontSize = fontSize
|
||||||
|
self.listsFontSize = listsFontSize
|
||||||
self.automaticThemeSwitchSetting = automaticThemeSwitchSetting
|
self.automaticThemeSwitchSetting = automaticThemeSwitchSetting
|
||||||
self.largeEmoji = largeEmoji
|
self.largeEmoji = largeEmoji
|
||||||
self.disableAnimations = disableAnimations
|
self.disableAnimations = disableAnimations
|
||||||
@ -599,7 +601,9 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.useSystemFont = decoder.decodeInt32ForKey("useSystemFont", orElse: 1) != 0
|
self.useSystemFont = decoder.decodeInt32ForKey("useSystemFont", orElse: 1) != 0
|
||||||
self.fontSize = PresentationFontSize(rawValue: decoder.decodeInt32ForKey("f", orElse: PresentationFontSize.regular.rawValue)) ?? .regular
|
let fontSize = PresentationFontSize(rawValue: decoder.decodeInt32ForKey("f", orElse: PresentationFontSize.regular.rawValue)) ?? .regular
|
||||||
|
self.fontSize = fontSize
|
||||||
|
self.listsFontSize = PresentationFontSize(rawValue: decoder.decodeInt32ForKey("lf", orElse: PresentationFontSize.regular.rawValue)) ?? fontSize
|
||||||
self.automaticThemeSwitchSetting = (decoder.decodeObjectForKey("automaticThemeSwitchSetting", decoder: { AutomaticThemeSwitchSetting(decoder: $0) }) as? AutomaticThemeSwitchSetting) ?? AutomaticThemeSwitchSetting(trigger: .system, theme: .builtin(.night))
|
self.automaticThemeSwitchSetting = (decoder.decodeObjectForKey("automaticThemeSwitchSetting", decoder: { AutomaticThemeSwitchSetting(decoder: $0) }) as? AutomaticThemeSwitchSetting) ?? AutomaticThemeSwitchSetting(trigger: .system, theme: .builtin(.night))
|
||||||
self.largeEmoji = decoder.decodeBoolForKey("largeEmoji", orElse: true)
|
self.largeEmoji = decoder.decodeBoolForKey("largeEmoji", orElse: true)
|
||||||
self.disableAnimations = decoder.decodeBoolForKey("disableAnimations", orElse: true)
|
self.disableAnimations = decoder.decodeBoolForKey("disableAnimations", orElse: true)
|
||||||
@ -615,6 +619,7 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
|||||||
})
|
})
|
||||||
encoder.encodeInt32(self.useSystemFont ? 1 : 0, forKey: "useSystemFont")
|
encoder.encodeInt32(self.useSystemFont ? 1 : 0, forKey: "useSystemFont")
|
||||||
encoder.encodeInt32(self.fontSize.rawValue, forKey: "f")
|
encoder.encodeInt32(self.fontSize.rawValue, forKey: "f")
|
||||||
|
encoder.encodeInt32(self.listsFontSize.rawValue, forKey: "lf")
|
||||||
encoder.encodeObject(self.automaticThemeSwitchSetting, forKey: "automaticThemeSwitchSetting")
|
encoder.encodeObject(self.automaticThemeSwitchSetting, forKey: "automaticThemeSwitchSetting")
|
||||||
encoder.encodeBool(self.largeEmoji, forKey: "largeEmoji")
|
encoder.encodeBool(self.largeEmoji, forKey: "largeEmoji")
|
||||||
encoder.encodeBool(self.disableAnimations, forKey: "disableAnimations")
|
encoder.encodeBool(self.disableAnimations, forKey: "disableAnimations")
|
||||||
@ -629,39 +634,39 @@ public struct PresentationThemeSettings: PreferencesEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: PresentationThemeSettings, rhs: PresentationThemeSettings) -> Bool {
|
public static func ==(lhs: PresentationThemeSettings, rhs: PresentationThemeSettings) -> Bool {
|
||||||
return lhs.theme == rhs.theme && lhs.themeSpecificAccentColors == rhs.themeSpecificAccentColors && lhs.themeSpecificChatWallpapers == rhs.themeSpecificChatWallpapers && lhs.useSystemFont == rhs.useSystemFont && lhs.fontSize == rhs.fontSize && lhs.automaticThemeSwitchSetting == rhs.automaticThemeSwitchSetting && lhs.largeEmoji == rhs.largeEmoji && lhs.disableAnimations == rhs.disableAnimations
|
return lhs.theme == rhs.theme && lhs.themeSpecificAccentColors == rhs.themeSpecificAccentColors && lhs.themeSpecificChatWallpapers == rhs.themeSpecificChatWallpapers && lhs.useSystemFont == rhs.useSystemFont && lhs.fontSize == rhs.fontSize && lhs.listsFontSize == rhs.listsFontSize && lhs.automaticThemeSwitchSetting == rhs.automaticThemeSwitchSetting && lhs.largeEmoji == rhs.largeEmoji && lhs.disableAnimations == rhs.disableAnimations
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedTheme(_ theme: PresentationThemeReference) -> PresentationThemeSettings {
|
public func withUpdatedTheme(_ theme: PresentationThemeReference) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedThemeSpecificAccentColors(_ themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]) -> PresentationThemeSettings {
|
public func withUpdatedThemeSpecificAccentColors(_ themeSpecificAccentColors: [Int64: PresentationThemeAccentColor]) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedThemeSpecificChatWallpapers(_ themeSpecificChatWallpapers: [Int64: TelegramWallpaper]) -> PresentationThemeSettings {
|
public func withUpdatedThemeSpecificChatWallpapers(_ themeSpecificChatWallpapers: [Int64: TelegramWallpaper]) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedUseSystemFont(_ useSystemFont: Bool) -> PresentationThemeSettings {
|
public func withUpdatedUseSystemFont(_ useSystemFont: Bool) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedFontSize(_ fontSize: PresentationFontSize) -> PresentationThemeSettings {
|
public func withUpdatedFontSizes(fontSize: PresentationFontSize, listsFontSize: PresentationFontSize) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: fontSize, listsFontSize: listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedAutomaticThemeSwitchSetting(_ automaticThemeSwitchSetting: AutomaticThemeSwitchSetting) -> PresentationThemeSettings {
|
public func withUpdatedAutomaticThemeSwitchSetting(_ automaticThemeSwitchSetting: AutomaticThemeSwitchSetting) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedLargeEmoji(_ largeEmoji: Bool) -> PresentationThemeSettings {
|
public func withUpdatedLargeEmoji(_ largeEmoji: Bool) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: largeEmoji, disableAnimations: self.disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: largeEmoji, disableAnimations: self.disableAnimations)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedDisableAnimations(_ disableAnimations: Bool) -> PresentationThemeSettings {
|
public func withUpdatedDisableAnimations(_ disableAnimations: Bool) -> PresentationThemeSettings {
|
||||||
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: disableAnimations)
|
return PresentationThemeSettings(theme: self.theme, themeSpecificAccentColors: self.themeSpecificAccentColors, themeSpecificChatWallpapers: self.themeSpecificChatWallpapers, useSystemFont: self.useSystemFont, fontSize: self.fontSize, listsFontSize: self.listsFontSize, automaticThemeSwitchSetting: self.automaticThemeSwitchSetting, largeEmoji: self.largeEmoji, disableAnimations: disableAnimations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user