mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Lock target peer selection when posting from channel profile
This commit is contained in:
parent
a254de2731
commit
41c7564af8
@ -3836,6 +3836,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
fileprivate let context: AccountContext
|
fileprivate let context: AccountContext
|
||||||
fileprivate let subject: Signal<Subject?, NoError>
|
fileprivate let subject: Signal<Subject?, NoError>
|
||||||
fileprivate let isEditingStory: Bool
|
fileprivate let isEditingStory: Bool
|
||||||
|
fileprivate let customTarget: EnginePeer.Id?
|
||||||
|
|
||||||
fileprivate let initialCaption: NSAttributedString?
|
fileprivate let initialCaption: NSAttributedString?
|
||||||
fileprivate let initialPrivacy: EngineStoryPrivacy?
|
fileprivate let initialPrivacy: EngineStoryPrivacy?
|
||||||
@ -3859,6 +3860,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
public init(
|
public init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
subject: Signal<Subject?, NoError>,
|
subject: Signal<Subject?, NoError>,
|
||||||
|
customTarget: EnginePeer.Id? = nil,
|
||||||
isEditing: Bool,
|
isEditing: Bool,
|
||||||
initialCaption: NSAttributedString? = nil,
|
initialCaption: NSAttributedString? = nil,
|
||||||
initialPrivacy: EngineStoryPrivacy? = nil,
|
initialPrivacy: EngineStoryPrivacy? = nil,
|
||||||
@ -3870,6 +3872,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
|
self.customTarget = customTarget
|
||||||
self.isEditingStory = isEditing
|
self.isEditingStory = isEditing
|
||||||
self.initialCaption = initialCaption
|
self.initialCaption = initialCaption
|
||||||
self.initialPrivacy = initialPrivacy
|
self.initialPrivacy = initialPrivacy
|
||||||
@ -3976,6 +3979,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
let controller = ShareWithPeersScreen(
|
let controller = ShareWithPeersScreen(
|
||||||
context: self.context,
|
context: self.context,
|
||||||
initialPrivacy: initialPrivacy,
|
initialPrivacy: initialPrivacy,
|
||||||
|
initialSendAsPeerId: self.customTarget,
|
||||||
allowScreenshots: !privacy.isForwardingDisabled,
|
allowScreenshots: !privacy.isForwardingDisabled,
|
||||||
pin: privacy.pin,
|
pin: privacy.pin,
|
||||||
timeout: privacy.timeout,
|
timeout: privacy.timeout,
|
||||||
|
@ -323,6 +323,7 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
private var isDismissed: Bool = false
|
private var isDismissed: Bool = false
|
||||||
|
|
||||||
private var sendAsPeerId: EnginePeer.Id?
|
private var sendAsPeerId: EnginePeer.Id?
|
||||||
|
private var isCustomTarget = false
|
||||||
|
|
||||||
private var selectedPeers: [EnginePeer.Id] = []
|
private var selectedPeers: [EnginePeer.Id] = []
|
||||||
private var selectedGroups: [EnginePeer.Id] = []
|
private var selectedGroups: [EnginePeer.Id] = []
|
||||||
@ -1039,7 +1040,7 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
var isStories = false
|
var isStories = false
|
||||||
var accessory: PeerListItemComponent.RightAccessory
|
var accessory: PeerListItemComponent.RightAccessory
|
||||||
if case .stories = component.stateContext.subject {
|
if case .stories = component.stateContext.subject {
|
||||||
accessory = .disclosure
|
accessory = self.isCustomTarget ? .none : .disclosure
|
||||||
isStories = true
|
isStories = true
|
||||||
} else {
|
} else {
|
||||||
if let selectedPeerId = self.sendAsPeerId {
|
if let selectedPeerId = self.sendAsPeerId {
|
||||||
@ -1070,7 +1071,9 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if isStories {
|
if isStories {
|
||||||
let _ = self.presentSendAsPeer()
|
if !self.isCustomTarget {
|
||||||
|
let _ = self.presentSendAsPeer()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if peer.id.namespace == Namespaces.Peer.CloudUser {
|
if peer.id.namespace == Namespaces.Peer.CloudUser {
|
||||||
self.component?.peerCompletion(peer.id)
|
self.component?.peerCompletion(peer.id)
|
||||||
@ -1114,7 +1117,7 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
|
|
||||||
if let previousController = navigationController?.viewControllers.reversed().first(where: { $0 is ShareWithPeersScreen}) as? ShareWithPeersScreen {
|
if let previousController = navigationController?.viewControllers.reversed().first(where: { $0 is ShareWithPeersScreen}) as? ShareWithPeersScreen {
|
||||||
previousController.dismiss(completion: { [weak navigationController] in
|
previousController.dismiss(completion: { [weak navigationController] in
|
||||||
Queue.mainQueue().justDispatch {
|
Queue.mainQueue().justDispatch {
|
||||||
if let controller = navigationController?.viewControllers.last as? ViewController {
|
if let controller = navigationController?.viewControllers.last as? ViewController {
|
||||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: true, position: .top, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: true, position: .top, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||||
}
|
}
|
||||||
@ -1824,7 +1827,10 @@ final class ShareWithPeersScreenComponent: Component {
|
|||||||
let containerSideInset = floorToScreenPixels((availableSize.width - containerWidth) / 2.0)
|
let containerSideInset = floorToScreenPixels((availableSize.width - containerWidth) / 2.0)
|
||||||
|
|
||||||
if self.component == nil {
|
if self.component == nil {
|
||||||
self.sendAsPeerId = component.initialSendAsPeerId
|
if let sendAsPeerId = component.initialSendAsPeerId {
|
||||||
|
self.sendAsPeerId = sendAsPeerId
|
||||||
|
self.isCustomTarget = true
|
||||||
|
}
|
||||||
|
|
||||||
switch component.initialPrivacy.base {
|
switch component.initialPrivacy.base {
|
||||||
case .everyone:
|
case .everyone:
|
||||||
|
@ -352,6 +352,7 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
|
|||||||
let controller = MediaEditorScreen(
|
let controller = MediaEditorScreen(
|
||||||
context: context,
|
context: context,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
|
customTarget: customTarget,
|
||||||
isEditing: false,
|
isEditing: false,
|
||||||
transitionIn: transitionIn,
|
transitionIn: transitionIn,
|
||||||
transitionOut: { finished, isNew in
|
transitionOut: { finished, isNew in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user