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

This commit is contained in:
Ilya Laktyushin 2021-03-11 21:01:36 +04:00
commit b12d85debf
7 changed files with 28 additions and 15 deletions

View File

@ -101,7 +101,7 @@ private final class ImportManager {
var totalMediaBytes = 0 var totalMediaBytes = 0
for entry in self.entries { for entry in self.entries {
self.entryProgress[entry.0.path] = (Int(entry.0.uncompressedSize), 0) self.entryProgress[entry.1] = (Int(entry.0.uncompressedSize), 0)
totalMediaBytes += Int(entry.0.uncompressedSize) totalMediaBytes += Int(entry.0.uncompressedSize)
} }
self.totalBytes = self.mainFileSize + totalMediaBytes self.totalBytes = self.mainFileSize + totalMediaBytes
@ -277,8 +277,8 @@ private final class ImportManager {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
if let (size, _) = strongSelf.entryProgress[entry.0.path] { if let (size, _) = strongSelf.entryProgress[entry.1] {
strongSelf.entryProgress[entry.0.path] = (size, Int(progress * Float(entry.0.uncompressedSize))) strongSelf.entryProgress[entry.1] = (size, Int(progress * Float(entry.0.uncompressedSize)))
strongSelf.updateProgress() strongSelf.updateProgress()
} }
}, error: { [weak self] error in }, error: { [weak self] error in
@ -290,8 +290,9 @@ private final class ImportManager {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
Logger.shared.log("ChatImportScreen", "updateState entry \(entry.1) has completed upload") Logger.shared.log("ChatImportScreen", "updateState entry \(entry.1) has completed upload, previous active entries: \(strongSelf.activeEntries.keys)")
strongSelf.activeEntries.removeValue(forKey: entry.0.path) strongSelf.activeEntries.removeValue(forKey: entry.1)
Logger.shared.log("ChatImportScreen", "removed active entry \(entry.1), current active entries: \(strongSelf.activeEntries.keys)")
strongSelf.updateState() strongSelf.updateState()
})) }))
} }

View File

@ -764,7 +764,7 @@ struct OrderedHistoryViewEntries {
if self.lowerOrAtAnchor.count > 1 { if self.lowerOrAtAnchor.count > 1 {
for i in 1 ..< self.lowerOrAtAnchor.count { for i in 1 ..< self.lowerOrAtAnchor.count {
if self.lowerOrAtAnchor[i].index < self.lowerOrAtAnchor[i - 1].index { if self.lowerOrAtAnchor[i].index < self.lowerOrAtAnchor[i - 1].index {
assertionFailure() //assertionFailure()
break break
} }
} }
@ -772,7 +772,7 @@ struct OrderedHistoryViewEntries {
if self.higherThanAnchor.count > 1 { if self.higherThanAnchor.count > 1 {
for i in 1 ..< self.higherThanAnchor.count { for i in 1 ..< self.higherThanAnchor.count {
if self.higherThanAnchor[i].index < self.higherThanAnchor[i - 1].index { if self.higherThanAnchor[i].index < self.higherThanAnchor[i - 1].index {
assertionFailure() //assertionFailure()
break break
} }
} }
@ -796,7 +796,7 @@ struct OrderedHistoryViewEntries {
} }
} }
if fix { if fix {
assertionFailure() //assertionFailure()
self.lowerOrAtAnchor.sort(by: { $0.index.id.id < $1.index.id.id }) self.lowerOrAtAnchor.sort(by: { $0.index.id.id < $1.index.id.id })
self.higherThanAnchor.sort(by: { $0.index.id.id < $1.index.id.id }) self.higherThanAnchor.sort(by: { $0.index.id.id < $1.index.id.id })
} }

View File

@ -360,6 +360,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
private var internalState: InternalState = .requesting private var internalState: InternalState = .requesting
private let internalStatePromise = Promise<InternalState>(.requesting) private let internalStatePromise = Promise<InternalState>(.requesting)
private var currentLocalSsrc: UInt32?
private var callContext: OngoingGroupCallContext? private var callContext: OngoingGroupCallContext?
private var currentConnectionMode: OngoingGroupCallContext.ConnectionMode = .none private var currentConnectionMode: OngoingGroupCallContext.ConnectionMode = .none
@ -1003,6 +1004,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
strongSelf.currentLocalSsrc = ssrc
strongSelf.requestDisposable.set((joinGroupCall( strongSelf.requestDisposable.set((joinGroupCall(
account: strongSelf.account, account: strongSelf.account,
peerId: strongSelf.peerId, peerId: strongSelf.peerId,
@ -1608,7 +1610,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
} }
public func leave(terminateIfPossible: Bool) -> Signal<Bool, NoError> { public func leave(terminateIfPossible: Bool) -> Signal<Bool, NoError> {
if case let .established(callInfo, _, _, localSsrc, _) = self.internalState { if let callInfo = self.internalState.callInfo, let localSsrc = self.currentLocalSsrc {
if terminateIfPossible { if terminateIfPossible {
self.leaveDisposable.set((stopGroupCall(account: self.account, peerId: self.peerId, callId: callInfo.id, accessHash: callInfo.accessHash) self.leaveDisposable.set((stopGroupCall(account: self.account, peerId: self.peerId, callId: callInfo.id, accessHash: callInfo.accessHash)
|> deliverOnMainQueue).start(completed: { [weak self] in |> deliverOnMainQueue).start(completed: { [weak self] in

View File

@ -3049,7 +3049,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} }
})) }))
} else if case let .replyThread(messagePromise) = self.chatLocationInfoData { } else if case let .replyThread(messagePromise) = self.chatLocationInfoData {
let hasScheduledMessages: Signal<Bool, NoError> = .single(false)
self.reportIrrelvantGeoNoticePromise.set(.single(nil)) self.reportIrrelvantGeoNoticePromise.set(.single(nil))
let replyThreadType: ChatTitleContent.ReplyThreadType let replyThreadType: ChatTitleContent.ReplyThreadType
@ -3936,8 +3935,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return message return message
} }
|> distinctUntilChanged |> distinctUntilChanged
default: case let .replyThread(replyThreadMessage):
topPinnedMessage = .single(nil) return .single(nil)
} }
return topPinnedMessage return topPinnedMessage
} }

View File

@ -28,7 +28,7 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
} }
var selectedContext: ChatTitlePanelContext? var selectedContext: ChatTitlePanelContext?
if !chatPresentationInterfaceState.titlePanelContexts.isEmpty && !inhibitTitlePanelDisplay { if !chatPresentationInterfaceState.titlePanelContexts.isEmpty {
loop: for context in chatPresentationInterfaceState.titlePanelContexts.reversed() { loop: for context in chatPresentationInterfaceState.titlePanelContexts.reversed() {
switch context { switch context {
case .pinnedMessage: case .pinnedMessage:
@ -42,6 +42,15 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
} }
} }
} }
if inhibitTitlePanelDisplay, let selectedContextValue = selectedContext {
switch selectedContextValue {
case .pinnedMessage:
break
default:
selectedContext = nil
}
}
var displayActionsPanel = false var displayActionsPanel = false
if !chatPresentationInterfaceState.peerIsBlocked && !inhibitTitlePanelDisplay, let contactStatus = chatPresentationInterfaceState.contactStatus, let peerStatusSettings = contactStatus.peerStatusSettings { if !chatPresentationInterfaceState.peerIsBlocked && !inhibitTitlePanelDisplay, let contactStatus = chatPresentationInterfaceState.contactStatus, let peerStatusSettings = contactStatus.peerStatusSettings {

View File

@ -7,6 +7,7 @@
#import "Instance.h" #import "Instance.h"
#import "InstanceImpl.h" #import "InstanceImpl.h"
#import "reference/InstanceImplReference.h" #import "reference/InstanceImplReference.h"
#include "StaticThreads.h"
#import "VideoCaptureInterface.h" #import "VideoCaptureInterface.h"
@ -158,7 +159,7 @@
if (keepLandscape) { if (keepLandscape) {
resolvedId += std::string(":landscape"); resolvedId += std::string(":landscape");
} }
_interface = tgcalls::VideoCaptureInterface::Create(resolvedId); _interface = tgcalls::VideoCaptureInterface::Create(tgcalls::StaticThreads::getThreads(), resolvedId);
} }
return self; return self;
} }
@ -863,6 +864,7 @@ private:
__weak GroupCallThreadLocalContext *weakSelf = self; __weak GroupCallThreadLocalContext *weakSelf = self;
_instance.reset(new tgcalls::GroupInstanceCustomImpl((tgcalls::GroupInstanceDescriptor){ _instance.reset(new tgcalls::GroupInstanceCustomImpl((tgcalls::GroupInstanceDescriptor){
.threads = tgcalls::StaticThreads::getThreads(),
.networkStateUpdated = [weakSelf, queue, networkStateUpdated](tgcalls::GroupNetworkState networkState) { .networkStateUpdated = [weakSelf, queue, networkStateUpdated](tgcalls::GroupNetworkState networkState) {
[queue dispatch:^{ [queue dispatch:^{
__strong GroupCallThreadLocalContext *strongSelf = weakSelf; __strong GroupCallThreadLocalContext *strongSelf = weakSelf;

@ -1 +1 @@
Subproject commit 943d24ab5c86d2e4d739e82234b4d14210433ca0 Subproject commit 4a953747375b8648f8b66e9572b59b10f7b769a1