Various improvements

This commit is contained in:
Ilya Laktyushin
2025-01-23 06:46:50 +04:00
parent 8cf054ef30
commit 0485aed646
17 changed files with 117 additions and 64 deletions

View File

@@ -320,7 +320,7 @@ private final class GiftViewSheetContent: CombinedComponent {
self.updated(transition: .spring(duration: 0.4))
if let arguments = self.subject.arguments, let peerId = arguments.peerId, peerId.namespace == Namespaces.Peer.CloudChannel {
let _ = self.context.engine.peers.updatePeerEmojiStatus(peerId: peerId, fileId: nil, expirationDate: nil)
let _ = self.context.engine.peers.updatePeerEmojiStatus(peerId: peerId, fileId: nil, expirationDate: nil).startStandalone()
} else {
let _ = self.context.engine.accountData.setEmojiStatus(file: nil, expirationDate: nil).startStandalone()
}
@@ -1101,8 +1101,10 @@ private final class GiftViewSheetContent: CombinedComponent {
return nil
}
},
tapAction: { _, _ in
component.openStarsIntro()
tapAction: { attributes, _ in
if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
component.openStarsIntro()
}
}
),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0 - 50.0, height: CGFloat.greatestFiniteMagnitude),
@@ -1907,11 +1909,13 @@ private final class GiftViewSheetContent: CombinedComponent {
return nil
}
},
tapAction: { _, _ in
component.updateSavedToProfile(!savedToProfile)
Queue.mainQueue().after(0.6, {
component.cancel(false)
})
tapAction: { attributes, _ in
if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
component.updateSavedToProfile(!savedToProfile)
Queue.mainQueue().after(0.6, {
component.cancel(false)
})
}
}
),
availableSize: CGSize(width: context.availableSize.width - sideInset * 2.0 - 60.0, height: CGFloat.greatestFiniteMagnitude),
@@ -2430,7 +2434,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
convertToStars: (() -> Void)? = nil,
transferGift: ((Bool, EnginePeer.Id) -> Void)? = nil,
upgradeGift: ((Int64?, Bool) -> Signal<ProfileGiftsContext.State.StarGift, UpgradeStarGiftError>)? = nil,
shareStory: (() -> Void)? = nil
shareStory: ((StarGift.UniqueGift) -> Void)? = nil
) {
self.context = context
self.subject = subject
@@ -2687,7 +2691,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
|> filter { !$0.isEmpty }
|> deliverOnMainQueue).start(next: { giftOptions in
let premiumOptions = giftOptions.filter { $0.users == 1 }.map { CachedPremiumGiftOption(months: $0.months, currency: $0.currency, amount: $0.amount, botUrl: "", storeProductId: $0.storeProductId) }
let controller = context.sharedContext.makeGiftOptionsController(context: context, peerId: peerId, premiumOptions: premiumOptions, hasBirthday: false)
let controller = context.sharedContext.makeGiftOptionsController(context: context, peerId: peerId, premiumOptions: premiumOptions, hasBirthday: false, completion: nil)
self.push(controller)
})
}
@@ -2766,12 +2770,19 @@ public class GiftViewScreen: ViewControllerComponentContainer {
guard let self, let arguments = self.subject.arguments, case let .unique(gift) = arguments.gift else {
return
}
var shareStoryImpl: (() -> Void)?
if let shareStory {
shareStoryImpl = {
shareStory(gift)
}
}
let link = "https://t.me/nft/\(gift.slug)"
let shareController = context.sharedContext.makeShareController(
context: context,
subject: .url(link),
forceExternal: false,
shareStory: shareStory,
shareStory: shareStoryImpl,
enqueued: { peerIds, _ in
let _ = (context.engine.data.get(
EngineDataList(