mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Merge commit '681b5c9d3aa69629d9ccd5a023a9e104b12a3054'
This commit is contained in:
@@ -1937,6 +1937,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}, playMessageEffect: { _ in
|
||||
}, editMessageFactCheck: { _ in
|
||||
}, sendGift: { _ in
|
||||
}, openUniqueGift: { _ in
|
||||
}, requestMessageUpdate: { _, _ in
|
||||
}, cancelInteractiveKeyboardGestures: {
|
||||
}, dismissTextInput: {
|
||||
@@ -2352,7 +2353,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var presentBirthdayPickerImpl: (() -> Void)?
|
||||
let starsMode: ContactSelectionControllerMode = .starsGifting(birthdays: birthdays, hasActions: false, showSelf: false)
|
||||
let starsMode: ContactSelectionControllerMode = .starsGifting(birthdays: birthdays, hasActions: false, showSelf: false, selfSubtitle: nil)
|
||||
|
||||
let contactOptions: Signal<[ContactListAdditionalOption], NoError> = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Birthday(id: context.account.peerId))
|
||||
|> map { birthday in
|
||||
@@ -2428,22 +2429,26 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
var currentBirthdays: [EnginePeer.Id: TelegramBirthday]?
|
||||
|
||||
if case let .starGiftTransfer(birthdays, _, _, _, _, showSelf) = source {
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: false, showSelf: showSelf)
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: false, showSelf: showSelf, selfSubtitle: presentationData.strings.Premium_Gift_ContactSelection_TransferSelf)
|
||||
currentBirthdays = birthdays
|
||||
} else if case let .chatList(birthdays) = source {
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: true, showSelf: true)
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: true, showSelf: true, selfSubtitle: presentationData.strings.Premium_Gift_ContactSelection_BuySelf)
|
||||
currentBirthdays = birthdays
|
||||
} else if case let .settings(birthdays) = source {
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: true, showSelf: true)
|
||||
mode = .starsGifting(birthdays: birthdays, hasActions: true, showSelf: true, selfSubtitle: presentationData.strings.Premium_Gift_ContactSelection_BuySelf)
|
||||
currentBirthdays = birthdays
|
||||
} else {
|
||||
mode = .starsGifting(birthdays: nil, hasActions: true, showSelf: false)
|
||||
mode = .starsGifting(birthdays: nil, hasActions: true, showSelf: false, selfSubtitle: nil)
|
||||
}
|
||||
|
||||
var allowChannelsInSearch = false
|
||||
var isChannelGift = false
|
||||
let contactOptions: Signal<[ContactListAdditionalOption], NoError>
|
||||
if case let .starGiftTransfer(_, _, _, _, canExportDate, _) = source {
|
||||
if case let .starGiftTransfer(_, reference, _, _, canExportDate, _) = source {
|
||||
allowChannelsInSearch = true
|
||||
if case let .peer(peerId, _) = reference, peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
isChannelGift = true
|
||||
}
|
||||
var subtitle: String?
|
||||
if let canExportDate {
|
||||
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
|
||||
@@ -2605,9 +2610,16 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
case .requestPassword:
|
||||
let alertController = confirmGiftWithdrawalController(context: context, reference: reference, present: { [weak controller] c, a in
|
||||
controller?.present(c, in: .window(.root))
|
||||
}, completion: { url in
|
||||
}, completion: { [weak controller] url in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: url, forceExternal: true, presentationData: presentationData, navigationController: nil, dismissInput: {})
|
||||
|
||||
guard let controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter { !($0 is ContactSelectionController) }
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
})
|
||||
controller?.present(alertController, in: .window(.root))
|
||||
default:
|
||||
@@ -2646,19 +2658,36 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter { !($0 is ContactSelectionController) }
|
||||
var foundController = false
|
||||
for controller in controllers.reversed() {
|
||||
if let chatController = controller as? ChatController, case .peer(id: peer.id) = chatController.chatLocation {
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
foundController = true
|
||||
break
|
||||
|
||||
if !isChannelGift {
|
||||
if peer.id.namespace == Namespaces.Peer.CloudChannel {
|
||||
if let controller = context.sharedContext.makePeerInfoController(
|
||||
context: context,
|
||||
updatedPresentationData: nil,
|
||||
peer: peer._asPeer(),
|
||||
mode: .gifts,
|
||||
avatarInitiallyExpanded: false,
|
||||
fromChat: false,
|
||||
requestsContext: nil
|
||||
) {
|
||||
controllers.append(controller)
|
||||
}
|
||||
} else {
|
||||
var foundController = false
|
||||
for controller in controllers.reversed() {
|
||||
if let chatController = controller as? ChatController, case .peer(id: peer.id) = chatController.chatLocation {
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
foundController = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundController {
|
||||
let chatController = context.sharedContext.makeChatController(context: context, chatLocation: .peer(id: peer.id), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
controllers.append(chatController)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !foundController {
|
||||
let chatController = context.sharedContext.makeChatController(context: context, chatLocation: .peer(id: peer.id), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
|
||||
chatController.hintPlayNextOutgoingGift()
|
||||
controllers.append(chatController)
|
||||
}
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
|
||||
Queue.mainQueue().after(0.3) {
|
||||
@@ -3228,15 +3257,18 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
|
||||
} else if let _ = peer as? TelegramChannel {
|
||||
var forumTopicThread: ChatReplyThreadMessage?
|
||||
var switchToRecommendedChannels = false
|
||||
var switchToGifts = false
|
||||
switch mode {
|
||||
case let .forumTopic(thread):
|
||||
forumTopicThread = thread
|
||||
case .recommendedChannels:
|
||||
switchToRecommendedChannels = true
|
||||
case .gifts:
|
||||
switchToGifts = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nil, reactionSourceMessageId: nil, callMessages: [], forumTopicThread: forumTopicThread, switchToRecommendedChannels: switchToRecommendedChannels)
|
||||
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nil, reactionSourceMessageId: nil, callMessages: [], forumTopicThread: forumTopicThread, switchToRecommendedChannels: switchToRecommendedChannels, switchToGifts: switchToGifts)
|
||||
} else if peer is TelegramUser {
|
||||
var nearbyPeerDistance: Int32?
|
||||
var reactionSourceMessageId: MessageId?
|
||||
|
||||
Reference in New Issue
Block a user