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 subject: Signal<Subject?, NoError>
|
||||
fileprivate let isEditingStory: Bool
|
||||
fileprivate let customTarget: EnginePeer.Id?
|
||||
|
||||
fileprivate let initialCaption: NSAttributedString?
|
||||
fileprivate let initialPrivacy: EngineStoryPrivacy?
|
||||
@ -3859,6 +3860,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
public init(
|
||||
context: AccountContext,
|
||||
subject: Signal<Subject?, NoError>,
|
||||
customTarget: EnginePeer.Id? = nil,
|
||||
isEditing: Bool,
|
||||
initialCaption: NSAttributedString? = nil,
|
||||
initialPrivacy: EngineStoryPrivacy? = nil,
|
||||
@ -3870,6 +3872,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
) {
|
||||
self.context = context
|
||||
self.subject = subject
|
||||
self.customTarget = customTarget
|
||||
self.isEditingStory = isEditing
|
||||
self.initialCaption = initialCaption
|
||||
self.initialPrivacy = initialPrivacy
|
||||
@ -3976,6 +3979,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
let controller = ShareWithPeersScreen(
|
||||
context: self.context,
|
||||
initialPrivacy: initialPrivacy,
|
||||
initialSendAsPeerId: self.customTarget,
|
||||
allowScreenshots: !privacy.isForwardingDisabled,
|
||||
pin: privacy.pin,
|
||||
timeout: privacy.timeout,
|
||||
|
@ -323,6 +323,7 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
private var isDismissed: Bool = false
|
||||
|
||||
private var sendAsPeerId: EnginePeer.Id?
|
||||
private var isCustomTarget = false
|
||||
|
||||
private var selectedPeers: [EnginePeer.Id] = []
|
||||
private var selectedGroups: [EnginePeer.Id] = []
|
||||
@ -1039,7 +1040,7 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
var isStories = false
|
||||
var accessory: PeerListItemComponent.RightAccessory
|
||||
if case .stories = component.stateContext.subject {
|
||||
accessory = .disclosure
|
||||
accessory = self.isCustomTarget ? .none : .disclosure
|
||||
isStories = true
|
||||
} else {
|
||||
if let selectedPeerId = self.sendAsPeerId {
|
||||
@ -1070,7 +1071,9 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
return
|
||||
}
|
||||
if isStories {
|
||||
if !self.isCustomTarget {
|
||||
let _ = self.presentSendAsPeer()
|
||||
}
|
||||
} else {
|
||||
if peer.id.namespace == Namespaces.Peer.CloudUser {
|
||||
self.component?.peerCompletion(peer.id)
|
||||
@ -1824,7 +1827,10 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
let containerSideInset = floorToScreenPixels((availableSize.width - containerWidth) / 2.0)
|
||||
|
||||
if self.component == nil {
|
||||
self.sendAsPeerId = component.initialSendAsPeerId
|
||||
if let sendAsPeerId = component.initialSendAsPeerId {
|
||||
self.sendAsPeerId = sendAsPeerId
|
||||
self.isCustomTarget = true
|
||||
}
|
||||
|
||||
switch component.initialPrivacy.base {
|
||||
case .everyone:
|
||||
|
@ -352,6 +352,7 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
|
||||
let controller = MediaEditorScreen(
|
||||
context: context,
|
||||
subject: subject,
|
||||
customTarget: customTarget,
|
||||
isEditing: false,
|
||||
transitionIn: transitionIn,
|
||||
transitionOut: { finished, isNew in
|
||||
|
Loading…
x
Reference in New Issue
Block a user