Merge commit '8025874259967d094ae793b709ba56cabff7e512'

# Conflicts:
#	Telegram/Telegram-iOS/en.lproj/Localizable.strings
This commit is contained in:
Isaac
2023-12-29 21:23:03 +04:00
11 changed files with 141 additions and 76 deletions

View File

@@ -11490,7 +11490,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if !strongSelf.traceVisibility() {
return false
}
if strongSelf.currentContextController != nil {
return false
}
if !isTopmostChatController(strongSelf) {
return false
}
@@ -11588,6 +11590,23 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return false
}
})
} else if peerId.namespace == Namespaces.Peer.CloudUser {
self.screenCaptureManager = ScreenCaptureDetectionManager(check: { [weak self] in
guard let self else {
return false
}
let _ = (self.context.sharedContext.mediaManager.globalMediaPlayerState
|> take(1)
|> deliverOnMainQueue).startStandalone(next: { [weak self] playlistStateAndType in
if let self, let (_, playbackState, _) = playlistStateAndType, case let .state(state) = playbackState {
if let source = state.item.playbackData?.source, case let .telegramFile(_, _, isViewOnce) = source, isViewOnce {
self.context.sharedContext.mediaManager.setPlaylist(nil, type: .voice, control: .playback(.pause))
}
}
})
return true
})
}
}
@@ -18952,6 +18971,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
func openViewOnceMediaMessage(_ message: Message) {
if self.screenCaptureManager?.isRecordingActive == true {
let controller = textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Chat_PlayOnceMesasge_DisableScreenCapture, actions: [TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: {
})])
self.present(controller, in: .window(.root))
return
}
let isIncoming = message.effectivelyIncoming(self.context.account.peerId)
var presentImpl: ((ViewController) -> Void)?
@@ -18972,7 +18998,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
)),
items: .single(ContextController.Items(content: .list([]))),
closeActionTitle: isIncoming ? "Delete and Close" : "Close",
closeActionTitle: isIncoming ? self.presentationData.strings.Chat_PlayOnceMesasgeCloseAndDelete : self.presentationData.strings.Chat_PlayOnceMesasgeClose,
closeAction: { [weak self] in
if let self {
self.context.sharedContext.mediaManager.setPlaylist(nil, type: .voice, control: .playback(.pause))