mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 01:11:46 +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.TopicChangedIcon" = "%1$@ changed topic %2$@ icon to %3$@";
|
||||
"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.DiscardPasteboardAlertText" = "Discard pasted items?";
|
||||
|
@ -1411,10 +1411,14 @@ open class TextNode: ASDisplayNode {
|
||||
context.setAllowsFontSubpixelQuantization(true)
|
||||
context.setShouldSubpixelQuantizeFonts(true)
|
||||
|
||||
var blendMode: CGBlendMode = .normal
|
||||
|
||||
var clearRects: [CGRect] = []
|
||||
if let layout = parameters as? TextNodeLayout {
|
||||
if !isRasterizing || layout.backgroundColor != nil {
|
||||
context.setBlendMode(.copy)
|
||||
blendMode = .copy
|
||||
|
||||
context.setFillColor((layout.backgroundColor ?? UIColor.clear).cgColor)
|
||||
context.fill(bounds)
|
||||
}
|
||||
@ -1426,6 +1430,8 @@ open class TextNode: ASDisplayNode {
|
||||
|
||||
if let (textStrokeColor, textStrokeWidth) = layout.textStroke {
|
||||
context.setBlendMode(.normal)
|
||||
blendMode = .normal
|
||||
|
||||
context.setLineCap(.round)
|
||||
context.setLineJoin(.round)
|
||||
context.setStrokeColor(textStrokeColor.cgColor)
|
||||
@ -1487,7 +1493,28 @@ open class TextNode: ASDisplayNode {
|
||||
if attributes["Attribute__EmbeddedItem"] != nil {
|
||||
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))
|
||||
if fixCoupleEmoji {
|
||||
context.setBlendMode(blendMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,12 @@ public enum AdminLogEventAction {
|
||||
public struct ForumTopicInfo {
|
||||
public var info: EngineMessageHistoryThread.Info
|
||||
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.isClosed = isClosed
|
||||
self.isHidden = isHidden
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,17 +304,17 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m
|
||||
let prevInfo: AdminLogEventAction.ForumTopicInfo
|
||||
switch prevTopic {
|
||||
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:
|
||||
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
|
||||
switch newTopic {
|
||||
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:
|
||||
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)
|
||||
|
@ -1714,7 +1714,14 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
||||
"Channel.AdminLog.TopicRemovedIcon" = "%1$@ removed topic %2$@ icon";*/
|
||||
|
||||
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
|
||||
if index == 0, let author = author {
|
||||
return [.TextMention(peerId: author.id)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user