Refactoring
This commit is contained in:
parent
a4d630bf24
commit
16c630b946
83 changed files with 838 additions and 889 deletions
|
|
@ -1519,7 +1519,7 @@ public protocol SharedAccountContext: AnyObject {
|
|||
func makeGiftDemoScreen(context: AccountContext) -> ViewController
|
||||
func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController
|
||||
func makeContentReportScreen(context: AccountContext, subject: ReportContentSubject, forceDark: Bool, present: @escaping (ViewController) -> Void, completion: @escaping () -> Void, requestSelectMessages: ((String, Data, String?) -> Void)?)
|
||||
func makeShareController(context: AccountContext, subject: ShareControllerSubject, forceExternal: Bool, shareStory: (() -> Void)?, enqueued: (([PeerId], [Int64]) -> Void)?, actionCompleted: (() -> Void)?) -> ViewController
|
||||
func makeShareController(context: AccountContext, params: ShareControllerParams) -> ViewController
|
||||
func makeMiniAppListScreenInitialData(context: AccountContext) -> Signal<MiniAppListScreenInitialData, NoError>
|
||||
func makeMiniAppListScreen(context: AccountContext, initialData: MiniAppListScreenInitialData) -> ViewController
|
||||
func makeIncomingMessagePrivacyScreen(context: AccountContext, value: GlobalPrivacySettings.NonContactChatsPrivacy, exceptions: SelectivePrivacySettings, update: @escaping (GlobalPrivacySettings.NonContactChatsPrivacy) -> Void) -> ViewController
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import TelegramPresentationData
|
|||
import TelegramUIPreferences
|
||||
import AnimationCache
|
||||
import MultiAnimationRenderer
|
||||
import Display
|
||||
|
||||
public enum StorySharingSubject {
|
||||
case messages([Message])
|
||||
|
|
@ -37,6 +38,43 @@ public protocol ShareControllerEnvironment: AnyObject {
|
|||
func donateSendMessageIntent(account: ShareControllerAccountContext, peerIds: [EnginePeer.Id])
|
||||
}
|
||||
|
||||
public final class ShareControllerAppAccountContext: ShareControllerAccountContext {
|
||||
public let context: AccountContext
|
||||
|
||||
public var accountId: AccountRecordId {
|
||||
return self.context.account.id
|
||||
}
|
||||
public var accountPeerId: EnginePeer.Id {
|
||||
return self.context.account.stateManager.accountPeerId
|
||||
}
|
||||
public var stateManager: AccountStateManager {
|
||||
return self.context.account.stateManager
|
||||
}
|
||||
public var engineData: TelegramEngine.EngineData {
|
||||
return self.context.engine.data
|
||||
}
|
||||
public var animationCache: AnimationCache {
|
||||
return self.context.animationCache
|
||||
}
|
||||
public var animationRenderer: MultiAnimationRenderer {
|
||||
return self.context.animationRenderer
|
||||
}
|
||||
public var contentSettings: ContentSettings {
|
||||
return self.context.currentContentSettings.with { $0 }
|
||||
}
|
||||
public var appConfiguration: AppConfiguration {
|
||||
return self.context.currentAppConfiguration.with { $0 }
|
||||
}
|
||||
|
||||
public init(context: AccountContext) {
|
||||
self.context = context
|
||||
}
|
||||
|
||||
public func resolveInlineStickers(fileIds: [Int64]) -> Signal<[Int64: TelegramMediaFile], NoError> {
|
||||
return self.context.engine.stickers.resolveInlineStickers(fileIds: fileIds)
|
||||
}
|
||||
}
|
||||
|
||||
public enum ShareControllerExternalStatus {
|
||||
case preparing(Bool)
|
||||
case progress(Float)
|
||||
|
|
@ -78,3 +116,110 @@ public enum ShareControllerSubject {
|
|||
case mapMedia(TelegramMediaMap)
|
||||
case fromExternal(Int, ([PeerId], [PeerId: Int64], [PeerId: StarsAmount], String, ShareControllerAccountContext, Bool) -> Signal<ShareControllerExternalStatus, ShareControllerError>)
|
||||
}
|
||||
|
||||
public struct ShareControllerAction {
|
||||
public let title: String
|
||||
public let action: () -> Void
|
||||
|
||||
public init(title: String, action: @escaping () -> Void) {
|
||||
self.title = title
|
||||
self.action = action
|
||||
}
|
||||
}
|
||||
|
||||
public enum ShareControllerPreferredAction {
|
||||
case `default`
|
||||
case saveToCameraRoll
|
||||
case custom(action: ShareControllerAction)
|
||||
}
|
||||
|
||||
public struct ShareControllerSegmentedValue {
|
||||
public let title: String
|
||||
public let subject: ShareControllerSubject
|
||||
public let actionTitle: String
|
||||
public let formatSendTitle: (Int) -> String
|
||||
|
||||
public init(title: String, subject: ShareControllerSubject, actionTitle: String, formatSendTitle: @escaping (Int) -> String) {
|
||||
self.title = title
|
||||
self.subject = subject
|
||||
self.actionTitle = actionTitle
|
||||
self.formatSendTitle = formatSendTitle
|
||||
}
|
||||
}
|
||||
|
||||
public final class ShareControllerParams {
|
||||
public let subject: ShareControllerSubject
|
||||
public let presetText: String?
|
||||
public let preferredAction: ShareControllerPreferredAction
|
||||
public let showInChat: ((Message) -> Void)?
|
||||
public let fromForeignApp: Bool
|
||||
public let segmentedValues: [ShareControllerSegmentedValue]?
|
||||
public let externalShare: Bool
|
||||
public let immediateExternalShare: Bool
|
||||
public let immediatePeerId: PeerId?
|
||||
public let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?
|
||||
public let forceTheme: PresentationTheme?
|
||||
public let forcedActionTitle: String?
|
||||
public let shareAsLink: Bool
|
||||
public let collectibleItemInfo: TelegramCollectibleItemInfo?
|
||||
|
||||
public let actionCompleted: (() -> Void)?
|
||||
public let dismissed: ((Bool) -> Void)?
|
||||
public let completed: (([PeerId]) -> Void)?
|
||||
public let enqueued: (([PeerId], [Int64]) -> Void)?
|
||||
public let shareStory: (() -> Void)?
|
||||
public let debugAction: (() -> Void)?
|
||||
public let onMediaTimestampLinkCopied: ((Int32?) -> Void)?
|
||||
public weak var parentNavigationController: NavigationController?
|
||||
public let canSendInHighQuality: Bool
|
||||
|
||||
public init(
|
||||
subject: ShareControllerSubject,
|
||||
presetText: String? = nil,
|
||||
preferredAction: ShareControllerPreferredAction = .default,
|
||||
showInChat: ((Message) -> Void)? = nil,
|
||||
fromForeignApp: Bool = false,
|
||||
segmentedValues: [ShareControllerSegmentedValue]? = nil,
|
||||
externalShare: Bool = true,
|
||||
immediateExternalShare: Bool = false,
|
||||
immediatePeerId: PeerId? = nil,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
||||
forceTheme: PresentationTheme? = nil,
|
||||
forcedActionTitle: String? = nil,
|
||||
shareAsLink: Bool = false,
|
||||
collectibleItemInfo: TelegramCollectibleItemInfo? = nil,
|
||||
actionCompleted: (() -> Void)? = nil,
|
||||
dismissed: ((Bool) -> Void)? = nil,
|
||||
completed: (([PeerId]) -> Void)? = nil,
|
||||
enqueued: (([PeerId], [Int64]) -> Void)? = nil,
|
||||
shareStory: (() -> Void)? = nil,
|
||||
debugAction: (() -> Void)? = nil,
|
||||
onMediaTimestampLinkCopied: ((Int32?) -> Void)? = nil,
|
||||
parentNavigationController: NavigationController? = nil,
|
||||
canSendInHighQuality: Bool = false
|
||||
) {
|
||||
self.subject = subject
|
||||
self.presetText = presetText
|
||||
self.preferredAction = preferredAction
|
||||
self.showInChat = showInChat
|
||||
self.fromForeignApp = fromForeignApp
|
||||
self.segmentedValues = segmentedValues
|
||||
self.externalShare = externalShare
|
||||
self.immediateExternalShare = immediateExternalShare
|
||||
self.immediatePeerId = immediatePeerId
|
||||
self.updatedPresentationData = updatedPresentationData
|
||||
self.forceTheme = forceTheme
|
||||
self.forcedActionTitle = forcedActionTitle
|
||||
self.shareAsLink = shareAsLink
|
||||
self.collectibleItemInfo = collectibleItemInfo
|
||||
self.actionCompleted = actionCompleted
|
||||
self.dismissed = dismissed
|
||||
self.completed = completed
|
||||
self.enqueued = enqueued
|
||||
self.shareStory = shareStory
|
||||
self.debugAction = debugAction
|
||||
self.onMediaTimestampLinkCopied = onMediaTimestampLinkCopied
|
||||
self.parentNavigationController = parentNavigationController
|
||||
self.canSendInHighQuality = canSendInHighQuality
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import AccountContext
|
|||
import AppBundle
|
||||
import PromptUI
|
||||
import SafariServices
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import UrlEscaping
|
||||
|
||||
|
|
@ -410,10 +409,9 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
|
|||
|
||||
private func share(url: String) {
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let shareController = ShareController(context: self.context, subject: .url(url))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(url), actionCompleted: { [weak self] in
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
self.present(shareController, nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import TranslateUI
|
|||
import ContextUI
|
||||
import Pasteboard
|
||||
import SaveToCameraRoll
|
||||
import ShareController
|
||||
import SafariServices
|
||||
import LocationUI
|
||||
import OpenInExternalAppUI
|
||||
|
|
@ -1182,7 +1181,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
|
|||
}
|
||||
}), ContextMenuAction(content: .text(title: self.presentationData.strings.Conversation_ContextMenuShare, accessibilityLabel: self.presentationData.strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
if let self, let (webPage, _) = self.webPage, let image = media.media._asMedia() as? TelegramMediaImage {
|
||||
self.present(ShareController(context: self.context, subject: .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.media(media: .webPage(webPage: WebpageReference(webPage), media: image), resource: $0.resource)) }))), nil)
|
||||
self.present(self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.media(media: .webPage(webPage: WebpageReference(webPage), media: image), resource: $0.resource)) })))), nil)
|
||||
}
|
||||
})], catchTapsOutside: true)
|
||||
self.present(controller, ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self] in
|
||||
|
|
@ -1325,7 +1324,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
|
|||
}
|
||||
}), ContextMenuAction(content: .text(title: strings.Conversation_ContextMenuShare, accessibilityLabel: strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
if let strongSelf = self, let (webPage, _) = strongSelf.webPage, case let .Loaded(content) = webPage.content {
|
||||
strongSelf.present(ShareController(context: strongSelf.context, subject: .quote(text: text, url: content.url)), nil)
|
||||
strongSelf.present(strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .quote(text: text, url: content.url))), nil)
|
||||
}
|
||||
})]
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import AccountContext
|
|||
import AppBundle
|
||||
import PromptUI
|
||||
import SafariServices
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import UrlEscaping
|
||||
import PDFKit
|
||||
|
|
@ -549,10 +548,9 @@ final class BrowserPdfContent: UIView, BrowserContent, UIScrollViewDelegate, PDF
|
|||
|
||||
private func share(url: String) {
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let shareController = ShareController(context: self.context, subject: .url(url))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(url), actionCompleted: { [weak self] in
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
self.present(shareController, nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import ComponentFlow
|
|||
import ViewControllerComponent
|
||||
import AccountContext
|
||||
import ContextUI
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import BundleIconComponent
|
||||
import TelegramUIPreferences
|
||||
|
|
@ -576,8 +575,9 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||
} else {
|
||||
subject = .url(url)
|
||||
}
|
||||
let shareController = ShareController(context: self.context, subject: subject)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: subject, actionCompleted: { [weak self] in
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}, completed: { [weak self] peerIds in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
|
@ -590,10 +590,10 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == self.context.account.peerId && !isDocument {
|
||||
|
|
@ -615,7 +615,7 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
self.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -633,10 +633,7 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
self.controller?.present(shareController, in: .window(.root))
|
||||
case .minimize:
|
||||
self.minimize()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import AccountContext
|
|||
import AppBundle
|
||||
import PromptUI
|
||||
import SafariServices
|
||||
import ShareController
|
||||
|
||||
import UndoUI
|
||||
import LottieComponent
|
||||
import MultilineTextComponent
|
||||
|
|
@ -1580,10 +1580,9 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||
|
||||
private func share(url: String) {
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let shareController = ShareController(context: self.context, subject: .url(url))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(url), actionCompleted: { [weak self] in
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
self.present(shareController, nil)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import AppBundle
|
|||
import GalleryData
|
||||
import InstantPageUI
|
||||
import ChatInterfaceState
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import TextFormat
|
||||
import Postbox
|
||||
|
|
@ -877,9 +876,9 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||
}
|
||||
|> deliverOnMainQueue).startStandalone(next: { messages in
|
||||
if let strongSelf = self, !messages.isEmpty {
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
return lhs.index < rhs.index
|
||||
}).map({ $0._asMessage() })), externalShare: true, immediateExternalShare: true)
|
||||
}).map({ $0._asMessage() })), externalShare: true, immediateExternalShare: true))
|
||||
strongSelf.dismissInput()
|
||||
strongSelf.present?(shareController, nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import TextFormat
|
|||
import TelegramStringFormatting
|
||||
import AccountContext
|
||||
import RadialStatusNode
|
||||
import ShareController
|
||||
import OpenInExternalAppUI
|
||||
import AppBundle
|
||||
import LocalizedPeerData
|
||||
|
|
@ -489,8 +488,8 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
let theme = defaultDarkPresentationTheme
|
||||
let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>) = (self.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: theme), self.context.sharedContext.presentationData |> map { $0.withUpdated(theme: theme) })
|
||||
|
||||
let shareController = ShareController(context: self.context, subject: .text(text.string), externalShare: true, immediateExternalShare: false, updatedPresentationData: updatedPresentationData)
|
||||
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .text(text.string), externalShare: true, immediateExternalShare: false, updatedPresentationData: updatedPresentationData))
|
||||
|
||||
self.controllerInteraction?.presentController(shareController, nil)
|
||||
case .lookup:
|
||||
let controller = UIReferenceLibraryViewController(term: text.string)
|
||||
|
|
@ -1888,41 +1887,14 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
}
|
||||
}
|
||||
|
||||
let shareController = ShareController(context: strongSelf.context, subject: subject, preferredAction: preferredAction, externalShare: hasExternalShare, forceTheme: forceTheme)
|
||||
shareController.dismissed = { [weak self] _ in
|
||||
self?.interacting?(false)
|
||||
}
|
||||
shareController.onMediaTimestampLinkCopied = { [weak self] timestamp in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
if let timestamp {
|
||||
let startTimeString: String
|
||||
let hours = timestamp / (60 * 60)
|
||||
let minutes = timestamp % (60 * 60) / 60
|
||||
let seconds = timestamp % 60
|
||||
if hours != 0 {
|
||||
startTimeString = String(format: "%d:%02d:%02d", hours, minutes, seconds)
|
||||
} else {
|
||||
startTimeString = String(format: "%d:%02d", minutes, seconds)
|
||||
}
|
||||
text = presentationData.strings.Conversation_VideoTimeLinkCopied(startTimeString).string
|
||||
} else {
|
||||
text = presentationData.strings.Conversation_LinkCopied
|
||||
}
|
||||
|
||||
self.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: text), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return true }), nil)
|
||||
}
|
||||
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: subject, preferredAction: preferredAction, externalShare: hasExternalShare, forceTheme: forceTheme, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self, let actionCompletionText = actionCompletionText {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: actionCompletionText), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return true }), nil)
|
||||
}
|
||||
}
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
}, dismissed: { [weak self] _ in
|
||||
self?.interacting?(false)
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -1933,7 +1905,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -1958,12 +1930,33 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: true, animateInAsReplacement: true, action: { _ in return false }), nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}, onMediaTimestampLinkCopied: { [weak self] timestamp in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
if let timestamp {
|
||||
let startTimeString: String
|
||||
let hours = timestamp / (60 * 60)
|
||||
let minutes = timestamp % (60 * 60) / 60
|
||||
let seconds = timestamp % 60
|
||||
if hours != 0 {
|
||||
startTimeString = String(format: "%d:%02d:%02d", hours, minutes, seconds)
|
||||
} else {
|
||||
startTimeString = String(format: "%d:%02d", minutes, seconds)
|
||||
}
|
||||
text = presentationData.strings.Conversation_VideoTimeLinkCopied(startTimeString).string
|
||||
} else {
|
||||
text = presentationData.strings.Conversation_LinkCopied
|
||||
}
|
||||
self.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: text), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return true }), nil)
|
||||
}))
|
||||
strongSelf.controllerInteraction?.presentController(shareController, nil)
|
||||
} else {
|
||||
var singleText = presentationData.strings.Media_ShareItem(1)
|
||||
|
|
@ -1984,17 +1977,14 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
|
||||
let shareAction: ([Message]) -> Void = { messages in
|
||||
if let strongSelf = self {
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .messages(messages), preferredAction: preferredAction, forceTheme: forceTheme)
|
||||
shareController.dismissed = { [weak self] _ in
|
||||
self?.interacting?(false)
|
||||
}
|
||||
shareController.actionCompleted = { [weak self, weak shareController] in
|
||||
if let strongSelf = self, let shareController = shareController, shareController.actionIsMediaSaving {
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .messages(messages), preferredAction: preferredAction, forceTheme: forceTheme, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: presentationData.strings.Gallery_ImageSaved), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return true }), nil)
|
||||
}
|
||||
}
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
}, dismissed: { [weak self] _ in
|
||||
self?.interacting?(false)
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -2005,7 +1995,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -2030,12 +2020,12 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: true, animateInAsReplacement: true, action: { _ in return false }), nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.controllerInteraction?.presentController(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -2142,11 +2132,9 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
}
|
||||
}
|
||||
}
|
||||
let shareController = ShareController(context: self.context, subject: subject, preferredAction: preferredAction, forceTheme: forceTheme)
|
||||
shareController.dismissed = { [weak self] _ in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: subject, preferredAction: preferredAction, forceTheme: forceTheme, dismissed: { [weak self] _ in
|
||||
self?.interacting?(false)
|
||||
}
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -2157,7 +2145,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -2182,12 +2170,12 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: true, animateInAsReplacement: true, action: { _ in return false }), nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}))
|
||||
self.controllerInteraction?.presentController(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import TelegramCore
|
|||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import RadialStatusNode
|
||||
import ShareController
|
||||
|
||||
class ChatExternalFileGalleryItem: GalleryItem {
|
||||
var id: AnyHashable {
|
||||
|
|
@ -333,7 +332,7 @@ class ChatExternalFileGalleryItemNode: GalleryItemNode {
|
|||
@objc func actionButtonPressed() {
|
||||
if let (context, _) = self.contextAndFile, let message = self.message, let status = self.status, case .Local = status {
|
||||
let baseNavigationController = self.baseNavigationController()
|
||||
(baseNavigationController?.topViewController as? ViewController)?.present(ShareController(context: context, subject: .messages([message]), showInChat: nil, externalShare: true, immediateExternalShare: true), in: .window(.root))
|
||||
(baseNavigationController?.topViewController as? ViewController)?.present(context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .messages([message]), showInChat: nil, externalShare: true, immediateExternalShare: true)), in: .window(.root))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import ImageContentAnalysis
|
|||
import TextSelectionNode
|
||||
import Speak
|
||||
import TranslateUI
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import ContextUI
|
||||
import SaveToCameraRoll
|
||||
|
|
@ -388,7 +387,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||
}
|
||||
case .share:
|
||||
if let controller = strongSelf.baseNavigationController()?.topViewController as? ViewController {
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .text(string), externalShare: true, immediateExternalShare: false, updatedPresentationData: (strongSelf.context.sharedContext.currentPresentationData.with({ $0 }), strongSelf.context.sharedContext.presentationData))
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .text(string), externalShare: true, immediateExternalShare: false, updatedPresentationData: (strongSelf.context.sharedContext.currentPresentationData.with({ $0 }), strongSelf.context.sharedContext.presentationData)))
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
case .lookup:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import TelegramPresentationData
|
|||
import AccountContext
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import EmojiStatusComponent
|
||||
|
||||
private class WeakGameScriptMessageHandler: NSObject, WKScriptMessageHandler {
|
||||
private let f: (WKScriptMessage) -> ()
|
||||
|
|
@ -144,7 +145,7 @@ final class GameControllerNode: ViewControllerTracingNode {
|
|||
if eventName == "share_game" || eventName == "share_score" {
|
||||
if let (botPeer, gameName) = self.shareData(), let addressName = botPeer.addressName, !addressName.isEmpty, !gameName.isEmpty {
|
||||
if eventName == "share_score" {
|
||||
self.present(ShareController(context: self.context, subject: .fromExternal(1, { [weak self] peerIds, threadIds, requireStars, text, account, _ in
|
||||
self.present(self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .fromExternal(1, { [weak self] peerIds, threadIds, requireStars, text, account, _ in
|
||||
if let strongSelf = self, let message = strongSelf.message, let account = account as? ShareControllerAppAccountContext {
|
||||
let signals = peerIds.map { TelegramEngine(account: account.context.account).messages.forwardGameWithScore(messageId: message.id, to: $0, threadId: threadIds[$0], as: nil) }
|
||||
return .single(.preparing(false))
|
||||
|
|
@ -158,7 +159,7 @@ final class GameControllerNode: ViewControllerTracingNode {
|
|||
} else {
|
||||
return .single(.done)
|
||||
}
|
||||
}), showInChat: nil, externalShare: false, immediateExternalShare: false), nil)
|
||||
}), showInChat: nil, externalShare: false, immediateExternalShare: false)), nil)
|
||||
} else {
|
||||
self.shareWithoutScore()
|
||||
}
|
||||
|
|
@ -171,13 +172,12 @@ final class GameControllerNode: ViewControllerTracingNode {
|
|||
let url = "https://t.me/\(addressName)?game=\(gameName)"
|
||||
|
||||
let context = self.context
|
||||
let shareController = ShareController(context: context, subject: .url(url), showInChat: nil, externalShare: true)
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(url), showInChat: nil, externalShare: true, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
}))
|
||||
self.present(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import TelegramCore
|
|||
import SwiftSignalKit
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import StickerResources
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import SafariServices
|
|||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import SaveToCameraRoll
|
||||
import GalleryUI
|
||||
import OpenInExternalAppUI
|
||||
|
|
@ -142,14 +141,12 @@ final class InstantPageControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
self.navigationBar.back = navigateBack
|
||||
self.navigationBar.share = { [weak self] in
|
||||
if let strongSelf = self, let (webPage, _) = strongSelf.webPage, case let .Loaded(content) = webPage.content {
|
||||
let shareController = ShareController(context: context, subject: .url(content.url))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(content.url), actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
}, completed: { [weak self] peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -159,7 +156,7 @@ final class InstantPageControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -201,7 +198,7 @@ final class InstantPageControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
}), nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
}))
|
||||
strongSelf.present(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -1036,7 +1033,7 @@ final class InstantPageControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
}
|
||||
}), ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuShare, accessibilityLabel: self.strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
if let strongSelf = self, let (webPage, _) = strongSelf.webPage, case let .image(image) = media.media {
|
||||
strongSelf.present(ShareController(context: strongSelf.context, subject: .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.media(media: .webPage(webPage: WebpageReference(webPage), media: image), resource: $0.resource)) }))), nil)
|
||||
strongSelf.present(strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.media(media: .webPage(webPage: WebpageReference(webPage), media: image), resource: $0.resource)) })))), nil)
|
||||
}
|
||||
})], catchTapsOutside: true)
|
||||
self.present(controller, ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self] in
|
||||
|
|
@ -1150,7 +1147,7 @@ final class InstantPageControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
}
|
||||
}), ContextMenuAction(content: .text(title: strings.Conversation_ContextMenuShare, accessibilityLabel: strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
if let strongSelf = self, let (webPage, _) = strongSelf.webPage, case let .Loaded(content) = webPage.content {
|
||||
strongSelf.present(ShareController(context: strongSelf.context, subject: .quote(text: text, url: content.url)), nil)
|
||||
strongSelf.present(strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .quote(text: text, url: content.url))), nil)
|
||||
}
|
||||
})]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import Photos
|
|||
import TelegramPresentationData
|
||||
import TextFormat
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import GalleryUI
|
||||
import AppBundle
|
||||
|
||||
|
|
@ -147,7 +146,7 @@ final class InstantPageGalleryFooterContentNode: GalleryFooterContentNode {
|
|||
|
||||
@objc func actionButtonPressed() {
|
||||
if let shareMedia = self.shareMedia {
|
||||
self.controllerInteraction?.presentController(ShareController(context: self.context, subject: .media(shareMedia, nil), preferredAction: .saveToCameraRoll, showInChat: nil, externalShare: true, immediateExternalShare: false), nil)
|
||||
self.controllerInteraction?.presentController(self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .media(shareMedia, nil), preferredAction: .saveToCameraRoll, showInChat: nil, externalShare: true, immediateExternalShare: false)), nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import TelegramCore
|
|||
import SafariServices
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import OpenInExternalAppUI
|
||||
import TelegramUIPreferences
|
||||
|
||||
|
|
@ -414,7 +413,7 @@ class InstantPageReferenceControllerNode: ViewControllerTracingNode, ASScrollVie
|
|||
UIPasteboard.general.string = text
|
||||
}), ContextMenuAction(content: .text(title: self.presentationData.strings.Conversation_ContextMenuShare, accessibilityLabel: self.presentationData.strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
if let strongSelf = self, case let .Loaded(content) = strongSelf.webPage.webPage.content {
|
||||
strongSelf.present(ShareController(context: strongSelf.context, subject: .quote(text: text, url: content.url)), nil)
|
||||
strongSelf.present(strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .quote(text: text, url: content.url))), nil)
|
||||
}
|
||||
})])
|
||||
controller.dismissed = { [weak self] in
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import ContextUI
|
|||
import TelegramStringFormatting
|
||||
import ItemListPeerActionItem
|
||||
import ItemListPeerItem
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import QrCodeUI
|
||||
import PromptUI
|
||||
|
|
@ -375,8 +374,10 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
|||
}
|
||||
|
||||
let arguments = FolderInviteLinkListControllerArguments(context: context, shareMainLink: { inviteLink in
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink), updatedPresentationData: updatedPresentationData)
|
||||
shareController.completed = { peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), updatedPresentationData: updatedPresentationData, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}, completed: { peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -385,7 +386,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
|||
|> deliverOnMainQueue).start(next: { peerList in
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
|
|
@ -406,7 +407,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|
|
@ -423,11 +424,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
|||
return false
|
||||
}), nil)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}, openMainLink: { _ in
|
||||
}, copyLink: { link in
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import SectionHeaderItem
|
|||
import TelegramStringFormatting
|
||||
import MergeLists
|
||||
import ContextUI
|
||||
import ShareController
|
||||
|
||||
import OverlayStatusController
|
||||
import PresentationDataUtils
|
||||
import DirectionalPanGesture
|
||||
|
|
@ -540,8 +540,12 @@ public final class InviteLinkInviteController: ViewController {
|
|||
return
|
||||
}
|
||||
let updatedPresentationData = (strongSelf.presentationData, strongSelf.presentationDataPromise.get())
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink), updatedPresentationData: updatedPresentationData)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), updatedPresentationData: updatedPresentationData, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -552,7 +556,7 @@ public final class InviteLinkInviteController: ViewController {
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -573,7 +577,7 @@ public final class InviteLinkInviteController: ViewController {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -589,18 +593,12 @@ public final class InviteLinkInviteController: ViewController {
|
|||
}
|
||||
return false
|
||||
}), in: .window(.root))
|
||||
|
||||
|
||||
strongSelf.controller?.dismiss()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.controller?.present(shareController, in: .window(.root))
|
||||
}, manageLinks: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import ContextUI
|
|||
import TelegramStringFormatting
|
||||
import ItemListPeerActionItem
|
||||
import ItemListPeerItem
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import QrCodeUI
|
||||
|
||||
|
|
@ -433,8 +432,10 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
guard let inviteLink = invite.link else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink), updatedPresentationData: updatedPresentationData)
|
||||
shareController.completed = { peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), updatedPresentationData: updatedPresentationData, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}, completed: { peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -443,7 +444,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
|> deliverOnMainQueue).start(next: { peerList in
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
|
|
@ -464,7 +465,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|
|
@ -481,11 +482,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
return false
|
||||
}), nil)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}, openMainLink: { invite in
|
||||
let controller = InviteLinkViewController(context: context, updatedPresentationData: updatedPresentationData, peerId: peerId, invite: invite, invitationsContext: nil, revokedInvitationsContext: revokedInvitesContext, importersContext: nil)
|
||||
|
|
@ -649,8 +646,10 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
return
|
||||
}
|
||||
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink), updatedPresentationData: updatedPresentationData)
|
||||
shareController.completed = { peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), updatedPresentationData: updatedPresentationData, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}, completed: { peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -659,7 +658,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
|> deliverOnMainQueue).start(next: { peerList in
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
|
|
@ -680,7 +679,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|
|
@ -697,11 +696,7 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio
|
|||
return false
|
||||
}), nil)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})))
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import SectionHeaderItem
|
|||
import TelegramStringFormatting
|
||||
import MergeLists
|
||||
import ContextUI
|
||||
import ShareController
|
||||
|
||||
import OverlayStatusController
|
||||
import PresentationDataUtils
|
||||
import DirectionalPanGesture
|
||||
|
|
@ -610,8 +610,10 @@ public final class InviteLinkViewController: ViewController {
|
|||
guard let inviteLink = invite.link else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink))
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), actionCompleted: { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -622,7 +624,7 @@ public final class InviteLinkViewController: ViewController {
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -643,7 +645,7 @@ public final class InviteLinkViewController: ViewController {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -662,11 +664,7 @@ public final class InviteLinkViewController: ViewController {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
self?.controller?.present(shareController, in: .window(.root))
|
||||
}, editLink: { [weak self] invite in
|
||||
self?.editButtonPressed()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import ContextUI
|
|||
import TelegramStringFormatting
|
||||
import ItemListPeerActionItem
|
||||
import ItemListPeerItem
|
||||
import ShareController
|
||||
import UndoUI
|
||||
|
||||
private final class InviteRequestsControllerArguments {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import TelegramPresentationData
|
|||
import AvatarNode
|
||||
import AccountContext
|
||||
import SelectablePeerNode
|
||||
import ShareController
|
||||
import SolidRoundedButtonNode
|
||||
import ActivityIndicator
|
||||
import ComponentFlow
|
||||
import EmojiStatusComponent
|
||||
import ShareController
|
||||
|
||||
private let avatarFont = avatarPlaceholderFont(size: 42.0)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import TelegramCore
|
|||
import TelegramPresentationData
|
||||
import TextFormat
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import Markdown
|
||||
import ShareController
|
||||
|
||||
final class LanguageLinkPreviewContentNode: ASDisplayNode, ShareContentContainerNode {
|
||||
private var contentOffsetUpdated: ((CGFloat, ContainedViewLayoutTransition) -> Void)?
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import AppBundle
|
|||
import CoreLocation
|
||||
import PresentationDataUtils
|
||||
import OpenInExternalAppUI
|
||||
import ShareController
|
||||
|
||||
import DeviceAccess
|
||||
import UndoUI
|
||||
import MapKit
|
||||
|
|
@ -207,7 +207,7 @@ public final class LocationViewController: ViewController {
|
|||
}
|
||||
if let location = getLocation(from: strongSelf.subject) {
|
||||
let shareAction = OpenInControllerAction(title: strongSelf.presentationData.strings.Conversation_ContextMenuShare, action: {
|
||||
strongSelf.present(ShareController(context: context, subject: .mapMedia(location), externalShare: true), in: .window(.root), with: nil)
|
||||
strongSelf.present(context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .mapMedia(location), externalShare: true)), in: .window(.root), with: nil)
|
||||
})
|
||||
strongSelf.present(OpenInActionSheetController(context: context, updatedPresentationData: updatedPresentationData, item: .location(location: location, directions: nil), additionalAction: shareAction, openUrl: params.openUrl), in: .window(.root), with: nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import TelegramCore
|
|||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import RadialStatusNode
|
||||
import ShareController
|
||||
import PhotoResources
|
||||
import GalleryUI
|
||||
import TelegramUniversalVideoContent
|
||||
|
|
@ -201,12 +200,11 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||
forceTheme = defaultDarkColorPresentationTheme
|
||||
}
|
||||
|
||||
let shareController = ShareController(context: strongSelf.context, subject: subject, preferredAction: .saveToCameraRoll, forceTheme: forceTheme)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: subject, preferredAction: .saveToCameraRoll, forceTheme: forceTheme, actionCompleted: {
|
||||
if let actionCompletionText = actionCompletionText {
|
||||
interaction.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: actionCompletionText), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return true }), nil)
|
||||
}
|
||||
}
|
||||
}))
|
||||
interaction.presentController(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1562,11 +1562,10 @@ public func channelVisibilityController(context: AccountContext, updatedPresenta
|
|||
guard let inviteLink = invite.link else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: context, subject: .url(inviteLink), updatedPresentationData: updatedPresentationData)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(inviteLink), updatedPresentationData: updatedPresentationData, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}, linkContextAction: { node, gesture in
|
||||
guard let node = node as? ContextReferenceContentNode, let controller = getControllerImpl?() else {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import ItemListUI
|
|||
import PresentationDataUtils
|
||||
import TelegramStringFormatting
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import PhotoResources
|
||||
|
|
@ -24,7 +25,6 @@ import UndoUI
|
|||
import GalleryUI
|
||||
import PeerAvatarGalleryUI
|
||||
import Postbox
|
||||
import ShareController
|
||||
import ContextUI
|
||||
|
||||
private enum DeviceContactInfoAction {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import TextFormat
|
|||
import OverlayStatusController
|
||||
import TelegramStringFormatting
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import TelegramNotices
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import MtProtoKit
|
|||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import UrlEscaping
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
|
||||
private final class ProxySettingsControllerArguments {
|
||||
let toggleEnabled: (Bool) -> Void
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import PresentationDataUtils
|
|||
import AccountContext
|
||||
import UrlEscaping
|
||||
import UrlHandling
|
||||
import ShareController
|
||||
|
||||
private func shareLink(for server: ProxyServerSettings) -> String {
|
||||
var link: String
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import UIKit
|
|||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import QrCode
|
||||
import ShareController
|
||||
|
||||
public final class ShareProxyServerActionSheetController: ActionSheetController {
|
||||
private var presentationDisposable: Disposable?
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import MergeLists
|
|||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import ShareController
|
||||
|
||||
import SearchBarNode
|
||||
import SearchUI
|
||||
import UndoUI
|
||||
|
|
@ -793,13 +793,12 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
|
|||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .url("https://t.me/setlanguage/\(info.languageCode)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .url("https://t.me/setlanguage/\(info.languageCode)"), actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.present(shareController, nil)
|
||||
}))
|
||||
controller.setItemGroups([
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import AccountContext
|
|||
import StickerPackPreviewUI
|
||||
import ItemListStickerPackItem
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
public enum ArchivedStickerPacksControllerMode {
|
||||
case stickers
|
||||
|
|
@ -565,7 +564,7 @@ public func archivedStickerPacksController(context: AccountContext, mode: Archiv
|
|||
}
|
||||
}
|
||||
let text = packNames.map { "https://t.me/addstickers/\($0)" }.joined(separator: "\n")
|
||||
let shareController = ShareController(context: context, subject: .text(text), externalShare: true)
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .text(text), externalShare: true))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})])
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import StickerPackPreviewUI
|
|||
import ItemListStickerPackItem
|
||||
import ItemListPeerActionItem
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
import WebPBinding
|
||||
import ReactionImageComponent
|
||||
import FeaturedStickersScreen
|
||||
|
|
@ -1063,7 +1063,7 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
|
|||
}
|
||||
}
|
||||
let text = packNames.map { "https://t.me/addstickers/\($0)" }.joined(separator: "\n")
|
||||
let shareController = ShareController(context: context, subject: .text(text), externalShare: true)
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .text(text), externalShare: true))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})])
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import AlertUI
|
|||
import PresentationDataUtils
|
||||
import MediaResources
|
||||
import WallpaperResources
|
||||
import ShareController
|
||||
|
||||
import AccountContext
|
||||
import ContextUI
|
||||
import UndoUI
|
||||
|
|
@ -623,11 +623,10 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
|||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c?.dismiss(completion: {
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
|
|
@ -876,11 +875,10 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme
|
|||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c?.dismiss(completion: {
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import TelegramCore
|
|||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import CounterControllerTitleView
|
||||
import WallpaperResources
|
||||
import OverlayStatusController
|
||||
|
|
@ -524,7 +523,7 @@ public final class ThemePreviewController: ViewController {
|
|||
subject = .media(media, nil)
|
||||
preferredAction = .default
|
||||
}
|
||||
let controller = ShareController(context: self.context, subject: subject, preferredAction: preferredAction)
|
||||
let controller = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: subject, preferredAction: preferredAction))
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import AlertUI
|
|||
import PresentationDataUtils
|
||||
import MediaResources
|
||||
import WallpaperResources
|
||||
import ShareController
|
||||
|
||||
import AccountContext
|
||||
import ContextUI
|
||||
import UndoUI
|
||||
|
|
@ -776,11 +776,10 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c?.dismiss(completion: {
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
|
|
@ -1027,11 +1026,10 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c?.dismiss(completion: {
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import TelegramPresentationData
|
|||
import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import InviteLinksUI
|
||||
import TextFormat
|
||||
|
|
@ -484,11 +483,10 @@ public func usernameSetupController(context: AccountContext, mode: UsernameSetup
|
|||
}
|
||||
if !currentAddressName.isEmpty {
|
||||
dismissInputImpl?()
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/\(currentAddressName)"))
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/\(currentAddressName)"), actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,36 +25,6 @@ import ChatMessagePaymentAlertController
|
|||
|
||||
private var ObjCKey_DeinitWatcher: Int?
|
||||
|
||||
public struct ShareControllerAction {
|
||||
let title: String
|
||||
let action: () -> Void
|
||||
|
||||
public init(title: String, action: @escaping () -> Void) {
|
||||
self.title = title
|
||||
self.action = action
|
||||
}
|
||||
}
|
||||
|
||||
public enum ShareControllerPreferredAction {
|
||||
case `default`
|
||||
case saveToCameraRoll
|
||||
case custom(action: ShareControllerAction)
|
||||
}
|
||||
|
||||
public struct ShareControllerSegmentedValue {
|
||||
let title: String
|
||||
let subject: ShareControllerSubject
|
||||
let actionTitle: String
|
||||
let formatSendTitle: (Int) -> String
|
||||
|
||||
public init(title: String, subject: ShareControllerSubject, actionTitle: String, formatSendTitle: @escaping (Int) -> String) {
|
||||
self.title = title
|
||||
self.subject = subject
|
||||
self.actionTitle = actionTitle
|
||||
self.formatSendTitle = formatSendTitle
|
||||
}
|
||||
}
|
||||
|
||||
private enum ExternalShareItem {
|
||||
case text(String)
|
||||
case url(URL)
|
||||
|
|
@ -327,43 +297,6 @@ public final class ShareControllerAppEnvironment: ShareControllerEnvironment {
|
|||
}
|
||||
}
|
||||
|
||||
public final class ShareControllerAppAccountContext: ShareControllerAccountContext {
|
||||
public let context: AccountContext
|
||||
|
||||
public var accountId: AccountRecordId {
|
||||
return self.context.account.id
|
||||
}
|
||||
public var accountPeerId: EnginePeer.Id {
|
||||
return self.context.account.stateManager.accountPeerId
|
||||
}
|
||||
public var stateManager: AccountStateManager {
|
||||
return self.context.account.stateManager
|
||||
}
|
||||
public var engineData: TelegramEngine.EngineData {
|
||||
return self.context.engine.data
|
||||
}
|
||||
public var animationCache: AnimationCache {
|
||||
return self.context.animationCache
|
||||
}
|
||||
public var animationRenderer: MultiAnimationRenderer {
|
||||
return self.context.animationRenderer
|
||||
}
|
||||
public var contentSettings: ContentSettings {
|
||||
return self.context.currentContentSettings.with { $0 }
|
||||
}
|
||||
public var appConfiguration: AppConfiguration {
|
||||
return self.context.currentAppConfiguration.with { $0 }
|
||||
}
|
||||
|
||||
public init(context: AccountContext) {
|
||||
self.context = context
|
||||
}
|
||||
|
||||
public func resolveInlineStickers(fileIds: [Int64]) -> Signal<[Int64: TelegramMediaFile], NoError> {
|
||||
return self.context.engine.stickers.resolveInlineStickers(fileIds: fileIds)
|
||||
}
|
||||
}
|
||||
|
||||
public final class ShareControllerSwitchableAccount: Equatable {
|
||||
public let account: ShareControllerAccountContext
|
||||
public let peer: Peer
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import ContextUI
|
|||
import ItemListPeerItem
|
||||
import InviteLinksUI
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
import ItemListPeerActionItem
|
||||
import PremiumUI
|
||||
import StoryContainerScreen
|
||||
|
|
@ -1940,8 +1940,10 @@ public func channelStatsController(
|
|||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.ChannelBoost_BoostLinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }))
|
||||
}, shareBoostLink: { link in
|
||||
let shareController = ShareController(context: context, subject: .url(link), updatedPresentationData: updatedPresentationData)
|
||||
shareController.completed = { peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(link), updatedPresentationData: updatedPresentationData, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.ChannelBoost_BoostLinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }))
|
||||
}, completed: { peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -1950,7 +1952,7 @@ public func channelStatsController(
|
|||
|> deliverOnMainQueue).start(next: { peerList in
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
|
|
@ -1971,7 +1973,7 @@ public func channelStatsController(
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
presentImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|
|
@ -1985,11 +1987,7 @@ public func channelStatsController(
|
|||
return false
|
||||
}))
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.ChannelBoost_BoostLinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }))
|
||||
}
|
||||
}))
|
||||
presentImpl?(shareController)
|
||||
},
|
||||
openBoost: { boost in
|
||||
|
|
|
|||
|
|
@ -1110,16 +1110,16 @@ private final class StickerPackContainer: ASDisplayNode {
|
|||
let parentNavigationController = strongSelf.controller?.parentNavigationController
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(
|
||||
context: strongSelf.context,
|
||||
subject: shareSubject,
|
||||
forceExternal: false,
|
||||
shareStory: nil,
|
||||
enqueued: nil,
|
||||
actionCompleted: { [weak parentNavigationController] in
|
||||
if let parentNavigationController = parentNavigationController, let controller = parentNavigationController.topViewController as? ViewController {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
params: ShareControllerParams(
|
||||
subject: shareSubject,
|
||||
externalShare: false,
|
||||
actionCompleted: { [weak parentNavigationController] in
|
||||
if let parentNavigationController = parentNavigationController, let controller = parentNavigationController.topViewController as? ViewController {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
strongSelf.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import SwiftSignalKit
|
|||
import AVKit
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import ShareController
|
||||
|
||||
import UndoUI
|
||||
import TelegramPresentationData
|
||||
import PresentationDataUtils
|
||||
|
|
@ -1202,8 +1202,12 @@ public final class MediaStreamComponentController: ViewControllerComponentContai
|
|||
|
||||
var segmentedValues: [ShareControllerSegmentedValue]?
|
||||
segmentedValues = nil
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .url(inviteLinks.listenerLink), segmentedValues: segmentedValues, forceTheme: defaultDarkPresentationTheme, forcedActionTitle: presentationData.strings.VoiceChat_CopyInviteLink)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .url(inviteLinks.listenerLink), segmentedValues: segmentedValues, forceTheme: defaultDarkPresentationTheme, forcedActionTitle: presentationData.strings.VoiceChat_CopyInviteLink, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.VoiceChat_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -1214,7 +1218,7 @@ public final class MediaStreamComponentController: ViewControllerComponentContai
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var isSavedMessages = false
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
|
|
@ -1231,18 +1235,12 @@ public final class MediaStreamComponentController: ViewControllerComponentContai
|
|||
} else {
|
||||
text = ""
|
||||
}
|
||||
|
||||
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: isSavedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .current)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.VoiceChat_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.present(shareController, in: .window(.root))
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import DeviceAccess
|
|||
import TelegramVoip
|
||||
import PresentationDataUtils
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
import AvatarNode
|
||||
import TelegramAudio
|
||||
import LegacyComponents
|
||||
|
|
@ -825,8 +825,13 @@ final class VideoChatScreenComponent: Component {
|
|||
return formatSendTitle(environment.strings.VoiceChat_InviteLink_InviteListeners(Int32(count)))
|
||||
})]
|
||||
}
|
||||
let shareController = ShareController(context: groupCall.accountContext, subject: .url(inviteLinks.listenerLink), segmentedValues: segmentedValues, forceTheme: environment.theme, forcedActionTitle: environment.strings.VoiceChat_CopyInviteLink)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = groupCall.accountContext.sharedContext.makeShareController(context: groupCall.accountContext, params: ShareControllerParams(subject: .url(inviteLinks.listenerLink), segmentedValues: segmentedValues, forceTheme: environment.theme, forcedActionTitle: environment.strings.VoiceChat_CopyInviteLink, actionCompleted: { [weak self] in
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
self.presentToast(icon: .animation("anim_linkcopied"), text: presentationData.strings.VoiceChat_InviteLinkCopiedText, duration: 3)
|
||||
}, completed: { [weak self] peerIds in
|
||||
guard let self, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
|
|
@ -839,10 +844,10 @@ final class VideoChatScreenComponent: Component {
|
|||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
|
||||
|
||||
let text: String
|
||||
var isSavedMessages = false
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
|
|
@ -861,14 +866,7 @@ final class VideoChatScreenComponent: Component {
|
|||
}
|
||||
self.presentToast(icon: .animation(isSavedMessages ? "anim_savedmessages" : "anim_forward"), text: text, duration: 3)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
self.presentToast(icon: .animation("anim_linkcopied"), text: presentationData.strings.VoiceChat_InviteLinkCopiedText, duration: 3)
|
||||
}
|
||||
}))
|
||||
environment.controller()?.present(shareController, in: .window(.root))
|
||||
})
|
||||
} else if groupCall.isConference {
|
||||
|
|
@ -876,8 +874,13 @@ final class VideoChatScreenComponent: Component {
|
|||
return
|
||||
}
|
||||
|
||||
let shareController = ShareController(context: groupCall.accountContext, subject: .url(inviteLinks.listenerLink), forceTheme: environment.theme, forcedActionTitle: environment.strings.VoiceChat_CopyInviteLink)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = groupCall.accountContext.sharedContext.makeShareController(context: groupCall.accountContext, params: ShareControllerParams(subject: .url(inviteLinks.listenerLink), forceTheme: environment.theme, forcedActionTitle: environment.strings.VoiceChat_CopyInviteLink, actionCompleted: { [weak self] in
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
self.presentToast(icon: .animation("anim_linkcopied"), text: presentationData.strings.VoiceChat_InviteLinkCopiedText, duration: 3)
|
||||
}, completed: { [weak self] peerIds in
|
||||
guard let self, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
|
|
@ -890,10 +893,10 @@ final class VideoChatScreenComponent: Component {
|
|||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
|
||||
|
||||
let text: String
|
||||
var isSavedMessages = false
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
|
|
@ -912,14 +915,7 @@ final class VideoChatScreenComponent: Component {
|
|||
}
|
||||
self.presentToast(icon: .animation(isSavedMessages ? "anim_savedmessages" : "anim_forward"), text: text, duration: 3)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
let presentationData = groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: environment.theme)
|
||||
self.presentToast(icon: .animation("anim_linkcopied"), text: presentationData.strings.VoiceChat_InviteLinkCopiedText, duration: 3)
|
||||
}
|
||||
}))
|
||||
environment.controller()?.present(shareController, in: .window(.root))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import MergeLists
|
|||
import ItemListUI
|
||||
import AppBundle
|
||||
import ContextUI
|
||||
import ShareController
|
||||
import DeleteChatPeerActionSheetItem
|
||||
import UndoUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import TelegramUIPreferences
|
|||
import AccountContext
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import ShareController
|
||||
import AvatarNode
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
public final class VoiceChatJoinScreen: ViewController {
|
||||
private var controllerNode: Node {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import ShimmerEffect
|
|||
import WallpaperBackgroundNode
|
||||
import QrCode
|
||||
import AvatarNode
|
||||
import ShareController
|
||||
import TelegramStringFormatting
|
||||
import PhotoResources
|
||||
import TextFormat
|
||||
|
|
@ -40,6 +39,7 @@ import ComponentFlow
|
|||
import GlassBarButtonComponent
|
||||
import SheetComponent
|
||||
import BundleIconComponent
|
||||
import ShareController
|
||||
|
||||
private func closeButtonImage(theme: PresentationTheme) -> UIImage? {
|
||||
return generateImage(CGSize(width: 30.0, height: 30.0), contextGenerator: { size, context in
|
||||
|
|
|
|||
|
|
@ -1726,69 +1726,70 @@ private final class GiftAuctionBidScreenComponent: Component {
|
|||
|
||||
let shareController = context.sharedContext.makeShareController(
|
||||
context: context,
|
||||
subject: .url(link),
|
||||
forceExternal: false,
|
||||
shareStory: nil,
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
params: ShareControllerParams(
|
||||
subject: .url(link),
|
||||
externalShare: false,
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
},
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
text = ""
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,73 +332,74 @@ private final class GiftAuctionViewSheetContent: CombinedComponent {
|
|||
|
||||
let shareController = self.context.sharedContext.makeShareController(
|
||||
context: self.context,
|
||||
subject: .url(link),
|
||||
forceExternal: false,
|
||||
shareStory: nil,
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
params: ShareControllerParams(
|
||||
subject: .url(link),
|
||||
externalShare: false,
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
},
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
text = ""
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
||||
|
||||
func openGiftResale() {
|
||||
guard let controller = self.getController() as? GiftAuctionViewScreen, let gift = self.giftAuctionState?.gift, case let .generic(gift) = gift else {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -934,73 +934,75 @@ private final class GiftViewSheetContent: CombinedComponent {
|
|||
let link = "https://t.me/nft/\(gift.slug)"
|
||||
let shareController = self.context.sharedContext.makeShareController(
|
||||
context: self.context,
|
||||
subject: .url(link),
|
||||
forceExternal: false,
|
||||
shareStory: shareStoryImpl,
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
params: ShareControllerParams(
|
||||
subject: .url(link),
|
||||
externalShare: false,
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
},
|
||||
enqueued: { [weak self, weak controller] peerIds, _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self, weak controller] peerList in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
text = ""
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
actionCompleted: { [weak controller] in
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: false, action: { [weak self, weak controller] action in
|
||||
if let self, savedMessages, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self, weak controller] peer in
|
||||
guard let peer else {
|
||||
return
|
||||
}
|
||||
self?.openPeer(peer)
|
||||
Queue.mainQueue().after(0.6) {
|
||||
controller?.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
shareStory: shareStoryImpl
|
||||
)
|
||||
)
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
||||
|
||||
func setAsGiftTheme() {
|
||||
guard let arguments = self.subject.arguments, let controller = self.getController() as? GiftViewScreen, let navigationController = controller.navigationController as? NavigationController, case let .unique(gift) = arguments.gift else {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ public func presentedLegacyShortcutCamera(context: AccountContext, saveCapturedM
|
|||
nativeGenerator(_1, _2, _3, nil)
|
||||
})
|
||||
if let parentController = parentController {
|
||||
parentController.present(ShareController(context: context, subject: .fromExternal(1, { peerIds, _, _, text, account, silently in
|
||||
parentController.present(context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .fromExternal(1, { peerIds, _, _, text, account, silently in
|
||||
guard let account = account as? ShareControllerAppAccountContext else {
|
||||
return .single(.done)
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ public func presentedLegacyShortcutCamera(context: AccountContext, saveCapturedM
|
|||
}
|
||||
|> then(.single(ShareControllerExternalStatus.done))
|
||||
}
|
||||
}), showInChat: nil, externalShare: false), in: .window(.root))
|
||||
}), showInChat: nil, externalShare: false)), in: .window(.root))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import PresentationDataUtils
|
|||
import NotificationMuteSettingsUI
|
||||
import NotificationSoundSelectionUI
|
||||
import OverlayStatusController
|
||||
import ShareController
|
||||
import PhotoResources
|
||||
import PeerAvatarGalleryUI
|
||||
import TelegramIntents
|
||||
|
|
@ -3603,8 +3602,12 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
}
|
||||
|
||||
func openShareLink(url: String) {
|
||||
let shareController = ShareController(context: self.context, subject: .url(url), updatedPresentationData: self.controller?.updatedPresentationData)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(url), updatedPresentationData: self.controller?.updatedPresentationData, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}, completed: { [weak self] peerIds in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
|
@ -3617,10 +3620,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -3641,7 +3644,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -3658,13 +3661,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}
|
||||
}))
|
||||
self.view.endEditing(true)
|
||||
self.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
@ -5552,9 +5549,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
if let strongSelf = self, !messages.isEmpty {
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone, nil, nil)
|
||||
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
return lhs.index < rhs.index
|
||||
}).map({ $0._asMessage() })), externalShare: true, immediateExternalShare: true, updatedPresentationData: strongSelf.controller?.updatedPresentationData)
|
||||
}).map({ $0._asMessage() })), externalShare: true, immediateExternalShare: true, updatedPresentationData: strongSelf.controller?.updatedPresentationData))
|
||||
strongSelf.view.endEditing(true)
|
||||
strongSelf.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import OpenInExternalAppUI
|
|||
import PresentationDataUtils
|
||||
import OverlayStatusController
|
||||
import HashtagSearchUI
|
||||
import ShareController
|
||||
import UndoUI
|
||||
|
||||
extension PeerInfoScreenNode {
|
||||
|
|
@ -222,8 +221,12 @@ extension PeerInfoScreenNode {
|
|||
guard let self else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: self.context, subject: .url(url), updatedPresentationData: self.controller?.updatedPresentationData, collectibleItemInfo: collectibleItemInfo)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(url), updatedPresentationData: self.controller?.updatedPresentationData, collectibleItemInfo: collectibleItemInfo, actionCompleted: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}, completed: { [weak self] peerIds in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
|
@ -236,10 +239,10 @@ extension PeerInfoScreenNode {
|
|||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -260,7 +263,7 @@ extension PeerInfoScreenNode {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -277,13 +280,7 @@ extension PeerInfoScreenNode {
|
|||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}
|
||||
}))
|
||||
self.view.endEditing(true)
|
||||
self.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import ContextUI
|
|||
import TelegramPresentationData
|
||||
import NotificationPeerExceptionController
|
||||
import NotificationExceptionsScreen
|
||||
import ShareController
|
||||
import TranslateUI
|
||||
import TelegramNotices
|
||||
import AlertComponent
|
||||
|
|
@ -584,8 +583,7 @@ extension PeerInfoScreenNode {
|
|||
|
||||
if let strongSelf = self {
|
||||
let contact = TelegramMediaContact(firstName: peer.firstName ?? "", lastName: peer.lastName ?? "", phoneNumber: phone, peerId: peer.id, vCardData: nil)
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .media(.standalone(media: contact), nil), updatedPresentationData: strongSelf.controller?.updatedPresentationData)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .media(.standalone(media: contact), nil), updatedPresentationData: strongSelf.controller?.updatedPresentationData, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -596,11 +594,11 @@ extension PeerInfoScreenNode {
|
|||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
|
||||
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -621,7 +619,7 @@ extension PeerInfoScreenNode {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -639,7 +637,7 @@ extension PeerInfoScreenNode {
|
|||
}), in: .current)
|
||||
})
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
})))
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import BottomButtonPanelComponent
|
|||
import UndoUI
|
||||
import MoreHeaderButton
|
||||
import SaveToCameraRoll
|
||||
import ShareController
|
||||
import OpenInExternalAppUI
|
||||
|
||||
final class StorySearchGridScreenComponent: Component {
|
||||
|
|
@ -250,7 +249,7 @@ public final class StorySearchGridScreen: ViewControllerComponentContainer {
|
|||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.present(ShareController(context: self.context, subject: .mapMedia(locationMap), externalShare: true), in: .window(.root), with: nil)
|
||||
self.present(self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .mapMedia(locationMap), externalShare: true)), in: .window(.root), with: nil)
|
||||
})
|
||||
self.present(OpenInActionSheetController(context: self.context, updatedPresentationData: nil, item: .location(location: locationMap, directions: nil), additionalAction: shareAction, openUrl: { [weak self] url in
|
||||
guard let self else {
|
||||
|
|
|
|||
|
|
@ -1202,72 +1202,74 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||
let context = self.context
|
||||
let shareController = context.sharedContext.makeShareController(
|
||||
context: context,
|
||||
subject: .url(link),
|
||||
forceExternal: false,
|
||||
shareStory: { [weak self] in
|
||||
guard let self, let parentController = self.parentController else {
|
||||
return
|
||||
}
|
||||
Queue.mainQueue().after(0.15) {
|
||||
let controller = self.context.sharedContext.makeStorySharingScreen(context: self.context, subject: .gift(gift), parentController: parentController)
|
||||
parentController.push(controller)
|
||||
}
|
||||
},
|
||||
enqueued: { [weak self] peerIds, _ in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
params: ShareControllerParams(
|
||||
subject: .url(link),
|
||||
externalShare: false,
|
||||
actionCompleted: { [weak self] in
|
||||
self?.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
},
|
||||
enqueued: { [weak self] peerIds, _ in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] peerList in
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] peerList in
|
||||
guard let self, let parentController = self.parentController else {
|
||||
return
|
||||
}
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
parentController.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: true, animateInAsReplacement: false, action: { [weak self] action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||
guard let peer, let navigationController = self?.parentController?.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, chatController: nil, context: context, chatLocation: .peer(peer), subject: nil, botStart: nil, updateTextInputState: nil, keepStack: .always, useExisting: true, purposefulAction: nil, scrollToEndIfExists: false, activateMessageSearch: nil, animated: true))
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
shareStory: { [weak self] in
|
||||
guard let self, let parentController = self.parentController else {
|
||||
return
|
||||
}
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_ForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
Queue.mainQueue().after(0.15) {
|
||||
let controller = self.context.sharedContext.makeStorySharingScreen(context: self.context, subject: .gift(gift), parentController: parentController)
|
||||
parentController.push(controller)
|
||||
}
|
||||
|
||||
parentController.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: true, animateInAsReplacement: false, action: { [weak self] action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||
guard let peer, let navigationController = self?.parentController?.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, chatController: nil, context: context, chatLocation: .peer(peer), subject: nil, botStart: nil, updateTextInputState: nil, keepStack: .always, useExisting: true, purposefulAction: nil, scrollToEndIfExists: false, activateMessageSearch: nil, animated: true))
|
||||
})
|
||||
}
|
||||
return false
|
||||
}, additionalView: nil), in: .current)
|
||||
})
|
||||
},
|
||||
actionCompleted: { [weak self] in
|
||||
self?.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
self.parentController?.present(shareController, in: .window(.root))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import StoryContainerScreen
|
|||
import EmptyStateIndicatorComponent
|
||||
import UIKitRuntimeUtils
|
||||
import PeerInfoPaneNode
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import PlainButtonComponent
|
||||
import ComponentDisplayAdapters
|
||||
|
|
@ -2771,24 +2770,10 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||
return
|
||||
}
|
||||
|
||||
let shareController = ShareController(
|
||||
context: self.context,
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(
|
||||
subject: .media(.story(peer: peerReference, id: item.id, media: TelegramMediaStory(storyId: StoryId(peerId: peer.id, id: item.id), isMention: false)), nil),
|
||||
presetText: nil,
|
||||
preferredAction: .default,
|
||||
showInChat: nil,
|
||||
fromForeignApp: false,
|
||||
segmentedValues: nil,
|
||||
externalShare: false,
|
||||
immediateExternalShare: false,
|
||||
switchableAccounts: [],
|
||||
immediatePeerId: nil,
|
||||
updatedPresentationData: nil,
|
||||
forceTheme: nil,
|
||||
forcedActionTitle: nil,
|
||||
shareAsLink: false,
|
||||
collectibleItemInfo: nil
|
||||
)
|
||||
externalShare: false
|
||||
))
|
||||
self.parentController?.present(shareController, in: .window(.root))
|
||||
})
|
||||
})
|
||||
|
|
@ -5404,83 +5389,69 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||
urlBase = "\(peer.id.id._internalGetInt64Value())"
|
||||
}
|
||||
|
||||
let shareController = ShareController(
|
||||
context: self.context,
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(
|
||||
subject: .url("https://t.me/\(urlBase)/a/\(id)"),
|
||||
presetText: nil,
|
||||
preferredAction: .default,
|
||||
showInChat: nil,
|
||||
fromForeignApp: false,
|
||||
segmentedValues: nil,
|
||||
externalShare: false,
|
||||
immediateExternalShare: false,
|
||||
switchableAccounts: [],
|
||||
immediatePeerId: nil,
|
||||
updatedPresentationData: nil,
|
||||
forceTheme: nil,
|
||||
forcedActionTitle: nil,
|
||||
shareAsLink: false,
|
||||
collectibleItemInfo: nil
|
||||
)
|
||||
self.parentController?.present(shareController, in: .window(.root))
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] peerList in
|
||||
actionCompleted: { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
let peerName = peer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_Chat_One(peerName).string
|
||||
savedMessages = peer.id == self.context.account.peerId
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
let firstPeerName = firstPeer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
let secondPeerName = secondPeer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
let peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
},
|
||||
completed: { [weak self] peerIds in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||
guard let self, let peer else {
|
||||
return
|
||||
}
|
||||
guard let navigationController = self.parentController?.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(peer), forceOpenChat: true))
|
||||
})
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] peerList in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
let peerName = peer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_Chat_One(peerName).string
|
||||
savedMessages = peer.id == self.context.account.peerId
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
let firstPeerName = firstPeer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
let secondPeerName = secondPeer.id == self.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
let peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
text = presentationData.strings.WebBrowser_LinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
|
||||
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||
guard let self, let peer else {
|
||||
return
|
||||
}
|
||||
guard let navigationController = self.parentController?.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(peer), forceOpenChat: true))
|
||||
})
|
||||
}
|
||||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
}
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
|
||||
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
))
|
||||
self.parentController?.present(shareController, in: .window(.root))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import ListItemComponentAdaptor
|
|||
import ButtonComponent
|
||||
import PlainButtonComponent
|
||||
import UndoUI
|
||||
import ShareController
|
||||
|
||||
|
||||
final class PostSuggestionsSettingsScreenComponent: Component {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
|
|
@ -200,8 +200,10 @@ final class PostSuggestionsSettingsScreenComponent: Component {
|
|||
}
|
||||
|
||||
let context = component.context
|
||||
let shareController = ShareController(context: context, subject: .url(link), updatedPresentationData: nil)
|
||||
shareController.completed = { [weak controller] peerIds in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(link), updatedPresentationData: nil, actionCompleted: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}, completed: { [weak controller] peerIds in
|
||||
let _ = (context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
|
|
@ -210,7 +212,7 @@ final class PostSuggestionsSettingsScreenComponent: Component {
|
|||
|> deliverOnMainQueue).start(next: { [weak controller] peerList in
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId {
|
||||
|
|
@ -231,7 +233,7 @@ final class PostSuggestionsSettingsScreenComponent: Component {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|
|
@ -248,11 +250,7 @@ final class PostSuggestionsSettingsScreenComponent: Component {
|
|||
return false
|
||||
}), in: .window(.root))
|
||||
})
|
||||
}
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import TelegramCore
|
|||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import AppBundle
|
||||
import ShareController
|
||||
|
||||
public final class ReportPeerDetailsActionSheetItem: ActionSheetItem {
|
||||
let context: AccountContext
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import ListActionItemComponent
|
|||
import BundleIconComponent
|
||||
import TextFormat
|
||||
import UndoUI
|
||||
import ShareController
|
||||
import ContextUI
|
||||
|
||||
final class BusinessLinksSetupScreenComponent: Component {
|
||||
|
|
@ -258,7 +257,7 @@ final class BusinessLinksSetupScreenComponent: Component {
|
|||
return
|
||||
}
|
||||
|
||||
environment.controller()?.present(ShareController(context: component.context, subject: .url(link.url), showInChat: nil, externalShare: false, immediateExternalShare: false), in: .window(.root))
|
||||
environment.controller()?.present(component.context.sharedContext.makeShareController(context: component.context, params: ShareControllerParams(subject: .url(link.url), showInChat: nil, externalShare: false, immediateExternalShare: false)), in: .window(.root))
|
||||
}
|
||||
|
||||
func update(component: BusinessLinksSetupScreenComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: ComponentTransition) -> CGSize {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import TelegramPresentationData
|
|||
import TelegramUIPreferences
|
||||
import MediaResources
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import GalleryUI
|
||||
import HexColor
|
||||
import CounterControllerTitleView
|
||||
|
|
@ -1100,7 +1099,6 @@ public class WallpaperGalleryController: ViewController {
|
|||
return
|
||||
}
|
||||
|
||||
var controller: ShareController?
|
||||
var options: [String] = []
|
||||
if (itemNode.options.contains(.blur)) {
|
||||
if (itemNode.options.contains(.motion)) {
|
||||
|
|
@ -1111,8 +1109,13 @@ public class WallpaperGalleryController: ViewController {
|
|||
} else if (itemNode.options.contains(.motion)) {
|
||||
options.append("mode=motion")
|
||||
}
|
||||
|
||||
|
||||
let context = self.context
|
||||
let actionCompleted: () -> Void = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
|
||||
switch wallpaper {
|
||||
case .image:
|
||||
let _ = (context.wallpaperUploadManager!.stateSignal()
|
||||
|
|
@ -1125,12 +1128,8 @@ public class WallpaperGalleryController: ViewController {
|
|||
if !options.isEmpty {
|
||||
optionsString = "?\(options.joined(separator: "&"))"
|
||||
}
|
||||
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"), actionCompleted: actionCompleted))
|
||||
self?.present(shareController, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
})
|
||||
|
|
@ -1159,15 +1158,17 @@ public class WallpaperGalleryController: ViewController {
|
|||
options.append("rotation=\(rotation)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var optionsString = ""
|
||||
if !options.isEmpty {
|
||||
optionsString = "?\(options.joined(separator: "&"))"
|
||||
}
|
||||
|
||||
controller = ShareController(context: context, subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"))
|
||||
|
||||
let controller = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"), actionCompleted: actionCompleted))
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
case let .color(color):
|
||||
controller = ShareController(context: context, subject: .url("https://t.me/bg/\(UIColor(rgb: color).hexString)"))
|
||||
let controller = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/bg/\(UIColor(rgb: color).hexString)"), actionCompleted: actionCompleted))
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
case let .gradient(gradient):
|
||||
var colorsString = ""
|
||||
|
||||
|
|
@ -1182,16 +1183,10 @@ public class WallpaperGalleryController: ViewController {
|
|||
colorsString.append(UIColor(rgb: color).hexString)
|
||||
}
|
||||
|
||||
controller = ShareController(context: context, subject: .url("https://t.me/bg/\(colorsString)"))
|
||||
let controller = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/bg/\(colorsString)"), actionCompleted: actionCompleted))
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
default:
|
||||
break
|
||||
}
|
||||
if let controller = controller {
|
||||
controller.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import TelegramPresentationData
|
|||
import TelegramUIPreferences
|
||||
import OverlayStatusController
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import SearchUI
|
||||
import HexColor
|
||||
import PresentationDataUtils
|
||||
|
|
@ -466,7 +465,7 @@ public final class ThemeGridController: ViewController {
|
|||
} else {
|
||||
subject = .text(string)
|
||||
}
|
||||
let shareController = ShareController(context: context, subject: subject)
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: subject))
|
||||
self.present(shareController, in: .window(.root), blockInteraction: true)
|
||||
|
||||
self.donePressed()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import AccountContext
|
|||
import SwiftSignalKit
|
||||
import AppBundle
|
||||
import MessageInputPanelComponent
|
||||
import ShareController
|
||||
import TelegramCore
|
||||
import Postbox
|
||||
import UndoUI
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import StoryFooterPanelComponent
|
|||
import TelegramPresentationData
|
||||
import LegacyInstantVideoController
|
||||
import TelegramPresentationData
|
||||
import ShareController
|
||||
import ChatPresentationInterfaceState
|
||||
import Postbox
|
||||
import OverlayStatusController
|
||||
|
|
@ -54,6 +53,7 @@ import AnimatedTextComponent
|
|||
import ChatSendAsContextMenu
|
||||
import ShareWithPeersScreen
|
||||
import AlertComponent
|
||||
import ShareController
|
||||
|
||||
private var ObjCKey_DeinitWatcher: Int?
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ final class StoryItemSetContainerSendMessage: @unchecked(Sendable) {
|
|||
private var inputPanelExternalState: MessageInputPanelComponent.ExternalState?
|
||||
|
||||
weak var attachmentController: AttachmentController?
|
||||
weak var shareController: ShareController?
|
||||
weak var shareController: ViewController?
|
||||
weak var tooltipScreen: ViewController?
|
||||
weak var actionSheet: ViewController?
|
||||
weak var statusController: ViewController?
|
||||
|
|
@ -1323,101 +1323,99 @@ final class StoryItemSetContainerSendMessage: @unchecked(Sendable) {
|
|||
}))
|
||||
}
|
||||
|
||||
let shareController = ShareController(
|
||||
context: component.context,
|
||||
let shareController = component.context.sharedContext.makeShareController(context: component.context, params: ShareControllerParams(
|
||||
subject: .media(AnyMediaReference.standalone(media: TelegramMediaStory(storyId: StoryId(peerId: peerId, id: focusedItem.storyItem.id), isMention: false)), nil),
|
||||
preferredAction: preferredAction ?? .default,
|
||||
externalShare: false,
|
||||
immediateExternalShare: false,
|
||||
forceTheme: defaultDarkColorPresentationTheme
|
||||
)
|
||||
shareController.shareStory = { [weak view] in
|
||||
guard let view else {
|
||||
return
|
||||
}
|
||||
view.openStoryEditing(repost: true)
|
||||
}
|
||||
shareController.completed = { [weak view] peerIds in
|
||||
guard let view, let component = view.component else {
|
||||
return
|
||||
}
|
||||
|
||||
let _ = (component.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { [weak view] peerList in
|
||||
forceTheme: defaultDarkColorPresentationTheme,
|
||||
dismissed: { [weak self, weak view] _ in
|
||||
guard let self, let view else {
|
||||
return
|
||||
}
|
||||
self.shareController = nil
|
||||
view.updateIsProgressPaused()
|
||||
},
|
||||
completed: { [weak view] peerIds in
|
||||
guard let view, let component = view.component else {
|
||||
return
|
||||
}
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == component.context.account.peerId {
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
|
||||
let _ = (component.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.Peer.init)
|
||||
)
|
||||
)
|
||||
|> deliverOnMainQueue).start(next: { [weak view] peerList in
|
||||
guard let view, let component = view.component else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if let controller = component.controller() {
|
||||
let context = component.context
|
||||
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(
|
||||
presentationData: presentationData,
|
||||
content: .forward(savedMessages: savedMessages, text: text),
|
||||
elevatedLayout: false,
|
||||
animateInAsReplacement: false,
|
||||
action: { [weak controller] action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { peer in
|
||||
guard let controller, let peer else {
|
||||
return
|
||||
}
|
||||
guard let navigationController = controller.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), forceOpenChat: true))
|
||||
})
|
||||
}
|
||||
return false
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == component.context.account.peerId {
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_SavedMessages_One
|
||||
savedMessages = true
|
||||
} else {
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
var peerName = peer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_Chat_One(peerName).string
|
||||
} else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last {
|
||||
var firstPeerName = firstPeer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : firstPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
firstPeerName = firstPeerName.replacingOccurrences(of: "**", with: "")
|
||||
var secondPeerName = secondPeer.id == component.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : secondPeer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
secondPeerName = secondPeerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string
|
||||
} else if let peer = peers.first {
|
||||
var peerName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
peerName = peerName.replacingOccurrences(of: "**", with: "")
|
||||
text = presentationData.strings.Conversation_StoryForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string
|
||||
} else {
|
||||
text = ""
|
||||
}
|
||||
), in: .current)
|
||||
}
|
||||
|
||||
if let controller = component.controller() {
|
||||
let context = component.context
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(
|
||||
presentationData: presentationData,
|
||||
content: .forward(savedMessages: savedMessages, text: text),
|
||||
elevatedLayout: false,
|
||||
animateInAsReplacement: false,
|
||||
action: { [weak controller] action in
|
||||
if savedMessages, action == .info {
|
||||
let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { peer in
|
||||
guard let controller, let peer else {
|
||||
return
|
||||
}
|
||||
guard let navigationController = controller.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), forceOpenChat: true))
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
), in: .current)
|
||||
}
|
||||
})
|
||||
},
|
||||
shareStory: { [weak view] in
|
||||
guard let view else {
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
view.openStoryEditing(repost: true)
|
||||
}
|
||||
))
|
||||
|
||||
self.shareController = shareController
|
||||
view.updateIsProgressPaused()
|
||||
|
||||
shareController.dismissed = { [weak self, weak view] _ in
|
||||
guard let self, let view else {
|
||||
return
|
||||
}
|
||||
self.shareController = nil
|
||||
view.updateIsProgressPaused()
|
||||
}
|
||||
|
||||
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
}
|
||||
|
|
@ -1501,19 +1499,17 @@ final class StoryItemSetContainerSendMessage: @unchecked(Sendable) {
|
|||
let theme = component.theme
|
||||
let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>) = (component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: theme), component.context.sharedContext.presentationData |> map { $0.withUpdated(theme: theme) })
|
||||
|
||||
let shareController = ShareController(context: component.context, subject: .text(text), externalShare: true, immediateExternalShare: false, updatedPresentationData: updatedPresentationData)
|
||||
|
||||
self.shareController = shareController
|
||||
view.updateIsProgressPaused()
|
||||
|
||||
shareController.dismissed = { [weak self, weak view] _ in
|
||||
let shareController = component.context.sharedContext.makeShareController(context: component.context, params: ShareControllerParams(subject: .text(text), externalShare: true, immediateExternalShare: false, updatedPresentationData: updatedPresentationData, dismissed: { [weak self, weak view] _ in
|
||||
guard let self, let view else {
|
||||
return
|
||||
}
|
||||
self.shareController = nil
|
||||
view.updateIsProgressPaused()
|
||||
}
|
||||
|
||||
}))
|
||||
|
||||
self.shareController = shareController
|
||||
view.updateIsProgressPaused()
|
||||
|
||||
controller.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ final class TextProcessingTextAreaComponent: Component {
|
|||
case .copy:
|
||||
storeAttributedTextInPasteboard(text)
|
||||
case .share:
|
||||
let shareController = component.context.sharedContext.makeShareController(context: component.context, subject: .text(text.string), forceExternal: true, shareStory: nil, enqueued: nil, actionCompleted: nil)
|
||||
let shareController = component.context.sharedContext.makeShareController(context: component.context, params: ShareControllerParams(subject: .text(text.string)))
|
||||
component.present(shareController, nil)
|
||||
case .lookup:
|
||||
let controller = UIReferenceLibraryViewController(term: text.string)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
@ -2082,9 +2081,9 @@ extension ChatControllerImpl {
|
|||
if let strongSelf = self, !messages.isEmpty {
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) })
|
||||
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: .messages(messages.sorted(by: { lhs, rhs in
|
||||
return lhs.index < rhs.index
|
||||
}).map { $0._asMessage() }), externalShare: true, immediateExternalShare: true, updatedPresentationData: strongSelf.updatedPresentationData)
|
||||
}).map { $0._asMessage() }), externalShare: true, immediateExternalShare: true, updatedPresentationData: strongSelf.updatedPresentationData))
|
||||
strongSelf.chatDisplayNode.dismissInput()
|
||||
strongSelf.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import AccountContext
|
|||
import TelegramCore
|
||||
import SwiftSignalKit
|
||||
import UndoUI
|
||||
import ShareController
|
||||
import LegacyChatHeaderPanelComponent
|
||||
|
||||
private final class ChatBusinessLinkTitlePanelComponent: Component {
|
||||
|
|
@ -184,7 +183,7 @@ final class ChatBusinessLinkTitlePanelNode: ChatTitleAccessoryPanelNode {
|
|||
return
|
||||
}
|
||||
|
||||
interfaceInteraction.presentController(ShareController(context: self.context, subject: .url(link.url), showInChat: nil, externalShare: false, immediateExternalShare: false), nil)
|
||||
interfaceInteraction.presentController(self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .url(link.url), showInChat: nil, externalShare: false, immediateExternalShare: false)), nil)
|
||||
}
|
||||
|
||||
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> LayoutResult {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import AccountContext
|
|||
import TelegramStringFormatting
|
||||
import OverlayStatusController
|
||||
import DeviceLocationManager
|
||||
import ShareController
|
||||
import UrlEscaping
|
||||
import ContextUI
|
||||
import AlertUI
|
||||
|
|
@ -3995,7 +3994,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
guard let self else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: self.context, subject: .text(text.string), externalShare: true, immediateExternalShare: false, updatedPresentationData: self.updatedPresentationData)
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .text(text.string), externalShare: true, immediateExternalShare: false, updatedPresentationData: self.updatedPresentationData))
|
||||
self.chatDisplayNode.dismissInput()
|
||||
self.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||
self?.interfaceInteraction?.presentController(controller, nil)
|
||||
})
|
||||
if let data = self.context.currentAppConfiguration.with({ $0 }).data, let value = data["ios_disable_ai_chat"] as? Double, value == 1.0 {
|
||||
} else if let peerId = self.presentationInterfaceState.chatLocation.peerId, peerId.namespace != Namespaces.Peer.SecretChat {
|
||||
} else if let peerId = self.chatPresentationInterfaceState.chatLocation.peerId, peerId.namespace != Namespaces.Peer.SecretChat {
|
||||
self.textInputPanelNode?.isAIEnabled = true
|
||||
}
|
||||
self.textInputPanelNode?.textInputAccessoryPanel = textInputAccessoryPanel
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import PresentationDataUtils
|
|||
import TextFormat
|
||||
import UrlHandling
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import ChatPresentationInterfaceState
|
||||
import LegacyComponents
|
||||
import LegacyUI
|
||||
|
|
@ -32,7 +33,6 @@ import TelegramCallsUI
|
|||
import AutomaticBusinessMessageSetupScreen
|
||||
import MediaEditorScreen
|
||||
import CameraScreen
|
||||
import ShareController
|
||||
import ComposeTodoScreen
|
||||
import ComposePollScreen
|
||||
import Photos
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import ChatControllerInteraction
|
|||
import Display
|
||||
import UIKit
|
||||
import UndoUI
|
||||
import ShareController
|
||||
import ChatShareMessageTagView
|
||||
import ReactionSelectionNode
|
||||
import TopMessageReactions
|
||||
|
|
@ -109,9 +108,6 @@ extension ChatControllerImpl {
|
|||
warnAboutPrivate = true
|
||||
}
|
||||
}
|
||||
let shareController = ShareController(context: self.context, subject: .messages(messages), updatedPresentationData: self.updatedPresentationData, shareAsLink: true)
|
||||
shareController.parentNavigationController = self.navigationController as? NavigationController
|
||||
|
||||
if let message = messages.first, message.media.contains(where: { media in
|
||||
if media is TelegramMediaContact || media is TelegramMediaPoll || media is TelegramMediaTodo {
|
||||
return true
|
||||
|
|
@ -126,24 +122,18 @@ extension ChatControllerImpl {
|
|||
if message.text.containsOnlyEmoji {
|
||||
canShareToStory = false
|
||||
}
|
||||
|
||||
if canShareToStory {
|
||||
shareController.shareStory = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
Queue.mainQueue().after(0.15) {
|
||||
let controller = self.context.sharedContext.makeStorySharingScreen(context: self.context, subject: .messages(messages), parentController: self)
|
||||
self.push(controller)
|
||||
}
|
||||
|
||||
let shareStory: (() -> Void)? = canShareToStory ? { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
}
|
||||
shareController.dismissed = { [weak self] shared in
|
||||
if shared {
|
||||
self?.commitPurposefulAction()
|
||||
Queue.mainQueue().after(0.15) {
|
||||
let controller = self.context.sharedContext.makeStorySharingScreen(context: self.context, subject: .messages(messages), parentController: self)
|
||||
self.push(controller)
|
||||
}
|
||||
}
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
} : nil
|
||||
|
||||
let shareController = self.context.sharedContext.makeShareController(context: self.context, params: ShareControllerParams(subject: .messages(messages), updatedPresentationData: self.updatedPresentationData, shareAsLink: true, actionCompleted: { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
|
@ -154,12 +144,15 @@ extension ChatControllerImpl {
|
|||
content = .linkCopied(title: nil, text: self.presentationData.strings.Conversation_LinkCopied)
|
||||
}
|
||||
self.present(UndoOverlayController(presentationData: self.presentationData, content: content, elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
shareController.enqueued = { [weak self] peerIds, correlationIds in
|
||||
}, dismissed: { [weak self] shared in
|
||||
if shared {
|
||||
self?.commitPurposefulAction()
|
||||
}
|
||||
}, enqueued: { [weak self] peerIds, correlationIds in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let _ = (self.context.engine.data.get(
|
||||
EngineDataList(
|
||||
peerIds.map(TelegramEngine.EngineData.Item.Peer.RenderedPeer.init)
|
||||
|
|
@ -195,20 +188,20 @@ extension ChatControllerImpl {
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let reactionItems: Signal<[ReactionItem], NoError>
|
||||
if savedMessages {
|
||||
reactionItems = tagMessageReactions(context: self.context, subPeerId: self.chatLocation.threadId.flatMap(EnginePeer.Id.init))
|
||||
} else {
|
||||
reactionItems = .single([])
|
||||
}
|
||||
|
||||
|
||||
let _ = (reactionItems
|
||||
|> deliverOnMainQueue).startStandalone(next: { [weak self] reactionItems in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
self.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, position: savedMessages ? .top : .bottom, animateInAsReplacement: !savedMessages, action: { [weak self] action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -226,7 +219,7 @@ extension ChatControllerImpl {
|
|||
}, additionalView: savedMessages ? chatShareToSavedMessagesAdditionalView(self, reactionItems: reactionItems, correlationIds: correlationIds) : nil), in: .current)
|
||||
})
|
||||
})
|
||||
}
|
||||
}, shareStory: shareStory, parentNavigationController: self.navigationController as? NavigationController))
|
||||
self.chatDisplayNode.dismissInput()
|
||||
self.present(shareController, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ import SwiftSignalKit
|
|||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import SearchUI
|
||||
import TelegramPermissionsUI
|
||||
import AppBundle
|
||||
import DeviceAccess
|
||||
import ShareController
|
||||
|
||||
public class ComposeControllerImpl: ViewController, ComposeController {
|
||||
private let context: AccountContext
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import TelegramCore
|
|||
import Display
|
||||
import DeviceAccess
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import PeerInfoUI
|
||||
import ShareController
|
||||
|
||||
func openAddContactImpl(context: AccountContext, firstName: String = "", lastName: String = "", phoneNumber: String, label: String = "_$!<Mobile>!$_", present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, completed: @escaping () -> Void = {}) {
|
||||
let _ = (DeviceAccess.authorizationStatus(subject: .contacts)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import Lottie
|
|||
import TelegramUIPreferences
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import GalleryUI
|
||||
import InstantPageUI
|
||||
import LocationUI
|
||||
|
|
@ -18,7 +19,6 @@ import PeerInfoUI
|
|||
import SettingsUI
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import WebsiteType
|
||||
import GalleryData
|
||||
|
|
@ -233,7 +233,7 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
|
|||
params.dismissInput()
|
||||
let presentationData = params.context.sharedContext.currentPresentationData.with { $0 }
|
||||
if immediateShare {
|
||||
let controller = ShareController(context: params.context, subject: .media(.standalone(media: file), nil), immediateExternalShare: true)
|
||||
let controller = params.context.sharedContext.makeShareController(context: params.context, params: ShareControllerParams(subject: .media(.standalone(media: file), nil), immediateExternalShare: true))
|
||||
params.present(controller, nil, .window(.root))
|
||||
} else if let rootController = params.navigationController?.view.window?.rootViewController {
|
||||
let proceed = {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import JoinLinkPreviewUI
|
|||
import LanguageLinkPreviewUI
|
||||
import SettingsUI
|
||||
import UrlHandling
|
||||
import ShareController
|
||||
import ChatInterfaceState
|
||||
import TelegramCallsUI
|
||||
import UndoUI
|
||||
|
|
@ -624,10 +623,9 @@ func openResolvedUrlImpl(
|
|||
}
|
||||
} else {
|
||||
if let url = url, !url.isEmpty {
|
||||
let shareController = ShareController(context: context, subject: .url(url), presetText: text, externalShare: false, immediateExternalShare: false)
|
||||
shareController.actionCompleted = {
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url(url), presetText: text, externalShare: false, immediateExternalShare: false, actionCompleted: {
|
||||
present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}))
|
||||
present(shareController, nil)
|
||||
context.sharedContext.applicationBindings.dismissNativeController()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Display
|
|||
import SwiftSignalKit
|
||||
import TelegramUIPreferences
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import AttachmentFileController
|
||||
import LegacyMediaPickerUI
|
||||
|
|
@ -82,13 +81,12 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||
if case .messages = subject {
|
||||
canShowInChat = true
|
||||
}
|
||||
let shareController = ShareController(context: strongSelf.context, subject: subject, showInChat: canShowInChat ? { message in
|
||||
let shareController = strongSelf.context.sharedContext.makeShareController(context: strongSelf.context, params: ShareControllerParams(subject: subject, showInChat: canShowInChat ? { message in
|
||||
if let strongSelf = self {
|
||||
strongSelf.context.sharedContext.navigateToChat(accountId: strongSelf.context.account.id, peerId: message.id.peerId, messageId: message.id)
|
||||
strongSelf.dismiss()
|
||||
}
|
||||
} : nil, externalShare: true)
|
||||
shareController.completed = { [weak self] peerIds in
|
||||
} : nil, externalShare: true, completed: { [weak self] peerIds in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.engine.data.get(
|
||||
EngineDataList(
|
||||
|
|
@ -99,7 +97,7 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||
if let strongSelf = self {
|
||||
let peers = peerList.compactMap { $0 }
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
|
||||
let text: String
|
||||
var savedMessages = false
|
||||
if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId {
|
||||
|
|
@ -124,7 +122,7 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||
text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { action in
|
||||
if savedMessages, let self, action == .info {
|
||||
let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.context.account.peerId))
|
||||
|
|
@ -143,7 +141,7 @@ final class OverlayAudioPlayerControllerImpl: ViewController, OverlayAudioPlayer
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}))
|
||||
strongSelf.controllerNode.view.endEditing(true)
|
||||
strongSelf.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4223,11 +4223,17 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||
})
|
||||
}
|
||||
|
||||
public func makeShareController(context: AccountContext, subject: ShareControllerSubject, forceExternal: Bool, shareStory: (() -> Void)?, enqueued: (([PeerId], [Int64]) -> Void)?, actionCompleted: (() -> Void)?) -> ViewController {
|
||||
let controller = ShareController(context: context, subject: subject, externalShare: forceExternal)
|
||||
controller.shareStory = shareStory
|
||||
controller.enqueued = enqueued
|
||||
controller.actionCompleted = actionCompleted
|
||||
public func makeShareController(context: AccountContext, params: ShareControllerParams) -> ViewController {
|
||||
let controller = ShareController(context: context, subject: params.subject, presetText: params.presetText, preferredAction: params.preferredAction, showInChat: params.showInChat, fromForeignApp: params.fromForeignApp, segmentedValues: params.segmentedValues, externalShare: params.externalShare, immediateExternalShare: params.immediateExternalShare, immediatePeerId: params.immediatePeerId, updatedPresentationData: params.updatedPresentationData, forceTheme: params.forceTheme, forcedActionTitle: params.forcedActionTitle, shareAsLink: params.shareAsLink, collectibleItemInfo: params.collectibleItemInfo)
|
||||
controller.actionCompleted = params.actionCompleted
|
||||
controller.dismissed = params.dismissed
|
||||
controller.completed = params.completed
|
||||
controller.enqueued = params.enqueued
|
||||
controller.shareStory = params.shareStory
|
||||
controller.debugAction = params.debugAction
|
||||
controller.onMediaTimestampLinkCopied = params.onMediaTimestampLinkCopied
|
||||
controller.parentNavigationController = params.parentNavigationController
|
||||
controller.canSendInHighQuality = params.canSendInHighQuality
|
||||
return controller
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import InstantPageUI
|
|||
import InstantPageCache
|
||||
import LocalAuth
|
||||
import OpenInExternalAppUI
|
||||
import ShareController
|
||||
import UndoUI
|
||||
import AvatarNode
|
||||
import OverlayStatusController
|
||||
|
|
@ -3940,11 +3939,10 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||
guard let self else {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/\(addressName)?profile"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let shareController = context.sharedContext.makeShareController(context: context, params: ShareControllerParams(subject: .url("https://t.me/\(addressName)?profile"), actionCompleted: { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(title: nil, text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
self.present(shareController, in: .window(.root))
|
||||
})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue