Skip to content

Commit 72ddbbb

Browse files
author
Isaac
committed
Merge commit '15fd6d7b37d0a2bbd522cf22ec0cdfdb595144e3'
2 parents 341b033 + 15fd6d7 commit 72ddbbb

File tree

21 files changed

+938
-47
lines changed

21 files changed

+938
-47
lines changed

‎Telegram/Telegram-iOS/en.lproj/Localizable.strings

+6
Original file line numberDiff line numberDiff line change
@@ -13870,6 +13870,12 @@ Sorry for the inconvenience.";
1387013870
"Stars.Intro.Transaction.PaidMessage_1" = "Fee for %@ Message";
1387113871
"Stars.Intro.Transaction.PaidMessage_any" = "Fee for %@ Messages";
1387213872

13873+
"Stars.Transaction.TelegramPremium_1" = "Premium for %@ Month";
13874+
"Stars.Transaction.TelegramPremium_any" = "Premium for %@ Months";
13875+
13876+
"Stars.Intro.Transaction.TelegramPremium_1" = "Premium for %@ Month";
13877+
"Stars.Intro.Transaction.TelegramPremium_any" = "Premium for %@ Months";
13878+
1387313879
"Stars.Purchase.SendMessageInfo" = "Buy Stars to send a message to **%@**.";
1387413880
"Stars.Purchase.SendGroupMessageInfo" = "Buy Stars to send a message in **%@**.";
1387513881

‎submodules/LegacyMediaPickerUI/Sources/LegacyPaintStickersContext.swift

+11
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ private class SendStarsButtonView: HighlightTrackingButton, TGPhotoSendStarsButt
629629

630630
override init(frame: CGRect) {
631631
self.backgroundView = UIView()
632+
self.backgroundView.isUserInteractionEnabled = false
632633

633634
self.textNode = ImmediateAnimatedCountLabelNode()
634635
self.textNode.isUserInteractionEnabled = false
@@ -654,12 +655,22 @@ private class SendStarsButtonView: HighlightTrackingButton, TGPhotoSendStarsButt
654655
self.textNode.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
655656
}
656657
}
658+
659+
self.addTarget(self, action: #selector(self.buttonPressed), for: .touchUpInside)
657660
}
658661

659662
required init?(coder: NSCoder) {
660663
preconditionFailure()
661664
}
662665

666+
deinit {
667+
print()
668+
}
669+
670+
@objc private func buttonPressed() {
671+
self.pressed?()
672+
}
673+
663674
func updateFrame(_ frame: CGRect) {
664675
let transition: ContainedViewLayoutTransition
665676
if self.frame.width.isZero {

‎submodules/MediaPickerUI/Sources/MediaPickerScreen.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
13221322
}
13231323
}
13241324

1325-
let proceed: (Bool) -> Void = { convertToJpeg in
1325+
let proceed: (Bool) -> Void = { [weak self] convertToJpeg in
13261326
let signals: [Any]!
13271327
switch controller.subject {
13281328
case .assets:
@@ -1340,6 +1340,11 @@ public final class MediaPickerScreenImpl: ViewController, MediaPickerScreen, Att
13401340
completion()
13411341
self?.controller?.dismiss(animated: animated)
13421342
})
1343+
1344+
Queue.mainQueue().after(1.5) {
1345+
controller.isDismissing = false
1346+
controller.completed = false
1347+
}
13431348
}
13441349

13451350
if asFile && hasHeic {

‎submodules/PremiumUI/Sources/PremiumIntroScreen.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,7 @@ struct PremiumIntroConfiguration {
885885
if perks.count < 4 {
886886
perks = PremiumIntroConfiguration.defaultValue.perks
887887
}
888-
889-
#if DEBUG
890-
if !perks.contains(.paidMessages) {
891-
perks.append(.paidMessages)
892-
}
893-
#endif
894-
888+
895889
var businessPerks: [PremiumPerk] = []
896890
if let values = data["business_promo_order"] as? [String] {
897891
for value in values {

‎submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public func incomingMessagePrivacyScreen(context: AccountContext, value: GlobalP
356356
},
357357
openPremiumInfo: {
358358
var replaceImpl: ((ViewController) -> Void)?
359-
let controller = context.sharedContext.makePremiumDemoController(context: context, subject: .paidMessages, forceDark: false, action: {
359+
let controller = context.sharedContext.makePremiumDemoController(context: context, subject: .messagePrivacy, forceDark: false, action: {
360360
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .paidMessages, forceDark: false, dismissed: nil)
361361
replaceImpl?(controller)
362362
}, dismissed: nil)

‎submodules/ShareController/Sources/ShareControllerNode.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -1328,9 +1328,11 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
13281328
if !self.inputFieldNode.text.isEmpty {
13291329
count += 1
13301330
}
1331+
var chargingPeers: [EnginePeer] = []
13311332
var totalAmount: StarsAmount = .zero
13321333
for peer in peers {
13331334
if let stars = requiresStars[peer.id] {
1335+
chargingPeers.append(peer)
13341336
totalAmount = totalAmount + StarsAmount(value: stars, nanos: 0)
13351337
}
13361338
}
@@ -1339,7 +1341,7 @@ final class ShareControllerNode: ViewControllerTracingNode, ASScrollViewDelegate
13391341
context: nil,
13401342
presentationData: self.presentationData,
13411343
updatedPresentationData: nil,
1342-
peers: peers,
1344+
peers: chargingPeers,
13431345
count: count,
13441346
amount: totalAmount,
13451347
totalAmount: totalAmount,

‎submodules/TelegramCore/Sources/TelegramEngine/Privacy/UpdatedAccountPrivacySettings.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ func _internal_updateGlobalPrivacySettings(account: Account, settings: GlobalPri
352352
var noncontactPeersPaidStars: Int64?
353353
switch settings.nonContactChatsPrivacy {
354354
case .everybody:
355-
break
355+
flags |= 1 << 5
356+
noncontactPeersPaidStars = 0
356357
case .requirePremium:
357358
flags |= 1 << 4
358359
case let .paidMessages(starsAmount):

‎submodules/TelegramUI/Components/Chat/ChatUserInfoItem/Sources/ChatUserInfoItem.swift

+12-9
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,14 @@ public final class ChatUserInfoItemNode: ListViewItemNode, ASGestureRecognizerDe
219219
}
220220

221221
public override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
222-
let location = gestureRecognizer.location(in: self.offsetContainer.view)
223-
if let backgroundContent = self.backgroundContent, backgroundContent.frame.contains(location) {
224-
return true
222+
if gestureRecognizer.view === self.offsetContainer.view {
223+
let location = gestureRecognizer.location(in: self.offsetContainer.view)
224+
if let backgroundContent = self.backgroundContent, backgroundContent.frame.contains(location) {
225+
return true
226+
}
227+
return false
225228
}
226-
return false
229+
return true
227230
}
228231

229232
@objc private func tapGesture(_ gestureRecognizer: UITapGestureRecognizer) {
@@ -366,7 +369,7 @@ public final class ChatUserInfoItemNode: ListViewItemNode, ASGestureRecognizerDe
366369
var estimatedValueOffset: CGFloat = 0.0
367370
if groupsInCommonCount > 0 {
368371
groupsValueText = NSMutableAttributedString(string: item.presentationData.strings.Chat_NonContactUser_GroupsCount(groupsInCommonCount), font: Font.semibold(13.0), textColor: primaryTextColor)
369-
estimatedValueOffset = avatarImageSize + CGFloat(min(2, max(0, item.groupsInCommonCount - 1))) * avatarSpacing + 4.0
372+
estimatedValueOffset = avatarImageSize + CGFloat(min(2, max(0, item.groupsInCommonCount - 1))) * avatarSpacing + 4.0 + 10.0
370373
} else {
371374
groupsValueText = NSMutableAttributedString(string: "", font: Font.semibold(13.0), textColor: primaryTextColor)
372375
}
@@ -380,7 +383,7 @@ public final class ChatUserInfoItemNode: ListViewItemNode, ASGestureRecognizerDe
380383
backgroundSize.height += groupsValueLayoutAndApply?.0.size.height ?? 0.0
381384

382385
maxTitleWidth = max(maxTitleWidth, groupsTitleLayoutAndApply?.0.size.width ?? 0)
383-
maxValueWidth = max(maxValueWidth, groupsValueLayoutAndApply?.0.size.width ?? 0 + estimatedValueOffset)
386+
maxValueWidth = max(maxValueWidth, (groupsValueLayoutAndApply?.0.size.width ?? 0) + estimatedValueOffset)
384387
} else {
385388
groupsTitleLayoutAndApply = nil
386389
groupsValueLayoutAndApply = nil
@@ -474,15 +477,15 @@ public final class ChatUserInfoItemNode: ListViewItemNode, ASGestureRecognizerDe
474477

475478
var attributeMidpoints: [CGFloat] = []
476479

477-
func appendAttributeMidpoint(titleLayout: TextNodeLayout?, valueLayout: TextNodeLayout?) {
480+
func appendAttributeMidpoint(titleLayout: TextNodeLayout?, valueLayout: TextNodeLayout?, valueOffset: CGFloat = 0.0) {
478481
if let valueLayout {
479-
let midpoint = backgroundSize.width - horizontalContentInset - valueLayout.size.width - attributeSpacing / 2.0
482+
let midpoint = backgroundSize.width - horizontalContentInset - valueLayout.size.width - valueOffset - attributeSpacing / 2.0
480483
attributeMidpoints.append(midpoint)
481484
}
482485
}
483486
appendAttributeMidpoint(titleLayout: phoneCountryTitleLayoutAndApply?.0, valueLayout: phoneCountryValueLayoutAndApply?.0)
484487
appendAttributeMidpoint(titleLayout: registrationDateTitleLayoutAndApply?.0, valueLayout: registrationDateValueLayoutAndApply?.0)
485-
appendAttributeMidpoint(titleLayout: groupsTitleLayoutAndApply?.0, valueLayout: groupsValueLayoutAndApply?.0)
488+
appendAttributeMidpoint(titleLayout: groupsTitleLayoutAndApply?.0, valueLayout: groupsValueLayoutAndApply?.0, valueOffset: estimatedValueOffset)
486489

487490
let middleX = floorToScreenPixels(attributeMidpoints.min() ?? backgroundSize.width / 2.0)
488491

‎submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
26782678
}
26792679

26802680
convertToStarsImpl = { [weak self] in
2681-
guard let self, let arguments = self.subject.arguments, let reference = arguments.reference, let fromPeerName = arguments.fromPeerName, let convertStars = arguments.convertStars, let navigationController = self.navigationController as? NavigationController else {
2681+
guard let self, let starsContext = context.starsContext, let arguments = self.subject.arguments, let reference = arguments.reference, let fromPeerName = arguments.fromPeerName, let convertStars = arguments.convertStars, let navigationController = self.navigationController as? NavigationController else {
26822682
return
26832683
}
26842684

@@ -2725,6 +2725,8 @@ public class GiftViewScreen: ViewControllerComponentContainer {
27252725

27262726
if let navigationController {
27272727
Queue.mainQueue().after(0.5) {
2728+
starsContext.load(force: true)
2729+
27282730
let text: String
27292731
if isChannelGift {
27302732
text = presentationData.strings.Gift_Convert_Success_ChannelText(presentationData.strings.Gift_Convert_Success_ChannelText_Stars(Int32(convertStars))).string

‎submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ public final class MessageInputPanelComponent: Component {
14521452
inputActionButtonMode = .send
14531453
} else {
14541454
if self.textFieldExternalState.hasText {
1455-
if let sendPaidMessageStars = component.sendPaidMessageStars {
1455+
if let sendPaidMessageStars = component.sendPaidMessageStars, "".isEmpty {
14561456
inputActionButtonMode = .stars(sendPaidMessageStars.value)
14571457
} else {
14581458
inputActionButtonMode = .send

‎submodules/TelegramUI/Components/PeerInfo/PeerInfoCoverComponent/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ swift_library(
2222
"//submodules/Components/ComponentDisplayAdapters",
2323
"//submodules/TelegramUI/Components/EmojiTextAttachmentView",
2424
"//submodules/Utils/LokiRng",
25+
"//submodules/TextFormat",
2526
],
2627
visibility = [
2728
"//visibility:public",

0 commit comments

Comments
 (0)