Skip to content

Commit 3fa8873

Browse files
author
Isaac
committed
Merge commit 'f696cfb915aeb214c54d1df46a2d81770f270b09'
# Conflicts: # Telegram/Telegram-iOS/en.lproj/Localizable.strings
2 parents 4bbea1f + f696cfb commit 3fa8873

File tree

88 files changed

+6954
-994
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6954
-994
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14193,3 +14193,12 @@ Sorry for the inconvenience.";
1419314193
"Call.LiveStreamInProgressConferenceMessage" = "Leave live stream in %1$@ and start a conference?";
1419414194

1419514195
"VoiceChat.RemoveConferencePeerConfirmation" = "Are you sure you want to remove %@ from this call?";
14196+
14197+
"Story.Privacy.ShareStories" = "Share Stories";
14198+
"Story.Privacy.PostStoriesAsHeader" = "POST STORIES AS";
14199+
"Story.Privacy.WhoCanViewStoriesHeader" = "WHO CAN VIEW THIS STORIES";
14200+
"Story.Privacy.PostStories_1" = "Post %@ Story";
14201+
"Story.Privacy.PostStories_any" = "Post %@ Stories";
14202+
"Story.Privacy.KeepOnMyPageManyInfo" = "Keep these stories on your profile even after they expire in %@. Privacy settings will apply.";
14203+
"Story.Privacy.KeepOnChannelPageManyInfo" = "Keep these stories on the channel profile even after they expire in %@.";
14204+
"Story.Privacy.KeepOnGroupPageManyInfo" = "Keep these stories on the group page even after they expire in %@.";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ public enum ChatListSearchFilter: Equatable {
653653
case files
654654
case music
655655
case voice
656+
case instantVideo
656657
case peer(PeerId, Bool, String, String)
657658
case date(Int32?, Int32, String)
658659
case publicPosts
@@ -679,8 +680,10 @@ public enum ChatListSearchFilter: Equatable {
679680
return 8
680681
case .voice:
681682
return 9
682-
case .publicPosts:
683+
case .instantVideo:
683684
return 10
685+
case .publicPosts:
686+
return 11
684687
case let .peer(peerId, _, _, _):
685688
return peerId.id._internalGetInt64Value()
686689
case let .date(_, date, _):
@@ -806,7 +809,7 @@ public protocol MediaEditorScreenResult {
806809
public protocol TelegramRootControllerInterface: NavigationController {
807810
@discardableResult
808811
func openStoryCamera(customTarget: Stories.PendingTarget?, transitionIn: StoryCameraTransitionIn?, transitionedIn: @escaping () -> Void, transitionOut: @escaping (Stories.PendingTarget?, Bool) -> StoryCameraTransitionOut?) -> StoryCameraTransitionInCoordinator?
809-
func proceedWithStoryUpload(target: Stories.PendingTarget, result: MediaEditorScreenResult, existingMedia: EngineMedia?, forwardInfo: Stories.PendingForwardInfo?, externalState: MediaEditorTransitionOutExternalState, commit: @escaping (@escaping () -> Void) -> Void)
812+
func proceedWithStoryUpload(target: Stories.PendingTarget, results: [MediaEditorScreenResult], existingMedia: EngineMedia?, forwardInfo: Stories.PendingForwardInfo?, externalState: MediaEditorTransitionOutExternalState, commit: @escaping (@escaping () -> Void) -> Void)
810813

811814
func getContactsController() -> ViewController?
812815
func getChatsController() -> ViewController?
@@ -1133,6 +1136,7 @@ public protocol SharedAccountContext: AnyObject {
11331136
func makeStarsGiftController(context: AccountContext, birthdays: [EnginePeer.Id: TelegramBirthday]?, completion: @escaping (([EnginePeer.Id]) -> Void)) -> ViewController
11341137
func makePremiumGiftController(context: AccountContext, source: PremiumGiftSource, completion: (([EnginePeer.Id]) -> Signal<Never, TransferStarGiftError>)?) -> ViewController
11351138
func makeGiftOptionsController(context: AccountContext, peerId: EnginePeer.Id, premiumOptions: [CachedPremiumGiftOption], hasBirthday: Bool, completion: (() -> Void)?) -> ViewController
1139+
func makeGiftStoreController(context: AccountContext, peerId: EnginePeer.Id, gift: StarGift.Gift) -> ViewController
11361140
func makePremiumPrivacyControllerController(context: AccountContext, subject: PremiumPrivacySubject, peerId: EnginePeer.Id) -> ViewController
11371141
func makePremiumBoostLevelsController(context: AccountContext, peerId: EnginePeer.Id, subject: BoostSubject, boostStatus: ChannelBoostStatus, myBoostStatus: MyBoostStatus, forceDark: Bool, openStats: (() -> Void)?) -> ViewController
11381142

@@ -1150,7 +1154,7 @@ public protocol SharedAccountContext: AnyObject {
11501154

11511155
func makeAvatarMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect?, canDelete: Bool, performDelete: @escaping () -> Void, completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController
11521156

1153-
func makeStoryMediaPickerScreen(context: AccountContext, isDark: Bool, forCollage: Bool, selectionLimit: Int?, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any, UIView, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, multipleCompletion: @escaping ([Any]) -> Void, dismissed: @escaping () -> Void, groupsPresented: @escaping () -> Void) -> ViewController
1157+
func makeStoryMediaPickerScreen(context: AccountContext, isDark: Bool, forCollage: Bool, selectionLimit: Int?, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any, UIView, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, multipleCompletion: @escaping ([Any], Bool) -> Void, dismissed: @escaping () -> Void, groupsPresented: @escaping () -> Void) -> ViewController
11541158

11551159
func makeStickerPickerScreen(context: AccountContext, inputData: Promise<StickerPickerInput>, completion: @escaping (FileMediaReference) -> Void) -> ViewController
11561160

@@ -1176,6 +1180,7 @@ public protocol SharedAccountContext: AnyObject {
11761180
func makeStarsAmountScreen(context: AccountContext, initialValue: Int64?, completion: @escaping (Int64) -> Void) -> ViewController
11771181
func makeStarsWithdrawalScreen(context: AccountContext, stats: StarsRevenueStats, completion: @escaping (Int64) -> Void) -> ViewController
11781182
func makeStarsWithdrawalScreen(context: AccountContext, completion: @escaping (Int64) -> Void) -> ViewController
1183+
func makeStarGiftResellScreen(context: AccountContext, update: Bool, completion: @escaping (Int64) -> Void) -> ViewController
11791184
func makeStarsGiftScreen(context: AccountContext, message: EngineMessage) -> ViewController
11801185
func makeStarsGiveawayBoostScreen(context: AccountContext, peerId: EnginePeer.Id, boost: ChannelBoostersContext.State.Boost) -> ViewController
11811186
func makeStarsIntroScreen(context: AccountContext) -> ViewController
@@ -1445,7 +1450,10 @@ public struct StarsSubscriptionConfiguration {
14451450
usdWithdrawRate: 1200,
14461451
paidMessageMaxAmount: 10000,
14471452
paidMessageCommissionPermille: 850,
1448-
paidMessagesAvailable: false
1453+
paidMessagesAvailable: false,
1454+
starGiftResaleMinAmount: 125,
1455+
starGiftResaleMaxAmount: 3500,
1456+
starGiftCommissionPermille: 80
14491457
)
14501458
}
14511459

@@ -1454,19 +1462,28 @@ public struct StarsSubscriptionConfiguration {
14541462
public let paidMessageMaxAmount: Int64
14551463
public let paidMessageCommissionPermille: Int32
14561464
public let paidMessagesAvailable: Bool
1465+
public let starGiftResaleMinAmount: Int64
1466+
public let starGiftResaleMaxAmount: Int64
1467+
public let starGiftCommissionPermille: Int32
14571468

14581469
fileprivate init(
14591470
maxFee: Int64,
14601471
usdWithdrawRate: Int64,
14611472
paidMessageMaxAmount: Int64,
14621473
paidMessageCommissionPermille: Int32,
1463-
paidMessagesAvailable: Bool
1474+
paidMessagesAvailable: Bool,
1475+
starGiftResaleMinAmount: Int64,
1476+
starGiftResaleMaxAmount: Int64,
1477+
starGiftCommissionPermille: Int32
14641478
) {
14651479
self.maxFee = maxFee
14661480
self.usdWithdrawRate = usdWithdrawRate
14671481
self.paidMessageMaxAmount = paidMessageMaxAmount
14681482
self.paidMessageCommissionPermille = paidMessageCommissionPermille
14691483
self.paidMessagesAvailable = paidMessagesAvailable
1484+
self.starGiftResaleMinAmount = starGiftResaleMinAmount
1485+
self.starGiftResaleMaxAmount = starGiftResaleMaxAmount
1486+
self.starGiftCommissionPermille = starGiftCommissionPermille
14701487
}
14711488

14721489
public static func with(appConfiguration: AppConfiguration) -> StarsSubscriptionConfiguration {
@@ -1476,13 +1493,19 @@ public struct StarsSubscriptionConfiguration {
14761493
let paidMessageMaxAmount = (data["stars_paid_message_amount_max"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.paidMessageMaxAmount
14771494
let paidMessageCommissionPermille = (data["stars_paid_message_commission_permille"] as? Double).flatMap(Int32.init) ?? StarsSubscriptionConfiguration.defaultValue.paidMessageCommissionPermille
14781495
let paidMessagesAvailable = (data["stars_paid_messages_available"] as? Bool) ?? StarsSubscriptionConfiguration.defaultValue.paidMessagesAvailable
1496+
let starGiftResaleMinAmount = (data["stars_stargift_resale_amount_min"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.starGiftResaleMinAmount
1497+
let starGiftResaleMaxAmount = (data["stars_stargift_resale_amount_max"] as? Double).flatMap(Int64.init) ?? StarsSubscriptionConfiguration.defaultValue.starGiftResaleMaxAmount
1498+
let starGiftCommissionPermille = (data["stars_stargift_resale_commission_permille"] as? Double).flatMap(Int32.init) ?? StarsSubscriptionConfiguration.defaultValue.starGiftCommissionPermille
14791499

14801500
return StarsSubscriptionConfiguration(
14811501
maxFee: maxFee,
14821502
usdWithdrawRate: usdWithdrawRate,
14831503
paidMessageMaxAmount: paidMessageMaxAmount,
14841504
paidMessageCommissionPermille: paidMessageCommissionPermille,
1485-
paidMessagesAvailable: paidMessagesAvailable
1505+
paidMessagesAvailable: paidMessagesAvailable,
1506+
starGiftResaleMinAmount: starGiftResaleMinAmount,
1507+
starGiftResaleMaxAmount: starGiftResaleMaxAmount,
1508+
starGiftCommissionPermille: starGiftCommissionPermille
14861509
)
14871510
} else {
14881511
return .defaultValue

submodules/AccountContext/Sources/AttachmentMainButtonState.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public struct AttachmentMainButtonState {
4141
public let progress: Progress
4242
public let isEnabled: Bool
4343
public let hasShimmer: Bool
44+
public let iconName: String?
45+
public let smallSpacing: Bool
4446
public let position: Position?
4547

4648
public init(
@@ -53,6 +55,8 @@ public struct AttachmentMainButtonState {
5355
progress: Progress,
5456
isEnabled: Bool,
5557
hasShimmer: Bool,
58+
iconName: String? = nil,
59+
smallSpacing: Bool = false,
5660
position: Position? = nil
5761
) {
5862
self.text = text
@@ -64,6 +68,8 @@ public struct AttachmentMainButtonState {
6468
self.progress = progress
6569
self.isEnabled = isEnabled
6670
self.hasShimmer = hasShimmer
71+
self.iconName = iconName
72+
self.smallSpacing = smallSpacing
6773
self.position = position
6874
}
6975

submodules/AccountContext/Sources/ChatController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public struct ChatTextInputStateText: Codable, Equatable {
608608
return lhs.text == rhs.text && lhs.attributes == rhs.attributes
609609
}
610610

611-
public func attributedText() -> NSAttributedString {
611+
public func attributedText(files: [Int64: TelegramMediaFile] = [:]) -> NSAttributedString {
612612
let result = NSMutableAttributedString(string: self.text)
613613
for attribute in self.attributes {
614614
switch attribute.type {
@@ -623,7 +623,7 @@ public struct ChatTextInputStateText: Codable, Equatable {
623623
case let .textUrl(url):
624624
result.addAttribute(ChatTextInputAttributes.textUrl, value: ChatTextInputTextUrlAttribute(url: url), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
625625
case let .customEmoji(_, fileId, enableAnimation):
626-
result.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: fileId, file: nil, enableAnimation: enableAnimation), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
626+
result.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: fileId, file: files[fileId], enableAnimation: enableAnimation), range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
627627
case .strikethrough:
628628
result.addAttribute(ChatTextInputAttributes.strikethrough, value: true as NSNumber, range: NSRange(location: attribute.range.lowerBound, length: attribute.range.count))
629629
case .underline:

submodules/AttachmentUI/Sources/AttachmentPanel.swift

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
476476
private var size: CGSize?
477477

478478
private let backgroundAnimationNode: ASImageNode
479+
private var iconNode: ASImageNode?
479480
fileprivate let textNode: ImmediateTextNode
480481
private var badgeNode: BadgeNode?
481482
private let statusNode: SemanticStatusNode
@@ -781,6 +782,26 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
781782
badgeNode.removeFromSupernode()
782783
}
783784

785+
if let iconName = state.iconName {
786+
let iconNode: ASImageNode
787+
if let current = self.iconNode {
788+
iconNode = current
789+
} else {
790+
iconNode = ASImageNode()
791+
iconNode.displaysAsynchronously = false
792+
iconNode.image = generateTintedImage(image: UIImage(bundleImageName: iconName), color: state.textColor)
793+
self.iconNode = iconNode
794+
self.addSubnode(iconNode)
795+
}
796+
if let iconSize = iconNode.image?.size {
797+
textFrame.origin.x += (iconSize.width + 6.0) / 2.0
798+
iconNode.frame = CGRect(origin: CGPoint(x: textFrame.minX - iconSize.width - 6.0, y: textFrame.minY + floorToScreenPixels((textFrame.height - iconSize.height) * 0.5)), size: iconSize)
799+
}
800+
} else if let iconNode = self.iconNode {
801+
self.iconNode = nil
802+
iconNode.removeFromSupernode()
803+
}
804+
784805
if self.textNode.frame.width.isZero {
785806
self.textNode.frame = textFrame
786807
} else {
@@ -795,7 +816,7 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
795816
self.transitionFromProgress()
796817
}
797818
}
798-
819+
799820
if let shimmerView = self.shimmerView, let borderView = self.borderView, let borderMaskView = self.borderMaskView, let borderShimmerView = self.borderShimmerView {
800821
let buttonFrame = CGRect(origin: .zero, size: size)
801822
let buttonWidth = size.width
@@ -1786,7 +1807,9 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
17861807
} else {
17871808
height = bounds.height + 8.0
17881809
}
1789-
if !isNarrowButton {
1810+
if isTwoVerticalButtons && self.secondaryButtonState.smallSpacing {
1811+
1812+
} else if !isNarrowButton {
17901813
height += 9.0
17911814
}
17921815
if isTwoVerticalButtons {
@@ -1876,7 +1899,8 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
18761899
mainButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX, y: buttonOriginY + sideInset + buttonSize.height), size: buttonSize)
18771900
case .bottom:
18781901
mainButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX, y: buttonOriginY), size: buttonSize)
1879-
secondaryButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX, y: buttonOriginY + sideInset + buttonSize.height), size: buttonSize)
1902+
let buttonSpacing = self.secondaryButtonState.smallSpacing ? 8.0 : sideInset
1903+
secondaryButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX, y: buttonOriginY + buttonSpacing + buttonSize.height), size: buttonSize)
18801904
case .left:
18811905
secondaryButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX, y: buttonOriginY), size: buttonSize)
18821906
mainButtonFrame = CGRect(origin: CGPoint(x: buttonOriginX + buttonSize.width + sideInset, y: buttonOriginY), size: buttonSize)

submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
357357
key = .music
358358
case .voice:
359359
key = .voice
360+
case .instantVideo:
361+
key = .instantVideo
360362
case .publicPosts:
361363
key = .publicPosts
362364
case let .date(minDate, maxDate, title):
@@ -685,6 +687,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
685687
filterKey = .music
686688
case .voice:
687689
filterKey = .voice
690+
case .instantVideo:
691+
filterKey = .instantVideo
688692
case .publicPosts:
689693
filterKey = .publicPosts
690694
}
@@ -725,6 +729,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
725729
key = .music
726730
case .voice:
727731
key = .voice
732+
case .instantVideo:
733+
key = .instantVideo
728734
case .downloads:
729735
key = .downloads
730736
default:

submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ private final class ItemNode: ASDisplayNode {
108108
case .voice:
109109
title = presentationData.strings.ChatList_Search_FilterVoice
110110
icon = nil
111+
case .instantVideo:
112+
title = presentationData.strings.ChatList_Search_FilterVoice
113+
icon = nil
111114
case .publicPosts:
112115
title = presentationData.strings.ChatList_Search_FilterPublicPosts
113116
icon = nil

0 commit comments

Comments
 (0)