mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-06 14:25:04 +00:00
Fixed chat action buttons color when custom wallpaper is applied
This commit is contained in:
parent
40456cd069
commit
b30ae66b1e
@ -329,7 +329,7 @@ final class ChatEmptyNode: ASDisplayNode {
|
|||||||
self.currentTheme = interfaceState.theme
|
self.currentTheme = interfaceState.theme
|
||||||
self.currentStrings = interfaceState.strings
|
self.currentStrings = interfaceState.strings
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(interfaceState.theme, wallpaper: interfaceState.chatWallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(interfaceState.theme, wallpaper: interfaceState.chatWallpaper)
|
||||||
self.backgroundNode.image = graphics.chatEmptyItemBackgroundImage
|
self.backgroundNode.image = graphics.chatEmptyItemBackgroundImage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class ChatHoleItemNode: ListViewItemNode {
|
|||||||
return { item, params, dateAtBottom in
|
return { item, params, dateAtBottom in
|
||||||
var updatedBackground: UIImage?
|
var updatedBackground: UIImage?
|
||||||
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
updatedBackground = graphics.chatServiceBubbleFillImage
|
updatedBackground = graphics.chatServiceBubbleFillImage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ final class ChatLoadingNode: ASDisplayNode {
|
|||||||
self.backgroundNode.displayWithoutProcessing = true
|
self.backgroundNode.displayWithoutProcessing = true
|
||||||
self.backgroundNode.displaysAsynchronously = false
|
self.backgroundNode.displaysAsynchronously = false
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(theme, wallpaper: chatWallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(theme, wallpaper: chatWallpaper)
|
||||||
self.backgroundNode.image = graphics.chatLoadingIndicatorBackgroundImage
|
self.backgroundNode.image = graphics.chatLoadingIndicatorBackgroundImage
|
||||||
|
|
||||||
let serviceColor = serviceMessageColorComponents(theme: theme, wallpaper: chatWallpaper)
|
let serviceColor = serviceMessageColorComponents(theme: theme, wallpaper: chatWallpaper)
|
||||||
|
|||||||
@ -53,7 +53,7 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ account: Account, _ theme: PresentationTheme, _ strings: PresentationStrings, _ message: Message, _ button: ReplyMarkupButton, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, () -> ChatMessageActionButtonNode))) {
|
class func asyncLayout(_ maybeNode: ChatMessageActionButtonNode?) -> (_ account: Account, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ message: Message, _ button: ReplyMarkupButton, _ constrainedWidth: CGFloat, _ position: MessageBubbleActionButtonPosition) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, () -> ChatMessageActionButtonNode))) {
|
||||||
let titleLayout = TextNode.asyncLayout(maybeNode?.titleNode)
|
let titleLayout = TextNode.asyncLayout(maybeNode?.titleNode)
|
||||||
|
|
||||||
return { account, theme, strings, message, button, constrainedWidth, position in
|
return { account, theme, strings, message, button, constrainedWidth, position in
|
||||||
@ -73,18 +73,19 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (titleSize, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: title, font: titleFont, textColor: incoming ? theme.chat.bubble.actionButtonsIncomingTextColor : theme.chat.bubble.actionButtonsOutgoingTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(1.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 ? theme.theme.chat.bubble.actionButtonsIncomingTextColor : theme.theme.chat.bubble.actionButtonsOutgoingTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(1.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 backgroundImage: UIImage?
|
let backgroundImage: UIImage?
|
||||||
switch position {
|
switch position {
|
||||||
case .middle:
|
case .middle:
|
||||||
backgroundImage = incoming ? PresentationResourcesChat.chatBubbleActionButtonIncomingMiddleImage(theme) : PresentationResourcesChat.chatBubbleActionButtonOutgoingMiddleImage(theme)
|
backgroundImage = incoming ? graphics.chatBubbleActionButtonIncomingMiddleImage : graphics.chatBubbleActionButtonOutgoingMiddleImage
|
||||||
case .bottomLeft:
|
case .bottomLeft:
|
||||||
backgroundImage = incoming ? PresentationResourcesChat.chatBubbleActionButtonIncomingBottomLeftImage(theme) : PresentationResourcesChat.chatBubbleActionButtonOutgoingBottomLeftImage(theme)
|
backgroundImage = incoming ? graphics.chatBubbleActionButtonIncomingBottomLeftImage : graphics.chatBubbleActionButtonOutgoingBottomLeftImage
|
||||||
case .bottomRight:
|
case .bottomRight:
|
||||||
backgroundImage = incoming ? PresentationResourcesChat.chatBubbleActionButtonIncomingBottomRightImage(theme) : PresentationResourcesChat.chatBubbleActionButtonOutgoingBottomRightImage(theme)
|
backgroundImage = incoming ? graphics.chatBubbleActionButtonIncomingBottomRightImage : graphics.chatBubbleActionButtonOutgoingBottomRightImage
|
||||||
case .bottomSingle:
|
case .bottomSingle:
|
||||||
backgroundImage = incoming ? PresentationResourcesChat.chatBubbleActionButtonIncomingBottomSingleImage(theme) : PresentationResourcesChat.chatBubbleActionButtonOutgoingBottomSingleImage(theme)
|
backgroundImage = incoming ? graphics.chatBubbleActionButtonIncomingBottomSingleImage : graphics.chatBubbleActionButtonOutgoingBottomSingleImage
|
||||||
}
|
}
|
||||||
|
|
||||||
return (titleSize.size.width + sideInset + sideInset, { width in
|
return (titleSize.size.width + sideInset + sideInset, { width in
|
||||||
@ -134,7 +135,7 @@ final class ChatMessageActionButtonsNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ account: Account, _ theme: PresentationTheme, _ strings: PresentationStrings, _ replyMarkup: ReplyMarkupMessageAttribute, _ message: Message, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode)) {
|
class func asyncLayout(_ maybeNode: ChatMessageActionButtonsNode?) -> (_ account: Account, _ theme: ChatPresentationThemeData, _ strings: PresentationStrings, _ replyMarkup: ReplyMarkupMessageAttribute, _ message: Message, _ constrainedWidth: CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode)) {
|
||||||
let currentButtonLayouts = maybeNode?.buttonNodes.map { ChatMessageActionButtonNode.asyncLayout($0) } ?? []
|
let currentButtonLayouts = maybeNode?.buttonNodes.map { ChatMessageActionButtonNode.asyncLayout($0) } ?? []
|
||||||
|
|
||||||
return { account, theme, strings, replyMarkup, message, constrainedWidth in
|
return { account, theme, strings, replyMarkup, message, constrainedWidth in
|
||||||
|
|||||||
@ -843,7 +843,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.account, item.presentationData.theme.theme, item.presentationData.strings, replyMarkup, item.message, maximumNodeWidth)
|
let (minWidth, buttonsLayout) = actionButtonsLayout(item.account, item.presentationData.theme, item.presentationData.strings, replyMarkup, item.message, maximumNodeWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
}
|
}
|
||||||
@ -1080,19 +1080,21 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
|||||||
if currentShareButtonNode != nil {
|
if currentShareButtonNode != nil {
|
||||||
updatedShareButtonNode = currentShareButtonNode
|
updatedShareButtonNode = currentShareButtonNode
|
||||||
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
||||||
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
if item.message.id.peerId == item.account.peerId {
|
if item.message.id.peerId == item.account.peerId {
|
||||||
updatedShareButtonBackground = PresentationResourcesChat.chatBubbleNavigateButtonImage(item.presentationData.theme.theme)
|
updatedShareButtonBackground = graphics.chatBubbleNavigateButtonImage
|
||||||
} else {
|
} else {
|
||||||
updatedShareButtonBackground = PresentationResourcesChat.chatBubbleShareButtonImage(item.presentationData.theme.theme)
|
updatedShareButtonBackground = graphics.chatBubbleShareButtonImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let buttonNode = HighlightableButtonNode()
|
let buttonNode = HighlightableButtonNode()
|
||||||
let buttonIcon: UIImage?
|
let buttonIcon: UIImage?
|
||||||
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
if item.message.id.peerId == item.account.peerId {
|
if item.message.id.peerId == item.account.peerId {
|
||||||
buttonIcon = PresentationResourcesChat.chatBubbleNavigateButtonImage(item.presentationData.theme.theme)
|
buttonIcon = graphics.chatBubbleNavigateButtonImage
|
||||||
} else {
|
} else {
|
||||||
buttonIcon = PresentationResourcesChat.chatBubbleShareButtonImage(item.presentationData.theme.theme)
|
buttonIcon = graphics.chatBubbleShareButtonImage
|
||||||
}
|
}
|
||||||
buttonNode.setBackgroundImage(buttonIcon, for: [.normal])
|
buttonNode.setBackgroundImage(buttonIcon, for: [.normal])
|
||||||
updatedShareButtonNode = buttonNode
|
updatedShareButtonNode = buttonNode
|
||||||
@ -1954,7 +1956,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: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, 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: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -149,7 +149,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
updatedReplyBackgroundNode = ASImageNode()
|
updatedReplyBackgroundNode = ASImageNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
replyBackgroundImage = graphics.chatServiceBubbleFillImage
|
replyBackgroundImage = graphics.chatServiceBubbleFillImage
|
||||||
break
|
break
|
||||||
} else if let attribute = attribute as? InlineBotMessageAttribute {
|
} else if let attribute = attribute as? InlineBotMessageAttribute {
|
||||||
@ -194,14 +194,14 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
|||||||
updatedForwardBackgroundNode = ASImageNode()
|
updatedForwardBackgroundNode = ASImageNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
forwardBackgroundImage = graphics.chatServiceBubbleFillImage
|
forwardBackgroundImage = graphics.chatServiceBubbleFillImage
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxContentWidth = videoLayout.contentSize.width
|
var maxContentWidth = videoLayout.contentSize.width
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animated: Bool) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
let (minWidth, buttonsLayout) = actionButtonsLayout(item.account, item.presentationData.theme.theme, item.presentationData.strings, replyMarkup, item.message, maxContentWidth)
|
let (minWidth, buttonsLayout) = actionButtonsLayout(item.account, item.presentationData.theme, item.presentationData.strings, replyMarkup, item.message, maxContentWidth)
|
||||||
maxContentWidth = max(maxContentWidth, minWidth)
|
maxContentWidth = max(maxContentWidth, minWidth)
|
||||||
actionButtonsFinalize = buttonsLayout
|
actionButtonsFinalize = buttonsLayout
|
||||||
}
|
}
|
||||||
@ -390,7 +390,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: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, 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: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -242,7 +242,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
updatedReplyBackgroundNode = ASImageNode()
|
updatedReplyBackgroundNode = ASImageNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
replyBackgroundImage = graphics.chatFreeformContentAdditionalInfoBackgroundImage
|
replyBackgroundImage = graphics.chatFreeformContentAdditionalInfoBackgroundImage
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -255,19 +255,21 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
if currentShareButtonNode != nil {
|
if currentShareButtonNode != nil {
|
||||||
updatedShareButtonNode = currentShareButtonNode
|
updatedShareButtonNode = currentShareButtonNode
|
||||||
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
if item.presentationData.theme !== currentItem?.presentationData.theme {
|
||||||
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
if item.message.id.peerId == item.account.peerId {
|
if item.message.id.peerId == item.account.peerId {
|
||||||
updatedShareButtonBackground = PresentationResourcesChat.chatBubbleNavigateButtonImage(item.presentationData.theme.theme)
|
updatedShareButtonBackground = graphics.chatBubbleNavigateButtonImage
|
||||||
} else {
|
} else {
|
||||||
updatedShareButtonBackground = PresentationResourcesChat.chatBubbleShareButtonImage(item.presentationData.theme.theme)
|
updatedShareButtonBackground = graphics.chatBubbleShareButtonImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let buttonNode = HighlightableButtonNode()
|
let buttonNode = HighlightableButtonNode()
|
||||||
let buttonIcon: UIImage?
|
let buttonIcon: UIImage?
|
||||||
|
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
|
||||||
if item.message.id.peerId == item.account.peerId {
|
if item.message.id.peerId == item.account.peerId {
|
||||||
buttonIcon = PresentationResourcesChat.chatBubbleNavigateButtonImage(item.presentationData.theme.theme)
|
buttonIcon = graphics.chatBubbleNavigateButtonImage
|
||||||
} else {
|
} else {
|
||||||
buttonIcon = PresentationResourcesChat.chatBubbleShareButtonImage(item.presentationData.theme.theme)
|
buttonIcon = graphics.chatBubbleShareButtonImage
|
||||||
}
|
}
|
||||||
buttonNode.setBackgroundImage(buttonIcon, for: [.normal])
|
buttonNode.setBackgroundImage(buttonIcon, for: [.normal])
|
||||||
updatedShareButtonNode = buttonNode
|
updatedShareButtonNode = buttonNode
|
||||||
@ -418,7 +420,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: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, 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: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor)
|
||||||
self.swipeToReplyNode = swipeToReplyNode
|
self.swipeToReplyNode = swipeToReplyNode
|
||||||
self.addSubnode(swipeToReplyNode)
|
self.addSubnode(swipeToReplyNode)
|
||||||
animateReplyNodeIn = true
|
animateReplyNodeIn = true
|
||||||
|
|||||||
@ -34,7 +34,7 @@ final class ChatRecentActionsEmptyNode: ASDisplayNode {
|
|||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
let graphics = PresentationResourcesChat.principalGraphics(theme, wallpaper: chatWallpaper)
|
let graphics = PresentationResourcesChat.additionalGraphics(theme, wallpaper: chatWallpaper)
|
||||||
self.backgroundNode.image = graphics.chatEmptyItemBackgroundImage
|
self.backgroundNode.image = graphics.chatEmptyItemBackgroundImage
|
||||||
|
|
||||||
self.addSubnode(self.backgroundNode)
|
self.addSubnode(self.backgroundNode)
|
||||||
|
|||||||
@ -168,15 +168,15 @@ 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: UIColor(rgb: 0x18222D, alpha: 0.5),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0x18222D, alpha: 0.5)),
|
||||||
shareButtonStrokeColor: UIColor(rgb: 0x213040),
|
shareButtonStrokeColor: UIColor(rgb: 0x213040),
|
||||||
shareButtonForegroundColor: UIColor(rgb: 0xb2b2b2), //!!!
|
shareButtonForegroundColor: 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: 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: 0x213040),
|
actionButtonsIncomingStrokeColor: UIColor(rgb: 0x213040),
|
||||||
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
||||||
actionButtonsOutgoingFillColor: 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: 0x213040),
|
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0x213040),
|
||||||
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
||||||
selectionControlBorderColor: .white,
|
selectionControlBorderColor: .white,
|
||||||
|
|||||||
@ -168,15 +168,15 @@ private let bubble = PresentationThemeChatBubble(
|
|||||||
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
outgoingFileDescriptionColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
||||||
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: 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: 0x1f1f1f),
|
shareButtonStrokeColor: UIColor(rgb: 0x1f1f1f),
|
||||||
shareButtonForegroundColor: UIColor(rgb: 0xb2b2b2), //!!!
|
shareButtonForegroundColor: 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: 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: 0x1f1f1f),
|
actionButtonsIncomingStrokeColor: UIColor(rgb: 0x1f1f1f),
|
||||||
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsIncomingTextColor: UIColor(rgb: 0xffffff),
|
||||||
actionButtonsOutgoingFillColor: 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: 0x1f1f1f),
|
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0x1f1f1f),
|
||||||
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
actionButtonsOutgoingTextColor: UIColor(rgb: 0xffffff),
|
||||||
selectionControlBorderColor: .white,
|
selectionControlBorderColor: .white,
|
||||||
|
|||||||
@ -199,15 +199,15 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, day: Bool) -> Pr
|
|||||||
outgoingFileDescriptionColor: UIColor(rgb: 0x6fb26a),
|
outgoingFileDescriptionColor: UIColor(rgb: 0x6fb26a),
|
||||||
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: UIColor(rgb: 0x748391, alpha: 0.45),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.25), withoutWallpaper: UIColor(rgb: 0x748391, alpha: 0.45)),
|
||||||
shareButtonStrokeColor: .clear,
|
shareButtonStrokeColor: .clear,
|
||||||
shareButtonForegroundColor: .white,
|
shareButtonForegroundColor: .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: UIColor(rgb: 0x596E89, alpha: 0.35),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.25), withoutWallpaper: UIColor(rgb: 0x596E89, alpha: 0.35)),
|
||||||
actionButtonsIncomingStrokeColor: .clear,
|
actionButtonsIncomingStrokeColor: .clear,
|
||||||
actionButtonsIncomingTextColor: .white,
|
actionButtonsIncomingTextColor: .white,
|
||||||
actionButtonsOutgoingFillColor: UIColor(rgb: 0x596E89, alpha: 0.35),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0x000000, alpha: 0.25), withoutWallpaper: UIColor(rgb: 0x596E89, alpha: 0.35)),
|
||||||
actionButtonsOutgoingStrokeColor: .clear,
|
actionButtonsOutgoingStrokeColor: .clear,
|
||||||
actionButtonsOutgoingTextColor: .white,
|
actionButtonsOutgoingTextColor: .white,
|
||||||
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
||||||
@ -253,15 +253,15 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, day: Bool) -> Pr
|
|||||||
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: UIColor(rgb: 0xffffff, alpha: 0.8),
|
shareButtonFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.8)),
|
||||||
shareButtonStrokeColor: UIColor(rgb: 0xE5E5EA),
|
shareButtonStrokeColor: UIColor(rgb: 0xE5E5EA),
|
||||||
shareButtonForegroundColor: accentColor,
|
shareButtonForegroundColor: 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: UIColor(rgb: 0xffffff, alpha: 0.5),
|
actionButtonsIncomingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.5)),
|
||||||
actionButtonsIncomingStrokeColor: UIColor(rgb: 0x3996ee),
|
actionButtonsIncomingStrokeColor: UIColor(rgb: 0x3996ee),
|
||||||
actionButtonsIncomingTextColor: UIColor(rgb: 0x3996ee),
|
actionButtonsIncomingTextColor: UIColor(rgb: 0x3996ee),
|
||||||
actionButtonsOutgoingFillColor: UIColor(rgb: 0xffffff, alpha: 0.5),
|
actionButtonsOutgoingFillColor: PresentationThemeVariableColor(withWallpaper: UIColor(rgb: 0xffffff, alpha: 0.5), withoutWallpaper: UIColor(rgb: 0xffffff, alpha: 0.5)),
|
||||||
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0x3996ee),
|
actionButtonsOutgoingStrokeColor: UIColor(rgb: 0x3996ee),
|
||||||
actionButtonsOutgoingTextColor: UIColor(rgb: 0x3996ee),
|
actionButtonsOutgoingTextColor: UIColor(rgb: 0x3996ee),
|
||||||
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
selectionControlBorderColor: UIColor(rgb: 0xC7C7CC),
|
||||||
|
|||||||
@ -57,7 +57,6 @@ final class InstantPageController: ViewController {
|
|||||||
if strongSelf.isNodeLoaded {
|
if strongSelf.isNodeLoaded {
|
||||||
strongSelf.controllerNode.update(settings: settings, strings: strongSelf.presentationData.strings)
|
strongSelf.controllerNode.update(settings: settings, strings: strongSelf.presentationData.strings)
|
||||||
}
|
}
|
||||||
strongSelf._ready.set(.single(true))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -98,14 +97,15 @@ final class InstantPageController: ViewController {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
self.displayNodeDidLoad()
|
|
||||||
|
|
||||||
let _ = (instantPageStoredState(postbox: self.account.postbox, webPage: self.webPage)
|
let _ = (instantPageStoredState(postbox: self.account.postbox, webPage: self.webPage)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] state in
|
|> deliverOnMainQueue).start(next: { [weak self] state in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.controllerNode.updateWebPage(strongSelf.webPage, anchor: strongSelf.anchor, state: state)
|
strongSelf.controllerNode.updateWebPage(strongSelf.webPage, anchor: strongSelf.anchor, state: state)
|
||||||
|
strongSelf._ready.set(.single(true))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||||
|
|||||||
@ -72,6 +72,10 @@ enum PresentationResourceKey: Int32 {
|
|||||||
|
|
||||||
case chatPrincipalThemeEssentialGraphicsWithWallpaper
|
case chatPrincipalThemeEssentialGraphicsWithWallpaper
|
||||||
case chatPrincipalThemeEssentialGraphicsWithoutWallpaper
|
case chatPrincipalThemeEssentialGraphicsWithoutWallpaper
|
||||||
|
|
||||||
|
case chatPrincipalThemeAdditionalGraphicsWithCustomWallpaper
|
||||||
|
case chatPrincipalThemeAdditionalGraphicsWithDefaultWallpaper
|
||||||
|
|
||||||
case chatBubbleVerticalLineIncomingImage
|
case chatBubbleVerticalLineIncomingImage
|
||||||
case chatBubbleVerticalLineOutgoingImage
|
case chatBubbleVerticalLineOutgoingImage
|
||||||
case chatServiceVerticalLineImage
|
case chatServiceVerticalLineImage
|
||||||
@ -85,9 +89,6 @@ enum PresentationResourceKey: Int32 {
|
|||||||
case chatBubbleConsumableContentOutgoingIcon
|
case chatBubbleConsumableContentOutgoingIcon
|
||||||
case chatMediaConsumableContentIcon
|
case chatMediaConsumableContentIcon
|
||||||
|
|
||||||
case chatBubbleShareButtonImage
|
|
||||||
case chatBubbleNavigateButtonImage
|
|
||||||
|
|
||||||
case chatBubbleMediaOverlayControlSecret
|
case chatBubbleMediaOverlayControlSecret
|
||||||
|
|
||||||
case chatBubbleSecretMediaIcon
|
case chatBubbleSecretMediaIcon
|
||||||
@ -98,16 +99,6 @@ enum PresentationResourceKey: Int32 {
|
|||||||
|
|
||||||
case chatUnreadBarBackgroundImage
|
case chatUnreadBarBackgroundImage
|
||||||
|
|
||||||
case chatBubbleActionButtonIncomingMiddleImage
|
|
||||||
case chatBubbleActionButtonIncomingBottomLeftImage
|
|
||||||
case chatBubbleActionButtonIncomingBottomRightImage
|
|
||||||
case chatBubbleActionButtonIncomingBottomSingleImage
|
|
||||||
|
|
||||||
case chatBubbleActionButtonOutgoingMiddleImage
|
|
||||||
case chatBubbleActionButtonOutgoingBottomLeftImage
|
|
||||||
case chatBubbleActionButtonOutgoingBottomRightImage
|
|
||||||
case chatBubbleActionButtonOutgoingBottomSingleImage
|
|
||||||
|
|
||||||
case chatBubbleFileCloudFetchMediaIcon
|
case chatBubbleFileCloudFetchMediaIcon
|
||||||
case chatBubbleFileCloudFetchIncomingIcon
|
case chatBubbleFileCloudFetchIncomingIcon
|
||||||
case chatBubbleFileCloudFetchOutgoingIcon
|
case chatBubbleFileCloudFetchOutgoingIcon
|
||||||
|
|||||||
@ -73,6 +73,13 @@ struct PresentationResourcesChat {
|
|||||||
}) as! PrincipalThemeEssentialGraphics
|
}) as! PrincipalThemeEssentialGraphics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func additionalGraphics(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeAdditionalGraphics {
|
||||||
|
let key: PresentationResourceKey = wallpaper.isBuiltin ? PresentationResourceKey.chatPrincipalThemeAdditionalGraphicsWithDefaultWallpaper : PresentationResourceKey.chatPrincipalThemeAdditionalGraphicsWithCustomWallpaper
|
||||||
|
return theme.object(key.rawValue, { theme in
|
||||||
|
return PrincipalThemeAdditionalGraphics(theme.chat, wallpaper: wallpaper)
|
||||||
|
}) as! PrincipalThemeAdditionalGraphics
|
||||||
|
}
|
||||||
|
|
||||||
static func chatBubbleVerticalLineIncomingImage(_ theme: PresentationTheme) -> UIImage? {
|
static func chatBubbleVerticalLineIncomingImage(_ theme: PresentationTheme) -> UIImage? {
|
||||||
return theme.image(PresentationResourceKey.chatBubbleVerticalLineIncomingImage.rawValue, { theme in
|
return theme.image(PresentationResourceKey.chatBubbleVerticalLineIncomingImage.rawValue, { theme in
|
||||||
return generateLineImage(color: theme.chat.bubble.incomingAccentControlColor)
|
return generateLineImage(color: theme.chat.bubble.incomingAccentControlColor)
|
||||||
@ -109,66 +116,6 @@ struct PresentationResourcesChat {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static func chatBubbleShareButtonImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleShareButtonImage.rawValue, { theme in
|
|
||||||
return generateImage(CGSize(width: 29.0, height: 29.0), rotatedContext: { size, context in
|
|
||||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
|
||||||
context.setFillColor(theme.chat.bubble.shareButtonFillColor.cgColor)
|
|
||||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
|
||||||
let lineWidth: CGFloat = 1.0
|
|
||||||
let halfLineWidth = lineWidth / 2.0
|
|
||||||
var strokeAlpha: CGFloat = 0.0
|
|
||||||
theme.chat.bubble.shareButtonStrokeColor.getRed(nil, green: nil, blue: nil, alpha: &strokeAlpha)
|
|
||||||
if !strokeAlpha.isZero {
|
|
||||||
context.setStrokeColor(theme.chat.bubble.shareButtonStrokeColor.cgColor)
|
|
||||||
context.setLineWidth(lineWidth)
|
|
||||||
context.strokeEllipse(in: CGRect(origin: CGPoint(x: halfLineWidth, y: halfLineWidth), size: CGSize(width: size.width - lineWidth, height: size.width - lineWidth)))
|
|
||||||
}
|
|
||||||
|
|
||||||
if let image = UIImage(bundleImageName: "Chat/Message/ShareIcon") {
|
|
||||||
let imageRect = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
|
||||||
|
|
||||||
context.translateBy(x: imageRect.midX, y: imageRect.midY)
|
|
||||||
context.scaleBy(x: 1.0, y: -1.0)
|
|
||||||
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
|
|
||||||
context.clip(to: imageRect, mask: image.cgImage!)
|
|
||||||
context.setFillColor(theme.chat.bubble.shareButtonForegroundColor.cgColor)
|
|
||||||
context.fill(imageRect)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleNavigateButtonImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleNavigateButtonImage.rawValue, { theme in
|
|
||||||
return generateImage(CGSize(width: 29.0, height: 29.0), rotatedContext: { size, context in
|
|
||||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
|
||||||
context.setFillColor(theme.chat.bubble.shareButtonFillColor.cgColor)
|
|
||||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
|
||||||
let lineWidth: CGFloat = 1.0
|
|
||||||
let halfLineWidth = lineWidth / 2.0
|
|
||||||
var strokeAlpha: CGFloat = 0.0
|
|
||||||
theme.chat.bubble.shareButtonStrokeColor.getRed(nil, green: nil, blue: nil, alpha: &strokeAlpha)
|
|
||||||
if !strokeAlpha.isZero {
|
|
||||||
context.setStrokeColor(theme.chat.bubble.shareButtonStrokeColor.cgColor)
|
|
||||||
context.setLineWidth(lineWidth)
|
|
||||||
context.strokeEllipse(in: CGRect(origin: CGPoint(x: halfLineWidth, y: halfLineWidth), size: CGSize(width: size.width - lineWidth, height: size.width - lineWidth)))
|
|
||||||
}
|
|
||||||
|
|
||||||
if let image = UIImage(bundleImageName: "Chat/Message/NavigateToMessageIcon") {
|
|
||||||
let imageRect = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0) + 1.0), size: image.size)
|
|
||||||
|
|
||||||
context.translateBy(x: imageRect.midX, y: imageRect.midY)
|
|
||||||
context.scaleBy(x: 1.0, y: -1.0)
|
|
||||||
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
|
|
||||||
context.clip(to: imageRect, mask: image.cgImage!)
|
|
||||||
context.setFillColor(theme.chat.bubble.shareButtonForegroundColor.cgColor)
|
|
||||||
context.fill(imageRect)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleSecretMediaIcon(_ theme: PresentationTheme) -> UIImage? {
|
static func chatBubbleSecretMediaIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||||
return theme.image(PresentationResourceKey.chatBubbleSecretMediaIcon.rawValue, { theme in
|
return theme.image(PresentationResourceKey.chatBubbleSecretMediaIcon.rawValue, { theme in
|
||||||
generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/SecretMediaIcon"), color: theme.chat.bubble.mediaOverlayControlForegroundColor)
|
generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/SecretMediaIcon"), color: theme.chat.bubble.mediaOverlayControlForegroundColor)
|
||||||
@ -209,54 +156,6 @@ struct PresentationResourcesChat {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static func chatBubbleActionButtonIncomingMiddleImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonIncomingMiddleImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsIncomingFillColor, strokeColor: theme.chat.bubble.actionButtonsIncomingStrokeColor, position: .middle)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonIncomingBottomLeftImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonIncomingBottomLeftImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsIncomingFillColor, strokeColor: theme.chat.bubble.actionButtonsIncomingStrokeColor, position: .bottomLeft)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonIncomingBottomRightImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonIncomingBottomRightImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsIncomingFillColor, strokeColor: theme.chat.bubble.actionButtonsIncomingStrokeColor, position: .bottomRight)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonIncomingBottomSingleImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonIncomingBottomSingleImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsIncomingFillColor, strokeColor: theme.chat.bubble.actionButtonsIncomingStrokeColor, position: .bottomSingle)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonOutgoingMiddleImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonOutgoingMiddleImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsOutgoingFillColor, strokeColor: theme.chat.bubble.actionButtonsOutgoingStrokeColor, position: .middle)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonOutgoingBottomLeftImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonOutgoingBottomLeftImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsOutgoingFillColor, strokeColor: theme.chat.bubble.actionButtonsOutgoingStrokeColor, position: .bottomLeft)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonOutgoingBottomRightImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonOutgoingBottomRightImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsOutgoingFillColor, strokeColor: theme.chat.bubble.actionButtonsOutgoingStrokeColor, position: .bottomRight)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatBubbleActionButtonOutgoingBottomSingleImage(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.chatBubbleActionButtonOutgoingBottomSingleImage.rawValue, { theme in
|
|
||||||
return messageBubbleActionButtonImage(color: theme.chat.bubble.actionButtonsOutgoingFillColor, strokeColor: theme.chat.bubble.actionButtonsOutgoingStrokeColor, position: .bottomSingle)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func chatInfoItemBackgroundImageWithoutWallpaper(_ theme: PresentationTheme) -> UIImage? {
|
static func chatInfoItemBackgroundImageWithoutWallpaper(_ theme: PresentationTheme) -> UIImage? {
|
||||||
return theme.image(PresentationResourceKey.chatInfoItemBackgroundImageWithoutWallpaper.rawValue, { theme in
|
return theme.image(PresentationResourceKey.chatInfoItemBackgroundImageWithoutWallpaper.rawValue, { theme in
|
||||||
return messageSingleBubbleLikeImage(fillColor: theme.chat.bubble.incoming.withoutWallpaper.fill, strokeColor: theme.chat.bubble.incoming.withoutWallpaper.stroke)
|
return messageSingleBubbleLikeImage(fillColor: theme.chat.bubble.incoming.withoutWallpaper.fill, strokeColor: theme.chat.bubble.incoming.withoutWallpaper.stroke)
|
||||||
|
|||||||
@ -412,6 +412,16 @@ public final class PresentationThemeBubbleColor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class PresentationThemeVariableColor {
|
||||||
|
public let withWallpaper: UIColor
|
||||||
|
public let withoutWallpaper: UIColor
|
||||||
|
|
||||||
|
public init(withWallpaper: UIColor, withoutWallpaper: UIColor) {
|
||||||
|
self.withWallpaper = withWallpaper
|
||||||
|
self.withoutWallpaper = withoutWallpaper
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wallpaper: Bool) -> PresentationThemeBubbleColorComponents {
|
public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wallpaper: Bool) -> PresentationThemeBubbleColorComponents {
|
||||||
if incoming {
|
if incoming {
|
||||||
if wallpaper {
|
if wallpaper {
|
||||||
@ -428,6 +438,14 @@ public func bubbleColorComponents(theme: PresentationTheme, incoming: Bool, wall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func bubbleVariableColor(variableColor: PresentationThemeVariableColor, wallpaper: TelegramWallpaper) -> UIColor {
|
||||||
|
if wallpaper != .builtin {
|
||||||
|
return variableColor.withWallpaper
|
||||||
|
} else {
|
||||||
|
return variableColor.withoutWallpaper
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final class PresentationThemeChatBubble {
|
public final class PresentationThemeChatBubble {
|
||||||
public let incoming: PresentationThemeBubbleColor
|
public let incoming: PresentationThemeBubbleColor
|
||||||
public let outgoing: PresentationThemeBubbleColor
|
public let outgoing: PresentationThemeBubbleColor
|
||||||
@ -469,18 +487,18 @@ public final class PresentationThemeChatBubble {
|
|||||||
public let incomingFileDurationColor: UIColor
|
public let incomingFileDurationColor: UIColor
|
||||||
public let outgoingFileDurationColor: UIColor
|
public let outgoingFileDurationColor: UIColor
|
||||||
|
|
||||||
public let shareButtonFillColor: UIColor
|
public let shareButtonFillColor: PresentationThemeVariableColor
|
||||||
public let shareButtonStrokeColor: UIColor
|
public let shareButtonStrokeColor: UIColor
|
||||||
public let shareButtonForegroundColor: UIColor
|
public let shareButtonForegroundColor: UIColor
|
||||||
|
|
||||||
public let mediaOverlayControlBackgroundColor: UIColor
|
public let mediaOverlayControlBackgroundColor: UIColor
|
||||||
public let mediaOverlayControlForegroundColor: UIColor
|
public let mediaOverlayControlForegroundColor: UIColor
|
||||||
|
|
||||||
public let actionButtonsIncomingFillColor: UIColor
|
public let actionButtonsIncomingFillColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsIncomingStrokeColor: UIColor
|
public let actionButtonsIncomingStrokeColor: UIColor
|
||||||
public let actionButtonsIncomingTextColor: UIColor
|
public let actionButtonsIncomingTextColor: UIColor
|
||||||
|
|
||||||
public let actionButtonsOutgoingFillColor: UIColor
|
public let actionButtonsOutgoingFillColor: PresentationThemeVariableColor
|
||||||
public let actionButtonsOutgoingStrokeColor: UIColor
|
public let actionButtonsOutgoingStrokeColor: UIColor
|
||||||
public let actionButtonsOutgoingTextColor: UIColor
|
public let actionButtonsOutgoingTextColor: UIColor
|
||||||
|
|
||||||
@ -496,7 +514,7 @@ public final class PresentationThemeChatBubble {
|
|||||||
public let incomingMediaPlaceholderColor: UIColor
|
public let incomingMediaPlaceholderColor: UIColor
|
||||||
public let outgoingMediaPlaceholderColor: UIColor
|
public let outgoingMediaPlaceholderColor: UIColor
|
||||||
|
|
||||||
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: UIColor, shareButtonStrokeColor: UIColor, shareButtonForegroundColor: UIColor, mediaOverlayControlBackgroundColor: UIColor, mediaOverlayControlForegroundColor: UIColor, actionButtonsIncomingFillColor: UIColor, actionButtonsIncomingStrokeColor: UIColor, actionButtonsIncomingTextColor: UIColor, actionButtonsOutgoingFillColor: UIColor, actionButtonsOutgoingStrokeColor: UIColor, actionButtonsOutgoingTextColor: UIColor, selectionControlBorderColor: UIColor, selectionControlFillColor: UIColor, selectionControlForegroundColor: UIColor, mediaHighlightOverlayColor: UIColor, deliveryFailedFillColor: UIColor, deliveryFailedForegroundColor: UIColor, incomingMediaPlaceholderColor: UIColor, outgoingMediaPlaceholderColor: UIColor) {
|
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) {
|
||||||
self.incoming = incoming
|
self.incoming = incoming
|
||||||
self.outgoing = outgoing
|
self.outgoing = outgoing
|
||||||
self.freeform = freeform
|
self.freeform = freeform
|
||||||
|
|||||||
@ -40,6 +40,34 @@ private func generateClockMinImage(color: UIColor) -> UIImage? {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func chatBubbleActionButtonImage(fillColor: UIColor, strokeColor: UIColor, foregroundColor: UIColor, image: UIImage?, iconOffset: CGPoint = CGPoint()) -> UIImage? {
|
||||||
|
return generateImage(CGSize(width: 29.0, height: 29.0), rotatedContext: { size, context in
|
||||||
|
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||||
|
context.setFillColor(fillColor.cgColor)
|
||||||
|
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
||||||
|
let lineWidth: CGFloat = 1.0
|
||||||
|
let halfLineWidth = lineWidth / 2.0
|
||||||
|
var strokeAlpha: CGFloat = 0.0
|
||||||
|
strokeColor.getRed(nil, green: nil, blue: nil, alpha: &strokeAlpha)
|
||||||
|
if !strokeAlpha.isZero {
|
||||||
|
context.setStrokeColor(strokeColor.cgColor)
|
||||||
|
context.setLineWidth(lineWidth)
|
||||||
|
context.strokeEllipse(in: CGRect(origin: CGPoint(x: halfLineWidth, y: halfLineWidth), size: CGSize(width: size.width - lineWidth, height: size.width - lineWidth)))
|
||||||
|
}
|
||||||
|
|
||||||
|
if let image = image {
|
||||||
|
let imageRect = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0) + iconOffset.x, y: floor((size.height - image.size.height) / 2.0) + iconOffset.y), size: image.size)
|
||||||
|
|
||||||
|
context.translateBy(x: imageRect.midX, y: imageRect.midY)
|
||||||
|
context.scaleBy(x: 1.0, y: -1.0)
|
||||||
|
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
|
||||||
|
context.clip(to: imageRect, mask: image.cgImage!)
|
||||||
|
context.setFillColor(foregroundColor.cgColor)
|
||||||
|
context.fill(imageRect)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public final class PrincipalThemeEssentialGraphics {
|
public final class PrincipalThemeEssentialGraphics {
|
||||||
public let chatMessageBackgroundIncomingImage: UIImage
|
public let chatMessageBackgroundIncomingImage: UIImage
|
||||||
public let chatMessageBackgroundIncomingHighlightedImage: UIImage
|
public let chatMessageBackgroundIncomingHighlightedImage: UIImage
|
||||||
@ -76,11 +104,6 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
public let checkFreeFullImage: UIImage
|
public let checkFreeFullImage: UIImage
|
||||||
public let checkFreePartialImage: UIImage
|
public let checkFreePartialImage: UIImage
|
||||||
|
|
||||||
public let chatServiceBubbleFillImage: UIImage
|
|
||||||
public let chatFreeformContentAdditionalInfoBackgroundImage: UIImage
|
|
||||||
public let chatEmptyItemBackgroundImage: UIImage
|
|
||||||
public let chatLoadingIndicatorBackgroundImage: UIImage
|
|
||||||
|
|
||||||
public let clockBubbleIncomingFrameImage: UIImage
|
public let clockBubbleIncomingFrameImage: UIImage
|
||||||
public let clockBubbleIncomingMinImage: UIImage
|
public let clockBubbleIncomingMinImage: UIImage
|
||||||
public let clockBubbleOutgoingFrameImage: UIImage
|
public let clockBubbleOutgoingFrameImage: UIImage
|
||||||
@ -144,15 +167,6 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
self.checkFreeFullImage = generateCheckImage(partial: false, color: serviceColor.primaryText)!
|
self.checkFreeFullImage = generateCheckImage(partial: false, color: serviceColor.primaryText)!
|
||||||
self.checkFreePartialImage = generateCheckImage(partial: true, color: serviceColor.primaryText)!
|
self.checkFreePartialImage = generateCheckImage(partial: true, color: serviceColor.primaryText)!
|
||||||
|
|
||||||
self.chatServiceBubbleFillImage = generateImage(CGSize(width: 20.0, height: 20.0), contextGenerator: { size, context -> Void in
|
|
||||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
|
||||||
context.setFillColor(serviceColor.fill.cgColor)
|
|
||||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
|
||||||
})!.stretchableImage(withLeftCapWidth: 8, topCapHeight: 8)
|
|
||||||
self.chatFreeformContentAdditionalInfoBackgroundImage = generateStretchableFilledCircleImage(radius: 4.0, color: serviceColor.fill)!
|
|
||||||
self.chatEmptyItemBackgroundImage = generateStretchableFilledCircleImage(radius: 14.0, color: serviceColor.fill)!
|
|
||||||
self.chatLoadingIndicatorBackgroundImage = generateStretchableFilledCircleImage(diameter: 30.0, color: serviceColor.fill)!
|
|
||||||
|
|
||||||
self.clockBubbleIncomingFrameImage = generateClockFrameImage(color: theme.bubble.incomingPendingActivityColor)!
|
self.clockBubbleIncomingFrameImage = generateClockFrameImage(color: theme.bubble.incomingPendingActivityColor)!
|
||||||
self.clockBubbleIncomingMinImage = generateClockMinImage(color: theme.bubble.incomingPendingActivityColor)!
|
self.clockBubbleIncomingMinImage = generateClockMinImage(color: theme.bubble.incomingPendingActivityColor)!
|
||||||
self.clockBubbleOutgoingFrameImage = generateClockFrameImage(color: theme.bubble.outgoingPendingActivityColor)!
|
self.clockBubbleOutgoingFrameImage = generateClockFrameImage(color: theme.bubble.outgoingPendingActivityColor)!
|
||||||
@ -165,7 +179,7 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
self.clockFreeMinImage = generateClockMinImage(color: serviceColor.primaryText)!
|
self.clockFreeMinImage = generateClockMinImage(color: serviceColor.primaryText)!
|
||||||
|
|
||||||
self.dateAndStatusMediaBackground = generateStretchableFilledCircleImage(diameter: 18.0, color: theme.bubble.mediaDateAndStatusFillColor)!
|
self.dateAndStatusMediaBackground = generateStretchableFilledCircleImage(diameter: 18.0, color: theme.bubble.mediaDateAndStatusFillColor)!
|
||||||
self.dateAndStatusFreeBackground = generateStretchableFilledCircleImage(diameter: 18.0, color: serviceColor.primaryText)!
|
self.dateAndStatusFreeBackground = generateStretchableFilledCircleImage(diameter: 18.0, color: serviceColor.dateFillStatic)!
|
||||||
|
|
||||||
let impressionCountImage = UIImage(bundleImageName: "Chat/Message/ImpressionCount")!
|
let impressionCountImage = UIImage(bundleImageName: "Chat/Message/ImpressionCount")!
|
||||||
self.incomingDateAndStatusImpressionIcon = generateTintedImage(image: impressionCountImage, color: theme.bubble.incomingSecondaryTextColor)!
|
self.incomingDateAndStatusImpressionIcon = generateTintedImage(image: impressionCountImage, color: theme.bubble.incomingSecondaryTextColor)!
|
||||||
@ -190,3 +204,44 @@ public final class PrincipalThemeEssentialGraphics {
|
|||||||
self.radialIndicatorFileIconOutgoing = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/RadialProgressIconDocumentIncoming"), color: outgoing.fill)!
|
self.radialIndicatorFileIconOutgoing = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/RadialProgressIconDocumentIncoming"), color: outgoing.fill)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class PrincipalThemeAdditionalGraphics {
|
||||||
|
public let chatServiceBubbleFillImage: UIImage
|
||||||
|
public let chatFreeformContentAdditionalInfoBackgroundImage: UIImage
|
||||||
|
public let chatEmptyItemBackgroundImage: UIImage
|
||||||
|
public let chatLoadingIndicatorBackgroundImage: UIImage
|
||||||
|
|
||||||
|
public let chatBubbleShareButtonImage: UIImage
|
||||||
|
public let chatBubbleNavigateButtonImage: UIImage
|
||||||
|
public let chatBubbleActionButtonIncomingMiddleImage: UIImage
|
||||||
|
public let chatBubbleActionButtonIncomingBottomLeftImage: UIImage
|
||||||
|
public let chatBubbleActionButtonIncomingBottomRightImage: UIImage
|
||||||
|
public let chatBubbleActionButtonIncomingBottomSingleImage: UIImage
|
||||||
|
public let chatBubbleActionButtonOutgoingMiddleImage: UIImage
|
||||||
|
public let chatBubbleActionButtonOutgoingBottomLeftImage: UIImage
|
||||||
|
public let chatBubbleActionButtonOutgoingBottomRightImage: UIImage
|
||||||
|
public let chatBubbleActionButtonOutgoingBottomSingleImage: UIImage
|
||||||
|
|
||||||
|
init(_ theme: PresentationThemeChat, wallpaper: TelegramWallpaper) {
|
||||||
|
let serviceColor = serviceMessageColorComponents(chatTheme: theme, wallpaper: wallpaper)
|
||||||
|
self.chatServiceBubbleFillImage = generateImage(CGSize(width: 20.0, height: 20.0), contextGenerator: { size, context -> Void in
|
||||||
|
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||||
|
context.setFillColor(serviceColor.fill.cgColor)
|
||||||
|
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
||||||
|
})!.stretchableImage(withLeftCapWidth: 8, topCapHeight: 8)
|
||||||
|
self.chatFreeformContentAdditionalInfoBackgroundImage = generateStretchableFilledCircleImage(radius: 4.0, color: serviceColor.fill)!
|
||||||
|
self.chatEmptyItemBackgroundImage = generateStretchableFilledCircleImage(radius: 14.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.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.chatBubbleActionButtonIncomingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .middle)
|
||||||
|
self.chatBubbleActionButtonIncomingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomLeft)
|
||||||
|
self.chatBubbleActionButtonIncomingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomRight)
|
||||||
|
self.chatBubbleActionButtonIncomingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsIncomingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsIncomingStrokeColor, position: .bottomSingle)
|
||||||
|
self.chatBubbleActionButtonOutgoingMiddleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .middle)
|
||||||
|
self.chatBubbleActionButtonOutgoingBottomLeftImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomLeft)
|
||||||
|
self.chatBubbleActionButtonOutgoingBottomRightImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomRight)
|
||||||
|
self.chatBubbleActionButtonOutgoingBottomSingleImage = messageBubbleActionButtonImage(color: bubbleVariableColor(variableColor: theme.bubble.actionButtonsOutgoingFillColor, wallpaper: wallpaper), strokeColor: theme.bubble.actionButtonsOutgoingStrokeColor, position: .bottomSingle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -252,10 +252,10 @@ func resolveUrl(account: Account, url: String) -> Signal<ResolvedUrl, NoError> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let baseTelegraPhPaths = ["telegra.ph"]
|
let baseTelegraPhPaths = ["telegra.ph/", "t.me/iv?"]
|
||||||
for basePath in baseTelegraPhPaths {
|
for basePath in baseTelegraPhPaths {
|
||||||
for scheme in schemes {
|
for scheme in schemes {
|
||||||
let basePrefix = scheme + basePath + "/"
|
let basePrefix = scheme + basePath
|
||||||
if url.lowercased().hasPrefix(basePrefix) {
|
if url.lowercased().hasPrefix(basePrefix) {
|
||||||
return resolveInstantViewUrl(account: account, url: url)
|
return resolveInstantViewUrl(account: account, url: url)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user