Skip to content

Commit 22e7642

Browse files
author
Isaac
committed
Stories
1 parent a16f71d commit 22e7642

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ final class StoryItemContentComponent: Component {
942942
}
943943
}
944944

945-
if let messageMedia, case .liveStream = messageMedia {
945+
if let messageMedia, case .liveStream = messageMedia, !component.isEmbeddedInCamera {
946946
self.imageView.update(
947947
context: component.context,
948948
strings: component.strings,

0 commit comments

Comments
 (0)