mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Voice chat fixes
This commit is contained in:
parent
e0d2201956
commit
b88da2e512
@ -2493,6 +2493,9 @@ Unused sets are archived when you add more.";
|
||||
"Call.CallInProgressMessage" = "Finish call with %1$@ and start a new one with %2$@?";
|
||||
"Call.ExternalCallInProgressMessage" = "Please finish the current call first.";
|
||||
|
||||
"Call.VoiceChatInProgressTitle" = "Voice Chat in Progress";
|
||||
"Call.VoiceChatInProgressMessage" = "Leave voice chat in %1$@ and start a new one with %2$@?";
|
||||
|
||||
"Call.Message" = "Message";
|
||||
|
||||
"UserInfo.TapToCall" = "Tap to make an end-to-end encrypted call";
|
||||
@ -2625,7 +2628,7 @@ Unused sets are archived when you add more.";
|
||||
"Channel.AdminLog.CanAddAdmins" = "Add New Admins";
|
||||
"Channel.AdminLog.CanBeAnonymous" = "Remain Anonymous";
|
||||
"Channel.AdminLog.CanEditMessages" = "Edit Messages";
|
||||
"Channel.AdminLog.CanManageCalls" = "Manage Calls";
|
||||
"Channel.AdminLog.CanManageCalls" = "Manage Voice Chats";
|
||||
|
||||
"Channel.AdminLog.MessageToggleInvitesOn" = "%@ enabled group invites";
|
||||
"Channel.AdminLog.MessageToggleInvitesOff" = "%@ disabled group invites";
|
||||
@ -5972,3 +5975,5 @@ Sorry for the inconvenience.";
|
||||
"VoiceChat.Panel.MembersSpeaking_any" = "%@ members speaking";
|
||||
|
||||
"ChannelInfo.CreateVoiceChat" = "Create Voice Chat";
|
||||
|
||||
"VoiceChat.AnonymousDisabledAlertText" = "Sorry, you can't join voice chat as an anonymous admin.";
|
||||
|
@ -497,10 +497,16 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
if let clientParams = joinCallResult.callInfo.clientParams {
|
||||
strongSelf.updateSessionState(internalState: .estabilished(info: joinCallResult.callInfo, clientParams: clientParams, localSsrc: ssrc, initialState: joinCallResult.state), audioSessionControl: strongSelf.audioSessionControl)
|
||||
}
|
||||
}, error: { _ in
|
||||
}, error: { error in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if case .anonymousNotAllowed = error {
|
||||
let presentationData = strongSelf.accountContext.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.accountContext.sharedContext.mainWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.VoiceChat_AnonymousDisabledAlertText, actions: [
|
||||
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})
|
||||
]), on: .root, blockInteraction: false, completion: {})
|
||||
}
|
||||
strongSelf._canBeRemoved.set(.single(true))
|
||||
}))
|
||||
}))
|
||||
@ -691,14 +697,29 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
||||
if terminateIfPossible {
|
||||
self.leaveDisposable.set((stopGroupCall(account: self.account, peerId: self.peerId, callId: callInfo.id, accessHash: callInfo.accessHash)
|
||||
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||
self?._canBeRemoved.set(.single(true))
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.callContext?.stop()
|
||||
strongSelf.callContext = nil
|
||||
strongSelf._canBeRemoved.set(.single(true))
|
||||
}))
|
||||
} else {
|
||||
self.leaveDisposable.set((leaveGroupCall(account: self.account, callId: callInfo.id, accessHash: callInfo.accessHash, source: localSsrc)
|
||||
|> deliverOnMainQueue).start(error: { [weak self] _ in
|
||||
self?._canBeRemoved.set(.single(true))
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.callContext?.stop()
|
||||
strongSelf.callContext = nil
|
||||
strongSelf._canBeRemoved.set(.single(true))
|
||||
}, completed: { [weak self] in
|
||||
self?._canBeRemoved.set(.single(true))
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.callContext?.stop()
|
||||
strongSelf.callContext = nil
|
||||
strongSelf._canBeRemoved.set(.single(true))
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
|
@ -386,7 +386,7 @@ public final class VoiceChatController: ViewController {
|
||||
}
|
||||
default:
|
||||
if peer.id != strongSelf.context.account.peerId {
|
||||
if let callState = strongSelf.callState, (callState.canManageCall || callState.adminIds.contains(strongSelf.context.account.peerId)) {
|
||||
if let callState = strongSelf.callState, (callState.canManageCall || callState.adminIds.contains(strongSelf.context.account.peerId)), !callState.adminIds.contains(peer.id) {
|
||||
if let muteState = entry.muteState, !muteState.canUnmute {
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_UnmutePeer, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Call/Context Menu/Unmute"), color: theme.actionSheet.primaryTextColor)
|
||||
@ -613,17 +613,24 @@ public final class VoiceChatController: ViewController {
|
||||
}
|
||||
|
||||
var items: [ContextMenuItem] = []
|
||||
/*items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_SpeakPermissionEveryone, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
f(.dismissWithoutContent)
|
||||
|
||||
})))
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_SpeakPermissionAdmin, icon: { _ in return nil}, action: { _, f in
|
||||
f(.dismissWithoutContent)
|
||||
|
||||
})))
|
||||
items.append(.separator)*/
|
||||
|
||||
if let callState = strongSelf.callState, callState.canManageCall {
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_SpeakPermissionEveryone, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
f(.dismissWithoutContent)
|
||||
|
||||
})))
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_SpeakPermissionAdmin, icon: { _ in return nil}, action: { _, f in
|
||||
f(.dismissWithoutContent)
|
||||
|
||||
})))
|
||||
}
|
||||
|
||||
if !items.isEmpty {
|
||||
items.append(.separator)
|
||||
}
|
||||
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_Share, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Link"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { [weak self] _, f in
|
||||
@ -698,7 +705,7 @@ public final class VoiceChatController: ViewController {
|
||||
super.didLoad()
|
||||
|
||||
let titleView = VoiceChatControllerTitleView(theme: self.presentationData.theme)
|
||||
titleView.set(title: "Voice Chat", subtitle: "connecting")
|
||||
titleView.set(title: self.presentationData.strings.VoiceChat_Title, subtitle: self.presentationData.strings.SocksProxySetup_ProxyStatusConnecting)
|
||||
self.controller?.navigationItem.titleView = titleView
|
||||
|
||||
let longTapRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.actionButtonPressGesture(_:)))
|
||||
|
@ -254,6 +254,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash
|
||||
|
||||
public enum JoinGroupCallError {
|
||||
case generic
|
||||
case anonymousNotAllowed
|
||||
}
|
||||
|
||||
public struct JoinGroupCallResult {
|
||||
@ -267,7 +268,10 @@ public func joinGroupCall(account: Account, peerId: PeerId, callId: Int64, acces
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
return account.network.request(Api.functions.phone.joinGroupCall(flags: flags, call: .inputGroupCall(id: callId, accessHash: accessHash), params: .dataJSON(data: joinPayload)))
|
||||
|> mapError { _ -> JoinGroupCallError in
|
||||
|> mapError { error -> JoinGroupCallError in
|
||||
if error.errorDescription == "GROUP_CALL_ANONYMOUS_FORBIDDEN" {
|
||||
return .anonymousNotAllowed
|
||||
}
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { updates -> Signal<JoinGroupCallResult, JoinGroupCallError> in
|
||||
|
@ -639,6 +639,11 @@ extension StoreMessage {
|
||||
if (flags & (1 << 4)) != 0 {
|
||||
notificationFlags.insert(.personal)
|
||||
}
|
||||
if (flags & (1 << 4)) != 0 {
|
||||
notificationFlags.insert(.personal)
|
||||
let notConsumed = (flags & (1 << 5)) != 0
|
||||
attributes.append(ConsumablePersonalMentionMessageAttribute(consumed: !notConsumed, pending: false))
|
||||
}
|
||||
if (flags & (1 << 13)) != 0 {
|
||||
notificationFlags.insert(.muted)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user