Skip to content

Commit 7f69681

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents e5a004f + 08ac8fa commit 7f69681

File tree

4 files changed

+54
-15
lines changed

4 files changed

+54
-15
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15425,3 +15425,6 @@ Error: %8$@";
1542515425
"ScheduledMessages.DeleteRepeatingActionSingle" = "Delete This Message Only";
1542615426
"ScheduledMessages.DeleteRepeatingActionMultiple" = "Delete All Future Messages";
1542715427

15428+
"ChatList.AlertResumeLiveStreamTitle" = "Resume Live Stream";
15429+
"ChatList.AlertResumeLiveStreamText" = "Do you want to resume an existing Live Stream?";
15430+
"ChatList.AlertResumeLiveStreamAction" = "Resume";

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/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemContentComponent.swift

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -943,21 +943,25 @@ final class StoryItemContentComponent: Component {
943943
}
944944

945945
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 {
946+
if component.isEmbeddedInCamera {
960947
self.imageView.isHidden = true
948+
} else {
949+
self.imageView.update(
950+
context: component.context,
951+
strings: component.strings,
952+
peer: component.peer,
953+
storyId: component.item.id,
954+
media: messageMedia,
955+
size: availableSize,
956+
isCaptureProtected: component.item.isForwardingDisabled,
957+
attemptSynchronous: synchronousLoad,
958+
transition: transition
959+
)
960+
if !self.contentLoaded || component.isVideoBuffering {
961+
self.imageView.isHidden = false
962+
} else {
963+
self.imageView.isHidden = true
964+
}
961965
}
962966
}
963967

0 commit comments

Comments
 (0)