Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2020-11-30 23:39:08 +04:00
commit c32b2bb2d5
5 changed files with 4406 additions and 4380 deletions

View File

@ -5977,3 +5977,11 @@ Sorry for the inconvenience.";
"ChannelInfo.CreateVoiceChat" = "Create Voice Chat";
"VoiceChat.AnonymousDisabledAlertText" = "Sorry, you can't join voice chat as an anonymous admin.";
"VoiceChat.EndConfirmationTitle" = "End voice chat";
"VoiceChat.EndConfirmationText" = "Are you sure you want to end this voice chat?";
"VoiceChat.EndConfirmationEnd" = "End";
"CHAT_VOICECHAT_START" = "%1$@ has started voice chat in the group %2$@";
"CHAT_VOICECHAT_INVITE" = "%1$@ has invited %3$@ in the group %2$@";
"CHAT_VOICECHAT_INVITE_YOU" = "%1$@ has invited you to voice chat in the group %1$@";

View File

@ -35,6 +35,7 @@ swift_library(
"//submodules/UndoUI:UndoUI",
"//submodules/AudioBlob:AudioBlob",
"//submodules/AnimatedAvatarSetNode:AnimatedAvatarSetNode",
"//submodules/AlertUI:AlertUI",
],
visibility = [
"//visibility:public",

View File

@ -18,6 +18,8 @@ import ContextUI
import ShareController
import DeleteChatPeerActionSheetItem
import UndoUI
import AlertUI
import PresentationDataUtils
private final class VoiceChatControllerTitleView: UIView {
private var theme: PresentationTheme
@ -690,12 +692,24 @@ public final class VoiceChatController: ViewController {
guard let strongSelf = self else {
return
}
let _ = (strongSelf.call.leave(terminateIfPossible: true)
|> filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(completed: {
self?.controller?.dismiss()
})
let action: () -> Void = {
guard let strongSelf = self else {
return
}
let _ = (strongSelf.call.leave(terminateIfPossible: true)
|> filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(completed: {
self?.controller?.dismiss()
})
}
let alert = textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.VoiceChat_EndConfirmationTitle, text: strongSelf.presentationData.strings.VoiceChat_EndConfirmationText, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.VoiceChat_EndConfirmationEnd, action: {
action()
})])
strongSelf.controller?.present(alert, in: .window(.root))
})))
}