mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Debugging
This commit is contained in:
parent
089eec1c09
commit
bd4d32d293
@ -21,6 +21,7 @@ swift_library(
|
||||
"//submodules/Reachability:Reachability",
|
||||
"//submodules/ManagedFile:ManagedFile",
|
||||
"//submodules/Utils/RangeSet:RangeSet",
|
||||
"//submodules/GZip:GZip",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -1195,6 +1195,12 @@ public class Account {
|
||||
self?.restartConfigurationUpdates()
|
||||
}
|
||||
self.restartConfigurationUpdates()
|
||||
|
||||
/*#if DEBUG
|
||||
self.managedOperationsDisposable.add(debugFetchAllStickers(account: self).start(completed: {
|
||||
print("debugFetchAllStickers done")
|
||||
}))
|
||||
#endif*/
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
@ -3,7 +3,7 @@ import Postbox
|
||||
import SwiftSignalKit
|
||||
import TelegramApi
|
||||
import MtProtoKit
|
||||
|
||||
import GZip
|
||||
|
||||
private final class ManagedSynchronizeInstalledStickerPacksOperationsHelper {
|
||||
var operationDisposables: [Int32: Disposable] = [:]
|
||||
@ -374,6 +374,61 @@ private func synchronizeInstalledStickerPacks(transaction: Transaction, postbox:
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
func debugFetchAllStickers(account: Account) -> Signal<Never, NoError> {
|
||||
let orderedItemListCollectionIds: [Int32] = [Namespaces.OrderedItemList.CloudSavedStickers]
|
||||
let namespaces: [ItemCollectionId.Namespace] = [Namespaces.ItemCollection.CloudStickerPacks]
|
||||
let stickerItems: Signal<[TelegramMediaFile], NoError> = account.postbox.itemCollectionsView(orderedItemListCollectionIds: orderedItemListCollectionIds, namespaces: namespaces, aroundIndex: nil, count: 10000000)
|
||||
|> map { view -> [TelegramMediaFile] in
|
||||
var files: [TelegramMediaFile] = []
|
||||
for entry in view.entries {
|
||||
guard let item = entry.item as? StickerPackItem else {
|
||||
continue
|
||||
}
|
||||
if !item.file.isAnimatedSticker {
|
||||
continue
|
||||
}
|
||||
files.append(item.file)
|
||||
}
|
||||
return files
|
||||
}
|
||||
|> take(1)
|
||||
|
||||
return stickerItems
|
||||
|> mapToSignal { files -> Signal<Never, NoError> in
|
||||
var loadFileSignals: [Signal<Never, NoError>] = []
|
||||
|
||||
let tempDir = TempBox.shared.tempDirectory()
|
||||
print("debugFetchAllStickers into \(tempDir.path)")
|
||||
|
||||
for file in files {
|
||||
loadFileSignals.append(Signal { subscriber in
|
||||
let fetch = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: stickerPackFileReference(file).resourceReference(file.resource)).start()
|
||||
let data = (account.postbox.mediaBox.resourceData(file.resource)
|
||||
|> filter { $0.complete }
|
||||
|> take(1)).start(next: { data in
|
||||
if let dataValue = try? Data(contentsOf: URL(fileURLWithPath: data.path)), let unpackedData = TGGUnzipData(dataValue, 5 * 1024 * 1024) {
|
||||
let filePath = tempDir.path + "/\(file.fileId.id).json"
|
||||
let _ = try? unpackedData.write(to: URL(fileURLWithPath: filePath), options: .atomic)
|
||||
subscriber.putCompletion()
|
||||
}
|
||||
})
|
||||
|
||||
return ActionDisposable {
|
||||
fetch.dispose()
|
||||
data.dispose()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return combineLatest(loadFileSignals)
|
||||
|> ignoreValues
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private func continueSynchronizeInstalledStickerPacks(transaction: Transaction, postbox: Postbox, network: Network, stateManager: AccountStateManager, namespace: SynchronizeInstalledStickerPacksOperationNamespace, operation: SynchronizeInstalledStickerPacksOperation) -> Signal<Void, NoError> {
|
||||
let collectionNamespace: ItemCollectionId.Namespace
|
||||
switch namespace {
|
||||
|
@ -738,7 +738,7 @@ public final class OngoingCallContext {
|
||||
private var signalingConnectionManager: QueueLocalObject<CallSignalingConnectionManager>?
|
||||
|
||||
public static func versions(includeExperimental: Bool, includeReference: Bool) -> [(version: String, supportsVideo: Bool)] {
|
||||
#if os(iOS) && DEBUG
|
||||
#if os(iOS) && DEBUG && false
|
||||
if "".isEmpty {
|
||||
return [("5.0.0", true)]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user