UI improvements

This commit is contained in:
Ali
2023-01-22 00:01:06 +04:00
parent ac34aac586
commit 55d076a494
17 changed files with 178 additions and 95 deletions

View File

@@ -18157,17 +18157,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var itemList: [String] = []
var flags: TelegramChatBannedRightsFlags = []
if let channel = peer as? TelegramChannel {
if let bannedRights = channel.bannedRights {
flags = bannedRights.flags
}
} else if let group = peer as? TelegramGroup {
if let bannedRights = group.defaultBannedRights {
flags = bannedRights.flags
}
}
let order: [TelegramChatBannedRightsFlags] = [
.banSendText,
.banSendPhotos,
@@ -18180,32 +18169,40 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
]
for right in order {
if !flags.contains(right) {
var title: String?
switch right {
case .banSendText:
title = "text messages"
case .banSendPhotos:
title = "photos"
case .banSendVideos:
title = "videos"
case .banSendVoice:
title = "voice messages"
case .banSendInstantVideos:
title = "video messages"
case .banSendFiles:
title = "files"
case .banSendMusic:
title = "music"
case .banSendStickers:
title = "Stickers & GIFs"
default:
break
if let channel = peer as? TelegramChannel {
if channel.hasBannedPermission(right) != nil {
continue
}
if let title {
itemList.append(title)
} else if let group = peer as? TelegramGroup {
if group.hasBannedPermission(right) {
continue
}
}
var title: String?
switch right {
case .banSendText:
title = "text messages"
case .banSendPhotos:
title = "photos"
case .banSendVideos:
title = "videos"
case .banSendVoice:
title = "voice messages"
case .banSendInstantVideos:
title = "video messages"
case .banSendFiles:
title = "files"
case .banSendMusic:
title = "music"
case .banSendStickers:
title = "Stickers & GIFs"
default:
break
}
if let title {
itemList.append(title)
}
}
if itemList.isEmpty {