mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 20:54:04 +00:00
Merge commit '55a730c752496129ef7acbff32a977d1086d5c1e'
This commit is contained in:
commit
0722a22bec
@ -1010,7 +1010,8 @@ public protocol ChatController: ViewController {
|
||||
var canReadHistory: ValuePromise<Bool> { get }
|
||||
var parentController: ViewController? { get set }
|
||||
var customNavigationController: NavigationController? { get set }
|
||||
|
||||
|
||||
var dismissPreviewing: (() -> Void)? { get set }
|
||||
var purposefulAction: (() -> Void)? { get set }
|
||||
|
||||
var stateUpdated: ((ContainedViewLayoutTransition) -> Void)? { get set }
|
||||
|
@ -1402,17 +1402,26 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
} else {
|
||||
var dismissPreviewingImpl: (() -> Void)?
|
||||
let source: ContextContentSource
|
||||
if let location = location {
|
||||
source = .location(ChatListContextLocationContentSource(controller: strongSelf, location: location))
|
||||
} else {
|
||||
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peer.peerId), subject: nil, botStart: nil, mode: .standard(.previewing), params: nil)
|
||||
chatController.customNavigationController = strongSelf.navigationController as? NavigationController
|
||||
chatController.canReadHistory.set(false)
|
||||
chatController.dismissPreviewing = {
|
||||
dismissPreviewingImpl?()
|
||||
}
|
||||
source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
|
||||
}
|
||||
|
||||
let contextController = ContextController(presentationData: strongSelf.presentationData, source: source, items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
|
||||
dismissPreviewingImpl = { [weak contextController] in
|
||||
contextController?.dismiss()
|
||||
}
|
||||
}
|
||||
case let .forum(pinnedIndex, _, threadId, _, _):
|
||||
let isPinned: Bool
|
||||
|
@ -224,8 +224,12 @@ func _internal_applyPremiumGiftCode(account: Account, slug: String) -> Signal<Ne
|
||||
public enum LaunchPrepaidGiveawayError {
|
||||
case generic
|
||||
}
|
||||
public enum LaunchGiveawayPurpose {
|
||||
case premium
|
||||
case stars(stars: Int64, users: Int32)
|
||||
}
|
||||
|
||||
func _internal_launchPrepaidGiveaway(account: Account, peerId: EnginePeer.Id, id: Int64, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32) -> Signal<Never, LaunchPrepaidGiveawayError> {
|
||||
func _internal_launchPrepaidGiveaway(account: Account, peerId: EnginePeer.Id, purpose: LaunchGiveawayPurpose, id: Int64, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32) -> Signal<Never, LaunchPrepaidGiveawayError> {
|
||||
return account.postbox.transaction { transaction -> Signal<Never, LaunchPrepaidGiveawayError> in
|
||||
var flags: Int32 = 0
|
||||
if onlyNewSubscribers {
|
||||
@ -256,7 +260,17 @@ func _internal_launchPrepaidGiveaway(account: Account, peerId: EnginePeer.Id, id
|
||||
guard let inputPeer = inputPeer else {
|
||||
return .complete()
|
||||
}
|
||||
return account.network.request(Api.functions.payments.launchPrepaidGiveaway(peer: inputPeer, giveawayId: id, purpose: .inputStorePaymentPremiumGiveaway(flags: flags, boostPeer: inputPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: "", amount: 0)))
|
||||
|
||||
let inputPurpose: Api.InputStorePaymentPurpose
|
||||
switch purpose {
|
||||
case let .stars(stars, users):
|
||||
inputPurpose = .inputStorePaymentStarsGiveaway(flags: flags, stars: stars, boostPeer: inputPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: "", amount: 0, users: users)
|
||||
case .premium:
|
||||
inputPurpose = .inputStorePaymentPremiumGiveaway(flags: flags, boostPeer: inputPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: "", amount: 0)
|
||||
}
|
||||
|
||||
|
||||
return account.network.request(Api.functions.payments.launchPrepaidGiveaway(peer: inputPeer, giveawayId: id, purpose: inputPurpose))
|
||||
|> mapError { _ -> LaunchPrepaidGiveawayError in
|
||||
return .generic
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ public extension TelegramEngine {
|
||||
return _internal_getPremiumGiveawayInfo(account: self.account, peerId: peerId, messageId: messageId)
|
||||
}
|
||||
|
||||
public func launchPrepaidGiveaway(peerId: EnginePeer.Id, id: Int64, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32) -> Signal<Never, LaunchPrepaidGiveawayError> {
|
||||
return _internal_launchPrepaidGiveaway(account: self.account, peerId: peerId, id: id, additionalPeerIds: additionalPeerIds, countries: countries, onlyNewSubscribers: onlyNewSubscribers, showWinners: showWinners, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate)
|
||||
public func launchPrepaidGiveaway(peerId: EnginePeer.Id, id: Int64, purpose: LaunchGiveawayPurpose, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32) -> Signal<Never, LaunchPrepaidGiveawayError> {
|
||||
return _internal_launchPrepaidGiveaway(account: self.account, peerId: peerId, purpose: purpose, id: id, additionalPeerIds: additionalPeerIds, countries: countries, onlyNewSubscribers: onlyNewSubscribers, showWinners: showWinners, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate)
|
||||
}
|
||||
|
||||
public func starsTopUpOptions() -> Signal<[StarsTopUpOption], NoError> {
|
||||
|
@ -387,6 +387,7 @@ extension ChatControllerImpl {
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] peerView in
|
||||
if let strongSelf = self, let peer = peerView.peers[peerView.peerId], peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil && !strongSelf.presentationInterfaceState.isNotAccessible {
|
||||
|
||||
if peer.id == strongSelf.context.account.peerId {
|
||||
if let peer = strongSelf.presentationInterfaceState.renderedPeer?.chatMainPeer, let infoController = strongSelf.context.sharedContext.makePeerInfoController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, peer: peer, mode: .generic, avatarInitiallyExpanded: false, fromChat: true, requestsContext: nil) {
|
||||
strongSelf.effectiveNavigationController?.pushViewController(infoController)
|
||||
@ -403,6 +404,8 @@ extension ChatControllerImpl {
|
||||
strongSelf.effectiveNavigationController?.pushViewController(infoController)
|
||||
}
|
||||
}
|
||||
|
||||
strongSelf.dismissPreviewing?()
|
||||
}
|
||||
}))
|
||||
case .replyThread:
|
||||
|
@ -376,7 +376,7 @@ public extension ChatControllerImpl {
|
||||
case let .withAttachBot(attachBotStart):
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), attachBotStart: attachBotStart))
|
||||
case let .withBotApp(botAppStart):
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), botAppStart: botAppStart))
|
||||
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), botAppStart: botAppStart, keepStack: .always))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -567,6 +567,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
var scheduledScrollToMessageId: (MessageId, NavigateToMessageParams)?
|
||||
|
||||
public var purposefulAction: (() -> Void)?
|
||||
public var dismissPreviewing: (() -> Void)?
|
||||
|
||||
var updatedClosedPinnedMessageId: ((MessageId) -> Void)?
|
||||
var requestedUnpinAllMessages: ((Int, MessageId) -> Void)?
|
||||
|
||||
@ -4653,7 +4655,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self.navigationItem.titleView = self.chatTitleView
|
||||
self.chatTitleView?.longPressed = { [weak self] in
|
||||
if let strongSelf = self, let peerView = strongSelf.peerView, let peer = peerView.peers[peerView.peerId], peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil && !strongSelf.presentationInterfaceState.isNotAccessible {
|
||||
strongSelf.interfaceInteraction?.beginMessageSearch(.everything, "")
|
||||
if case .standard(.previewing) = strongSelf.mode {
|
||||
} else {
|
||||
strongSelf.interfaceInteraction?.beginMessageSearch(.everything, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5414,7 +5419,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
imageOverride = nil
|
||||
}
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: EnginePeer(peer), overrideImage: imageOverride)
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
|
||||
if case .standard(.previewing) = strongSelf.mode {
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = false
|
||||
} else {
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
|
||||
}
|
||||
strongSelf.chatInfoNavigationButton?.buttonItem.accessibilityLabel = presentationInterfaceState.strings.Conversation_ContextMenuOpenProfile
|
||||
|
||||
strongSelf.storyStats = peerView.storyStats
|
||||
@ -6304,7 +6313,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if strongSelf.isNodeLoaded {
|
||||
strongSelf.chatDisplayNode.overlayTitle = strongSelf.overlayTitle
|
||||
}
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = true
|
||||
if case .standard(.previewing) = strongSelf.mode {
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = false
|
||||
} else {
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = true
|
||||
}
|
||||
|
||||
var peerDiscussionId: PeerId?
|
||||
var peerGeoLocation: PeerGeoLocation?
|
||||
@ -8368,7 +8381,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
|
||||
@objc func rightNavigationButtonAction() {
|
||||
if let button = self.rightNavigationButton {
|
||||
if case let .peer(peerId) = self.chatLocation, case .openChatInfo(expandAvatar: true, _) = button.action, let storyStats = self.storyStats, storyStats.unseenCount != 0, let avatarNode = self.avatarNode {
|
||||
if case .standard(.previewing) = self.mode {
|
||||
self.navigationButtonAction(button.action)
|
||||
} else if case let .peer(peerId) = self.chatLocation, case .openChatInfo(expandAvatar: true, _) = button.action, let storyStats = self.storyStats, storyStats.unseenCount != 0, let avatarNode = self.avatarNode {
|
||||
self.openStories(peerId: peerId, avatarHeaderNode: nil, avatarNode: avatarNode.avatarNode)
|
||||
} else {
|
||||
self.navigationButtonAction(button.action)
|
||||
|
@ -3684,7 +3684,9 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let navigationBar = self.navigationBar, let result = navigationBar.view.hitTest(self.view.convert(point, to: navigationBar.view), with: nil) {
|
||||
return result
|
||||
}
|
||||
if let result = self.historyNode.view.hitTest(self.view.convert(point, to: self.historyNode.view), with: event), let node = result.asyncdisplaykit_node, node is ChatMessageSelectionNode || node is GridMessageSelectionNode {
|
||||
return result
|
||||
}
|
||||
|
@ -636,6 +636,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
if let controller = self.controller {
|
||||
webView.updateMetrics(height: viewportFrame.height, isExpanded: controller.isContainerExpanded(), isStable: !controller.isContainerPanning(), transition: transition)
|
||||
}
|
||||
|
||||
webView.customBottomInset = layout.intrinsicInsets.bottom
|
||||
}
|
||||
|
||||
if let placeholderNode = self.placeholderNode {
|
||||
|
Loading…
x
Reference in New Issue
Block a user