mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 01:10:09 +00:00
Add more logs
This commit is contained in:
parent
e1a56f6f57
commit
5861c381b8
@ -5959,7 +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.ErrorLimitExceeded" = "Daily maximum reached,\nplease come back tomorrow.";
|
||||||
"ChatImportActivity.Success" = "Chat imported\nsuccessfully.";
|
"ChatImportActivity.Success" = "Chat imported\nsuccessfully.";
|
||||||
|
|
||||||
"VoiceOver.Chat.GoToOriginalMessage" = "Go to message";
|
"VoiceOver.Chat.GoToOriginalMessage" = "Go to message";
|
||||||
|
|||||||
@ -109,6 +109,11 @@ private final class ImportManager {
|
|||||||
|
|
||||||
self.stateValue = .progress(totalBytes: self.totalBytes, totalUploadedBytes: 0, totalMediaBytes: self.totalMediaBytes, totalUploadedMediaBytes: 0)
|
self.stateValue = .progress(totalBytes: self.totalBytes, totalUploadedBytes: 0, totalMediaBytes: self.totalMediaBytes, totalUploadedMediaBytes: 0)
|
||||||
|
|
||||||
|
Logger.shared.log("ChatImportScreen", "Requesting import session for \(peerId), media count: \(entries.count) with pending entries:")
|
||||||
|
for entry in entries {
|
||||||
|
Logger.shared.log("ChatImportScreen", " \(entry.1)")
|
||||||
|
}
|
||||||
|
|
||||||
self.disposable.set((ChatHistoryImport.initSession(account: self.account, peerId: peerId, file: mainFile, mediaCount: Int32(entries.count))
|
self.disposable.set((ChatHistoryImport.initSession(account: self.account, peerId: peerId, file: mainFile, mediaCount: Int32(entries.count))
|
||||||
|> mapError { error -> ImportError in
|
|> mapError { error -> ImportError in
|
||||||
switch error {
|
switch error {
|
||||||
@ -191,28 +196,37 @@ private final class ImportManager {
|
|||||||
|
|
||||||
private func updateState() {
|
private func updateState() {
|
||||||
guard let session = self.session else {
|
guard let session = self.session else {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState called with no session, ignoring")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if self.pendingEntries.isEmpty && self.activeEntries.isEmpty {
|
if self.pendingEntries.isEmpty && self.activeEntries.isEmpty {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState called with no pending and no active entries, completing")
|
||||||
self.complete()
|
self.complete()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if case .error = self.stateValue {
|
if case .error = self.stateValue {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState called after error, ignoring")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard let archivePath = self.archivePath else {
|
guard let archivePath = self.archivePath else {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState called with empty arhivePath, ignoring")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
while true {
|
while true {
|
||||||
if self.activeEntries.count >= 3 {
|
if self.activeEntries.count >= 3 {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState concurrent processing limit reached, stop searching")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if self.pendingEntries.isEmpty {
|
if self.pendingEntries.isEmpty {
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState no more pending entries, stop searching")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
let entry = self.pendingEntries.removeFirst()
|
let entry = self.pendingEntries.removeFirst()
|
||||||
|
|
||||||
|
Logger.shared.log("ChatImportScreen", "updateState take pending entry \(entry.1)")
|
||||||
|
|
||||||
let unpackedFile = Signal<TempBoxFile, ImportError> { subscriber in
|
let unpackedFile = Signal<TempBoxFile, ImportError> { subscriber in
|
||||||
let tempFile = TempBox.shared.tempFile(fileName: entry.0.path)
|
let tempFile = TempBox.shared.tempFile(fileName: entry.0.path)
|
||||||
Logger.shared.log("ChatImportScreen", "Extracting \(entry.0.path) to \(tempFile.path)...")
|
Logger.shared.log("ChatImportScreen", "Extracting \(entry.0.path) to \(tempFile.path)...")
|
||||||
@ -269,6 +283,7 @@ 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")
|
||||||
strongSelf.activeEntries.removeValue(forKey: entry.0.path)
|
strongSelf.activeEntries.removeValue(forKey: entry.0.path)
|
||||||
strongSelf.updateState()
|
strongSelf.updateState()
|
||||||
}))
|
}))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user