mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-31 01:42:18 +00:00
Various fixes
This commit is contained in:
parent
fd341053a6
commit
c6788d923b
@ -8261,6 +8261,8 @@ Sorry for the inconvenience.";
|
|||||||
"Channel.AdminLog.TopicRenamedWithRemovedIcon" = "%1$@ renamed topic %2$@ to %3$@ and removed icon";
|
"Channel.AdminLog.TopicRenamedWithRemovedIcon" = "%1$@ renamed topic %2$@ to %3$@ and removed icon";
|
||||||
"Channel.AdminLog.TopicChangedIcon" = "%1$@ changed topic %2$@ icon to %3$@";
|
"Channel.AdminLog.TopicChangedIcon" = "%1$@ changed topic %2$@ icon to %3$@";
|
||||||
"Channel.AdminLog.TopicRemovedIcon" = "%1$@ removed topic %2$@ icon";
|
"Channel.AdminLog.TopicRemovedIcon" = "%1$@ removed topic %2$@ icon";
|
||||||
|
"Channel.AdminLog.TopicUnhidden" = "%1$@ unhid topic %2$@";
|
||||||
|
"Channel.AdminLog.TopicHidden" = "%1$@ hid topic %2$@";
|
||||||
|
|
||||||
"Attachment.Pasteboard" = "Clipboard";
|
"Attachment.Pasteboard" = "Clipboard";
|
||||||
"Attachment.DiscardPasteboardAlertText" = "Discard pasted items?";
|
"Attachment.DiscardPasteboardAlertText" = "Discard pasted items?";
|
||||||
|
@ -1411,10 +1411,14 @@ open class TextNode: ASDisplayNode {
|
|||||||
context.setAllowsFontSubpixelQuantization(true)
|
context.setAllowsFontSubpixelQuantization(true)
|
||||||
context.setShouldSubpixelQuantizeFonts(true)
|
context.setShouldSubpixelQuantizeFonts(true)
|
||||||
|
|
||||||
|
var blendMode: CGBlendMode = .normal
|
||||||
|
|
||||||
var clearRects: [CGRect] = []
|
var clearRects: [CGRect] = []
|
||||||
if let layout = parameters as? TextNodeLayout {
|
if let layout = parameters as? TextNodeLayout {
|
||||||
if !isRasterizing || layout.backgroundColor != nil {
|
if !isRasterizing || layout.backgroundColor != nil {
|
||||||
context.setBlendMode(.copy)
|
context.setBlendMode(.copy)
|
||||||
|
blendMode = .copy
|
||||||
|
|
||||||
context.setFillColor((layout.backgroundColor ?? UIColor.clear).cgColor)
|
context.setFillColor((layout.backgroundColor ?? UIColor.clear).cgColor)
|
||||||
context.fill(bounds)
|
context.fill(bounds)
|
||||||
}
|
}
|
||||||
@ -1426,6 +1430,8 @@ open class TextNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let (textStrokeColor, textStrokeWidth) = layout.textStroke {
|
if let (textStrokeColor, textStrokeWidth) = layout.textStroke {
|
||||||
context.setBlendMode(.normal)
|
context.setBlendMode(.normal)
|
||||||
|
blendMode = .normal
|
||||||
|
|
||||||
context.setLineCap(.round)
|
context.setLineCap(.round)
|
||||||
context.setLineJoin(.round)
|
context.setLineJoin(.round)
|
||||||
context.setStrokeColor(textStrokeColor.cgColor)
|
context.setStrokeColor(textStrokeColor.cgColor)
|
||||||
@ -1487,7 +1493,28 @@ open class TextNode: ASDisplayNode {
|
|||||||
if attributes["Attribute__EmbeddedItem"] != nil {
|
if attributes["Attribute__EmbeddedItem"] != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fixCoupleEmoji = false
|
||||||
|
if glyphCount == 2, let font = attributes["NSFont"] as? UIFont, font.fontName.contains("ColorEmoji"), let string = layout.attributedString {
|
||||||
|
let range = CTRunGetStringRange(run)
|
||||||
|
let substring = string.attributedSubstring(from: NSMakeRange(range.location, range.length)).string
|
||||||
|
|
||||||
|
let heart = Unicode.Scalar(0x2764)!
|
||||||
|
let man = Unicode.Scalar(0x1F468)!
|
||||||
|
let woman = Unicode.Scalar(0x1F469)!
|
||||||
|
|
||||||
|
if substring.unicodeScalars.contains(heart) && (substring.unicodeScalars.contains(man) || substring.unicodeScalars.contains(woman)) {
|
||||||
|
fixCoupleEmoji = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if fixCoupleEmoji {
|
||||||
|
context.setBlendMode(.normal)
|
||||||
|
}
|
||||||
CTRunDraw(run, context, CFRangeMake(0, glyphCount))
|
CTRunDraw(run, context, CFRangeMake(0, glyphCount))
|
||||||
|
if fixCoupleEmoji {
|
||||||
|
context.setBlendMode(blendMode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +35,12 @@ public enum AdminLogEventAction {
|
|||||||
public struct ForumTopicInfo {
|
public struct ForumTopicInfo {
|
||||||
public var info: EngineMessageHistoryThread.Info
|
public var info: EngineMessageHistoryThread.Info
|
||||||
public var isClosed: Bool
|
public var isClosed: Bool
|
||||||
|
public var isHidden: Bool
|
||||||
|
|
||||||
public init(info: EngineMessageHistoryThread.Info, isClosed: Bool) {
|
public init(info: EngineMessageHistoryThread.Info, isClosed: Bool, isHidden: Bool) {
|
||||||
self.info = info
|
self.info = info
|
||||||
self.isClosed = isClosed
|
self.isClosed = isClosed
|
||||||
|
self.isHidden = isHidden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,17 +304,17 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m
|
|||||||
let prevInfo: AdminLogEventAction.ForumTopicInfo
|
let prevInfo: AdminLogEventAction.ForumTopicInfo
|
||||||
switch prevTopic {
|
switch prevTopic {
|
||||||
case let .forumTopic(flags, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
case let .forumTopic(flags, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||||
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0)
|
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0, isHidden: (flags & (1 << 6)) != 0)
|
||||||
case .forumTopicDeleted:
|
case .forumTopicDeleted:
|
||||||
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false)
|
prevInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false, isHidden: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
let newInfo: AdminLogEventAction.ForumTopicInfo
|
let newInfo: AdminLogEventAction.ForumTopicInfo
|
||||||
switch newTopic {
|
switch newTopic {
|
||||||
case let .forumTopic(flags, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
case let .forumTopic(flags, _, _, title, iconColor, iconEmojiId, _, _, _, _, _, _, _, _, _):
|
||||||
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0)
|
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: title, icon: iconEmojiId, iconColor: iconColor), isClosed: (flags & (1 << 2)) != 0, isHidden: (flags & (1 << 6)) != 0)
|
||||||
case .forumTopicDeleted:
|
case .forumTopicDeleted:
|
||||||
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false)
|
newInfo = AdminLogEventAction.ForumTopicInfo(info: EngineMessageHistoryThread.Info(title: "", icon: nil, iconColor: 0), isClosed: false, isHidden: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
action = .editTopic(prevInfo: prevInfo, newInfo: newInfo)
|
action = .editTopic(prevInfo: prevInfo, newInfo: newInfo)
|
||||||
|
@ -1714,7 +1714,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
|||||||
"Channel.AdminLog.TopicRemovedIcon" = "%1$@ removed topic %2$@ icon";*/
|
"Channel.AdminLog.TopicRemovedIcon" = "%1$@ removed topic %2$@ icon";*/
|
||||||
|
|
||||||
let authorTitle: String = author.flatMap(EnginePeer.init)?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""
|
let authorTitle: String = author.flatMap(EnginePeer.init)?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? ""
|
||||||
if prevInfo.isClosed != newInfo.isClosed {
|
if prevInfo.isHidden != newInfo.isHidden {
|
||||||
|
appendAttributedText(text: newInfo.isHidden ? self.presentationData.strings.Channel_AdminLog_TopicHidden(authorTitle, newInfo.info.title) : self.presentationData.strings.Channel_AdminLog_TopicUnhidden(authorTitle, newInfo.info.title), generateEntities: { index in
|
||||||
|
if index == 0, let author = author {
|
||||||
|
return [.TextMention(peerId: author.id)]
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}, to: &text, entities: &entities)
|
||||||
|
} else if prevInfo.isClosed != newInfo.isClosed {
|
||||||
appendAttributedText(text: newInfo.isClosed ? self.presentationData.strings.Channel_AdminLog_TopicClosed(authorTitle, newInfo.info.title) : self.presentationData.strings.Channel_AdminLog_TopicReopened(authorTitle, newInfo.info.title), generateEntities: { index in
|
appendAttributedText(text: newInfo.isClosed ? self.presentationData.strings.Channel_AdminLog_TopicClosed(authorTitle, newInfo.info.title) : self.presentationData.strings.Channel_AdminLog_TopicReopened(authorTitle, newInfo.info.title), generateEntities: { index in
|
||||||
if index == 0, let author = author {
|
if index == 0, let author = author {
|
||||||
return [.TextMention(peerId: author.id)]
|
return [.TextMention(peerId: author.id)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user