Skip to content

Commit 3c38b4d

Browse files
author
Isaac
committed
Merge commit '009ff2a4b24e200388d23a38bd1fecc8691b3168'
2 parents 6a4b085 + 009ff2a commit 3c38b4d

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputPanelNode.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
959959
textFieldInsets.right += additionalSideInsets.right / 3.0
960960
}
961961

962+
var isPaidMessage = false
962963
var textBackgroundInset: CGFloat = 0.0
963964
let actionButtonsSize: CGSize
964965
if let presentationInterfaceState = self.presentationInterfaceState {
@@ -968,6 +969,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
968969
isMinimized = false
969970
let count = max(1, presentationInterfaceState.interfaceState.forwardMessageIds?.count ?? 1)
970971
text = "⭐️\(sendPaidMessageStars.value * Int64(count))"
972+
isPaidMessage = true
971973
} else {
972974
isMinimized = !self.isAttachment || inputHasText
973975
text = presentationInterfaceState.strings.MediaPicker_Send
@@ -981,7 +983,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
981983
let actionButtonsFrame = CGRect(origin: CGPoint(x: width - rightInset - actionButtonsSize.width + 1.0 - UIScreenPixel + composeButtonsOffset, y: panelHeight - minimalHeight), size: actionButtonsSize)
982984
transition.updateFrame(node: self.actionButtons, frame: actionButtonsFrame)
983985

984-
let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: textInputFrame.size.width + composeButtonsOffset, height: textInputFrame.size.height))
986+
let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: textInputFrame.size.height))
985987
transition.updateFrame(node: self.textInputContainerBackgroundNode, frame: textInputBackgroundFrame)
986988

987989
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
10281030
}
10291031
transition.updateFrame(node: self.textPlaceholderNode, frame: placeholderFrame)
10301032

1031-
return textBackgroundInset
1033+
return isPaidMessage ? textBackgroundInset : 0.0
10321034
}
10331035

10341036
private var skipUpdate = false

submodules/ChatListUI/Sources/Node/ChatListNode.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,8 @@ public final class ChatListNode: ListView {
18811881
let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .gracePremium).startStandalone()
18821882
case .setupPhoto:
18831883
let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .setupPhoto).startStandalone()
1884+
case .starsSubscriptionLowBalance:
1885+
let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .starsSubscriptionLowBalance).startStandalone()
18841886
default:
18851887
break
18861888
}

submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,8 @@ final class GiftOptionsScreenComponent: Component {
869869
let optionSpacing: CGFloat = 10.0
870870
let optionWidth = (availableSize.width - sideInset * 2.0 - optionSpacing * 2.0) / 3.0
871871

872+
let showStarPrice = (self.starsState?.balance.value ?? 0) > 10
873+
872874
if isSelfGift || isChannelGift || isPremiumDisabled {
873875
contentHeight += 6.0
874876
} else {
@@ -906,7 +908,7 @@ final class GiftOptionsScreenComponent: Component {
906908
default:
907909
title = strings.Gift_Options_Premium_Months(3)
908910
}
909-
911+
910912
let _ = visibleItem.update(
911913
transition: itemTransition,
912914
component: AnyComponent(
@@ -920,7 +922,7 @@ final class GiftOptionsScreenComponent: Component {
920922
subject: .premium(months: product.months, price: product.price),
921923
title: title,
922924
subtitle: strings.Gift_Options_Premium_Premium,
923-
label: product.starsPrice.flatMap { strings.Gift_Options_Premium_OrStars("**#\(presentationStringsFormattedNumber(Int32($0), environment.dateTimeFormat.groupingSeparator))**").string },
925+
label: showStarPrice ? product.starsPrice.flatMap { strings.Gift_Options_Premium_OrStars("**#\(presentationStringsFormattedNumber(Int32($0), environment.dateTimeFormat.groupingSeparator))**").string } : nil,
924926
ribbon: product.discount.flatMap {
925927
GiftItemComponent.Ribbon(
926928
text: "-\($0)%",

submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,8 @@ final class GiftSetupScreenComponent: Component {
968968

969969
switch component.subject {
970970
case let .premium(product):
971-
if let starsPrice = product.starsPrice {
972-
let balance = component.context.starsContext?.currentState?.balance.value ?? 0
971+
let balance = component.context.starsContext?.currentState?.balance.value ?? 0
972+
if let starsPrice = product.starsPrice, balance >= starsPrice {
973973
let balanceString = presentationStringsFormattedNumber(Int32(balance), environment.dateTimeFormat.groupingSeparator)
974974

975975
let starsFooterRawString = environment.strings.Gift_Send_PayWithStars_Info("# \(balanceString)").string

0 commit comments

Comments
 (0)