diff --git a/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift b/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift index 360e9656e8..6c7a30bfc5 100644 --- a/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift @@ -711,7 +711,7 @@ private func channelVisibilityControllerEntries(presentationData: PresentationDa entries.append(.forwardingHeader(presentationData.theme, isGroup ? presentationData.strings.Group_Setup_ForwardingGroupTitle.uppercased() : presentationData.strings.Group_Setup_ForwardingChannelTitle.uppercased())) entries.append(.forwardingEnabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, forwardingEnabled)) - entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingEnabled, !forwardingEnabled)) + entries.append(.forwardingDisabled(presentationData.theme, presentationData.strings.Group_Setup_ForwardingDisabled, !forwardingEnabled)) entries.append(.forwardingInfo(presentationData.theme, isGroup ? presentationData.strings.Group_Setup_ForwardingGroupInfo : presentationData.strings.Group_Setup_ForwardingChannelInfo)) } else if let _ = view.peers[view.peerId] as? TelegramGroup { @@ -955,6 +955,9 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta let revokeLinkDisposable = MetaDisposable() actionsDisposable.add(revokeLinkDisposable) + let toggleCopyProtectionDisposable = MetaDisposable() + actionsDisposable.add(toggleCopyProtectionDisposable) + let arguments = ChannelVisibilityControllerArguments(context: context, updateCurrentType: { type in updateState { state in return state.withUpdatedSelectedType(type) @@ -1224,6 +1227,10 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta return state } + if let updatedCopyProtection = state.forwardingEnabled { + toggleCopyProtectionDisposable.set(context.engine.peers.toggleMessageCopyProtection(peerId: peerId, enabled: updatedCopyProtection).start()) + } + if let updatedAddressNameValue = updatedAddressNameValue { let invokeAction: () -> Void = { updateState { state in @@ -1300,6 +1307,10 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta return state } + if let updatedCopyProtection = state.forwardingEnabled { + toggleCopyProtectionDisposable.set(context.engine.peers.toggleMessageCopyProtection(peerId: peerId, enabled: updatedCopyProtection).start()) + } + if let updatedAddressNameValue = updatedAddressNameValue { let invokeAction: () -> Void = { updateState { state in diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 8525d4b2ed..266ee16fe8 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -3849,7 +3849,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G self.inputActivityDisposable = (self.typingActivityPromise.get() |> deliverOnMainQueue).start(next: { [weak self] value in - if let strongSelf = self { + if let strongSelf = self, strongSelf.presentationInterfaceState.interfaceState.editMessage == nil && strongSelf.presentationInterfaceState.subject != .scheduledMessages && strongSelf.presentationInterfaceState.currentSendAsPeerId == nil { strongSelf.context.account.updateLocalInputActivity(peerId: activitySpace, activity: .typingText, isPresent: value) } }) @@ -3863,7 +3863,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } } |> deliverOnMainQueue).start(next: { [weak self] value in - if let strongSelf = self { + if let strongSelf = self, strongSelf.presentationInterfaceState.interfaceState.editMessage == nil && strongSelf.presentationInterfaceState.subject != .scheduledMessages && strongSelf.presentationInterfaceState.currentSendAsPeerId == nil { if value { strongSelf.context.account.updateLocalInputActivity(peerId: activitySpace, activity: .typingText, isPresent: false) } @@ -3873,7 +3873,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G self.recordingActivityDisposable = (self.recordingActivityPromise.get() |> deliverOnMainQueue).start(next: { [weak self] value in - if let strongSelf = self { + if let strongSelf = self, strongSelf.presentationInterfaceState.interfaceState.editMessage == nil && strongSelf.presentationInterfaceState.subject != .scheduledMessages && strongSelf.presentationInterfaceState.currentSendAsPeerId == nil { strongSelf.acquiredRecordingActivityDisposable?.dispose() switch value { case .voice: @@ -5347,7 +5347,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } } self.chatDisplayNode.updateTypingActivity = { [weak self] value in - if let strongSelf = self, strongSelf.presentationInterfaceState.interfaceState.editMessage == nil && strongSelf.presentationInterfaceState.subject != .scheduledMessages { + if let strongSelf = self { if value { strongSelf.typingActivityPromise.set(Signal.single(true) |> then( diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 309249b98b..077f4fde8f 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -436,7 +436,6 @@ private final class PeerInfoInteraction { let editingOpenInviteLinksSetup: () -> Void let editingOpenDiscussionGroupSetup: () -> Void let editingToggleMessageSignatures: (Bool) -> Void - let editingToggleChannelMessageCopyProtection: (Bool) -> Void let openParticipantsSection: (PeerInfoParticipantsSection) -> Void let editingOpenPreHistorySetup: () -> Void let editingOpenAutoremoveMesages: () -> Void @@ -477,7 +476,6 @@ private final class PeerInfoInteraction { editingOpenInviteLinksSetup: @escaping () -> Void, editingOpenDiscussionGroupSetup: @escaping () -> Void, editingToggleMessageSignatures: @escaping (Bool) -> Void, - editingToggleChannelMessageCopyProtection: @escaping (Bool) -> Void, openParticipantsSection: @escaping (PeerInfoParticipantsSection) -> Void, editingOpenPreHistorySetup: @escaping () -> Void, editingOpenAutoremoveMesages: @escaping () -> Void, @@ -517,7 +515,6 @@ private final class PeerInfoInteraction { self.editingOpenInviteLinksSetup = editingOpenInviteLinksSetup self.editingOpenDiscussionGroupSetup = editingOpenDiscussionGroupSetup self.editingToggleMessageSignatures = editingToggleMessageSignatures - self.editingToggleChannelMessageCopyProtection = editingToggleChannelMessageCopyProtection self.openParticipantsSection = openParticipantsSection self.editingOpenPreHistorySetup = editingOpenPreHistorySetup self.editingOpenAutoremoveMesages = editingOpenAutoremoveMesages @@ -1117,7 +1114,6 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr let ItemDiscussionGroup = 3 let ItemSignMessages = 4 let ItemSignMessagesHelp = 5 - let ItemCopyProtection = 6 if channel.flags.contains(.isCreator) { let linkText: String @@ -1166,7 +1162,6 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr if channel.flags.contains(.isCreator) || (channel.adminRights != nil && channel.hasPermission(.sendMessages)) { let messagesShouldHaveSignatures: Bool - let messagesCopyProtection = channel.flags.contains(.copyProtectionEnabled) switch channel.info { case let .broadcast(info): messagesShouldHaveSignatures = info.flags.contains(.messagesShouldHaveSignatures) @@ -1177,10 +1172,6 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr interaction.editingToggleMessageSignatures(value) })) items[.peerSettings]!.append(PeerInfoScreenCommentItem(id: ItemSignMessagesHelp, text: presentationData.strings.Channel_SignMessages_Help)) - - items[.peerAdditionalSettings]!.append(PeerInfoScreenSwitchItem(id: ItemCopyProtection, text: "Restrict Saving Content", value: messagesCopyProtection, icon: UIImage(bundleImageName: "Chat/Info/GroupSignIcon"), toggled: { value in - interaction.editingToggleChannelMessageCopyProtection(value) - })) } case .group: let ItemUsername = 101 @@ -1597,9 +1588,6 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate editingToggleMessageSignatures: { [weak self] value in self?.editingToggleMessageSignatures(value: value) }, - editingToggleChannelMessageCopyProtection: { [weak self] value in - self?.editingToggleMessageCopyProtection(value: value) - }, openParticipantsSection: { [weak self] section in self?.openParticipantsSection(section: section) }, @@ -4708,11 +4696,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate private func editingToggleMessageSignatures(value: Bool) { self.toggleShouldChannelMessagesSignaturesDisposable.set(self.context.engine.peers.toggleShouldChannelMessagesSignatures(peerId: self.peerId, enabled: value).start()) } - - private func editingToggleMessageCopyProtection(value: Bool) { - self.toggleMessageCopyProtectionDisposable.set(self.context.engine.peers.toggleMessageCopyProtection(peerId: self.peerId, enabled: value).start()) - } - + private func openParticipantsSection(section: PeerInfoParticipantsSection) { guard let data = self.data, let peer = data.peer else { return