Fix call log sending

This commit is contained in:
Ali 2020-08-08 19:33:10 +04:00
parent 0562d606fc
commit 9df77b8d19
5 changed files with 26 additions and 3 deletions

View File

@ -1306,6 +1306,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
let (size, apply) = inputActivitiesLayout(CGSize(width: rawContentWidth - badgeSize, height: 40.0), item.presentationData, item.presentationData.theme.chatList.messageTextColor, item.index.messageIndex.id.peerId, inputActivities)
inputActivitiesSize = size
inputActivitiesApply = apply
} else {
let (size, apply) = inputActivitiesLayout(CGSize(width: rawContentWidth - badgeSize, height: 40.0), item.presentationData, item.presentationData.theme.chatList.messageTextColor, item.index.messageIndex.id.peerId, [])
inputActivitiesSize = size
inputActivitiesApply = apply
}
var online = false

View File

@ -15,6 +15,9 @@ public func rateCall(account: Account, callId: CallId, starsCount: Int32, commen
}
public func saveCallDebugLog(network: Network, callId: CallId, log: String) -> Signal<Void, NoError> {
if log.count > 1024 * 16 {
return .complete()
}
return network.request(Api.functions.phone.saveCallDebug(peer: Api.InputPhoneCall.inputPhoneCall(id: callId.id, accessHash: callId.accessHash), debug: .dataJSON(data: log)))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)

View File

@ -717,6 +717,18 @@ public final class OngoingCallContext {
}
}
private func withContextThenDeallocate(_ f: @escaping (OngoingCallThreadLocalContextProtocol) -> Void) {
self.queue.async {
if let contextRef = self.contextRef {
let context = contextRef.takeUnretainedValue()
f(context.context)
self.contextRef?.release()
self.contextRef = nil
}
}
}
public func beginTermination() {
self.withContext { context in
context.nativeBeginTermination()
@ -727,7 +739,7 @@ public final class OngoingCallContext {
let account = self.account
let logPath = self.logPath
self.withContext { context in
self.withContextThenDeallocate { context in
context.nativeStop { debugLog, bytesSentWifi, bytesReceivedWifi, bytesSentMobile, bytesReceivedMobile in
debugLogValue.set(.single(debugLog))
let delta = NetworkUsageStatsConnectionsEntry(

View File

@ -515,6 +515,10 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
}
- (void)dealloc {
if (InternalVoipLoggingFunction) {
InternalVoipLoggingFunction(@"OngoingCallThreadLocalContext: dealloc");
}
assert([_queue isCurrent]);
if (_tgVoip != NULL) {
[self stop:nil];
@ -530,7 +534,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
return;
}
tgcalls::FinalState finalState = _tgVoip->stop();
_tgVoip = nil;
_tgVoip.reset();
_terminationResult = [[OngoingCallThreadLocalContextWebrtcTerminationResult alloc] initWithFinalState:finalState];
}

@ -1 +1 @@
Subproject commit 9e425c1fbd34e544f831a612608fce1da1c73200
Subproject commit 44ec8cf45b267a0931bf52adb2d6a83f8aab3690