Premium gift fixes

This commit is contained in:
Ilya Laktyushin 2023-03-06 15:02:03 +04:00
parent fcadacbd15
commit ed0c3bc0ca
3 changed files with 7 additions and 7 deletions

View File

@ -122,7 +122,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
jsonString += "]}}"
if let data = jsonString.data(using: .utf8), let json = JSON(data: data) {
addAppLogEvent(postbox: strongSelf.context.account.postbox, type: "premium.promo_screen_show", data: json)
addAppLogEvent(postbox: strongSelf.context.account.postbox, type: "premium_gift.promo_screen_show", data: json)
}
}
@ -430,7 +430,7 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
controller?.dismiss(animated: true, completion: nil)
}
addAppLogEvent(postbox: accountContext.account.postbox, type: "premium.promo_screen_tap", data: ["item": perk.identifier])
addAppLogEvent(postbox: accountContext.account.postbox, type: "premium_gift.promo_screen_tap", data: ["item": perk.identifier])
}
))
i += 1
@ -668,7 +668,7 @@ private final class PremiumGiftScreenComponent: CombinedComponent {
let (currency, amount) = product.storeProduct.priceCurrencyAndAmount
let duration = product.months
// addAppLogEvent(postbox: self.context.account.postbox, type: "premium.promo_screen_accept")
addAppLogEvent(postbox: self.context.account.postbox, type: "premium_gift.promo_screen_accept")
self.inProgress = true
self.updateInProgress(true)
@ -714,7 +714,7 @@ private final class PremiumGiftScreenComponent: CombinedComponent {
}
if let errorText = errorText {
// addAppLogEvent(postbox: strongSelf.context.account.postbox, type: "premium.promo_screen_fail")
addAppLogEvent(postbox: strongSelf.context.account.postbox, type: "premium_gift.promo_screen_fail")
let alertController = textAlertController(context: strongSelf.context, title: nil, text: errorText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
strongSelf.present(alertController)

View File

@ -602,7 +602,7 @@ public struct PresentationResourcesChat {
}
public static func chatInputTextFieldGiftImage(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.chatInputTextFieldScheduleImage.rawValue, { theme in
return theme.image(PresentationResourceKey.chatInputTextFieldGiftImage.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconGift"), color: theme.chat.inputPanel.inputControlColor)
})
}

View File

@ -338,7 +338,8 @@ func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInte
let isTextEmpty = chatPresentationInterfaceState.interfaceState.composeInputState.inputText.length == 0
let hasForward = chatPresentationInterfaceState.interfaceState.forwardMessageIds != nil
if isTextEmpty, let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser, !peer.isDeleted && peer.botInfo == nil && !peer.flags.contains(.isSupport) && !peer.isPremium && !chatPresentationInterfaceState.premiumGiftOptions.isEmpty {
if case .scheduledMessages = chatPresentationInterfaceState.subject {
} else if isTextEmpty, let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser, !peer.isDeleted && peer.botInfo == nil && !peer.flags.contains(.isSupport) && !peer.isPremium && !chatPresentationInterfaceState.premiumGiftOptions.isEmpty {
accessoryItems.append(.gift)
}
@ -366,7 +367,6 @@ func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInte
var stickersEnabled = true
var stickersAreEmoji = !isTextEmpty
if let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel {
if isTextEmpty, case .broadcast = peer.info, canSendMessagesToPeer(peer) {
accessoryItems.append(.silentPost(chatPresentationInterfaceState.interfaceState.silentPosting))