mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
8a8ff6fddc
commit
39dd9110f5
@ -13961,6 +13961,8 @@ Sorry for the inconvenience.";
|
||||
"PeerInfo.Gifts.ToastUnpinned.Text" = "Gift Unpinned.";
|
||||
"PeerInfo.Gifts.ToastPinned.Title" = "Gift Pinned";
|
||||
"PeerInfo.Gifts.ToastPinned.Text" = "Now it will always be shown on the top.";
|
||||
"PeerInfo.Gifts.ToastPinned.TitleNew" = "%@ Pinned";
|
||||
"PeerInfo.Gifts.ToastPinned.ReplacingText" = "replacing %@.";
|
||||
|
||||
"Chat.PaidMessage.Confirm.Title" = "Confirm Payment";
|
||||
"Chat.PaidMessage.Confirm.DontAskAgain" = "Don't ask again";
|
||||
|
@ -514,6 +514,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var dismissImpl: (() -> Void)?
|
||||
let controller = GiftViewScreen(
|
||||
context: self.context,
|
||||
subject: .profileGift(self.peerId, product),
|
||||
@ -550,11 +551,36 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
let controller = GiftUnpinScreen(
|
||||
context: context,
|
||||
gifts: gifts,
|
||||
completion: { [weak self] reference in
|
||||
completion: { [weak self] unpinnedReference in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.profileGifts.updateStarGiftPinnedToTop(reference: reference, pinnedToTop: false)
|
||||
dismissImpl?()
|
||||
|
||||
var replacingTitle = ""
|
||||
for gift in gifts {
|
||||
if gift.reference == unpinnedReference, case let .unique(uniqueGift) = gift.gift {
|
||||
replacingTitle = "\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, params.presentationData.dateTimeFormat.groupingSeparator))"
|
||||
}
|
||||
}
|
||||
|
||||
var updatedPinnedGifts = self.pinnedReferences
|
||||
if let index = updatedPinnedGifts.firstIndex(of: unpinnedReference), let reference = product.reference {
|
||||
updatedPinnedGifts[index] = reference
|
||||
}
|
||||
self.profileGifts.updatePinnedToTopStarGifts(references: updatedPinnedGifts)
|
||||
|
||||
var title = ""
|
||||
if case let .unique(uniqueGift) = product.gift {
|
||||
title = "\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, params.presentationData.dateTimeFormat.groupingSeparator))"
|
||||
}
|
||||
|
||||
let _ = self.scrollToTop()
|
||||
Queue.mainQueue().after(0.35) {
|
||||
let toastTitle = params.presentationData.strings.PeerInfo_Gifts_ToastPinned_TitleNew(title).string
|
||||
let toastText = params.presentationData.strings.PeerInfo_Gifts_ToastPinned_ReplacingText(replacingTitle).string
|
||||
self.parentController?.present(UndoOverlayController(presentationData: params.presentationData, content: .universal(animation: "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
)
|
||||
self.parentController?.push(controller)
|
||||
@ -564,10 +590,15 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
if let reference = product.reference {
|
||||
self.profileGifts.updateStarGiftPinnedToTop(reference: reference, pinnedToTop: pinnedToTop)
|
||||
|
||||
var title = ""
|
||||
if case let .unique(uniqueGift) = product.gift {
|
||||
title = "\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, params.presentationData.dateTimeFormat.groupingSeparator))"
|
||||
}
|
||||
|
||||
if pinnedToTop {
|
||||
let _ = self.scrollToTop()
|
||||
Queue.mainQueue().after(0.35) {
|
||||
let toastTitle = params.presentationData.strings.PeerInfo_Gifts_ToastPinned_Title
|
||||
let toastTitle = params.presentationData.strings.PeerInfo_Gifts_ToastPinned_TitleNew(title).string
|
||||
let toastText = params.presentationData.strings.PeerInfo_Gifts_ToastPinned_Text
|
||||
self.parentController?.present(UndoOverlayController(presentationData: params.presentationData, content: .universal(animation: "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
@ -585,6 +616,9 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
}
|
||||
}
|
||||
)
|
||||
dismissImpl = { [weak controller] in
|
||||
controller?.dismissAnimated()
|
||||
}
|
||||
self.parentController?.push(controller)
|
||||
}
|
||||
},
|
||||
@ -1041,7 +1075,11 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||
toastTitle = nil
|
||||
toastText = strings.PeerInfo_Gifts_ToastUnpinned_Text
|
||||
} else {
|
||||
toastTitle = strings.PeerInfo_Gifts_ToastPinned_Title
|
||||
var title = ""
|
||||
if case let .unique(uniqueGift) = gift.gift {
|
||||
title = "\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, presentationData.dateTimeFormat.groupingSeparator))"
|
||||
}
|
||||
toastTitle = strings.PeerInfo_Gifts_ToastPinned_TitleNew(title).string
|
||||
toastText = strings.PeerInfo_Gifts_ToastPinned_Text
|
||||
}
|
||||
self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: !pinnedToTop ? "anim_toastunpin" : "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
|
@ -6397,7 +6397,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if case let .known(value) = cachedData.businessIntro {
|
||||
businessIntro = value
|
||||
}
|
||||
alwaysShowGiftButton = cachedData.flags.contains(.displayGiftButton)
|
||||
if cachedData.disallowedGifts != .All {
|
||||
alwaysShowGiftButton = cachedData.flags.contains(.displayGiftButton)
|
||||
}
|
||||
} else if let cachedData = peerView.cachedData as? CachedGroupData {
|
||||
var invitedBy: Peer?
|
||||
if let invitedByPeerId = cachedData.invitedBy {
|
||||
|
Loading…
x
Reference in New Issue
Block a user