Autoremove improvements

This commit is contained in:
Ali 2022-11-27 21:11:08 +04:00
parent 2073f13e56
commit 49192871e1
6 changed files with 19 additions and 8 deletions

View File

@ -322,6 +322,9 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32,
if user.botInfo == nil { if user.botInfo == nil {
canManage = true canManage = true
} }
if user.id.isRepliesOrSavedMessages(accountPeerId: context.account.peerId) {
return false
}
} else if case .secretChat = peer { } else if case .secretChat = peer {
canManage = true canManage = true
} else if case let .legacyGroup(group) = peer { } else if case let .legacyGroup(group) = peer {

View File

@ -1,5 +0,0 @@
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5953 11.5986C4.12087 11.4918 2.82405 10.6403 2.17149 8.85384C1.77098 7.7574 2.07201 6.26373 3.0746 4.37282C3.16459 4.20303 3.68939 4.39974 3.71944 4.44691L4.50543 5.68903C4.55963 5.77404 4.79721 5.69973 4.8111 5.67179C5.03783 5.21551 5.22636 4.6273 5.37671 3.90715C5.52201 3.21113 5.59278 2.56825 5.5953 1.81662C5.59594 1.62274 5.95245 1.32054 6 1.34613C7.14662 1.96317 8.0944 2.72803 8.66171 3.48285C9.63301 4.7752 9.88777 5.77431 9.96174 6.98816C10.1296 8.28857 9.7451 9.42338 8.80824 10.3926C7.87138 11.3618 6.8004 11.7638 5.5953 11.5986Z" fill="#8E8E93"/>
<path d="M3 11L11 3" stroke="white" stroke-width="1.66" stroke-linecap="round"/>
<path d="M2 11L10 3" stroke="#8E8E93" stroke-width="1.33" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 879 B

View File

@ -1,7 +1,7 @@
{ {
"images" : [ "images" : [
{ {
"filename" : "AutoremoveIconOff.svg", "filename" : "Frame 4.svg",
"idiom" : "universal" "idiom" : "universal"
} }
], ],

View File

@ -0,0 +1,4 @@
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.02539 11.1484C4.50657 11.4116 5.03826 11.5582 5.5953 11.5986C6.8004 11.7638 7.87138 11.3618 8.80824 10.3926C9.7451 9.42338 10.1296 8.28857 9.96174 6.98816C9.92908 6.45213 9.86116 5.95798 9.71184 5.46195L4.02539 11.1484ZM2.7871 10.0391C2.54531 9.70246 2.33754 9.30842 2.17149 8.85384C1.77098 7.7574 2.07201 6.26373 3.0746 4.37282C3.16459 4.20303 3.68939 4.39974 3.71944 4.44691L4.50543 5.68903C4.55963 5.77404 4.79721 5.69973 4.8111 5.67179C5.03783 5.21551 5.22636 4.6273 5.37671 3.90715C5.52201 3.21113 5.59278 2.56825 5.5953 1.81662C5.59594 1.62274 5.95245 1.32054 6 1.34613C7.14662 1.96317 8.0944 2.72803 8.66171 3.48285C8.76382 3.61871 8.85801 3.75133 8.9449 3.8813L2.7871 10.0391Z" fill="#8E8E93"/>
<path d="M2 11L10 3" stroke="#8E8E93" stroke-width="1.33" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 941 B

View File

@ -208,7 +208,7 @@ class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
if let (currentOffset, currentImage, currentRects) = cachedMaskBackgroundImage, currentRects == labelRects { if let (currentOffset, currentImage, currentRects) = cachedMaskBackgroundImage, currentRects == labelRects {
backgroundMaskImage = (currentOffset, currentImage) backgroundMaskImage = (currentOffset, currentImage)
} else { } else {
backgroundMaskImage = LinkHighlightingNode.generateImage(color: .black, inset: 0.0, innerRadius: 10.0, outerRadius: 10.0, rects: labelRects, useModernPathCalculation: false) backgroundMaskImage = LinkHighlightingNode.generateImage(color: .black, inset: 0.0, innerRadius: 10.0, outerRadius: 10.0, rects: labelRects, useModernPathCalculation: true)
backgroundMaskUpdated = true backgroundMaskUpdated = true
} }
@ -449,6 +449,7 @@ class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
} else { } else {
let serviceColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper) let serviceColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
linkHighlightingNode = LinkHighlightingNode(color: serviceColor.linkHighlight) linkHighlightingNode = LinkHighlightingNode(color: serviceColor.linkHighlight)
linkHighlightingNode.useModernPathCalculation = true
linkHighlightingNode.inset = 2.5 linkHighlightingNode.inset = 2.5
self.linkHighlightingNode = linkHighlightingNode self.linkHighlightingNode = linkHighlightingNode
self.insertSubnode(linkHighlightingNode, belowSubnode: self.labelNode.textNode) self.insertSubnode(linkHighlightingNode, belowSubnode: self.labelNode.textNode)

View File

@ -169,8 +169,10 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
let previousItem = self.item let previousItem = self.item
self.item = item self.item = item
let (updatedImage, text, _, _, _) = AccessoryItemIconButtonNode.imageAndInsets(item: item, theme: self.theme, strings: self.strings)
if let image = self.iconImageNode.image { if let image = self.iconImageNode.image {
self.iconImageNode.image = AccessoryItemIconButtonNode.imageAndInsets(item: item, theme: self.theme, strings: self.strings).0 self.iconImageNode.image = updatedImage
let bottomInset: CGFloat = 0.0 let bottomInset: CGFloat = 0.0
let imageFrame = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0) - bottomInset), size: image.size) let imageFrame = CGRect(origin: CGPoint(x: floor((size.width - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0) - bottomInset), size: image.size)
@ -307,6 +309,12 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
} }
} }
} }
if let text = text {
self.setAttributedTitle(NSAttributedString(string: text, font: accessoryButtonFont, textColor: self.theme.chat.inputPanel.inputControlColor), for: .normal)
} else {
self.setAttributedTitle(NSAttributedString(), for: .normal)
}
} }
var buttonWidth: CGFloat { var buttonWidth: CGFloat {