mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 17:43:18 +00:00
Merge commit '6427a7109d3b25bea8056ddf4de2996b35d61da7' into voiceover
This commit is contained in:
commit
6713e11d2a
@ -984,7 +984,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
let inputShortcuts: [KeyShortcut] = [
|
||||||
KeyShortcut(title: strings.KeyCommand_JumpToPreviousChat, input: UIKeyInputUpArrow, modifiers: [.alternate], action: { [weak self] in
|
KeyShortcut(title: strings.KeyCommand_JumpToPreviousChat, input: UIKeyInputUpArrow, modifiers: [.alternate], action: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.chatListDisplayNode.chatListNode.selectChat(.previous(unread: false))
|
strongSelf.chatListDisplayNode.chatListNode.selectChat(.previous(unread: false))
|
||||||
@ -1013,6 +1013,24 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
|||||||
KeyShortcut(title: strings.KeyCommand_Find, input: "\t", modifiers: [], action: toggleSearch),
|
KeyShortcut(title: strings.KeyCommand_Find, input: "\t", modifiers: [], action: toggleSearch),
|
||||||
KeyShortcut(input: UIKeyInputEscape, modifiers: [], action: toggleSearch)
|
KeyShortcut(input: UIKeyInputEscape, modifiers: [], action: toggleSearch)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let openChat: (Int) -> Void = { [weak self] index in
|
||||||
|
if let strongSelf = self {
|
||||||
|
if index == 0 {
|
||||||
|
strongSelf.chatListDisplayNode.chatListNode.selectChat(.peerId(strongSelf.account.peerId))
|
||||||
|
} else {
|
||||||
|
strongSelf.chatListDisplayNode.chatListNode.selectChat(.index(index - 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let chatShortcuts: [KeyShortcut] = (0 ... 9).map { index in
|
||||||
|
return KeyShortcut(input: "\(index)", modifiers: [.command], action: {
|
||||||
|
openChat(index)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputShortcuts + chatShortcuts
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func toolbarActionSelected(left: Bool) {
|
override public func toolbarActionSelected(left: Bool) {
|
||||||
|
|||||||
@ -262,6 +262,8 @@ private final class ChatListOpaqueTransactionState {
|
|||||||
enum ChatListSelectionOption {
|
enum ChatListSelectionOption {
|
||||||
case previous(unread: Bool)
|
case previous(unread: Bool)
|
||||||
case next(unread: Bool)
|
case next(unread: Bool)
|
||||||
|
case peerId(PeerId)
|
||||||
|
case index(Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ChatListGlobalScrollOption {
|
enum ChatListGlobalScrollOption {
|
||||||
@ -645,8 +647,7 @@ final class ChatListNode: ListView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let location = location, location != strongSelf.currentLocation {
|
if let location = location, location != strongSelf.currentLocation {
|
||||||
strongSelf.currentLocation = location
|
strongSelf.setChatListLocation(location)
|
||||||
strongSelf.chatListLocation.set(location)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.enqueueHistoryPreloadUpdate()
|
strongSelf.enqueueHistoryPreloadUpdate()
|
||||||
@ -687,16 +688,13 @@ final class ChatListNode: ListView {
|
|||||||
self.chatListDisposable.set(appliedTransition.start())
|
self.chatListDisposable.set(appliedTransition.start())
|
||||||
|
|
||||||
let initialLocation: ChatListNodeLocation
|
let initialLocation: ChatListNodeLocation
|
||||||
|
|
||||||
switch mode {
|
switch mode {
|
||||||
case .chatList:
|
case .chatList:
|
||||||
initialLocation = .initial(count: 50)
|
initialLocation = .initial(count: 50)
|
||||||
case .peers:
|
case .peers:
|
||||||
initialLocation = .initial(count: 200)
|
initialLocation = .initial(count: 200)
|
||||||
}
|
}
|
||||||
|
self.setChatListLocation(initialLocation)
|
||||||
self.currentLocation = initialLocation
|
|
||||||
self.chatListLocation.set(initialLocation)
|
|
||||||
|
|
||||||
let postbox = context.account.postbox
|
let postbox = context.account.postbox
|
||||||
let previousPeerCache = Atomic<[PeerId: Peer]>(value: [:])
|
let previousPeerCache = Atomic<[PeerId: Peer]>(value: [:])
|
||||||
@ -1075,19 +1073,22 @@ final class ChatListNode: ListView {
|
|||||||
if view.laterIndex == nil {
|
if view.laterIndex == nil {
|
||||||
self.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: ListViewScrollToItem(index: 0, position: .top(0.0), animated: true, curve: .Default(duration: nil), directionHint: .Up), updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
self.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: ListViewScrollToItem(index: 0, position: .top(0.0), animated: true, curve: .Default(duration: nil), directionHint: .Up), updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||||
} else {
|
} else {
|
||||||
let location: ChatListNodeLocation = .scroll(index: ChatListIndex.absoluteUpperBound, sourceIndex: ChatListIndex.absoluteLowerBound
|
let location: ChatListNodeLocation = .scroll(index: .absoluteUpperBound, sourceIndex: .absoluteLowerBound
|
||||||
, scrollPosition: .top(0.0), animated: true)
|
, scrollPosition: .top(0.0), animated: true)
|
||||||
self.currentLocation = location
|
self.setChatListLocation(location)
|
||||||
self.chatListLocation.set(location)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let location: ChatListNodeLocation = .scroll(index: ChatListIndex.absoluteUpperBound, sourceIndex: ChatListIndex.absoluteLowerBound
|
let location: ChatListNodeLocation = .scroll(index: .absoluteUpperBound, sourceIndex: .absoluteLowerBound
|
||||||
, scrollPosition: .top(0.0), animated: true)
|
, scrollPosition: .top(0.0), animated: true)
|
||||||
self.currentLocation = location
|
self.setChatListLocation(location)
|
||||||
self.chatListLocation.set(location)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func setChatListLocation(_ location: ChatListNodeLocation) {
|
||||||
|
self.currentLocation = location
|
||||||
|
self.chatListLocation.set(location)
|
||||||
|
}
|
||||||
|
|
||||||
private func relativeUnreadChatListIndex(position: ChatListRelativePosition) -> Signal<ChatListIndex?, NoError> {
|
private func relativeUnreadChatListIndex(position: ChatListRelativePosition) -> Signal<ChatListIndex?, NoError> {
|
||||||
let postbox = self.context.account.postbox
|
let postbox = self.context.account.postbox
|
||||||
return self.context.sharedContext.accountManager.transaction { transaction -> Signal<ChatListIndex?, NoError> in
|
return self.context.sharedContext.accountManager.transaction { transaction -> Signal<ChatListIndex?, NoError> in
|
||||||
@ -1114,15 +1115,13 @@ final class ChatListNode: ListView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let index = index {
|
if let index = index {
|
||||||
let location: ChatListNodeLocation = .scroll(index: index, sourceIndex: self?.currentlyVisibleLatestChatListIndex() ?? ChatListIndex.absoluteUpperBound
|
let location: ChatListNodeLocation = .scroll(index: index, sourceIndex: self?.currentlyVisibleLatestChatListIndex() ?? .absoluteUpperBound
|
||||||
, scrollPosition: .center(.top), animated: true)
|
, scrollPosition: .center(.top), animated: true)
|
||||||
strongSelf.currentLocation = location
|
strongSelf.setChatListLocation(location)
|
||||||
strongSelf.chatListLocation.set(location)
|
|
||||||
} else {
|
} else {
|
||||||
let location: ChatListNodeLocation = .scroll(index: ChatListIndex.absoluteUpperBound, sourceIndex: ChatListIndex.absoluteLowerBound
|
let location: ChatListNodeLocation = .scroll(index: .absoluteUpperBound, sourceIndex: .absoluteLowerBound
|
||||||
, scrollPosition: .top(0.0), animated: true)
|
, scrollPosition: .top(0.0), animated: true)
|
||||||
strongSelf.currentLocation = location
|
strongSelf.setChatListLocation(location)
|
||||||
strongSelf.chatListLocation.set(location)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1140,14 +1139,14 @@ final class ChatListNode: ListView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if interaction.highlightedChatLocation == nil {
|
// if interaction.highlightedChatLocation == nil {
|
||||||
let location: ChatListNodeLocation = .scroll(index: ChatListIndex.absoluteUpperBound, sourceIndex: ChatListIndex.absoluteLowerBound
|
// let location: ChatListNodeLocation = .scroll(index: ChatListIndex.absoluteUpperBound, sourceIndex: ChatListIndex.absoluteLowerBound
|
||||||
, scrollPosition: .top(0.0), animated: true)
|
// , scrollPosition: .top(0.0), animated: true)
|
||||||
self.currentLocation = location
|
// self.currentLocation = location
|
||||||
self.chatListLocation.set(location)
|
// self.chatListLocation.set(location)
|
||||||
//interaction.highlightedChatLocation = ChatListHighlightedLocation(location: .peer(0), progress: 1.0)
|
// //interaction.highlightedChatLocation = ChatListHighlightedLocation(location: .peer(0), progress: 1.0)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
let entryCount = chatListView.filteredEntries.count
|
let entryCount = chatListView.filteredEntries.count
|
||||||
var current: (ChatListIndex, PeerId, Int)? = nil
|
var current: (ChatListIndex, PeerId, Int)? = nil
|
||||||
@ -1170,53 +1169,67 @@ final class ChatListNode: ListView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let current = current {
|
switch option {
|
||||||
switch option {
|
case .previous(unread: true), .next(unread: true):
|
||||||
case .previous(unread: true), .next(unread: true):
|
let position: ChatListRelativePosition
|
||||||
let position: ChatListRelativePosition
|
if let current = current {
|
||||||
if case .previous = option {
|
if case .previous = option {
|
||||||
position = .earlier(than: current.0)
|
position = .earlier(than: current.0)
|
||||||
} else {
|
} else {
|
||||||
position = .later(than: current.0)
|
position = .later(than: current.0)
|
||||||
}
|
}
|
||||||
let _ = (relativeUnreadChatListIndex(position: position) |> deliverOnMainQueue).start(next: { [weak self] index in
|
} else {
|
||||||
guard let strongSelf = self, let index = index else {
|
position = .later(than: nil)
|
||||||
return
|
}
|
||||||
}
|
let _ = (relativeUnreadChatListIndex(position: position) |> deliverOnMainQueue).start(next: { [weak self] index in
|
||||||
|
guard let strongSelf = self, let index = index else {
|
||||||
let location: ChatListNodeLocation = .scroll(index: index, sourceIndex: self?.currentlyVisibleLatestChatListIndex() ?? ChatListIndex.absoluteUpperBound, scrollPosition: .center(.top), animated: true)
|
return
|
||||||
strongSelf.currentLocation = location
|
|
||||||
strongSelf.chatListLocation.set(location)
|
|
||||||
strongSelf.peerSelected?(index.messageIndex.id.peerId, false, false)
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case .previous(unread: false), .next(unread: false):
|
|
||||||
if entryCount > 1 {
|
|
||||||
if current.2 > 0, case let .PeerEntry(index, _, _, _, _, _, peer, _, _, _, _, _, _) = chatListView.filteredEntries[current.2 - 1] {
|
|
||||||
next = (index, peer.peerId)
|
|
||||||
}
|
|
||||||
if current.2 <= entryCount - 2, case let .PeerEntry(index, _, _, _, _, _, peer, _, _, _, _, _, _) = chatListView.filteredEntries[current.2 + 1] {
|
|
||||||
previous = (index, peer.peerId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
let location: ChatListNodeLocation = .scroll(index: index, sourceIndex: strongSelf.currentlyVisibleLatestChatListIndex() ?? .absoluteUpperBound, scrollPosition: .center(.top), animated: true)
|
||||||
var target: (ChatListIndex, PeerId)? = nil
|
strongSelf.setChatListLocation(location)
|
||||||
switch option {
|
strongSelf.peerSelected?(index.messageIndex.id.peerId, false, false)
|
||||||
case .previous:
|
})
|
||||||
target = previous
|
case .previous(unread: false), .next(unread: false):
|
||||||
case .next:
|
var target: (ChatListIndex, PeerId)? = nil
|
||||||
target = next
|
if let current = current, entryCount > 1 {
|
||||||
|
if current.2 > 0, case let .PeerEntry(index, _, _, _, _, _, peer, _, _, _, _, _, _) = chatListView.filteredEntries[current.2 - 1] {
|
||||||
|
next = (index, peer.peerId)
|
||||||
}
|
}
|
||||||
|
if current.2 <= entryCount - 2, case let .PeerEntry(index, _, _, _, _, _, peer, _, _, _, _, _, _) = chatListView.filteredEntries[current.2 + 1] {
|
||||||
if let target = target {
|
previous = (index, peer.peerId)
|
||||||
let location: ChatListNodeLocation = .scroll(index: target.0, sourceIndex: ChatListIndex.absoluteLowerBound
|
|
||||||
, scrollPosition: .center(.top), animated: true)
|
|
||||||
self.currentLocation = location
|
|
||||||
self.chatListLocation.set(location)
|
|
||||||
self.peerSelected?(target.1, false, false)
|
|
||||||
}
|
}
|
||||||
break
|
if case .previous = option {
|
||||||
}
|
target = previous
|
||||||
|
} else {
|
||||||
|
target = next
|
||||||
|
}
|
||||||
|
} else if entryCount > 0 {
|
||||||
|
if case let .PeerEntry(index, _, _, _, _, _, peer, _, _, _, _, _, _) = chatListView.filteredEntries[entryCount - 1] {
|
||||||
|
target = (index, peer.peerId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let target = target {
|
||||||
|
let location: ChatListNodeLocation = .scroll(index: target.0, sourceIndex: .absoluteLowerBound, scrollPosition: .center(.top), animated: true)
|
||||||
|
self.setChatListLocation(location)
|
||||||
|
self.peerSelected?(target.1, false, false)
|
||||||
|
}
|
||||||
|
case let .peerId(peerId):
|
||||||
|
self.peerSelected?(peerId, false, false)
|
||||||
|
case let .index(index):
|
||||||
|
guard index < 10 else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let _ = (chatListViewForLocation(groupId: nil, location: .initial(count: 10), account: self.account)
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue).start(next: { update in
|
||||||
|
let entries = update.view.entries
|
||||||
|
if entries.count > index, case let .MessageEntry(index, _, _, _, _, renderedPeer, _) = entries[10 - index - 1] {
|
||||||
|
let location: ChatListNodeLocation = .scroll(index: index, sourceIndex: .absoluteLowerBound, scrollPosition: .center(.top), animated: true)
|
||||||
|
self.setChatListLocation(location)
|
||||||
|
self.peerSelected?(renderedPeer.peerId, false, false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (titleSize, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: title, font: titleFont, textColor: incoming ? theme.theme.chat.bubble.actionButtonsIncomingTextColor : theme.theme.chat.bubble.actionButtonsOutgoingTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(44.0, constrainedWidth - minimumSideInset - minimumSideInset), height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets(top: 1.0, left: 0.0, bottom: 1.0, right: 0.0)))
|
let (titleSize, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: title, font: titleFont, textColor: incoming ? bubbleVariableColor(variableColor: theme.theme.chat.bubble.actionButtonsIncomingTextColor, wallpaper: theme.wallpaper) : bubbleVariableColor(variableColor: theme.theme.chat.bubble.actionButtonsOutgoingTextColor, wallpaper: theme.wallpaper)), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(44.0, constrainedWidth - minimumSideInset - minimumSideInset), height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets(top: 1.0, left: 0.0, bottom: 1.0, right: 0.0)))
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.additionalGraphics(theme.theme, wallpaper: theme.wallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(theme.theme, wallpaper: theme.wallpaper)
|
||||||
let backgroundImage: UIImage?
|
let backgroundImage: UIImage?
|
||||||
|
|||||||
@ -495,7 +495,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
||||||
self.swipeToReplyFeedback?.impact()
|
self.swipeToReplyFeedback?.impact()
|
||||||
|
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -2002,7 +2002,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
|||||||
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
||||||
self.swipeToReplyFeedback?.impact()
|
self.swipeToReplyFeedback?.impact()
|
||||||
|
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -106,9 +106,6 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
self.stickBackgroundNode.displayWithoutProcessing = true
|
self.stickBackgroundNode.displayWithoutProcessing = true
|
||||||
self.stickBackgroundNode.displaysAsynchronously = false
|
self.stickBackgroundNode.displaysAsynchronously = false
|
||||||
|
|
||||||
//self.testNode.backgroundColor = .black
|
|
||||||
//self.testNode.isLayerBacked = true
|
|
||||||
|
|
||||||
super.init(layerBacked: false, dynamicBounce: true, isRotated: true, seeThrough: false)
|
super.init(layerBacked: false, dynamicBounce: true, isRotated: true, seeThrough: false)
|
||||||
|
|
||||||
self.transform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
|
self.transform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
|
||||||
@ -122,8 +119,6 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
self.addSubnode(self.backgroundNode)
|
self.addSubnode(self.backgroundNode)
|
||||||
self.addSubnode(self.labelNode)
|
self.addSubnode(self.labelNode)
|
||||||
|
|
||||||
//self.addSubnode(self.testNode)
|
|
||||||
|
|
||||||
let nowTimestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970)
|
let nowTimestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970)
|
||||||
|
|
||||||
var t: time_t = time_t(localTimestamp)
|
var t: time_t = time_t(localTimestamp)
|
||||||
@ -145,21 +140,12 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
text = presentationData.strings.Date_ChatDateHeaderYear(monthAtIndex(Int(timeinfo.tm_mon), strings: presentationData.strings), "\(timeinfo.tm_mday)", "\(1900 + timeinfo.tm_year)").0
|
text = presentationData.strings.Date_ChatDateHeaderYear(monthAtIndex(Int(timeinfo.tm_mon), strings: presentationData.strings), "\(timeinfo.tm_mday)", "\(1900 + timeinfo.tm_year)").0
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributedString = NSAttributedString(string: text, font: titleFont, textColor: presentationData.theme.theme.chat.serviceMessage.dateTextColor)
|
let attributedString = NSAttributedString(string: text, font: titleFont, textColor: bubbleVariableColor(variableColor: presentationData.theme.theme.chat.serviceMessage.dateTextColor, wallpaper: presentationData.theme.wallpaper))
|
||||||
let labelLayout = TextNode.asyncLayout(self.labelNode)
|
let labelLayout = TextNode.asyncLayout(self.labelNode)
|
||||||
|
|
||||||
let (size, apply) = labelLayout(TextNodeLayoutArguments(attributedString: attributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: 320.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (size, apply) = labelLayout(TextNodeLayoutArguments(attributedString: attributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: 320.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
let _ = apply()
|
let _ = apply()
|
||||||
self.labelNode.frame = CGRect(origin: CGPoint(), size: size.size)
|
self.labelNode.frame = CGRect(origin: CGPoint(), size: size.size)
|
||||||
|
|
||||||
/*(self.layer as! CASeeThroughTracingLayer).updateRelativePosition = { [weak self] position in
|
|
||||||
if let strongSelf = self {
|
|
||||||
strongSelf.testNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 70.0 + position.y), size: CGSize(width: 40.0, height: 20.0))
|
|
||||||
print("position \(position.x), \(position.y)")
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
@ -178,8 +164,6 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
|
override func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat) {
|
||||||
//let labelLayout = TextNode.asyncLayout(self.labelNode)
|
|
||||||
|
|
||||||
let chatDateSize: CGFloat = 20.0
|
let chatDateSize: CGFloat = 20.0
|
||||||
let chatDateInset: CGFloat = 6.0
|
let chatDateInset: CGFloat = 6.0
|
||||||
|
|
||||||
@ -232,8 +216,6 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||||
if !self.bounds.contains(point) {
|
if !self.bounds.contains(point) {
|
||||||
return nil
|
return nil
|
||||||
@ -247,15 +229,13 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override func touchesCancelled(_ touches: Set<UITouch>?, with event: UIEvent?) {
|
override func touchesCancelled(_ touches: Set<UITouch>?, with event: UIEvent?) {
|
||||||
super.touchesCancelled(touches, with: event)
|
super.touchesCancelled(touches, with: event)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func tapGesture(_ recognizer: ListViewTapGestureRecognizer) {
|
@objc func tapGesture(_ recognizer: ListViewTapGestureRecognizer) {
|
||||||
if case .ended = recognizer.state {
|
if case .ended = recognizer.state {
|
||||||
action?(self.localTimestamp)
|
self.action?(self.localTimestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -559,7 +559,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
||||||
self.swipeToReplyFeedback?.impact()
|
self.swipeToReplyFeedback?.impact()
|
||||||
|
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -600,7 +600,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
||||||
self.swipeToReplyFeedback?.impact()
|
self.swipeToReplyFeedback?.impact()
|
||||||
|
|
||||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper))
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -172,17 +172,17 @@ private let bubble = PresentationThemeChatBubble(
|
|||||||
outgoingFileDescriptionColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
outgoingFileDescriptionColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||||
incomingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
incomingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||||
outgoingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
outgoingFileDurationColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||||
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
shareButtonFillColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x18222d, alpha: 0.5)),
|
||||||
shareButtonStrokeColor: UIColor(rgb: 0x587fa3, alpha: 0.15),
|
shareButtonStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
|
||||||
shareButtonForegroundColor: UIColor(rgb: 0xb2b2b2),
|
shareButtonForegroundColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2)),
|
||||||
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
|
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
|
||||||
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
|
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
|
||||||
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
||||||
actionButtonsIncomingStrokeColor: UIColor(rgb: 0x587fa3, alpha: 0.15),
|
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
|
||||||
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
|
||||||
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
||||||
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0x587fa3, alpha: 0.15),
|
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0x587fa3, alpha: 0.15)),
|
||||||
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
|
||||||
selectionControlBorderColor: .white,
|
selectionControlBorderColor: .white,
|
||||||
selectionControlFillColor: accentColor,
|
selectionControlFillColor: accentColor,
|
||||||
selectionControlForegroundColor: .white,
|
selectionControlForegroundColor: .white,
|
||||||
@ -200,7 +200,7 @@ private let serviceMessage = PresentationThemeServiceMessage(
|
|||||||
unreadBarFillColor: UIColor(rgb: 0x213040),
|
unreadBarFillColor: UIColor(rgb: 0x213040),
|
||||||
unreadBarStrokeColor: UIColor(rgb: 0x213040),
|
unreadBarStrokeColor: UIColor(rgb: 0x213040),
|
||||||
unreadBarTextColor: UIColor(rgb: 0xffffff),
|
unreadBarTextColor: UIColor(rgb: 0xffffff),
|
||||||
dateTextColor: UIColor(rgb: 0xffffff)
|
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff))
|
||||||
)
|
)
|
||||||
|
|
||||||
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||||
|
|||||||
@ -173,16 +173,16 @@ private let bubble = PresentationThemeChatBubble(
|
|||||||
incomingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
incomingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||||
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||||
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
||||||
shareButtonStrokeColor: UIColor(rgb: 0xb2b2b2, alpha: 0.18),
|
shareButtonStrokeColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18), withoutWallpaper: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
|
||||||
shareButtonForegroundColor: UIColor(rgb: 0xb2b2b2), //!!!
|
shareButtonForegroundColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xb2b2b2), withoutWallpaper: UIColor(rgb: 0xb2b2b2)), //!!!
|
||||||
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
|
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6), //!!!
|
||||||
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
|
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0), //!!!
|
||||||
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
||||||
actionButtonsIncomingStrokeColor: UIColor(rgb: 0xb2b2b2, alpha: 0.18),
|
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
|
||||||
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
|
||||||
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x000000, alpha: 0.5)),
|
||||||
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0xb2b2b2, alpha: 0.18),
|
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2, alpha: 0.18)),
|
||||||
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xffffff)),
|
||||||
selectionControlBorderColor: .white,
|
selectionControlBorderColor: .white,
|
||||||
selectionControlFillColor: accentColor,
|
selectionControlFillColor: accentColor,
|
||||||
selectionControlForegroundColor: .black,
|
selectionControlForegroundColor: .black,
|
||||||
@ -200,7 +200,7 @@ private let serviceMessage = PresentationThemeServiceMessage(
|
|||||||
unreadBarFillColor: UIColor(rgb: 0x1b1b1b), //!!!
|
unreadBarFillColor: UIColor(rgb: 0x1b1b1b), //!!!
|
||||||
unreadBarStrokeColor: UIColor(rgb: 0x000000),
|
unreadBarStrokeColor: UIColor(rgb: 0x000000),
|
||||||
unreadBarTextColor: UIColor(rgb: 0xb2b2b2), //!!!
|
unreadBarTextColor: UIColor(rgb: 0xb2b2b2), //!!!
|
||||||
dateTextColor: UIColor(rgb: 0xb2b2b2)
|
dateTextColor: PresentationThemeVariableColor(color: UIColor(rgb: 0xb2b2b2))
|
||||||
)
|
)
|
||||||
|
|
||||||
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
private let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||||
|
|||||||
@ -187,12 +187,12 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
incomingAccentTextColor: UIColor(rgb: 0x007ee5),
|
incomingAccentTextColor: UIColor(rgb: 0x007ee5),
|
||||||
outgoingAccentTextColor: UIColor(rgb: 0x00a700),
|
outgoingAccentTextColor: UIColor(rgb: 0x00a700),
|
||||||
incomingAccentControlColor: UIColor(rgb: 0x007ee5),
|
incomingAccentControlColor: UIColor(rgb: 0x007ee5),
|
||||||
outgoingAccentControlColor: UIColor(rgb: 0x3FC33B),
|
outgoingAccentControlColor: UIColor(rgb: 0x3fc33b),
|
||||||
incomingMediaActiveControlColor: UIColor(rgb: 0x007ee5),
|
incomingMediaActiveControlColor: UIColor(rgb: 0x007ee5),
|
||||||
outgoingMediaActiveControlColor: UIColor(rgb: 0x3FC33B),
|
outgoingMediaActiveControlColor: UIColor(rgb: 0x3fc33b),
|
||||||
incomingMediaInactiveControlColor: UIColor(rgb: 0xcacaca),
|
incomingMediaInactiveControlColor: UIColor(rgb: 0xcacaca),
|
||||||
outgoingMediaInactiveControlColor: UIColor(rgb: 0x93D987),
|
outgoingMediaInactiveControlColor: UIColor(rgb: 0x93d987),
|
||||||
outgoingCheckColor: UIColor(rgb: 0x19C700),
|
outgoingCheckColor: UIColor(rgb: 0x19c700),
|
||||||
incomingPendingActivityColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
incomingPendingActivityColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
||||||
outgoingPendingActivityColor: UIColor(rgb: 0x42b649),
|
outgoingPendingActivityColor: UIColor(rgb: 0x42b649),
|
||||||
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
|
mediaDateAndStatusFillColor: UIColor(white: 0.0, alpha: 0.5),
|
||||||
@ -204,17 +204,17 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
incomingFileDurationColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
incomingFileDurationColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
||||||
outgoingFileDurationColor: UIColor(rgb: 0x008c09, alpha: 0.8),
|
outgoingFileDurationColor: UIColor(rgb: 0x008c09, alpha: 0.8),
|
||||||
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x748391, alpha: 0.45)),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x748391, alpha: 0.45)),
|
||||||
shareButtonStrokeColor: .clear,
|
shareButtonStrokeColor: PresentationThemeVariableColor(withWallpaper: .clear, withoutWallpaper: .clear),
|
||||||
shareButtonForegroundColor: .white,
|
shareButtonForegroundColor: PresentationThemeVariableColor(withWallpaper: .white, withoutWallpaper: .white),
|
||||||
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6),
|
mediaOverlayControlBackgroundColor: UIColor(white: 0.0, alpha: 0.6),
|
||||||
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0),
|
mediaOverlayControlForegroundColor: UIColor(white: 1.0, alpha: 1.0),
|
||||||
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x596E89, alpha: 0.35)),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x596e89, alpha: 0.35)),
|
||||||
actionButtonsIncomingStrokeColor: .clear,
|
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(color: .clear),
|
||||||
actionButtonsIncomingTextColor: .white,
|
actionButtonsIncomingTextColor: PresentationThemeVariableColor(color: .white),
|
||||||
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x596E89, alpha: 0.35)),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0x596e89, alpha: 0.35)),
|
||||||
actionButtonsOutgoingStrokeColor: .clear,
|
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(color: .clear),
|
||||||
actionButtonsOutgoingTextColor: .white,
|
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(color: .white),
|
||||||
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
selectionControlBorderColor: UIColor(rgb: 0xc7c7cc),
|
||||||
selectionControlFillColor: accentColor,
|
selectionControlFillColor: accentColor,
|
||||||
selectionControlForegroundColor: .white,
|
selectionControlForegroundColor: .white,
|
||||||
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
|
mediaHighlightOverlayColor: UIColor(white: 1.0, alpha: 0.6),
|
||||||
@ -223,7 +223,7 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
incomingMediaPlaceholderColor: UIColor(rgb: 0xe8ecf0),
|
incomingMediaPlaceholderColor: UIColor(rgb: 0xe8ecf0),
|
||||||
outgoingMediaPlaceholderColor: UIColor(rgb: 0xd2f2b6),
|
outgoingMediaPlaceholderColor: UIColor(rgb: 0xd2f2b6),
|
||||||
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0xc8c7cc), radioProgress: UIColor(rgb: 0x007ee5), highlight: UIColor(rgb: 0x007ee5).withAlphaComponent(0.08), separator: UIColor(rgb: 0xc8c7cc), bar: UIColor(rgb: 0x007ee5)),
|
incomingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0xc8c7cc), radioProgress: UIColor(rgb: 0x007ee5), highlight: UIColor(rgb: 0x007ee5).withAlphaComponent(0.08), separator: UIColor(rgb: 0xc8c7cc), bar: UIColor(rgb: 0x007ee5)),
|
||||||
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x93d987), radioProgress: UIColor(rgb: 0x3FC33B), highlight: UIColor(rgb: 0x3FC33B).withAlphaComponent(0.08), separator: UIColor(rgb: 0x93d987), bar: UIColor(rgb: 0x3fc33b))
|
outgoingPolls: PresentationThemeChatBubblePolls(radioButton: UIColor(rgb: 0x93d987), radioProgress: UIColor(rgb: 0x3fc33b), highlight: UIColor(rgb: 0x3fc33b).withAlphaComponent(0.08), separator: UIColor(rgb: 0x93d987), bar: UIColor(rgb: 0x3fc33b))
|
||||||
)
|
)
|
||||||
|
|
||||||
let bubbleDay = PresentationThemeChatBubble(
|
let bubbleDay = PresentationThemeChatBubble(
|
||||||
@ -259,18 +259,18 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.7),
|
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.7),
|
||||||
incomingFileDurationColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
incomingFileDurationColor: UIColor(rgb: 0x525252, alpha: 0.6),
|
||||||
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.7),
|
outgoingFileDurationColor: UIColor(rgb: 0xffffff, alpha: 0.7),
|
||||||
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
||||||
shareButtonStrokeColor: UIColor(rgb: 0xE5E5EA),
|
shareButtonStrokeColor: PresentationThemeVariableColor(withWallpaper: .clear, withoutWallpaper: UIColor(rgb: 0xe5e5ea)),
|
||||||
shareButtonForegroundColor: accentColor,
|
shareButtonForegroundColor: PresentationThemeVariableColor(withWallpaper: .white, withoutWallpaper: accentColor),
|
||||||
mediaOverlayControlBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.6),
|
mediaOverlayControlBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.6),
|
||||||
mediaOverlayControlForegroundColor: UIColor(rgb: 0xffffff, alpha: 1.0),
|
mediaOverlayControlForegroundColor: UIColor(rgb: 0xffffff, alpha: 1.0),
|
||||||
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
||||||
actionButtonsIncomingStrokeColor: accentColor.withMultipliedBrightnessBy(1.2),
|
actionButtonsIncomingStrokeColor: PresentationThemeVariableColor(withWallpaper: .clear, withoutWallpaper: accentColor.withMultipliedBrightnessBy(1.2)),
|
||||||
actionButtonsIncomingTextColor: accentColor.withMultipliedBrightnessBy(1.2),
|
actionButtonsIncomingTextColor: PresentationThemeVariableColor(withWallpaper: .white, withoutWallpaper: accentColor.withMultipliedBrightnessBy(1.2)),
|
||||||
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: serviceBackgroundColor, withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
||||||
actionButtonsOutgoingStrokeColor: accentColor.withMultipliedBrightnessBy(1.2),
|
actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor(withWallpaper: .clear, withoutWallpaper: accentColor.withMultipliedBrightnessBy(1.2)),
|
||||||
actionButtonsOutgoingTextColor: accentColor.withMultipliedBrightnessBy(1.2),
|
actionButtonsOutgoingTextColor: PresentationThemeVariableColor(withWallpaper: .white, withoutWallpaper: accentColor.withMultipliedBrightnessBy(1.2)),
|
||||||
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
selectionControlBorderColor: UIColor(rgb: 0xc7c7cc),
|
||||||
selectionControlFillColor: accentColor,
|
selectionControlFillColor: accentColor,
|
||||||
selectionControlForegroundColor: .white,
|
selectionControlForegroundColor: .white,
|
||||||
mediaHighlightOverlayColor: UIColor(rgb: 0xffffff, alpha: 0.6),
|
mediaHighlightOverlayColor: UIColor(rgb: 0xffffff, alpha: 0.6),
|
||||||
@ -287,15 +287,15 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
unreadBarFillColor: UIColor(white: 1.0, alpha: 0.9),
|
unreadBarFillColor: UIColor(white: 1.0, alpha: 0.9),
|
||||||
unreadBarStrokeColor: UIColor(white: 0.0, alpha: 0.2),
|
unreadBarStrokeColor: UIColor(white: 0.0, alpha: 0.2),
|
||||||
unreadBarTextColor: UIColor(rgb: 0x86868d),
|
unreadBarTextColor: UIColor(rgb: 0x86868d),
|
||||||
dateTextColor: .white
|
dateTextColor: PresentationThemeVariableColor(color: .white)
|
||||||
)
|
)
|
||||||
|
|
||||||
let serviceMessageDay = PresentationThemeServiceMessage(
|
let serviceMessageDay = PresentationThemeServiceMessage(
|
||||||
components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0xffffff, alpha: 0.8), primaryText: UIColor(rgb: 0x8D8E93), linkHighlight: UIColor(rgb: 0x748391, alpha: 0.25), dateFillStatic: UIColor(rgb: 0xffffff, alpha: 0.8), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.8)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0xffffff, alpha: 0.8), primaryText: UIColor(rgb: 0x8D8E93), linkHighlight: UIColor(rgb: 0x748391, alpha: 0.25), dateFillStatic: UIColor(rgb: 0xffffff, alpha: 0.8), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.8))),
|
components: PresentationThemeServiceMessageColor(withDefaultWallpaper: PresentationThemeServiceMessageColorComponents(fill: UIColor(rgb: 0xffffff, alpha: 0.8), primaryText: UIColor(rgb: 0x8d8e93), linkHighlight: UIColor(rgb: 0x748391, alpha: 0.25), dateFillStatic: UIColor(rgb: 0xffffff, alpha: 0.8), dateFillFloating: UIColor(rgb: 0xffffff, alpha: 0.8)), withCustomWallpaper: PresentationThemeServiceMessageColorComponents(fill: serviceBackgroundColor, primaryText: .white, linkHighlight: UIColor(rgb: 0x748391, alpha: 0.25), dateFillStatic: serviceBackgroundColor, dateFillFloating: serviceBackgroundColor.withAlphaComponent(serviceBackgroundColor.alpha * 0.6667))),
|
||||||
unreadBarFillColor: UIColor(rgb: 0xffffff),
|
unreadBarFillColor: UIColor(rgb: 0xffffff),
|
||||||
unreadBarStrokeColor: UIColor(rgb: 0xffffff),
|
unreadBarStrokeColor: UIColor(rgb: 0xffffff),
|
||||||
unreadBarTextColor: UIColor(rgb: 0x8D8E93),
|
unreadBarTextColor: UIColor(rgb: 0x8D8E93),
|
||||||
dateTextColor: UIColor(rgb: 0x8D8E93)
|
dateTextColor: PresentationThemeVariableColor(withWallpaper: .white, withoutWallpaper: UIColor(rgb: 0x8d8e93))
|
||||||
)
|
)
|
||||||
|
|
||||||
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||||
@ -427,20 +427,21 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public let defaultPresentationTheme = makeDefaultPresentationTheme(accentColor: UIColor(rgb: 0x007ee5), serviceBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.3), day: false)
|
public let defaultPresentationTheme = makeDefaultPresentationTheme(accentColor: UIColor(rgb: 0x007ee5), serviceBackgroundColor: defaultServiceBackgroundColor, day: false)
|
||||||
|
|
||||||
let defaultDayAccentColor: Int32 = 0x007ee5
|
let defaultDayAccentColor: Int32 = 0x007ee5
|
||||||
|
let defaultServiceBackgroundColor: UIColor = UIColor(rgb: 0x000000, alpha: 0.3)
|
||||||
|
|
||||||
func makeDefaultPresentationTheme(serviceBackgroundColor: UIColor?) -> PresentationTheme {
|
func makeDefaultPresentationTheme(serviceBackgroundColor: UIColor?) -> PresentationTheme {
|
||||||
return makeDefaultPresentationTheme(accentColor: UIColor(rgb: 0x007ee5), serviceBackgroundColor: serviceBackgroundColor ?? .black, day: false)
|
return makeDefaultPresentationTheme(accentColor: UIColor(rgb: 0x007ee5), serviceBackgroundColor: serviceBackgroundColor ?? .black, day: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeDefaultDayPresentationTheme(accentColor: Int32?) -> PresentationTheme {
|
func makeDefaultDayPresentationTheme(accentColor: Int32?, serviceBackgroundColor: UIColor) -> PresentationTheme {
|
||||||
let color: UIColor
|
let color: UIColor
|
||||||
if let accentColor = accentColor {
|
if let accentColor = accentColor {
|
||||||
color = UIColor(rgb: UInt32(bitPattern: accentColor))
|
color = UIColor(rgb: UInt32(bitPattern: accentColor))
|
||||||
} else {
|
} else {
|
||||||
color = UIColor(rgb: UInt32(bitPattern: defaultDayAccentColor))
|
color = UIColor(rgb: UInt32(bitPattern: defaultDayAccentColor))
|
||||||
}
|
}
|
||||||
return makeDefaultPresentationTheme(accentColor: color, serviceBackgroundColor: UIColor(rgb: 0x000000, alpha: 0.3), day: true)
|
return makeDefaultPresentationTheme(accentColor: color, serviceBackgroundColor: serviceBackgroundColor, day: true)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -261,7 +261,7 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager) -
|
|||||||
case .nightAccent:
|
case .nightAccent:
|
||||||
themeValue = defaultDarkAccentPresentationTheme
|
themeValue = defaultDarkAccentPresentationTheme
|
||||||
case .day:
|
case .day:
|
||||||
themeValue = makeDefaultDayPresentationTheme(accentColor: themeSettings.themeAccentColor ?? defaultDayAccentColor)
|
themeValue = makeDefaultDayPresentationTheme(accentColor: themeSettings.themeAccentColor ?? defaultDayAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let stringsValue: PresentationStrings
|
let stringsValue: PresentationStrings
|
||||||
@ -408,7 +408,7 @@ public func updatedPresentationData(accountManager: AccountManager, applicationB
|
|||||||
case .nightAccent:
|
case .nightAccent:
|
||||||
themeValue = defaultDarkAccentPresentationTheme
|
themeValue = defaultDarkAccentPresentationTheme
|
||||||
case .day:
|
case .day:
|
||||||
themeValue = makeDefaultDayPresentationTheme(accentColor: themeSettings.themeAccentColor ?? defaultDayAccentColor)
|
themeValue = makeDefaultDayPresentationTheme(accentColor: themeSettings.themeAccentColor ?? defaultDayAccentColor, serviceBackgroundColor: serviceBackgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -428,6 +428,11 @@ public final class PresentationThemeVariableColor {
|
|||||||
self.withWallpaper = withWallpaper
|
self.withWallpaper = withWallpaper
|
||||||
self.withoutWallpaper = withoutWallpaper
|
self.withoutWallpaper = withoutWallpaper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public init(color: UIColor) {
|
||||||
|
self.withWallpaper = color
|
||||||
|
self.withoutWallpaper = color
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wallpaper: Bool) -> PresentationThemeBubbleColorComponents {
|
public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wallpaper: Bool) -> PresentationThemeBubbleColorComponents {
|
||||||
@ -447,7 +452,7 @@ public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wall
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func bubbleVariableColor(variableColor: PresentationThemeVariableColor, wallpaper: TelegramWallpaper) -> UIColor {
|
public func bubbleVariableColor(variableColor: PresentationThemeVariableColor, wallpaper: TelegramWallpaper) -> UIColor {
|
||||||
if wallpaper != .builtin {
|
if wallpaper != .builtin && wallpaper != .color(0xffffff) {
|
||||||
return variableColor.withWallpaper
|
return variableColor.withWallpaper
|
||||||
} else {
|
} else {
|
||||||
return variableColor.withoutWallpaper
|
return variableColor.withoutWallpaper
|
||||||
@ -512,19 +517,19 @@ public final class PresentationThemeChatBubble {
|
|||||||
public let outgoingFileDurationColor: UIColor
|
public let outgoingFileDurationColor: UIColor
|
||||||
|
|
||||||
public let shareButtonFillColor: PresentationThemeVariableColor
|
public let shareButtonFillColor: PresentationThemeVariableColor
|
||||||
public let shareButtonStrokeColor: UIColor
|
public let shareButtonStrokeColor: PresentationThemeVariableColor
|
||||||
public let shareButtonForegroundColor: UIColor
|
public let shareButtonForegroundColor: PresentationThemeVariableColor
|
||||||
|
|
||||||
public let mediaOverlayControlBackgroundColor: UIColor
|
public let mediaOverlayControlBackgroundColor: UIColor
|
||||||
public let mediaOverlayControlForegroundColor: UIColor
|
public let mediaOverlayControlForegroundColor: UIColor
|
||||||
|
|
||||||
public let actionButtonsIncomingFillColor: PresentationThemeVariableColor
|
public let actionButtonsIncomingFillColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsIncomingStrokeColor: UIColor
|
public let actionButtonsIncomingStrokeColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsIncomingTextColor: UIColor
|
public let actionButtonsIncomingTextColor: PresentationThemeVariableColor
|
||||||
|
|
||||||
public let actionButtonsOutgoingFillColor: PresentationThemeVariableColor
|
public let actionButtonsOutgoingFillColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsOutgoingStrokeColor: UIColor
|
public let actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsOutgoingTextColor: UIColor
|
public let actionButtonsOutgoingTextColor: PresentationThemeVariableColor
|
||||||
|
|
||||||
public let selectionControlBorderColor: UIColor
|
public let selectionControlBorderColor: UIColor
|
||||||
public let selectionControlFillColor: UIColor
|
public let selectionControlFillColor: UIColor
|
||||||
@ -541,7 +546,7 @@ public final class PresentationThemeChatBubble {
|
|||||||
public let incomingPolls: PresentationThemeChatBubblePolls
|
public let incomingPolls: PresentationThemeChatBubblePolls
|
||||||
public let outgoingPolls: PresentationThemeChatBubblePolls
|
public let outgoingPolls: PresentationThemeChatBubblePolls
|
||||||
|
|
||||||
public init(incoming: PresentationThemeBubbleColor, outgoing: PresentationThemeBubbleColor, freeform: PresentationThemeBubbleColor, incomingPrimaryTextColor: UIColor, incomingSecondaryTextColor: UIColor, incomingLinkTextColor: UIColor, incomingLinkHighlightColor: UIColor, outgoingPrimaryTextColor: UIColor, outgoingSecondaryTextColor: UIColor, outgoingLinkTextColor: UIColor, outgoingLinkHighlightColor: UIColor, infoPrimaryTextColor: UIColor, infoLinkTextColor: UIColor, incomingAccentTextColor: UIColor, outgoingAccentTextColor: UIColor, incomingAccentControlColor: UIColor, outgoingAccentControlColor: UIColor, incomingMediaActiveControlColor: UIColor, outgoingMediaActiveControlColor: UIColor, incomingMediaInactiveControlColor: UIColor, outgoingMediaInactiveControlColor: UIColor, outgoingCheckColor: UIColor, incomingPendingActivityColor: UIColor, outgoingPendingActivityColor: UIColor, mediaDateAndStatusFillColor: UIColor, mediaDateAndStatusTextColor: UIColor, incomingFileTitleColor: UIColor, outgoingFileTitleColor: UIColor, incomingFileDescriptionColor: UIColor, outgoingFileDescriptionColor: UIColor, incomingFileDurationColor: UIColor, outgoingFileDurationColor: UIColor, shareButtonFillColor: PresentationThemeVariableColor, shareButtonStrokeColor: UIColor, shareButtonForegroundColor: UIColor, mediaOverlayControlBackgroundColor: UIColor, mediaOverlayControlForegroundColor: UIColor, actionButtonsIncomingFillColor: PresentationThemeVariableColor, actionButtonsIncomingStrokeColor: UIColor, actionButtonsIncomingTextColor: UIColor, actionButtonsOutgoingFillColor: PresentationThemeVariableColor, actionButtonsOutgoingStrokeColor: UIColor, actionButtonsOutgoingTextColor: UIColor, selectionControlBorderColor: UIColor, selectionControlFillColor: UIColor, selectionControlForegroundColor: UIColor, mediaHighlightOverlayColor: UIColor, deliveryFailedFillColor: UIColor, deliveryFailedForegroundColor: UIColor, incomingMediaPlaceholderColor: UIColor, outgoingMediaPlaceholderColor: UIColor, incomingPolls: PresentationThemeChatBubblePolls, outgoingPolls: PresentationThemeChatBubblePolls) {
|
public init(incoming: PresentationThemeBubbleColor, outgoing: PresentationThemeBubbleColor, freeform: PresentationThemeBubbleColor, incomingPrimaryTextColor: UIColor, incomingSecondaryTextColor: UIColor, incomingLinkTextColor: UIColor, incomingLinkHighlightColor: UIColor, outgoingPrimaryTextColor: UIColor, outgoingSecondaryTextColor: UIColor, outgoingLinkTextColor: UIColor, outgoingLinkHighlightColor: UIColor, infoPrimaryTextColor: UIColor, infoLinkTextColor: UIColor, incomingAccentTextColor: UIColor, outgoingAccentTextColor: UIColor, incomingAccentControlColor: UIColor, outgoingAccentControlColor: UIColor, incomingMediaActiveControlColor: UIColor, outgoingMediaActiveControlColor: UIColor, incomingMediaInactiveControlColor: UIColor, outgoingMediaInactiveControlColor: UIColor, outgoingCheckColor: UIColor, incomingPendingActivityColor: UIColor, outgoingPendingActivityColor: UIColor, mediaDateAndStatusFillColor: UIColor, mediaDateAndStatusTextColor: UIColor, incomingFileTitleColor: UIColor, outgoingFileTitleColor: UIColor, incomingFileDescriptionColor: UIColor, outgoingFileDescriptionColor: UIColor, incomingFileDurationColor: UIColor, outgoingFileDurationColor: UIColor, shareButtonFillColor: PresentationThemeVariableColor, shareButtonStrokeColor: PresentationThemeVariableColor, shareButtonForegroundColor: PresentationThemeVariableColor, mediaOverlayControlBackgroundColor: UIColor, mediaOverlayControlForegroundColor: UIColor, actionButtonsIncomingFillColor: PresentationThemeVariableColor, actionButtonsIncomingStrokeColor: PresentationThemeVariableColor, actionButtonsIncomingTextColor: PresentationThemeVariableColor, actionButtonsOutgoingFillColor: PresentationThemeVariableColor, actionButtonsOutgoingStrokeColor: PresentationThemeVariableColor, actionButtonsOutgoingTextColor: PresentationThemeVariableColor, selectionControlBorderColor: UIColor, selectionControlFillColor: UIColor, selectionControlForegroundColor: UIColor, mediaHighlightOverlayColor: UIColor, deliveryFailedFillColor: UIColor, deliveryFailedForegroundColor: UIColor, incomingMediaPlaceholderColor: UIColor, outgoingMediaPlaceholderColor: UIColor, incomingPolls: PresentationThemeChatBubblePolls, outgoingPolls: PresentationThemeChatBubblePolls) {
|
||||||
self.incoming = incoming
|
self.incoming = incoming
|
||||||
self.outgoing = outgoing
|
self.outgoing = outgoing
|
||||||
self.freeform = freeform
|
self.freeform = freeform
|
||||||
@ -644,7 +649,7 @@ public func serviceMessageColorComponents(theme: PresentationTheme, wallpaper: T
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func serviceMessageColorComponents(chatTheme: PresentationThemeChat, wallpaper: TelegramWallpaper) -> PresentationThemeServiceMessageColorComponents {
|
public func serviceMessageColorComponents(chatTheme: PresentationThemeChat, wallpaper: TelegramWallpaper) -> PresentationThemeServiceMessageColorComponents {
|
||||||
if wallpaper != .builtin {
|
if wallpaper != .builtin && wallpaper != .color(0xffffff) {
|
||||||
return chatTheme.serviceMessage.components.withCustomWallpaper
|
return chatTheme.serviceMessage.components.withCustomWallpaper
|
||||||
} else {
|
} else {
|
||||||
return chatTheme.serviceMessage.components.withDefaultWallpaper
|
return chatTheme.serviceMessage.components.withDefaultWallpaper
|
||||||
@ -658,9 +663,9 @@ public final class PresentationThemeServiceMessage {
|
|||||||
public let unreadBarStrokeColor: UIColor
|
public let unreadBarStrokeColor: UIColor
|
||||||
public let unreadBarTextColor: UIColor
|
public let unreadBarTextColor: UIColor
|
||||||
|
|
||||||
public let dateTextColor: UIColor
|
public let dateTextColor: PresentationThemeVariableColor
|
||||||
|
|
||||||
public init(components: PresentationThemeServiceMessageColor, unreadBarFillColor: UIColor, unreadBarStrokeColor: UIColor, unreadBarTextColor: UIColor, dateTextColor: UIColor) {
|
public init(components: PresentationThemeServiceMessageColor, unreadBarFillColor: UIColor, unreadBarStrokeColor: UIColor, unreadBarTextColor: UIColor, dateTextColor: PresentationThemeVariableColor) {
|
||||||
self.components = components
|
self.components = components
|
||||||
self.unreadBarFillColor = unreadBarFillColor
|
self.unreadBarFillColor = unreadBarFillColor
|
||||||
self.unreadBarStrokeColor = unreadBarStrokeColor
|
self.unreadBarStrokeColor = unreadBarStrokeColor
|
||||||
|
|||||||
@ -245,25 +245,25 @@ public final class PrincipalThemeAdditionalGraphics {
|
|||||||
self.chatEmptyItemBackgroundImage = generateStretchableFilledCircleImage(radius: 14.0, color: serviceColor.fill)!
|
self.chatEmptyItemBackgroundImage = generateStretchableFilledCircleImage(radius: 14.0, color: serviceColor.fill)!
|
||||||
self.chatLoadingIndicatorBackgroundImage = generateStretchableFilledCircleImage(diameter: 30.0, color: serviceColor.fill)!
|
self.chatLoadingIndicatorBackgroundImage = generateStretchableFilledCircleImage(diameter: 30.0, color: serviceColor.fill)!
|
||||||
|
|
||||||
self.chatBubbleShareButtonImage = chatBubbleActionButtonImage(fillColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.shareButtonStrokeColor, foregroundColor: theme.bubble.shareButtonForegroundColor, image: UIImage(bundleImageName: "Chat/Message/ShareIcon"))!
|
self.chatBubbleShareButtonImage = chatBubbleActionButtonImage(fillColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonStrokeColor, wallpaper: wallpaper), foregroundColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonForegroundColor, wallpaper: wallpaper), image: UIImage(bundleImageName: "Chat/Message/ShareIcon"))!
|
||||||
self.chatBubbleNavigateButtonImage = chatBubbleActionButtonImage(fillColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.shareButtonStrokeColor, foregroundColor: theme.bubble.shareButtonForegroundColor, image: UIImage(bundleImageName: "Chat/Message/NavigateToMessageIcon"), iconOffset: CGPoint(x: 0.0, y: 1.0))!
|
self.chatBubbleNavigateButtonImage = chatBubbleActionButtonImage(fillColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonStrokeColor, wallpaper: wallpaper), foregroundColor: bubbleVariableColor(variableColor: theme.bubble.shareButtonForegroundColor, wallpaper: wallpaper), image: UIImage(bundleImageName: "Chat/Message/NavigateToMessageIcon"), iconOffset: CGPoint(x: 0.0, y: 1.0))!
|
||||||
self.chatBubbleActionButtonIncomingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .middle)
|
self.chatBubbleActionButtonIncomingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingStrokeColor, wallpaper: wallpaper), position: .middle)
|
||||||
self.chatBubbleActionButtonIncomingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomLeft)
|
self.chatBubbleActionButtonIncomingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingStrokeColor, wallpaper: wallpaper), position: .bottomLeft)
|
||||||
self.chatBubbleActionButtonIncomingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomRight)
|
self.chatBubbleActionButtonIncomingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingStrokeColor, wallpaper: wallpaper), position: .bottomRight)
|
||||||
self.chatBubbleActionButtonIncomingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomSingle)
|
self.chatBubbleActionButtonIncomingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingStrokeColor, wallpaper: wallpaper), position: .bottomSingle)
|
||||||
self.chatBubbleActionButtonOutgoingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .middle)
|
self.chatBubbleActionButtonOutgoingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingStrokeColor, wallpaper: wallpaper), position: .middle)
|
||||||
self.chatBubbleActionButtonOutgoingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomLeft)
|
self.chatBubbleActionButtonOutgoingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingStrokeColor, wallpaper: wallpaper), position: .bottomLeft)
|
||||||
self.chatBubbleActionButtonOutgoingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomRight)
|
self.chatBubbleActionButtonOutgoingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingStrokeColor, wallpaper: wallpaper), position: .bottomRight)
|
||||||
self.chatBubbleActionButtonOutgoingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomSingle)
|
self.chatBubbleActionButtonOutgoingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingStrokeColor, wallpaper: wallpaper), position: .bottomSingle)
|
||||||
self.chatBubbleActionButtonIncomingMessageIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: theme.bubble.actionButtonsIncomingTextColor)!
|
self.chatBubbleActionButtonIncomingMessageIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonIncomingLinkIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLink"), color: theme.bubble.actionButtonsIncomingTextColor)!
|
self.chatBubbleActionButtonIncomingLinkIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLink"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonIncomingShareIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotShare"), color: theme.bubble.actionButtonsIncomingTextColor)!
|
self.chatBubbleActionButtonIncomingShareIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotShare"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonIncomingPhoneIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotPhone"), color: theme.bubble.actionButtonsIncomingTextColor)!
|
self.chatBubbleActionButtonIncomingPhoneIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotPhone"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonIncomingLocationIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLocation"), color: theme.bubble.actionButtonsIncomingTextColor)!
|
self.chatBubbleActionButtonIncomingLocationIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLocation"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonOutgoingMessageIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: theme.bubble.actionButtonsOutgoingTextColor)!
|
self.chatBubbleActionButtonOutgoingMessageIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonOutgoingLinkIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLink"), color: theme.bubble.actionButtonsOutgoingTextColor)!
|
self.chatBubbleActionButtonOutgoingLinkIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLink"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonOutgoingShareIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotShare"), color: theme.bubble.actionButtonsOutgoingTextColor)!
|
self.chatBubbleActionButtonOutgoingShareIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotShare"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonOutgoingPhoneIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotPhone"), color: theme.bubble.actionButtonsOutgoingTextColor)!
|
self.chatBubbleActionButtonOutgoingPhoneIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotPhone"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingTextColor, wallpaper: wallpaper))!
|
||||||
self.chatBubbleActionButtonOutgoingLocationIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLocation"), color: theme.bubble.actionButtonsOutgoingTextColor)!
|
self.chatBubbleActionButtonOutgoingLocationIconImage = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotLocation"), color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingTextColor, wallpaper: wallpaper))!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ public final class ProxyServerActionSheetController: ActionSheetController {
|
|||||||
if case .mtp = server.connection {
|
if case .mtp = server.connection {
|
||||||
items.append(ActionSheetTextItem(title: strings.SocksProxySetup_AdNoticeHelp))
|
items.append(ActionSheetTextItem(title: strings.SocksProxySetup_AdNoticeHelp))
|
||||||
}
|
}
|
||||||
items.append(ProxyServerInfoItem(strings: strings, server: server))
|
items.append(ProxyServerInfoItem(strings: strings, network: network, server: server))
|
||||||
items.append(ProxyServerActionItem(accountManager: accountManager, postbox: postbox, network: network, presentationTheme: theme, strings: strings, server: server, dismiss: { [weak self] success in
|
items.append(ProxyServerActionItem(accountManager:accountManager, postbox: postbox, network: network, presentationTheme: theme, strings: strings, server: server, dismiss: { [weak self] success in
|
||||||
guard let strongSelf = self, !strongSelf.isDismissed else {
|
guard let strongSelf = self, !strongSelf.isDismissed else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -73,15 +73,17 @@ public final class ProxyServerActionSheetController: ActionSheetController {
|
|||||||
|
|
||||||
private final class ProxyServerInfoItem: ActionSheetItem {
|
private final class ProxyServerInfoItem: ActionSheetItem {
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
private let network: Network
|
||||||
private let server: ProxyServerSettings
|
private let server: ProxyServerSettings
|
||||||
|
|
||||||
init(strings: PresentationStrings, server: ProxyServerSettings) {
|
init(strings: PresentationStrings, network: Network, server: ProxyServerSettings) {
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.network = network
|
||||||
self.server = server
|
self.server = server
|
||||||
}
|
}
|
||||||
|
|
||||||
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
||||||
return ProxyServerInfoItemNode(theme: theme, strings: self.strings, server: self.server)
|
return ProxyServerInfoItemNode(theme: theme, strings: self.strings, network: self.network, server: self.server)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateNode(_ node: ActionSheetItemNode) {
|
func updateNode(_ node: ActionSheetItemNode) {
|
||||||
@ -90,16 +92,27 @@ private final class ProxyServerInfoItem: ActionSheetItem {
|
|||||||
|
|
||||||
private let textFont = Font.regular(16.0)
|
private let textFont = Font.regular(16.0)
|
||||||
|
|
||||||
|
private enum ProxyServerInfoStatusType {
|
||||||
|
case generic(String)
|
||||||
|
case failed(String)
|
||||||
|
}
|
||||||
|
|
||||||
private final class ProxyServerInfoItemNode: ActionSheetItemNode {
|
private final class ProxyServerInfoItemNode: ActionSheetItemNode {
|
||||||
private let theme: ActionSheetControllerTheme
|
private let theme: ActionSheetControllerTheme
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
|
|
||||||
|
private let network: Network
|
||||||
private let server: ProxyServerSettings
|
private let server: ProxyServerSettings
|
||||||
|
|
||||||
private let fieldNodes: [(ImmediateTextNode, ImmediateTextNode)]
|
private let fieldNodes: [(ImmediateTextNode, ImmediateTextNode)]
|
||||||
|
private let statusTextNode: ImmediateTextNode
|
||||||
|
|
||||||
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, server: ProxyServerSettings) {
|
private let statusDisposable = MetaDisposable()
|
||||||
|
|
||||||
|
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, network: Network, server: ProxyServerSettings) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.network = network
|
||||||
self.server = server
|
self.server = server
|
||||||
|
|
||||||
var fieldNodes: [(ImmediateTextNode, ImmediateTextNode)] = []
|
var fieldNodes: [(ImmediateTextNode, ImmediateTextNode)] = []
|
||||||
@ -160,7 +173,18 @@ private final class ProxyServerInfoItemNode: ActionSheetItemNode {
|
|||||||
fieldNodes.append((passwordTitleNode, passwordTextNode))
|
fieldNodes.append((passwordTitleNode, passwordTextNode))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let statusTitleNode = ImmediateTextNode()
|
||||||
|
statusTitleNode.isUserInteractionEnabled = false
|
||||||
|
statusTitleNode.displaysAsynchronously = false
|
||||||
|
statusTitleNode.attributedText = NSAttributedString(string: strings.SocksProxySetup_Status, font: textFont, textColor: theme.secondaryTextColor)
|
||||||
|
let statusTextNode = ImmediateTextNode()
|
||||||
|
statusTextNode.isUserInteractionEnabled = false
|
||||||
|
statusTextNode.displaysAsynchronously = false
|
||||||
|
statusTextNode.attributedText = NSAttributedString(string: strings.SocksProxySetup_ProxyStatusChecking, font: textFont, textColor: theme.primaryTextColor)
|
||||||
|
fieldNodes.append((statusTitleNode, statusTextNode))
|
||||||
|
|
||||||
self.fieldNodes = fieldNodes
|
self.fieldNodes = fieldNodes
|
||||||
|
self.statusTextNode = statusTextNode
|
||||||
|
|
||||||
super.init(theme: theme)
|
super.init(theme: theme)
|
||||||
|
|
||||||
@ -170,6 +194,46 @@ private final class ProxyServerInfoItemNode: ActionSheetItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
self.statusDisposable.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
|
||||||
|
let statusesContext = ProxyServersStatuses(network: network, servers: .single([self.server]))
|
||||||
|
self.statusDisposable.set((statusesContext.statuses()
|
||||||
|
|> map { return $0.first?.value }
|
||||||
|
|> distinctUntilChanged
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] status in
|
||||||
|
if let strongSelf = self, let status = status {
|
||||||
|
let statusType: ProxyServerInfoStatusType
|
||||||
|
switch status {
|
||||||
|
case .checking:
|
||||||
|
statusType = .generic(strongSelf.strings.SocksProxySetup_ProxyStatusChecking)
|
||||||
|
case let .available(rtt):
|
||||||
|
let pingTime = Int(rtt * 1000.0)
|
||||||
|
statusType = .generic(strongSelf.strings.SocksProxySetup_ProxyStatusPing("\(pingTime)").0)
|
||||||
|
case .notAvailable:
|
||||||
|
statusType = .failed(strongSelf.strings.SocksProxySetup_ProxyStatusUnavailable)
|
||||||
|
}
|
||||||
|
strongSelf.setStatus(statusType)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
func setStatus(_ status: ProxyServerInfoStatusType) {
|
||||||
|
let attributedString: NSAttributedString
|
||||||
|
switch status {
|
||||||
|
case let .generic(text):
|
||||||
|
attributedString = NSAttributedString(string: text, font: textFont, textColor: theme.primaryTextColor)
|
||||||
|
case let .failed(text):
|
||||||
|
attributedString = NSAttributedString(string: text, font: textFont, textColor: theme.destructiveActionTextColor)
|
||||||
|
}
|
||||||
|
self.statusTextNode.attributedText = attributedString
|
||||||
|
self.setNeedsLayout()
|
||||||
|
}
|
||||||
|
|
||||||
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
|
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
|
||||||
return CGSize(width: constrainedSize.width, height: 36.0 * CGFloat(self.fieldNodes.count) + 12.0)
|
return CGSize(width: constrainedSize.width, height: 36.0 * CGFloat(self.fieldNodes.count) + 12.0)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -318,27 +318,46 @@ public func themeSettingsController(context: AccountContext) -> ViewController {
|
|||||||
let previousTheme = Atomic<PresentationTheme?>(value: nil)
|
let previousTheme = Atomic<PresentationTheme?>(value: nil)
|
||||||
|
|
||||||
let signal = combineLatest(context.sharedContext.presentationData, context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]))
|
let signal = combineLatest(context.sharedContext.presentationData, context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]))
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|> map { presentationData, sharedData -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in
|
|> map { presentationData, sharedData -> (ItemListControllerState, (ItemListNodeState<ThemeSettingsControllerEntry>, ThemeSettingsControllerEntry.ItemGenerationArguments)) in
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
let fontSize: PresentationFontSize
|
let fontSize: PresentationFontSize
|
||||||
let wallpaper: TelegramWallpaper
|
let wallpaper: TelegramWallpaper
|
||||||
let strings: PresentationStrings
|
let strings: PresentationStrings
|
||||||
let dateTimeFormat: PresentationDateTimeFormat
|
let dateTimeFormat: PresentationDateTimeFormat
|
||||||
let disableAnimations: Bool
|
let disableAnimations: Bool
|
||||||
|
|
||||||
let settings = (sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings] as? PresentationThemeSettings) ?? PresentationThemeSettings.defaultSettings
|
let settings = (sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings] as? PresentationThemeSettings) ?? PresentationThemeSettings.defaultSettings
|
||||||
switch settings.theme {
|
switch settings.theme {
|
||||||
case let .builtin(reference):
|
case let .builtin(reference):
|
||||||
switch reference {
|
switch reference {
|
||||||
case .dayClassic:
|
case .dayClassic:
|
||||||
theme = defaultPresentationTheme
|
theme = defaultPresentationTheme
|
||||||
case .nightGrayscale:
|
case .nightGrayscale:
|
||||||
theme = defaultDarkPresentationTheme
|
theme = defaultDarkPresentationTheme
|
||||||
case .nightAccent:
|
case .nightAccent:
|
||||||
theme = defaultDarkAccentPresentationTheme
|
theme = defaultDarkAccentPresentationTheme
|
||||||
case .day:
|
case .day:
|
||||||
theme = makeDefaultDayPresentationTheme(accentColor: settings.themeAccentColor ?? defaultDayAccentColor)
|
theme = makeDefaultDayPresentationTheme(accentColor: settings.themeAccentColor ?? defaultDayAccentColor, serviceBackgroundColor: defaultServiceBackgroundColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wallpaper = settings.chatWallpaper
|
||||||
|
fontSize = settings.fontSize
|
||||||
|
|
||||||
|
if let localizationSettings = preferences.values[localizationSettingsKey] as? LocalizationSettings {
|
||||||
|
strings = PresentationStrings(primaryComponent: PresentationStringsComponent(languageCode: localizationSettings.primaryComponent.languageCode, localizedName: localizationSettings.primaryComponent.localizedName, pluralizationRulesCode: localizationSettings.primaryComponent.customPluralizationCode, dict: dictFromLocalization(localizationSettings.primaryComponent.localization)), secondaryComponent: localizationSettings.secondaryComponent.flatMap({ PresentationStringsComponent(languageCode: $0.languageCode, localizedName: $0.localizedName, pluralizationRulesCode: $0.customPluralizationCode, dict: dictFromLocalization($0.localization)) }))
|
||||||
|
} else {
|
||||||
|
strings = defaultPresentationStrings
|
||||||
|
}
|
||||||
|
|
||||||
|
dateTimeFormat = presentationData.dateTimeFormat
|
||||||
|
disableAnimations = settings.disableAnimations
|
||||||
|
|
||||||
|
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Appearance_Title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: strings.Common_Back))
|
||||||
|
let listState = ItemListNodeState(entries: themeSettingsControllerEntries(presentationData: presentationData, theme: theme, themeAccentColor: settings.themeAccentColor, autoNightSettings: settings.automaticThemeSwitchSetting, strings: presentationData.strings, wallpaper: wallpaper, fontSize: fontSize, dateTimeFormat: dateTimeFormat, disableAnimations: disableAnimations), style: .blocks, animateChanges: false)
|
||||||
|
|
||||||
|
if previousTheme.swap(theme)?.name != theme.name {
|
||||||
|
presentControllerImpl?(ThemeSettingsCrossfadeController())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wallpaper = settings.chatWallpaper
|
wallpaper = settings.chatWallpaper
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user