mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Fix voice chat missing peer requests
This commit is contained in:
parent
7608fff064
commit
1e1d9ae977
@ -5959,6 +5959,7 @@ Sorry for the inconvenience.";
|
|||||||
"ChatImportActivity.ErrorInvalidChatType" = "Wrong type of chat for the messages you are trying to import.";
|
"ChatImportActivity.ErrorInvalidChatType" = "Wrong type of chat for the messages you are trying to import.";
|
||||||
"ChatImportActivity.ErrorUserBlocked" = "Unable to import messages due to privacy settings.";
|
"ChatImportActivity.ErrorUserBlocked" = "Unable to import messages due to privacy settings.";
|
||||||
"ChatImportActivity.ErrorGeneric" = "An error occurred.";
|
"ChatImportActivity.ErrorGeneric" = "An error occurred.";
|
||||||
|
"ChatImportActivity.ErrorLimitExceeded" = "Limit exceeded. Please try again later.";
|
||||||
"ChatImportActivity.Success" = "Chat imported\nsuccessfully.";
|
"ChatImportActivity.Success" = "Chat imported\nsuccessfully.";
|
||||||
|
|
||||||
"VoiceOver.Chat.GoToOriginalMessage" = "Go to message";
|
"VoiceOver.Chat.GoToOriginalMessage" = "Go to message";
|
||||||
|
|||||||
@ -57,6 +57,7 @@ private final class ImportManager {
|
|||||||
case chatAdminRequired
|
case chatAdminRequired
|
||||||
case invalidChatType
|
case invalidChatType
|
||||||
case userBlocked
|
case userBlocked
|
||||||
|
case limitExceeded
|
||||||
}
|
}
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
@ -119,6 +120,8 @@ private final class ImportManager {
|
|||||||
return .generic
|
return .generic
|
||||||
case .userBlocked:
|
case .userBlocked:
|
||||||
return .userBlocked
|
return .userBlocked
|
||||||
|
case .limitExceeded:
|
||||||
|
return .limitExceeded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] session in
|
|> deliverOnMainQueue).start(next: { [weak self] session in
|
||||||
@ -533,6 +536,8 @@ public final class ChatImportActivityScreen: ViewController {
|
|||||||
errorText = self.presentationData.strings.ChatImportActivity_ErrorGeneric
|
errorText = self.presentationData.strings.ChatImportActivity_ErrorGeneric
|
||||||
case .userBlocked:
|
case .userBlocked:
|
||||||
errorText = self.presentationData.strings.ChatImportActivity_ErrorUserBlocked
|
errorText = self.presentationData.strings.ChatImportActivity_ErrorUserBlocked
|
||||||
|
case .limitExceeded:
|
||||||
|
errorText = self.presentationData.strings.ChatImportActivity_ErrorLimitExceeded
|
||||||
}
|
}
|
||||||
self.statusText.attributedText = NSAttributedString(string: errorText, font: Font.regular(17.0), textColor: self.presentationData.theme.list.itemDestructiveColor)
|
self.statusText.attributedText = NSAttributedString(string: errorText, font: Font.regular(17.0), textColor: self.presentationData.theme.list.itemDestructiveColor)
|
||||||
case .done:
|
case .done:
|
||||||
|
|||||||
@ -891,6 +891,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
var result: [(PeerId, UInt32, Float, Bool)] = []
|
var result: [(PeerId, UInt32, Float, Bool)] = []
|
||||||
var myLevel: Float = 0.0
|
var myLevel: Float = 0.0
|
||||||
var myLevelHasVoice: Bool = false
|
var myLevelHasVoice: Bool = false
|
||||||
|
var missingSsrcs = Set<UInt32>()
|
||||||
for (ssrcKey, level, hasVoice) in levels {
|
for (ssrcKey, level, hasVoice) in levels {
|
||||||
var peerId: PeerId?
|
var peerId: PeerId?
|
||||||
let ssrcValue: UInt32
|
let ssrcValue: UInt32
|
||||||
@ -910,6 +911,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.append((peerId, ssrcValue, level, hasVoice))
|
result.append((peerId, ssrcValue, level, hasVoice))
|
||||||
|
} else if ssrcValue != 0 {
|
||||||
|
missingSsrcs.insert(ssrcValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -918,6 +921,10 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
let mappedLevel = myLevel * 1.5
|
let mappedLevel = myLevel * 1.5
|
||||||
strongSelf.myAudioLevelPipe.putNext(mappedLevel)
|
strongSelf.myAudioLevelPipe.putNext(mappedLevel)
|
||||||
strongSelf.processMyAudioLevel(level: mappedLevel, hasVoice: myLevelHasVoice)
|
strongSelf.processMyAudioLevel(level: mappedLevel, hasVoice: myLevelHasVoice)
|
||||||
|
|
||||||
|
if !missingSsrcs.isEmpty {
|
||||||
|
strongSelf.participantsContext?.ensureHaveParticipants(ssrcs: missingSsrcs)
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1229,7 +1229,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if case let .known(value) = offset, value < 100.0 {
|
if case let .known(value) = offset, value < 200.0 {
|
||||||
if let loadMoreToken = strongSelf.currentCallMembers?.1 {
|
if let loadMoreToken = strongSelf.currentCallMembers?.1 {
|
||||||
strongSelf.currentLoadToken = loadMoreToken
|
strongSelf.currentLoadToken = loadMoreToken
|
||||||
strongSelf.call.loadMoreMembers(token: loadMoreToken)
|
strongSelf.call.loadMoreMembers(token: loadMoreToken)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public enum ChatHistoryImport {
|
|||||||
case chatAdminRequired
|
case chatAdminRequired
|
||||||
case invalidChatType
|
case invalidChatType
|
||||||
case userBlocked
|
case userBlocked
|
||||||
|
case limitExceeded
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ParsedInfo {
|
public enum ParsedInfo {
|
||||||
@ -64,16 +65,17 @@ public enum ChatHistoryImport {
|
|||||||
guard let inputPeer = inputPeer else {
|
guard let inputPeer = inputPeer else {
|
||||||
return .fail(.generic)
|
return .fail(.generic)
|
||||||
}
|
}
|
||||||
return account.network.request(Api.functions.messages.initHistoryImport(peer: inputPeer, file: inputFile, mediaCount: mediaCount))
|
return account.network.request(Api.functions.messages.initHistoryImport(peer: inputPeer, file: inputFile, mediaCount: mediaCount), automaticFloodWait: false)
|
||||||
|> mapError { error -> InitImportError in
|
|> mapError { error -> InitImportError in
|
||||||
switch error.errorDescription {
|
if error.errorDescription == "CHAT_ADMIN_REQUIRED" {
|
||||||
case "CHAT_ADMIN_REQUIRED":
|
|
||||||
return .chatAdminRequired
|
return .chatAdminRequired
|
||||||
case "IMPORT_PEER_TYPE_INVALID":
|
} else if error.errorDescription == "IMPORT_PEER_TYPE_INVALID" {
|
||||||
return .invalidChatType
|
return .invalidChatType
|
||||||
case "USER_IS_BLOCKED":
|
} else if error.errorDescription == "USER_IS_BLOCKED" {
|
||||||
return .userBlocked
|
return .userBlocked
|
||||||
default:
|
} else if error.errorDescription == "FLOOD_WAIT" {
|
||||||
|
return .limitExceeded
|
||||||
|
} else {
|
||||||
return .generic
|
return .generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -949,7 +949,7 @@ public final class GroupCallParticipantsContext {
|
|||||||
self.ensureHaveParticipants(ssrcs: Set(ids.map { $0.1 }))
|
self.ensureHaveParticipants(ssrcs: Set(ids.map { $0.1 }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func ensureHaveParticipants(ssrcs: Set<UInt32>) {
|
public func ensureHaveParticipants(ssrcs: Set<UInt32>) {
|
||||||
var missingSsrcs = Set<UInt32>()
|
var missingSsrcs = Set<UInt32>()
|
||||||
|
|
||||||
var existingSsrcs = Set<UInt32>()
|
var existingSsrcs = Set<UInt32>()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user