diff --git a/submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift b/submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift index 25da592f9b..93ddd3224b 100644 --- a/submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift +++ b/submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift @@ -959,6 +959,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS textFieldInsets.right += additionalSideInsets.right / 3.0 } + var isPaidMessage = false var textBackgroundInset: CGFloat = 0.0 let actionButtonsSize: CGSize if let presentationInterfaceState = self.presentationInterfaceState { @@ -968,6 +969,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS isMinimized = false let count = max(1, presentationInterfaceState.interfaceState.forwardMessageIds?.count ?? 1) text = "⭐️\(sendPaidMessageStars.value * Int64(count))" + isPaidMessage = true } else { isMinimized = !self.isAttachment || inputHasText text = presentationInterfaceState.strings.MediaPicker_Send @@ -981,7 +983,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS let actionButtonsFrame = CGRect(origin: CGPoint(x: width - rightInset - actionButtonsSize.width + 1.0 - UIScreenPixel + composeButtonsOffset, y: panelHeight - minimalHeight), size: actionButtonsSize) transition.updateFrame(node: self.actionButtons, frame: actionButtonsFrame) - let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: textInputFrame.size.width + composeButtonsOffset, height: textInputFrame.size.height)) + let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: textInputFrame.size.height)) transition.updateFrame(node: self.textInputContainerBackgroundNode, frame: textInputBackgroundFrame) transition.updateFrame(layer: self.textInputBackgroundNode.layer, frame: CGRect(x: leftInset + textFieldInsets.left, y: textFieldInsets.top, width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: panelHeight - textFieldInsets.top - textFieldInsets.bottom)) @@ -1028,7 +1030,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS } transition.updateFrame(node: self.textPlaceholderNode, frame: placeholderFrame) - return textBackgroundInset + return isPaidMessage ? textBackgroundInset : 0.0 } private var skipUpdate = false diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift index 54a58826da..0e83bccb9e 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift @@ -1881,6 +1881,8 @@ public final class ChatListNode: ListView { let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .gracePremium).startStandalone() case .setupPhoto: let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .setupPhoto).startStandalone() + case .starsSubscriptionLowBalance: + let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .starsSubscriptionLowBalance).startStandalone() default: break } diff --git a/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift index d45f5fc0b9..b684b61345 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift @@ -869,6 +869,8 @@ final class GiftOptionsScreenComponent: Component { let optionSpacing: CGFloat = 10.0 let optionWidth = (availableSize.width - sideInset * 2.0 - optionSpacing * 2.0) / 3.0 + let showStarPrice = (self.starsState?.balance.value ?? 0) > 10 + if isSelfGift || isChannelGift || isPremiumDisabled { contentHeight += 6.0 } else { @@ -906,7 +908,7 @@ final class GiftOptionsScreenComponent: Component { default: title = strings.Gift_Options_Premium_Months(3) } - + let _ = visibleItem.update( transition: itemTransition, component: AnyComponent( @@ -920,7 +922,7 @@ final class GiftOptionsScreenComponent: Component { subject: .premium(months: product.months, price: product.price), title: title, subtitle: strings.Gift_Options_Premium_Premium, - label: product.starsPrice.flatMap { strings.Gift_Options_Premium_OrStars("**#\(presentationStringsFormattedNumber(Int32($0), environment.dateTimeFormat.groupingSeparator))**").string }, + label: showStarPrice ? product.starsPrice.flatMap { strings.Gift_Options_Premium_OrStars("**#\(presentationStringsFormattedNumber(Int32($0), environment.dateTimeFormat.groupingSeparator))**").string } : nil, ribbon: product.discount.flatMap { GiftItemComponent.Ribbon( text: "-\($0)%", diff --git a/submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift index 78b8b1a82b..56549057c4 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift @@ -968,8 +968,8 @@ final class GiftSetupScreenComponent: Component { switch component.subject { case let .premium(product): - if let starsPrice = product.starsPrice { - let balance = component.context.starsContext?.currentState?.balance.value ?? 0 + let balance = component.context.starsContext?.currentState?.balance.value ?? 0 + if let starsPrice = product.starsPrice, balance >= starsPrice { let balanceString = presentationStringsFormattedNumber(Int32(balance), environment.dateTimeFormat.groupingSeparator) let starsFooterRawString = environment.strings.Gift_Send_PayWithStars_Info("# \(balanceString)").string