mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
96256c99bb
commit
660234168d
@ -6065,9 +6065,10 @@ Sorry for the inconvenience.";
|
||||
"BroadcastGroups.Cancel" = "Leave as regular group";
|
||||
|
||||
"BroadcastGroups.ConfirmationAlert.Title" = "Are you sure?";
|
||||
"BroadcastGroups.ConfirmationAlert.Text" = "Do you want to convert your group to a channel? This action cannot be undone.";
|
||||
"BroadcastGroups.ConfirmationAlert.Text" = "Regular members of the group (non-admins) will irrevocably lose their right to post messages in the group.\n\nThis action **cannot** be undone.";
|
||||
"BroadcastGroups.ConfirmationAlert.Convert" = "Convert";
|
||||
|
||||
"BroadcastGroups.LimitAlert.Title" = "Limit Reached";
|
||||
"BroadcastGroups.LimitAlert.Text" = "Your group has reached a limit of **%@** members. You can increase this limit by converting the group to a **broadcast group** where only admins can post. Interested?";
|
||||
"BroadcastGroups.LimitAlert.LearnMore" = "Learn More";
|
||||
"BroadcastGroups.LimitAlert.SettingsTip" = "If you change your mind, go to the settings of your group.";
|
||||
|
@ -17,6 +17,7 @@ import PresentationDataUtils
|
||||
import ItemListPeerItem
|
||||
import TelegramPermissionsUI
|
||||
import ItemListPeerActionItem
|
||||
import Markdown
|
||||
|
||||
private final class ChannelPermissionsControllerArguments {
|
||||
let context: AccountContext
|
||||
@ -29,11 +30,11 @@ private final class ChannelPermissionsControllerArguments {
|
||||
let openPeerInfo: (Peer) -> Void
|
||||
let openKicked: () -> Void
|
||||
let presentRestrictedPermissionAlert: (TelegramChatBannedRightsFlags) -> Void
|
||||
let presentConversionToChannel: () -> Void
|
||||
let presentConversionToBroadcastGroup: () -> Void
|
||||
let openChannelExample: () -> Void
|
||||
let updateSlowmode: (Int32) -> Void
|
||||
|
||||
init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (PeerId) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (Peer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToChannel: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void) {
|
||||
init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (PeerId) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (Peer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToBroadcastGroup: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void) {
|
||||
self.context = context
|
||||
self.updatePermission = updatePermission
|
||||
self.addPeer = addPeer
|
||||
@ -43,7 +44,7 @@ private final class ChannelPermissionsControllerArguments {
|
||||
self.openPeerInfo = openPeerInfo
|
||||
self.openKicked = openKicked
|
||||
self.presentRestrictedPermissionAlert = presentRestrictedPermissionAlert
|
||||
self.presentConversionToChannel = presentConversionToChannel
|
||||
self.presentConversionToBroadcastGroup = presentConversionToBroadcastGroup
|
||||
self.openChannelExample = openChannelExample
|
||||
self.updateSlowmode = updateSlowmode
|
||||
}
|
||||
@ -277,7 +278,7 @@ private enum ChannelPermissionsEntry: ItemListNodeEntry {
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: value, sectionId: self.section)
|
||||
case let .conversion(_, text):
|
||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks) {
|
||||
arguments.presentConversionToChannel()
|
||||
arguments.presentConversionToBroadcastGroup()
|
||||
}
|
||||
case let .conversionInfo(_, value):
|
||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(value), sectionId: self.section) { _ in
|
||||
@ -465,10 +466,10 @@ private func channelPermissionsControllerEntries(presentationData: PresentationD
|
||||
rightIndex += 1
|
||||
}
|
||||
|
||||
if channel.flags.contains(.isCreator) && effectiveRightsFlags.contains(.banSendMessages) {
|
||||
if channel.flags.contains(.isCreator) && effectiveRightsFlags.contains(.banSendMessages) && !channel.flags.contains(.isGigagroup) {
|
||||
entries.append(.conversionHeader(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastTitle.uppercased()))
|
||||
entries.append(.conversion(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvert))
|
||||
entries.append(.conversionInfo(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvertInfo))
|
||||
entries.append(.conversionInfo(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvertInfo(presentationStringsFormattedNumber(200000, presentationData.dateTimeFormat.groupingSeparator)).0))
|
||||
} else {
|
||||
entries.append(.slowmodeHeader(presentationData.theme, presentationData.strings.GroupInfo_Permissions_SlowmodeHeader))
|
||||
entries.append(.slowmode(presentationData.theme, presentationData.strings, state.modifiedSlowmodeTimeout ?? (cachedData.slowModeTimeout ?? 0)))
|
||||
@ -752,18 +753,26 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|
||||
}
|
||||
}
|
||||
})
|
||||
}, presentConversionToChannel: {
|
||||
}, presentConversionToBroadcastGroup: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let controller = PermissionController(context: context, splashScreen: true)
|
||||
controller.navigationPresentation = .modal
|
||||
controller.setState(.custom(icon: .animation("BroadcastGroup"), title: presentationData.strings.BroadcastGroups_IntroTitle, subtitle: nil, text: presentationData.strings.BroadcastGroups_IntroText, buttonTitle: presentationData.strings.BroadcastGroups_Convert, secondaryButtonTitle: presentationData.strings.BroadcastGroups_Cancel, footerText: nil), animated: false)
|
||||
controller.proceed = { result in
|
||||
presentControllerImpl?(textAlertController(context: context, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Title, text: presentationData.strings.BroadcastGroups_ConfirmationAlert_Text, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Convert, action: {
|
||||
let attributedTitle = NSAttributedString(string: presentationData.strings.BroadcastGroups_ConfirmationAlert_Title, font: Font.medium(17.0), textColor: presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
|
||||
let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let attributedText = parseMarkdownIntoAttributedString(presentationData.strings.BroadcastGroups_ConfirmationAlert_Text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
|
||||
|
||||
let alertController = richTextAlertController(context: context, title: attributedTitle, text: attributedText, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Convert, action: { [weak controller] in
|
||||
controller?.dismiss()
|
||||
|
||||
})]), nil)
|
||||
|
||||
// (strongSelf.navigationController as? NavigationController)?.replaceTopController(createChannelController(context: strongSelf.context), animated: true)
|
||||
|
||||
let _ = (convertGroupToGigagroup(account: context.account, peerId: originalPeerId)
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
|
||||
})
|
||||
})])
|
||||
presentControllerImpl?(alertController, nil)
|
||||
}
|
||||
pushControllerImpl?(controller)
|
||||
}, openChannelExample: {
|
||||
|
@ -108,7 +108,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
|
||||
if (flags & Int32(1 << 25)) != 0 {
|
||||
channelFlags.insert(.isFake)
|
||||
}
|
||||
if (flags & Int32(1 << 25)) != 0 {
|
||||
if (flags & Int32(1 << 26)) != 0 {
|
||||
channelFlags.insert(.isGigagroup)
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
@ -61,6 +62,8 @@ import GalleryData
|
||||
import ChatInterfaceState
|
||||
import InviteLinksUI
|
||||
import ChatHistoryImportTasks
|
||||
import Markdown
|
||||
import TelegramPermissionsUI
|
||||
|
||||
extension ChatLocation {
|
||||
var peerId: PeerId {
|
||||
@ -7030,12 +7033,40 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if values.contains(.convertToGigagroup) && !strongSelf.displayedConvertToGigagroupSuggestion {
|
||||
strongSelf.displayedConvertToGigagroupSuggestion = true
|
||||
|
||||
// let attributedTitle = NSAttributedString(string: strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_Title, font: Font.medium(17.0), textColor: theme.primaryColor, paragraphAlignment: .center)
|
||||
// let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: theme.primaryColor)
|
||||
// let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: theme.primaryColor)
|
||||
// let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
|
||||
//
|
||||
//// let controller = richTextAlertController(context: strongSelf.context, title: <#T##NSAttributedString?#>, text: <#T##NSAttributedString#>, actions: <#T##[TextAlertAction]#>)
|
||||
let attributedTitle = NSAttributedString(string: strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_Title, font: Font.medium(17.0), textColor: strongSelf.presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
|
||||
let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: strongSelf.presentationData.theme.actionSheet.primaryTextColor)
|
||||
let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: strongSelf.presentationData.theme.actionSheet.primaryTextColor)
|
||||
let text = strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_Text(presentationStringsFormattedNumber(200000, strongSelf.presentationData.dateTimeFormat.groupingSeparator)).0
|
||||
let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
|
||||
|
||||
let controller = richTextAlertController(context: strongSelf.context, title: attributedTitle, text: attributedText, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {
|
||||
strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .info(text: strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_SettingsTip), elevatedLayout: false, action: { _ in return false }), in: .current)
|
||||
}), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.BroadcastGroups_LimitAlert_LearnMore, action: {
|
||||
|
||||
let context = strongSelf.context
|
||||
let presentationData = strongSelf.presentationData
|
||||
let controller = PermissionController(context: context, splashScreen: true)
|
||||
controller.navigationPresentation = .modal
|
||||
controller.setState(.custom(icon: .animation("BroadcastGroup"), title: presentationData.strings.BroadcastGroups_IntroTitle, subtitle: nil, text: presentationData.strings.BroadcastGroups_IntroText, buttonTitle: presentationData.strings.BroadcastGroups_Convert, secondaryButtonTitle: presentationData.strings.BroadcastGroups_Cancel, footerText: nil), animated: false)
|
||||
controller.proceed = { result in
|
||||
let attributedTitle = NSAttributedString(string: presentationData.strings.BroadcastGroups_ConfirmationAlert_Title, font: Font.medium(17.0), textColor: presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center)
|
||||
let body = MarkdownAttributeSet(font: Font.regular(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let bold = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let attributedText = parseMarkdownIntoAttributedString(presentationData.strings.BroadcastGroups_ConfirmationAlert_Text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .center)
|
||||
|
||||
let alertController = richTextAlertController(context: context, title: attributedTitle, text: attributedText, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.BroadcastGroups_ConfirmationAlert_Convert, action: { [weak controller] in
|
||||
controller?.dismiss()
|
||||
|
||||
let _ = (convertGroupToGigagroup(account: context.account, peerId: peerId)
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
|
||||
})
|
||||
})])
|
||||
strongSelf.present(alertController, in: .window(.root))
|
||||
}
|
||||
strongSelf.push(controller)
|
||||
})])
|
||||
strongSelf.present(controller, in: .window(.root))
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
isMember = true
|
||||
}
|
||||
}
|
||||
|
||||
if isMember && channel.hasBannedPermission(.banSendMessages) != nil {
|
||||
|
||||
if isMember && channel.hasBannedPermission(.banSendMessages) != nil && !channel.flags.contains(.isGigagroup) {
|
||||
if let currentPanel = (currentPanel as? ChatRestrictedInputPanelNode) ?? (currentSecondaryPanel as? ChatRestrictedInputPanelNode) {
|
||||
return (currentPanel, nil)
|
||||
} else {
|
||||
@ -191,7 +191,18 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
}
|
||||
}
|
||||
case .member:
|
||||
break
|
||||
if channel.flags.contains(.isGigagroup) && !channel.hasPermission(.sendMessages) {
|
||||
if let currentPanel = (currentPanel as? ChatChannelSubscriberInputPanelNode) ?? (currentSecondaryPanel as? ChatChannelSubscriberInputPanelNode) {
|
||||
return (currentPanel, nil)
|
||||
} else {
|
||||
let panel = ChatChannelSubscriberInputPanelNode()
|
||||
panel.interfaceInteraction = interfaceInteraction
|
||||
panel.context = context
|
||||
return (panel, nil)
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let group = peer as? TelegramGroup {
|
||||
|
Loading…
x
Reference in New Issue
Block a user