Skip to content

Commit 2a35678

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents a8d4de1 + cbf23d0 commit 2a35678

File tree

60 files changed

+1591
-743
lines changed

Some content is hidden

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

60 files changed

+1591
-743
lines changed

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

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15167,7 +15167,12 @@ Error: %8$@";
1516715167
"ScheduledMessages.Reminder.Delete" = "Delete Reminder";
1516815168
"ScheduledMessages.Reminder.DeleteMany" = "Delete Reminders";
1516915169

15170-
"Gift.Setup.NextDropIn" = "next drop in {m}:{s}";
15170+
"Gift.Setup.PlaceBid" = "Place a Bid";
15171+
"Gift.Setup.AuctionInfo" = "%@ are dropped to the top %@ by bid amount. [Learn more >]()";
15172+
"Gift.Setup.AuctionInfo.Gifts_1" = "%@ gift";
15173+
"Gift.Setup.AuctionInfo.Gifts_any" = "%@ gifts";
15174+
"Gift.Setup.AuctionInfo.Bidders_1" = "%@ bidder";
15175+
"Gift.Setup.AuctionInfo.Bidders_any" = "%@ bidders";
1517115176

1517215177
"PrivacySettings.LoginEmailSetupInfo" = "Setup your email address for Telegram login codes.";
1517315178

@@ -15223,6 +15228,11 @@ Error: %8$@";
1522315228
"Gift.AuctionBid.Top" = "TOP %@";
1522415229
"Gift.AuctionBid.Custom" = "Custom";
1522515230

15231+
"Gift.AuctionBid.CustomBid.Title" = "Place a Custom Bid";
15232+
"Gift.AuctionBid.CustomBid.Text" = "If you fall below the top %@, your bid will roll over to the next drop.";
15233+
"Gift.AuctionBid.CustomBid.Placeholder" = "Amount";
15234+
"Gift.AuctionBid.CustomBid.Done" = "Place a Bid";
15235+
1522615236
"Gift.Auction.Context.About" = "About";
1522715237
"Gift.Auction.Context.CopyLink" = "Copy Link";
1522815238
"Gift.Auction.Context.Share" = "Share";
@@ -15269,11 +15279,6 @@ Error: %8$@";
1526915279
"ChatList.Auctions.Status.Many.OutbidAll" = "You've been outbid in all of them.";
1527015280
"ChatList.Auctions.View" = "View";
1527115281

15272-
"Gift.Auction.Ongoing.Title" = "One Auction at a Time";
15273-
"Gift.Auction.Ongoing.Text" = "You’ve already bid in this gift auction for **%@**.";
15274-
"Gift.Auction.Ongoing.TextYourself" = "You’ve already bid in this gift auction for yourself.";
15275-
"Gift.Auction.Ongoing.View" = "View";
15276-
1527715282
"Gift.Auction.Info.Title" = "Auction";
1527815283
"Gift.Auction.Info.Description" = "Join the battle for exclusive gifts.";
1527915284

@@ -15367,3 +15372,54 @@ Error: %8$@";
1536715372
"Stars.Transaction.LiveStreamPaidMessage_1" = "Fee for %@ Live Stream Message";
1536815373
"Stars.Transaction.LiveStreamPaidMessage_any" = "Fee for %@ Live Stream Messages";
1536915374
"Stars.Transaction.LiveStreamPaidMessage.Text" = "You receive **%@%** of the price that you charge for each incoming message.";
15375+
15376+
"Notification.StarGift.Subtitle.NoConvert" = "Display this gift on your page and turn it into a collectible.";
15377+
"Notification.StarGift.Subtitle.OtherNoConvert" = "Display this gift on your page and turn it into a collectible.";
15378+
"Gift.View.NoConvertDescription" = "We will notify you once it becomes eligible for unique upgrades.";
15379+
"Gift.View.OtherNoConvertDescription" = "We will notify %1$@ once it becomes eligible for unique upgrades.";
15380+
15381+
"Gift.AuctionTransfer.Title" = "Change Recipient";
15382+
"Gift.AuctionTransfer.Text" = "The current recipient of this gift is **%@**. Change to **%@**?";
15383+
"Gift.AuctionTransfer.TextFromYourself" = "The current recipient of this gift is you. Change to **%@**?";
15384+
"Gift.AuctionTransfer.TextToYourself" = "The current recipient of this gift is **%@**. Change to yourself?";
15385+
"Gift.AuctionTransfer.Change" = "Change";
15386+
15387+
"Story.LiveBadge" = "LIVE";
15388+
"SendStarReactions.LiveStreamPerk1Title" = "pin in chat";
15389+
"SendStarReactions.LiveStreamPerk2Title" = "characters";
15390+
"SendStarReactions.LiveStreamPerk3Title" = "emoji";
15391+
"SendStarReactions.LiveStreamMessageTitle" = "Highlight and Pin";
15392+
"SendStarReactions.LiveStreamReactionText" = "Highlight and pin a message\nby adding Stars for **%@**";
15393+
"SendStarReactions.LiveStreamMessageText" = "Highlight and pin a message\nby adding Stars for **%@**";
15394+
"SendStarReactions.OwnLiveStreamCloseButton" = "Close";
15395+
"SendStarReactions.OwnLiveStreamInfoText" = "You can't send star reactions to own story.";
15396+
"SendStarReactions.LiveStreamActionButton" = "Add # %@";
15397+
15398+
"LiveStream.CommentsDisabledPlaceholder" = "Comments disabled";
15399+
"LiveStream.LoadingStatus" = "loading...";
15400+
"LiveStream.StoryViewerEmpty" = "no viewers";
15401+
"LiveStream.StoryViewerCount_1" = "1 watching";
15402+
"LiveStream.StoryViewerCount_any" = "%@ watching";
15403+
15404+
"LiveStream.InputPlaceholder" = "Comment";
15405+
15406+
"Story.ContextMenuPip" = "Minimize";
15407+
"Story.ContextMenuLiveSettings" = "Live Settings";
15408+
15409+
"LiveStream.InputContextMenuAddStars" = "Add Stars";
15410+
"LiveStream.InputContextMenuEditStars" = "Edit Stars";
15411+
"LiveStream.InputContextMenuRemoveStars" = "Remove Stars";
15412+
15413+
"Reminders.DeleteRepeatingTitle" = "Delete Repeating Reminder";
15414+
"Reminders.DeleteRepeatingText" = "Are you sure you want to delete this reminder? This is a repeating reminder.";
15415+
"Reminders.DeleteRepeatingActionSingle" = "Delete This Reminder Only";
15416+
"Reminders.DeleteRepeatingActionMultiple" = "Delete All Future Reminders";
15417+
15418+
"ScheduledMessages.DeleteRepeatingTitle" = "Delete Repeating Message";
15419+
"ScheduledMessages.DeleteRepeatingText" = "Are you sure you want to delete this scheduled message? This is a repeating message.";
15420+
"ScheduledMessages.DeleteRepeatingActionSingle" = "Delete This Message Only";
15421+
"ScheduledMessages.DeleteRepeatingActionMultiple" = "Delete All Future Messages";
15422+
15423+
"ChatList.AlertResumeLiveStreamTitle" = "Resume Live Stream";
15424+
"ChatList.AlertResumeLiveStreamText" = "Do you want to resume an existing Live Stream?";
15425+
"ChatList.AlertResumeLiveStreamAction" = "Resume";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,8 +1423,8 @@ public protocol SharedAccountContext: AnyObject {
14231423
func makeGiftViewScreen(context: AccountContext, gift: StarGift.UniqueGift, shareStory: ((StarGift.UniqueGift) -> Void)?, openChatTheme: (() -> Void)?, dismissed: (() -> Void)?) -> ViewController
14241424
func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift.UniqueGift) -> ViewController
14251425
func makeGiftAuctionInfoScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: (() -> Void)?) -> ViewController
1426-
func makeGiftAuctionBidScreen(context: AccountContext, toPeerId: EnginePeer.Id, auctionContext: GiftAuctionContext) -> ViewController
1427-
func makeGiftAuctionViewScreen(context: AccountContext, toPeerId: EnginePeer.Id, auctionContext: GiftAuctionContext) -> ViewController
1426+
func makeGiftAuctionBidScreen(context: AccountContext, toPeerId: EnginePeer.Id, text: String?, entities: [MessageTextEntity]?, hideName: Bool, auctionContext: GiftAuctionContext) -> ViewController
1427+
func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: @escaping () -> Void) -> ViewController
14281428
func makeGiftAuctionActiveBidsScreen(context: AccountContext) -> ViewController
14291429

14301430
func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController

submodules/AttachmentTextInputPanelNode/Sources/AttachmentTextInputActionButtonsNode.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
152152
}
153153
titleOffset -= 2.0
154154
buttonInset = 14.0
155+
self.iconNode.isHidden = true
155156
} else {
156157
segments.append(.text(0, NSAttributedString(string: text, font: Font.semibold(17.0), textColor: interfaceState.theme.chat.inputPanel.actionControlForegroundColor)))
158+
self.iconNode.isHidden = false
157159
}
158160
self.textNode.segments = segments
159161

submodules/ChatListUI/Sources/ChatListController.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3057,6 +3057,19 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
30573057
}
30583058
}
30593059

3060+
func displayContinueLiveStream() {
3061+
self.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: self.presentationData.strings.ChatList_AlertResumeLiveStreamTitle, text: self.presentationData.strings.ChatList_AlertResumeLiveStreamText, actions: [
3062+
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
3063+
}),
3064+
TextAlertAction(type: .defaultAction, title: presentationData.strings.ChatList_AlertResumeLiveStreamAction, action: { [weak self] in
3065+
guard let self else {
3066+
return
3067+
}
3068+
self.openStoryCamera(fromList: false)
3069+
})
3070+
]), in: .window(.root))
3071+
}
3072+
30603073
public func storyCameraTransitionOut() -> (Stories.PendingTarget?, Bool) -> StoryCameraTransitionOut? {
30613074
return { [weak self] target, isArchived in
30623075
guard let self, let target else {
@@ -7052,7 +7065,12 @@ private final class ChatListLocationContext {
70527065
guard let self, let parentController = self.parentController else {
70537066
return
70547067
}
7055-
parentController.openStoryCamera(fromList: false)
7068+
7069+
if let componentView = parentController.chatListHeaderView(), let storyPeerListView = componentView.storyPeerListView(), storyPeerListView.isLiveStreaming {
7070+
parentController.displayContinueLiveStream()
7071+
} else {
7072+
parentController.openStoryCamera(fromList: false)
7073+
}
70567074
}
70577075
)))
70587076
} else {

submodules/ChatListUI/Sources/ChatListControllerNode.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,22 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
592592
let coefficient: CGFloat = 0.4
593593
return bandingStart + (1.0 - (1.0 / ((bandedOffset * coefficient / range) + 1.0))) * range
594594
}
595+
596+
var hasLiveStream = false
597+
if let componentView = self.controller?.chatListHeaderView(), let storyPeerListView = componentView.storyPeerListView(), storyPeerListView.isLiveStreaming {
598+
hasLiveStream = true
599+
}
595600

596601
if case .compact = layout.metrics.widthClass, self.controller?.isStoryPostingAvailable == true && !(self.context.sharedContext.callManager?.hasActiveCall ?? false) {
602+
if hasLiveStream {
603+
if translation.x >= 30.0 {
604+
self.panRecognizer?.cancel()
605+
606+
self.controller?.displayContinueLiveStream()
607+
}
608+
return
609+
}
610+
597611
let cameraIsAlreadyOpened = self.controller?.hasStoryCameraTransition ?? false
598612
if selectedIndex <= 0 && translation.x > 0.0 {
599613
transitionFraction = 0.0

submodules/ChatListUI/Sources/Node/ChatListItem.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
18091809
self.avatarNode.view.addSubview(avatarLiveBadge.outline)
18101810
self.avatarNode.view.addSubview(avatarLiveBadge.foreground)
18111811

1812-
//TODO:localize
1813-
let liveString = NSAttributedString(string: "LIVE", font: Font.semibold(10.0), textColor: .white)
1812+
let liveString = NSAttributedString(string: item.presentationData.strings.Story_LiveBadge, font: Font.semibold(10.0), textColor: .white)
18141813
let liveStringBounds = liveString.boundingRect(with: CGSize(width: 100.0, height: 100.0), options: .usesLineFragmentOrigin, context: nil)
18151814
let liveBadgeSize = CGSize(width: ceil(liveStringBounds.width) + 4.0 * 2.0, height: ceil(liveStringBounds.height) + 2.0 * 2.0)
18161815
avatarLiveBadge.foreground.image = generateImage(liveBadgeSize, rotatedContext: { size, context in
@@ -4125,6 +4124,17 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
41254124
let liveBadgeFrame = CGRect(origin: CGPoint(x: floor((avatarFrame.width - iconImage.size.width) * 0.5), y: avatarFrame.height + 5.0 - iconImage.size.height), size: iconImage.size)
41264125
transition.updateFrame(view: avatarLiveBadge.foreground, frame: liveBadgeFrame)
41274126
transition.updateFrame(view: avatarLiveBadge.outline, frame: liveBadgeFrame.insetBy(dx: -outlineInset, dy: -outlineInset))
4127+
4128+
let effectiveBackgroundColor: UIColor
4129+
if item.isPinned {
4130+
effectiveBackgroundColor = item.presentationData.theme.chatList.pinnedItemBackgroundColor
4131+
} else {
4132+
effectiveBackgroundColor = item.presentationData.theme.chatList.itemBackgroundColor
4133+
}
4134+
4135+
let highlightAlpha = strongSelf.highlightedBackgroundNode.supernode == nil ? 0.0 : strongSelf.highlightedBackgroundNode.alpha
4136+
let outlineColor = item.presentationData.theme.chatList.itemHighlightedBackgroundColor.mixedWith(effectiveBackgroundColor, alpha: 1.0 - highlightAlpha)
4137+
transition.updateTintColor(view: avatarLiveBadge.outline, color: outlineColor)
41284138
}
41294139

41304140
let onlineInlineNavigationFraction: CGFloat = item.interaction.inlineNavigationLocation?.progress ?? 0.0

submodules/ComponentFlow/Source/Components/Button.swift

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import UIKit
44
public final class Button: Component {
55
public let content: AnyComponent<Empty>
66
public let minSize: CGSize?
7+
public let hitTestEdgeInsets: UIEdgeInsets?
78
public let tag: AnyObject?
89
public let automaticHighlight: Bool
910
public let isEnabled: Bool
@@ -22,6 +23,7 @@ public final class Button: Component {
2223
self.init(
2324
content: content,
2425
minSize: nil,
26+
hitTestEdgeInsets: nil,
2527
tag: nil,
2628
automaticHighlight: automaticHighlight,
2729
isEnabled: isEnabled,
@@ -34,6 +36,7 @@ public final class Button: Component {
3436
private init(
3537
content: AnyComponent<Empty>,
3638
minSize: CGSize? = nil,
39+
hitTestEdgeInsets: UIEdgeInsets? = nil,
3740
tag: AnyObject? = nil,
3841
automaticHighlight: Bool = true,
3942
isEnabled: Bool = true,
@@ -44,6 +47,7 @@ public final class Button: Component {
4447
) {
4548
self.content = content
4649
self.minSize = minSize
50+
self.hitTestEdgeInsets = hitTestEdgeInsets
4751
self.tag = tag
4852
self.automaticHighlight = automaticHighlight
4953
self.isEnabled = isEnabled
@@ -57,6 +61,22 @@ public final class Button: Component {
5761
return Button(
5862
content: self.content,
5963
minSize: minSize,
64+
hitTestEdgeInsets: self.hitTestEdgeInsets,
65+
tag: self.tag,
66+
automaticHighlight: self.automaticHighlight,
67+
isEnabled: self.isEnabled,
68+
isExclusive: self.isExclusive,
69+
action: self.action,
70+
holdAction: self.holdAction,
71+
highlightedAction: self.highlightedAction
72+
)
73+
}
74+
75+
public func withHitTestEdgeInsets(_ hitTestEdgeInsets: UIEdgeInsets?) -> Button {
76+
return Button(
77+
content: self.content,
78+
minSize: self.minSize,
79+
hitTestEdgeInsets: hitTestEdgeInsets,
6080
tag: self.tag,
6181
automaticHighlight: self.automaticHighlight,
6282
isEnabled: self.isEnabled,
@@ -71,6 +91,7 @@ public final class Button: Component {
7191
return Button(
7292
content: self.content,
7393
minSize: self.minSize,
94+
hitTestEdgeInsets: self.hitTestEdgeInsets,
7495
tag: self.tag,
7596
automaticHighlight: self.automaticHighlight,
7697
isEnabled: self.isEnabled,
@@ -86,6 +107,7 @@ public final class Button: Component {
86107
return Button(
87108
content: self.content,
88109
minSize: self.minSize,
110+
hitTestEdgeInsets: self.hitTestEdgeInsets,
89111
tag: self.tag,
90112
automaticHighlight: self.automaticHighlight,
91113
isEnabled: self.isEnabled,
@@ -100,6 +122,7 @@ public final class Button: Component {
100122
return Button(
101123
content: self.content,
102124
minSize: self.minSize,
125+
hitTestEdgeInsets: self.hitTestEdgeInsets,
103126
tag: tag,
104127
automaticHighlight: self.automaticHighlight,
105128
isEnabled: self.isEnabled,
@@ -117,6 +140,9 @@ public final class Button: Component {
117140
if lhs.minSize != rhs.minSize {
118141
return false
119142
}
143+
if lhs.hitTestEdgeInsets != rhs.hitTestEdgeInsets {
144+
return false
145+
}
120146
if lhs.tag !== rhs.tag {
121147
return false
122148
}
@@ -174,6 +200,14 @@ public final class Button: Component {
174200
private var holdActionTriggerred: Bool = false
175201
private var holdActionTimer: Timer?
176202

203+
public override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
204+
var bounds = self.bounds
205+
if let hitTestEdgeInsets = self.component?.hitTestEdgeInsets {
206+
bounds = bounds.insetBy(dx: hitTestEdgeInsets.left, dy: hitTestEdgeInsets.top)
207+
}
208+
return bounds.contains(point)
209+
}
210+
177211
override init(frame: CGRect) {
178212
self.contentView = ComponentHostView<Empty>()
179213
self.contentView.isUserInteractionEnabled = false

0 commit comments

Comments
 (0)