mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Merge commit '2af174f570e0a73954d3e6ec33abcf55bd03b1bb'
This commit is contained in:
@@ -2529,26 +2529,47 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}
|
||||
|
||||
presentExportAlertImpl = { [weak controller] in
|
||||
guard let controller, case let .starGiftTransfer(_, _, _, _, canExportDate) = source, let canExportDate else {
|
||||
guard let controller, case let .starGiftTransfer(_, reference, gift, _, canExportDate) = source, let canExportDate else {
|
||||
return
|
||||
}
|
||||
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
|
||||
let title: String
|
||||
let text: String
|
||||
if currentTime > canExportDate {
|
||||
title = presentationData.strings.Gift_Transfer_UpdateRequired_Title
|
||||
text = presentationData.strings.Gift_Transfer_UpdateRequired_Text
|
||||
if currentTime > canExportDate || "".isEmpty {
|
||||
let alertController = giftWithdrawAlertController(context: context, gift: gift, commit: {
|
||||
let _ = (context.engine.payments.checkStarGiftWithdrawalAvailability(reference: reference)
|
||||
|> deliverOnMainQueue).start(error: { [weak controller] error in
|
||||
switch error {
|
||||
case .serverProvided:
|
||||
return
|
||||
case .requestPassword:
|
||||
let alertController = confirmGiftWithdrawalController(context: context, reference: reference, present: { [weak controller] c, a in
|
||||
controller?.present(c, in: .window(.root))
|
||||
}, completion: { 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: {})
|
||||
})
|
||||
controller?.present(alertController, in: .window(.root))
|
||||
default:
|
||||
let alertController = giftWithdrawalController(context: context, reference: reference, initialError: error, present: { [weak controller] c, a in
|
||||
controller?.present(c, in: .window(.root))
|
||||
}, completion: { _ in
|
||||
|
||||
})
|
||||
controller?.present(alertController, in: .window(.root))
|
||||
}
|
||||
})
|
||||
})
|
||||
controller.present(alertController, in: .window(.root))
|
||||
} else {
|
||||
let delta = canExportDate - currentTime
|
||||
let days: Int32 = Int32(ceil(Float(delta) / 86400.0))
|
||||
let daysString = presentationData.strings.Gift_Transfer_UnlockPending_Text_Days(days)
|
||||
title = presentationData.strings.Gift_Transfer_UnlockPending_Title
|
||||
text = presentationData.strings.Gift_Transfer_UnlockPending_Text(daysString).string
|
||||
let title = presentationData.strings.Gift_Transfer_UnlockPending_Title
|
||||
let text = presentationData.strings.Gift_Transfer_UnlockPending_Text(daysString).string
|
||||
let alertController = textAlertController(context: context, title: title, text: text, actions: [
|
||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})
|
||||
])
|
||||
controller.present(alertController, in: .window(.root))
|
||||
}
|
||||
let alertController = textAlertController(context: context, title: title, text: text, actions: [
|
||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})
|
||||
])
|
||||
controller.present(alertController, in: .window(.root))
|
||||
}
|
||||
|
||||
presentTransferAlertImpl = { [weak controller] peer in
|
||||
@@ -3006,8 +3027,17 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
return GiftViewScreen(context: context, subject: .message(message), shareStory: shareStory)
|
||||
}
|
||||
|
||||
public func makeGiftViewScreen(context: AccountContext, gift: StarGift.UniqueGift, shareStory: (() -> Void)?) -> ViewController {
|
||||
return GiftViewScreen(context: context, subject: .uniqueGift(gift), shareStory: shareStory)
|
||||
public func makeGiftViewScreen(context: AccountContext, gift: StarGift.UniqueGift, shareStory: (() -> Void)?, dismissed: (() -> Void)?) -> ViewController {
|
||||
let controller = GiftViewScreen(context: context, subject: .uniqueGift(gift), shareStory: shareStory)
|
||||
controller.disposed = {
|
||||
dismissed?()
|
||||
}
|
||||
return controller
|
||||
}
|
||||
|
||||
public func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift.UniqueGift) -> ViewController {
|
||||
let controller = GiftViewScreen(context: context, subject: .wearPreview(gift))
|
||||
return controller
|
||||
}
|
||||
|
||||
public func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController {
|
||||
|
||||
Reference in New Issue
Block a user