Skip to content

Commit 09c12f9

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 5e17b32 + cebadbb commit 09c12f9

File tree

13 files changed

+105
-66
lines changed

13 files changed

+105
-66
lines changed

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15384,3 +15384,44 @@ Error: %8$@";
1538415384
"Gift.AuctionTransfer.TextToYourself" = "The current recipient of this gift is **%@**. Change to yourself?";
1538515385
"Gift.AuctionTransfer.Change" = "Change";
1538615386

15387+
"Notification.StarGift.Subtitle.NoConvert" = "We'll notify you once it becomes eligible for unique upgrades.";
15388+
"Notification.StarGift.Subtitle.OtherNoConvert" = "We'll notify %1$@ once it becomes eligible for unique upgrades.";
15389+
"Gift.View.NoConvertDescription" = "We'll notify you once it becomes eligible for unique upgrades.";
15390+
"Gift.View.OtherNoConvertDescription" = "We'll notify %1$@ once it becomes eligible for unique upgrades.";
15391+
15392+
"Story.LiveBadge" = "LIVE";
15393+
"SendStarReactions.LiveStreamPerk1Title" = "pin in chat";
15394+
"SendStarReactions.LiveStreamPerk2Title" = "characters";
15395+
"SendStarReactions.LiveStreamPerk3Title" = "emoji";
15396+
"SendStarReactions.LiveStreamMessageTitle" = "Highlight and Pin";
15397+
"SendStarReactions.LiveStreamReactionText" = "Highlight and pin a message\nby adding Stars for **%@**";
15398+
"SendStarReactions.LiveStreamMessageText" = "Highlight and pin a message\nby adding Stars for **%@**";
15399+
"SendStarReactions.OwnLiveStreamCloseButton" = "Close";
15400+
"SendStarReactions.OwnLiveStreamInfoText" = "You can't send star reactions to own story.";
15401+
"SendStarReactions.LiveStreamActionButton" = "Add # %@";
15402+
15403+
"LiveStream.CommentsDisabledPlaceholder" = "Comments disabled";
15404+
"LiveStream.LoadingStatus" = "loading...";
15405+
"LiveStream.StoryViewerEmpty" = "no viewers";
15406+
"LiveStream.StoryViewerCount_1" = "1 watching";
15407+
"LiveStream.StoryViewerCount_any" = "%@ watching";
15408+
15409+
"LiveStream.InputPlaceholder" = "Comment";
15410+
15411+
"Story.ContextMenuPip" = "Minimize";
15412+
"Story.ContextMenuLiveSettings" = "Live Settings";
15413+
15414+
"LiveStream.InputContextMenuAddStars" = "Add Stars";
15415+
"LiveStream.InputContextMenuEditStars" = "Edit Stars";
15416+
"LiveStream.InputContextMenuRemoveStars" = "Remove Stars";
15417+
15418+
"Reminders.DeleteRepeatingTitle" = "Delete Repeating Reminder";
15419+
"Reminders.DeleteRepeatingText" = "Are you sure you want to delete this reminder? This is a repeating reminder.";
15420+
"Reminders.DeleteRepeatingActionSingle" = "Delete This Reminder Only";
15421+
"Reminders.DeleteRepeatingActionMultiple" = "Delete All Future Reminders";
15422+
15423+
"ScheduledMessages.DeleteRepeatingTitle" = "Delete Repeating Message";
15424+
"ScheduledMessages.DeleteRepeatingText" = "Are you sure you want to delete this scheduled message? This is a repeating message.";
15425+
"ScheduledMessages.DeleteRepeatingActionSingle" = "Delete This Message Only";
15426+
"ScheduledMessages.DeleteRepeatingActionMultiple" = "Delete All Future Messages";
15427+

submodules/ChatListUI/Sources/Node/ChatListItem.swift

Lines changed: 1 addition & 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

submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,23 +1750,22 @@ private final class ChatSendStarsScreenComponent: Component {
17501750

17511751
switch component.initialData.subjectInitialData {
17521752
case let .liveStreamMessage(liveStreamMessageData):
1753-
//TODO:localize
17541753
let params = GroupCallMessagesContext.getStarAmountParamMapping(params: liveStreamMessageData.liveChatMessageParams, value: Int64(self.amount.realValue))
17551754
var perks: [(String, String)] = []
17561755

17571756
perks.append((
17581757
shortTimeIntervalString(strings: environment.strings, value: Int32(params.period), useLargeFormat: false),
1759-
"pin in chat"
1758+
environment.strings.SendStarReactions_LiveStreamPerk1Title
17601759
))
17611760

17621761
perks.append((
17631762
"\(params.maxLength)",
1764-
"characters"
1763+
environment.strings.SendStarReactions_LiveStreamPerk2Title
17651764
))
17661765

17671766
perks.append((
17681767
"\(params.emojiCount)",
1769-
"emoji"
1768+
environment.strings.SendStarReactions_LiveStreamPerk3Title
17701769
))
17711770

17721771
contentHeight += 54.0
@@ -1932,8 +1931,7 @@ private final class ChatSendStarsScreenComponent: Component {
19321931
case .react:
19331932
titleText = environment.strings.SendStarReactions_Title
19341933
case .liveStreamMessage:
1935-
//TODO:localize
1936-
titleText = "Highlight and Pin"
1934+
titleText = environment.strings.SendStarReactions_LiveStreamMessageTitle
19371935
}
19381936

19391937
let titleSize = title.update(
@@ -1974,8 +1972,7 @@ private final class ChatSendStarsScreenComponent: Component {
19741972
switch component.initialData.subjectInitialData {
19751973
case let .react(reactData):
19761974
if case .liveStream = reactData.reactSubject {
1977-
//TODO:localize
1978-
text = "Highlight and pin a message\nby adding Stars for **\(reactData.peer.displayTitle(strings: environment.strings, displayOrder: .firstLast))**."
1975+
text = environment.strings.SendStarReactions_LiveStreamReactionText(reactData.peer.displayTitle(strings: environment.strings, displayOrder: .firstLast)).string
19791976
} else {
19801977
if let currentSentAmount = reactData.currentSentAmount {
19811978
text = environment.strings.SendStarReactions_TextSentStars(Int32(clamping: currentSentAmount))
@@ -1984,8 +1981,7 @@ private final class ChatSendStarsScreenComponent: Component {
19841981
}
19851982
}
19861983
case let .liveStreamMessage(liveStreamMessageData):
1987-
//TODO:localize
1988-
text = "Highlight and pin a message\nby adding Stars for **\(liveStreamMessageData.peer.displayTitle(strings: environment.strings, displayOrder: .firstLast))**."
1984+
text = environment.strings.SendStarReactions_LiveStreamMessageText(liveStreamMessageData.peer.displayTitle(strings: environment.strings, displayOrder: .firstLast)).string
19891985
}
19901986

19911987
let addDescriptionText: () -> Void = {
@@ -2508,14 +2504,12 @@ private final class ChatSendStarsScreenComponent: Component {
25082504
switch component.initialData.subjectInitialData {
25092505
case .react:
25102506
if isOnlyDisplay {
2511-
//TODO:localize
2512-
buttonString = "Close"
2507+
buttonString = environment.strings.SendStarReactions_OwnLiveStreamCloseButton
25132508
} else {
25142509
buttonString = environment.strings.SendStarReactions_SendButtonTitle("\(self.amount.realValue)").string
25152510
}
25162511
case .liveStreamMessage:
2517-
//TODO:localize
2518-
buttonString = "Add # \(self.amount.realValue)"
2512+
buttonString = environment.strings.SendStarReactions_LiveStreamActionButton("\(self.amount.realValue)").string
25192513
}
25202514
let buttonAttributedString = NSMutableAttributedString(string: buttonString, font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
25212515
if let range = buttonAttributedString.string.range(of: "#"), let starImage = self.cachedStarImage?.0 {
@@ -2579,7 +2573,6 @@ private final class ChatSendStarsScreenComponent: Component {
25792573
case let .react(reactData):
25802574
purchasePurpose = .reactions(peerId: reactData.peer.id, requiredStars: Int64(self.amount.realValue))
25812575
case let .liveStreamMessage(liveStreamMessageData):
2582-
//TODO:localize
25832576
purchasePurpose = .reactions(peerId: liveStreamMessageData.peer.id, requiredStars: Int64(self.amount.realValue))
25842577
}
25852578

@@ -2641,11 +2634,10 @@ private final class ChatSendStarsScreenComponent: Component {
26412634

26422635
var buttonDescriptionTextSize: CGSize?
26432636
if case .react = component.initialData.subjectInitialData {
2644-
//TODO:localize
26452637
buttonDescriptionTextSize = self.buttonDescriptionText.update(
26462638
transition: .immediate,
26472639
component: AnyComponent(MultilineTextComponent(
2648-
text: .markdown(text: isOnlyDisplay ? "You can't send star reactions to own story." : environment.strings.SendStarReactions_TermsOfServiceFooter, attributes: MarkdownAttributes(
2640+
text: .markdown(text: isOnlyDisplay ? environment.strings.SendStarReactions_OwnLiveStreamInfoText : environment.strings.SendStarReactions_TermsOfServiceFooter, attributes: MarkdownAttributes(
26492641
body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemSecondaryTextColor),
26502642
bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: environment.theme.list.itemSecondaryTextColor),
26512643
link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: environment.theme.list.itemAccentColor),

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,8 +1110,7 @@ public final class MessageInputPanelComponent: Component {
11101110
rightAction: rightAction,
11111111
secondaryRightAction: secondaryRightAction,
11121112
sendAsConfiguration: component.liveChatState?.isEnabled == true ? sendAsConfiguration : nil,
1113-
//TODO:localize
1114-
placeholder: (component.liveChatState == nil || component.liveChatState?.isEnabled == true) ? placeholder : "Comments are disabled",
1113+
placeholder: (component.liveChatState == nil || component.liveChatState?.isEnabled == true) ? placeholder : component.strings.LiveStream_CommentsDisabledPlaceholder,
11151114
isEnabled: (component.liveChatState == nil || component.liveChatState?.isEnabled == true),
11161115
paidMessagePrice: component.sendPaidMessageStars,
11171116
sendColor: component.sendPaidMessageStars.flatMap { value in

submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent/Sources/AvatarStoryIndicatorComponent.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ public final class AvatarStoryIndicatorComponent: Component {
666666
let inactiveColors: [CGColor]
667667

668668
if component.hasLiveItems {
669-
//TODO:localize
670669
activeColors = [UIColor(rgb: 0xFF3777).cgColor, UIColor(rgb: 0xFF2D55).cgColor]
671670
} else if component.hasUnseenCloseFriendsItems {
672671
activeColors = component.colors.unseenCloseFriendsColors.map(\.cgColor)

submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryAuthorInfoComponent.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ final class StoryAuthorInfoComponent: Component {
278278
liveBadgeView = UIImageView()
279279
self.liveBadgeView = liveBadgeView
280280
self.addSubview(liveBadgeView)
281-
//TODO:localize
282-
let liveString = NSAttributedString(string: "LIVE", font: Font.semibold(10.0), textColor: .white)
281+
let liveString = NSAttributedString(string: component.strings.Story_LiveBadge, font: Font.semibold(10.0), textColor: .white)
283282
let liveStringBounds = liveString.boundingRect(with: CGSize(width: 100.0, height: 100.0), options: .usesLineFragmentOrigin, context: nil)
284283
let liveBadgeSize = CGSize(width: ceil(liveStringBounds.width) + 3.0 * 2.0, height: ceil(liveStringBounds.height) + 1.0 * 2.0)
285284
liveBadgeView.image = generateImage(liveBadgeSize, rotatedContext: { size, context in

submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentLiveChatComponent.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,8 @@ final class StoryContentLiveChatComponent: Component {
421421
}
422422

423423
var items: [ContextMenuItem] = []
424-
//TODO:localize
425424
if !isPinned {
426-
items.append(.action(ContextMenuActionItem(text: "Copy", textColor: .primary, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
425+
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Conversation_ContextMenuCopy, textColor: .primary, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
427426
guard let self else {
428427
return
429428
}
@@ -459,13 +458,12 @@ final class StoryContentLiveChatComponent: Component {
459458
isMessageFromAdmin = true
460459
}
461460

462-
//TODO:localize
463461
if !isMyMessage, let author = message.author {
464462
let openProfileString: String
465463
if case .channel = author {
466-
openProfileString = "Open Channel"
464+
openProfileString = presentationData.strings.Conversation_ContextMenuOpenChannel
467465
} else {
468-
openProfileString = "Open Profile"
466+
openProfileString = presentationData.strings.Conversation_ContextMenuOpenProfile
469467
}
470468
items.append(.action(ContextMenuActionItem(text: openProfileString, textColor: .primary, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/User"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
471469
guard let self else {

submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,8 @@ final class StoryItemContentComponent: Component {
831831
selectedMedia = component.item.media
832832
messageMedia = selectedMedia
833833

834-
//TODO:localize
835834
if self.customSubtitle == nil {
836-
self.customSubtitle = "loading..."
835+
self.customSubtitle = component.strings.LiveStream_LoadingStatus
837836
}
838837
} else if !component.preferHighQuality, !component.item.isMy, let alternativeMediaValue = component.item.alternativeMediaList.first {
839838
selectedMedia = alternativeMediaValue
@@ -943,6 +942,25 @@ final class StoryItemContentComponent: Component {
943942
}
944943
}
945944

945+
if let messageMedia, case .liveStream = messageMedia {
946+
self.imageView.update(
947+
context: component.context,
948+
strings: component.strings,
949+
peer: component.peer,
950+
storyId: component.item.id,
951+
media: messageMedia,
952+
size: availableSize,
953+
isCaptureProtected: component.item.isForwardingDisabled,
954+
attemptSynchronous: synchronousLoad,
955+
transition: transition
956+
)
957+
if !self.contentLoaded || component.isVideoBuffering {
958+
self.imageView.isHidden = false
959+
} else {
960+
self.imageView.isHidden = true
961+
}
962+
}
963+
946964
if case let .liveStream(liveStream) = messageMedia, let mediaStreamCall = self.mediaStreamCall {
947965
var mediaStreamTransition = transition
948966
let mediaStream: ComponentView<Empty>
@@ -1188,20 +1206,19 @@ final class StoryItemContentComponent: Component {
11881206
guard let self, let component = self.component, let environment = self.environment else {
11891207
return
11901208
}
1191-
//TODO:localize
11921209
let subtitle: String
11931210
if let members {
11941211
var totalCount = members.totalCount
11951212
if component.isEmbeddedInCamera {
11961213
totalCount -= 1
11971214
}
11981215
if totalCount == 0 && component.isEmbeddedInCamera {
1199-
subtitle = "no viewers"
1216+
subtitle = component.strings.LiveStream_StoryViewerEmpty
12001217
} else {
1201-
subtitle = "\(max(1, totalCount)) watching"
1218+
subtitle = component.strings.LiveStream_StoryViewerCount(Int32(max(1, totalCount)))
12021219
}
12031220
} else {
1204-
subtitle = "loading..."
1221+
subtitle = component.strings.LiveStream_LoadingStatus
12051222
}
12061223
if self.customSubtitle != subtitle {
12071224
self.customSubtitle = subtitle
@@ -1228,10 +1245,6 @@ final class StoryItemContentComponent: Component {
12281245
}
12291246
}
12301247

1231-
if video != nil {
1232-
print("updating with video")
1233-
}
1234-
12351248
if !self.isUpdating {
12361249
self.state?.updated(transition: .immediate)
12371250
}

submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemImageView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,15 @@ final class StoryItemImageView: UIView {
220220
})
221221
}
222222
}
223+
case .liveStream:
224+
dimensions = CGSize(width: 128.0, height: 128.0)
225+
if isMediaUpdated, let thumbnailData = peer.smallProfileImage?.immediateThumbnailData {
226+
if let thumbnailData = decodeTinyThumbnail(data: thumbnailData), let thumbnailImage = UIImage(data: thumbnailData) {
227+
if let image = blurredImage(thumbnailImage, radius: 10.0, iterations: 3) {
228+
self.updateImage(image: image, isCaptureProtected: isCaptureProtected)
229+
}
230+
}
231+
}
223232
default:
224233
break
225234
}

0 commit comments

Comments
 (0)