Moderation sheet improvements

This commit is contained in:
Isaac 2024-04-19 00:00:04 +04:00
parent b4e1173279
commit 2d65b3d90b
21 changed files with 1183 additions and 241 deletions

View File

@ -11896,6 +11896,7 @@ Sorry for the inconvenience.";
"BusinessLink.ErrorExpired" = "Link Expired";
"WebApp.AlertBiometryAccessText" = "Do you want to allow %@ to use Face ID?";
"WebApp.AlertBiometryAccessTouchIDText" = "Do you want to allow %@ to use Touch ID?";
"StoryList.SubtitleArchived_1" = "1 archived post";
"StoryList.SubtitleArchived_any" = "%d archived posts";
@ -12089,3 +12090,6 @@ Sorry for the inconvenience.";
"Map.SharingLocation" = "Sharing Location...";
"Channel.AdminLog.Settings" = "Settings";
"ChannelProfile.AboutActionCopy" = "Copy";
"ChannelProfile.ToastAboutCopied" = "Copied to clipboard.";

View File

@ -5,5 +5,6 @@
- (void)setPositiveContentColor:(UIColor *)color;
- (void)setNegativeContentColor:(UIColor *)color;
- (void)updateIsLocked:(bool)isLocked;
@end

View File

@ -30,8 +30,10 @@ static const void *positionChangedKey = &positionChangedKey;
@interface TGIconSwitchView () {
UIImageView *_offIconView;
UIImageView *_onIconView;
UIColor *_negativeContentColor;
bool _stateIsOn;
bool _isLocked;
}
@end
@ -60,13 +62,8 @@ static const void *positionChangedKey = &positionChangedKey;
object_setClass(handleView.layer, subclass);
});
CGPoint offset = CGPointZero;
if (iosMajorVersion() >= 12) {
offset = CGPointMake(-7.0, -3.0);
}
[self updateIconFrame];
_offIconView.frame = CGRectOffset(_offIconView.bounds, TGScreenPixelFloor(21.5f) + offset.x, TGScreenPixelFloor(14.5f) + offset.y);
_onIconView.frame = CGRectOffset(_onIconView.bounds, 20.0f + offset.x, 15.0f + offset.y);
[handleView addSubview:_onIconView];
[handleView addSubview:_offIconView];
@ -92,6 +89,21 @@ static const void *positionChangedKey = &positionChangedKey;
[self updateState:on animated:animated force:true];
}
- (void)updateIconFrame {
CGPoint offset = CGPointZero;
if (iosMajorVersion() >= 12) {
offset = CGPointMake(-7.0, -3.0);
}
if (_isLocked) {
_offIconView.frame = CGRectOffset(_offIconView.bounds, TGScreenPixelFloor(21.5f) + offset.x, TGScreenPixelFloor(12.5f) + offset.y);
} else {
_offIconView.frame = CGRectOffset(_offIconView.bounds, TGScreenPixelFloor(21.5f) + offset.x, TGScreenPixelFloor(14.5f) + offset.y);
}
_onIconView.frame = CGRectOffset(_onIconView.bounds, 20.0f + offset.x, 15.0f + offset.y);
}
- (void)updateState:(bool)on animated:(bool)animated force:(bool)force {
if (_stateIsOn != on || force) {
_stateIsOn = on;
@ -125,7 +137,24 @@ static const void *positionChangedKey = &positionChangedKey;
}
- (void)setNegativeContentColor:(UIColor *)color {
_offIconView.image = TGTintedImage(TGComponentsImageNamed(@"PermissionSwitchOff.png"), color);
_negativeContentColor = color;
if (_isLocked) {
_offIconView.image = TGTintedImage(TGComponentsImageNamed(@"Item List/SwitchLockIcon"), color);
_offIconView.frame = CGRectMake(_offIconView.frame.origin.x, _offIconView.frame.origin.y, _offIconView.image.size.width, _offIconView.image.size.height);
} else {
_offIconView.image = TGTintedImage(TGComponentsImageNamed(@"PermissionSwitchOff.png"), color);
}
}
- (void)updateIsLocked:(bool)isLocked {
if (_isLocked != isLocked) {
_isLocked = isLocked;
if (_negativeContentColor) {
[self setNegativeContentColor:_negativeContentColor];
}
[self updateIconFrame];
}
}
- (void)currentValueChanged {

View File

@ -69,6 +69,8 @@ open class IconSwitchNode: ASDisplayNode {
}
}
private var _isLocked: Bool = false
override public init() {
super.init()
@ -82,8 +84,8 @@ open class IconSwitchNode: ASDisplayNode {
(self.view as! UISwitch).backgroundColor = self.backgroundColor
(self.view as! UISwitch).tintColor = self.frameColor
//(self.view as! UISwitch).thumbTintColor = self.handleColor
(self.view as! UISwitch).onTintColor = self.contentColor
(self.view as? TGIconSwitchView)?.updateIsLocked(self._isLocked)
(self.view as! IconSwitchNodeView).setNegativeContentColor(self.negativeContentColor)
(self.view as! IconSwitchNodeView).setPositiveContentColor(self.positiveContentColor)
@ -99,6 +101,16 @@ open class IconSwitchNode: ASDisplayNode {
}
}
public func updateIsLocked(_ value: Bool) {
if self._isLocked == value {
return
}
self._isLocked = value
if self.isNodeLoaded {
(self.view as? TGIconSwitchView)?.updateIsLocked(value)
}
}
override open func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return CGSize(width: 51.0, height: 31.0)
}

View File

@ -317,6 +317,8 @@ public enum PresentationResourceKey: Int32 {
case hideIconImage
case peerStatusLockedImage
case expandDownArrowImage
case expandSmallDownArrowImage
}
public enum ChatExpiredStoryIndicatorType: Hashable {

View File

@ -414,4 +414,16 @@ public struct PresentationResourcesItemList {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Stickers/SmallLock"), color: theme.list.itemSecondaryTextColor)
})
}
public static func expandDownArrowImage(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.expandDownArrowImage.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Item List/ExpandingItemVerticalRegularArrow"), color: .white)?.withRenderingMode(.alwaysTemplate)
})
}
public static func expandSmallDownArrowImage(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.expandSmallDownArrowImage.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Item List/ExpandingItemVerticalSmallArrow"), color: .white)?.withRenderingMode(.alwaysTemplate)
})
}
}

View File

@ -403,7 +403,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
if let current = node.avatarNode {
avatarNode = current
} else {
avatarNode = AvatarNode(font: avatarPlaceholderFont(size: 11.0))
avatarNode = AvatarNode(font: avatarPlaceholderFont(size: 8.0))
node.avatarNode = avatarNode
node.addSubnode(avatarNode)
}

View File

@ -607,6 +607,7 @@ public final class ListActionItemComponent: Component {
}
}
}
switchNode.isUserInteractionEnabled = toggle.isInteractive
if updateSwitchTheme {
@ -624,11 +625,15 @@ public final class ListActionItemComponent: Component {
var updateSwitchTheme = themeUpdated
if let current = self.iconSwitchNode {
switchNode = current
switchNode.setOn(toggle.isOn, animated: !transition.animation.isImmediate)
switchNode.updateIsLocked(toggle.style == .lock)
if switchNode.isOn != toggle.isOn {
switchNode.setOn(toggle.isOn, animated: !transition.animation.isImmediate)
}
} else {
switchTransition = switchTransition.withAnimation(.none)
updateSwitchTheme = true
switchNode = IconSwitchNode()
switchNode.updateIsLocked(toggle.style == .lock)
switchNode.setOn(toggle.isOn, animated: false)
self.iconSwitchNode = switchNode
self.addSubview(switchNode.view)

View File

@ -7000,7 +7000,14 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
UIPasteboard.general.string = bioText
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: self.presentationData.strings.MyProfile_ToastBioCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
let toastText: String
if let _ = self.data?.peer as? TelegramUser {
toastText = self.presentationData.strings.MyProfile_ToastBioCopied
} else {
toastText = self.presentationData.strings.ChannelProfile_ToastAboutCopied
}
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: toastText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
}
var items: [ContextMenuItem] = []
@ -7027,7 +7034,13 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
})))
}
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.MyProfile_BioActionCopy, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
let copyText: String
if let _ = self.data?.peer as? TelegramUser {
copyText = self.presentationData.strings.MyProfile_BioActionCopy
} else {
copyText = self.presentationData.strings.ChannelProfile_AboutActionCopy
}
items.append(.action(ContextMenuActionItem(text: copyText, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss {
copyAction()
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "delmsgarrow_16.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,92 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
0.000000 -1.000000 1.000000 0.000000 6.177734 10.500000 cm
0.000000 0.000000 0.000000 scn
0.586899 7.409164 m
0.262763 7.733299 -0.262763 7.733299 -0.586899 7.409164 c
-0.911034 7.085029 -0.911034 6.559502 -0.586899 6.235367 c
0.586899 7.409164 l
h
5.000000 1.822266 m
5.586899 1.235367 l
5.911034 1.559502 5.911034 2.085029 5.586899 2.409164 c
5.000000 1.822266 l
h
-0.586899 -2.590836 m
-0.911034 -2.914971 -0.911034 -3.440497 -0.586899 -3.764633 c
-0.262763 -4.088768 0.262763 -4.088768 0.586899 -3.764633 c
-0.586899 -2.590836 l
h
-0.586899 6.235367 m
4.413101 1.235367 l
5.586899 2.409164 l
0.586899 7.409164 l
-0.586899 6.235367 l
h
4.413101 2.409164 m
-0.586899 -2.590836 l
0.586899 -3.764633 l
5.586899 1.235367 l
4.413101 2.409164 l
h
f
n
Q
endstream
endobj
3 0 obj
780
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000000870 00000 n
0000000892 00000 n
0000001065 00000 n
0000001139 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
1198
%%EOF

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "arrow.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,92 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
0.000000 -1.000000 1.000000 0.000000 3.682617 4.500000 cm
0.000000 0.000000 0.000000 scn
0.424264 5.241647 m
0.189949 5.475962 -0.189949 5.475962 -0.424264 5.241647 c
-0.658579 5.007332 -0.658579 4.627433 -0.424264 4.393119 c
0.424264 5.241647 l
h
3.500000 1.317383 m
3.924264 0.893119 l
4.158579 1.127433 4.158579 1.507332 3.924264 1.741647 c
3.500000 1.317383 l
h
-0.424264 -1.758353 m
-0.658579 -1.992668 -0.658579 -2.372567 -0.424264 -2.606881 c
-0.189949 -2.841196 0.189949 -2.841196 0.424264 -2.606881 c
-0.424264 -1.758353 l
h
-0.424264 4.393119 m
3.075736 0.893119 l
3.924264 1.741647 l
0.424264 5.241647 l
-0.424264 4.393119 l
h
3.075736 1.741647 m
-0.424264 -1.758353 l
0.424264 -2.606881 l
3.924264 0.893119 l
3.075736 1.741647 l
h
f
n
Q
endstream
endobj
3 0 obj
779
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 10.000000 6.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000000869 00000 n
0000000891 00000 n
0000001063 00000 n
0000001137 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
1196
%%EOF

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "delmsgusers_16.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,98 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
1.000000 0.000000 -0.000000 1.000000 1.385620 3.388916 cm
0.000000 0.000000 0.000000 scn
4.505642 6.066639 m
5.622485 6.066639 6.527864 6.972019 6.527864 8.088861 c
6.527864 9.205704 5.622485 10.111084 4.505642 10.111084 c
3.388799 10.111084 2.483420 9.205704 2.483420 8.088861 c
2.483420 6.972019 3.388799 6.066639 4.505642 6.066639 c
h
9.128903 6.066618 m
10.086196 6.066618 10.862236 6.842658 10.862236 7.799952 c
10.862236 8.757245 10.086196 9.533284 9.128903 9.533284 c
8.171610 9.533284 7.395570 8.757245 7.395570 7.799952 c
7.395570 6.842658 8.171610 6.066618 9.128903 6.066618 c
h
8.084225 3.303497 m
8.414125 2.965264 8.662351 2.592029 8.849121 2.221855 c
9.037642 1.848210 9.052315 1.480731 8.941890 1.155545 c
8.715535 0.488963 7.963518 0.000092 7.105636 0.000092 c
1.905633 0.000092 l
0.629242 0.000092 -0.412813 1.082295 0.162149 2.221854 c
0.759815 3.406412 1.986777 4.622314 4.505635 4.622314 c
5.505974 4.622314 6.302553 4.430541 6.936879 4.125120 c
6.951430 4.118114 6.965898 4.111050 6.980279 4.103925 c
7.194489 3.997796 7.389868 3.878607 7.568068 3.749475 c
7.759200 3.610973 7.930571 3.461031 8.084225 3.303497 c
h
7.816253 4.510825 m
8.649220 3.970058 9.188520 3.255078 9.535180 2.568007 c
9.778294 2.086163 9.829369 1.599931 9.736712 1.155545 c
11.150474 1.155545 l
12.107767 1.155545 12.888267 1.965531 12.464911 2.824125 c
12.013588 3.739441 11.076003 4.690186 9.128251 4.690186 c
8.623553 4.690186 8.186680 4.626350 7.808517 4.515837 c
7.816253 4.510825 l
h
f*
n
Q
endstream
endobj
3 0 obj
1521
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000001611 00000 n
0000001634 00000 n
0000001807 00000 n
0000001881 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
1940
%%EOF

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "lock.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,91 @@
%PDF-1.7
1 0 obj
<< >>
endobj
2 0 obj
<< /Length 3 0 R >>
stream
/DeviceRGB CS
/DeviceRGB cs
q
1.000000 0.000000 -0.000000 1.000000 0.904785 0.982666 cm
0.000000 0.000000 0.000000 scn
6.094680 16.137451 m
3.493683 16.137451 1.385156 14.028931 1.385156 11.427931 c
1.385156 8.649511 l
0.873086 8.316221 0.469098 7.833959 0.231986 7.261518 c
0.000000 6.701453 0.000000 5.991447 0.000000 4.571436 c
0.000000 3.151424 0.000000 2.441419 0.231986 1.881354 c
0.541301 1.134602 1.134594 0.541308 1.881347 0.231994 c
2.441411 0.000008 3.151414 0.000008 4.571422 0.000008 c
7.619050 0.000008 l
9.039061 0.000008 9.749065 0.000008 10.309130 0.231994 c
11.055882 0.541308 11.649176 1.134602 11.958490 1.881354 c
12.190476 2.441419 12.190476 3.151424 12.190476 4.571436 c
12.190476 5.991447 12.190476 6.701453 11.958490 7.261518 c
11.721206 7.834374 11.316802 8.316923 10.804203 8.650238 c
10.804203 11.427927 l
10.804203 14.028925 8.695679 16.137451 6.094680 16.137451 c
h
9.004204 9.128557 m
9.004204 11.427927 l
9.004204 13.034813 7.701565 14.337451 6.094680 14.337451 c
4.487793 14.337451 3.185156 13.034816 3.185156 11.427931 c
3.185156 9.128514 l
3.559292 9.142864 4.009834 9.142864 4.571427 9.142864 c
7.619054 9.142864 l
8.180087 9.142864 8.630290 9.142864 9.004204 9.128557 c
h
f*
n
Q
endstream
endobj
3 0 obj
1216
endobj
4 0 obj
<< /Annots []
/Type /Page
/MediaBox [ 0.000000 0.000000 14.000000 18.000000 ]
/Resources 1 0 R
/Contents 2 0 R
/Parent 5 0 R
>>
endobj
5 0 obj
<< /Kids [ 4 0 R ]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<< /Pages 5 0 R
/Type /Catalog
>>
endobj
xref
0 7
0000000000 65535 f
0000000010 00000 n
0000000034 00000 n
0000001306 00000 n
0000001329 00000 n
0000001502 00000 n
0000001576 00000 n
trailer
<< /ID [ (some) (id) ]
/Root 6 0 R
/Size 7
>>
startxref
1635
%%EOF

View File

@ -26,7 +26,7 @@ extension ChatControllerImpl {
}
//TODO:localize
let title: String = "Messages Deleted"
var title: String? = messageIds.count == 1 ? "Message Deleted" : "Messages Deleted"
var text: String = ""
var undoRights: [EnginePeer.Id: InitialBannedRights] = [:]
@ -35,9 +35,9 @@ extension ChatControllerImpl {
text.append("\n")
}
if result.reportSpamPeers.count == 1 {
text.append("**1** user reported for spam")
text.append("**1** user reported for spam.")
} else {
text.append("**\(result.reportSpamPeers.count)** users reported for spam")
text.append("**\(result.reportSpamPeers.count)** users reported for spam.")
}
}
if !result.banPeers.isEmpty {
@ -45,9 +45,9 @@ extension ChatControllerImpl {
text.append("\n")
}
if result.banPeers.count == 1 {
text.append("**1** user banned")
text.append("**1** user banned.")
} else {
text.append("**\(result.banPeers.count)** users banned")
text.append("**\(result.banPeers.count)** users banned.")
}
for id in result.banPeers {
if let value = initialUserBannedRights[id] {
@ -60,9 +60,9 @@ extension ChatControllerImpl {
text.append("\n")
}
if result.updateBannedRights.count == 1 {
text.append("**1** user restricted")
text.append("**1** user restricted.")
} else {
text.append("**\(result.updateBannedRights.count)** users restricted")
text.append("**\(result.updateBannedRights.count)** users restricted.")
}
for id in result.banPeers {
if let value = initialUserBannedRights[id] {
@ -92,10 +92,15 @@ extension ChatControllerImpl {
}
}
if text.isEmpty {
text = messageIds.count == 1 ? "Message Deleted." : "Messages Deleted."
title = nil
}
self.present(
UndoOverlayController(
presentationData: self.presentationData,
content: undoRights.isEmpty ? .actionSucceeded(title: text.isEmpty ? nil : title, text: text.isEmpty ? title : text, cancel: nil, destructive: false) : .removedChat(title: title, text: text),
content: undoRights.isEmpty ? .actionSucceeded(title: title, text: text, cancel: nil, destructive: false) : .removedChat(title: title ?? text, text: title == nil ? nil : text),
elevatedLayout: false,
action: { [weak self] action in
guard let self else {
@ -140,12 +145,19 @@ extension ChatControllerImpl {
guard let self, let chatPeer else {
return
}
var peers: [EnginePeer] = []
var renderedParticipants: [RenderedChannelParticipant] = []
var initialUserBannedRights: [EnginePeer.Id: InitialBannedRights] = [:]
for maybeParticipant in participants {
guard let participant = maybeParticipant else {
continue
}
guard let peer = authors.first(where: { $0.id == participant.peerId }) else {
continue
}
renderedParticipants.append(RenderedChannelParticipant(
participant: participant,
peer: peer
))
switch participant {
case .creator:
break
@ -157,13 +169,10 @@ extension ChatControllerImpl {
}
}
}
for author in authors {
peers.append(EnginePeer(author))
}
self.push(AdminUserActionsSheet(
context: self.context,
chatPeer: chatPeer,
peers: peers,
peers: renderedParticipants,
messageCount: messageIds.count,
completion: { [weak self] result in
guard let self else {
@ -186,6 +195,9 @@ extension ChatControllerImpl {
|> deliverOnMainQueue).startStrict(next: { [weak self] participant in
if let strongSelf = self {
if "".isEmpty {
guard let participant else {
return
}
let _ = (strongSelf.context.engine.data.get(
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId),
TelegramEngine.EngineData.Item.Peer.Peer(id: author.id)
@ -198,22 +210,23 @@ extension ChatControllerImpl {
return
}
var initialUserBannedRights: [EnginePeer.Id: InitialBannedRights] = [:]
if let participant {
switch participant {
case .creator:
break
case let .member(_, _, _, banInfo, _):
if let banInfo {
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: banInfo.rights)
} else {
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: nil)
}
switch participant {
case .creator:
break
case let .member(_, _, _, banInfo, _):
if let banInfo {
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: banInfo.rights)
} else {
initialUserBannedRights[participant.peerId] = InitialBannedRights(value: nil)
}
}
self.push(AdminUserActionsSheet(
context: self.context,
chatPeer: chatPeer,
peers: [authorPeer],
peers: [RenderedChannelParticipant(
participant: participant,
peer: authorPeer._asPeer()
)],
messageCount: messageIds.count,
completion: { [weak self] result in
guard let self else {

View File

@ -2182,7 +2182,7 @@ func chatAvailableMessageActionsImpl(engine: TelegramEngine, accountPeerId: Peer
if message.flags.contains(.Incoming) {
optionsMap[id]!.insert(.report)
}
if channel.hasPermission(.banMembers), case .group = channel.info {
if (channel.hasPermission(.banMembers) || channel.hasPermission(.deleteAllMessages)), case .group = channel.info {
if message.flags.contains(.Incoming) {
if let author = message.author {
if author is TelegramUser {

View File

@ -1501,10 +1501,18 @@ public final class WebAppController: ViewController, AttachmentContainable {
var alertTitle: String?
let alertText: String
if let reason {
alertTitle = self.presentationData.strings.WebApp_AlertBiometryAccessText(botPeer.compactDisplayTitle).string
if case .touchId = LocalAuth.biometricAuthentication {
alertTitle = self.presentationData.strings.WebApp_AlertBiometryAccessTouchIDText(botPeer.compactDisplayTitle).string
} else {
alertTitle = self.presentationData.strings.WebApp_AlertBiometryAccessText(botPeer.compactDisplayTitle).string
}
alertText = reason
} else {
alertText = self.presentationData.strings.WebApp_AlertBiometryAccessText(botPeer.compactDisplayTitle).string
if case .touchId = LocalAuth.biometricAuthentication {
alertText = self.presentationData.strings.WebApp_AlertBiometryAccessTouchIDText(botPeer.compactDisplayTitle).string
} else {
alertText = self.presentationData.strings.WebApp_AlertBiometryAccessText(botPeer.compactDisplayTitle).string
}
}
controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: alertTitle, text: alertText, actions: [
TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_No, action: {