mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Add the ability to share logs before the UI loads
This commit is contained in:
parent
fd1bf9eddb
commit
1a2ae61be4
@ -270,8 +270,42 @@ public class Window1 {
|
||||
private var shouldNotAnimateLikelyKeyboardAutocorrectionSwitch: Bool = false
|
||||
|
||||
public private(set) var forceInCallStatusBarText: String? = nil
|
||||
public var inCallNavigate: (() -> Void)? {
|
||||
public var inCallNavigate: (() -> Void)?
|
||||
|
||||
private var debugTapCounter: (Double, Int) = (0.0, 0)
|
||||
private var debugTapRecognizer: UITapGestureRecognizer?
|
||||
public var debugAction: (() -> Void)? {
|
||||
didSet {
|
||||
if self.debugAction != nil {
|
||||
if self.debugTapRecognizer == nil {
|
||||
let debugTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.debugTapGesture(_:)))
|
||||
self.debugTapRecognizer = debugTapRecognizer
|
||||
self.hostView.containerView.addGestureRecognizer(debugTapRecognizer)
|
||||
}
|
||||
} else if let debugTapRecognizer = self.debugTapRecognizer {
|
||||
self.debugTapRecognizer = nil
|
||||
self.hostView.containerView.removeGestureRecognizer(debugTapRecognizer)
|
||||
}
|
||||
}
|
||||
}
|
||||
@objc private func debugTapGesture(_ recognizer: UITapGestureRecognizer) {
|
||||
if case .ended = recognizer.state {
|
||||
let timestamp = CACurrentMediaTime()
|
||||
if self.debugTapCounter.0 < timestamp - 0.4 {
|
||||
self.debugTapCounter.0 = timestamp
|
||||
self.debugTapCounter.1 = 0
|
||||
}
|
||||
|
||||
if self.debugTapCounter.0 >= timestamp - 0.4 {
|
||||
self.debugTapCounter.0 = timestamp
|
||||
self.debugTapCounter.1 += 1
|
||||
}
|
||||
|
||||
if self.debugTapCounter.1 >= 10 {
|
||||
self.debugTapCounter.1 = 0
|
||||
|
||||
self.debugAction?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1407,6 +1407,8 @@ public final class Postbox {
|
||||
self.seedConfiguration = seedConfiguration
|
||||
self.tempDir = tempDir
|
||||
|
||||
sleep(1)
|
||||
|
||||
print("MediaBox path: \(self.basePath + "/media")")
|
||||
|
||||
self.mediaBox = MediaBox(basePath: self.basePath + "/media")
|
||||
|
@ -33,6 +33,7 @@ import AccountUtils
|
||||
import CoreSpotlight
|
||||
import LightweightAccountData
|
||||
import TelegramAudio
|
||||
import DebugSettingsUI
|
||||
|
||||
#if canImport(BackgroundTasks)
|
||||
import BackgroundTasks
|
||||
@ -814,6 +815,15 @@ final class SharedApplicationContext {
|
||||
}
|
||||
})
|
||||
|
||||
self.mainWindow.debugAction = {
|
||||
self.mainWindow.debugAction = nil
|
||||
|
||||
let presentationData = sharedContext.currentPresentationData.with { $0 }
|
||||
let navigationController = NavigationController(mode: .single, theme: NavigationControllerTheme(presentationTheme: presentationData.theme))
|
||||
navigationController.viewControllers = [debugController(sharedContext: sharedContext, context: nil)]
|
||||
self.mainWindow.present(navigationController, on: .root)
|
||||
}
|
||||
|
||||
presentationDataPromise.set(sharedContext.presentationData)
|
||||
|
||||
let rawAccounts = sharedContext.activeAccounts
|
||||
@ -1084,6 +1094,8 @@ final class SharedApplicationContext {
|
||||
}
|
||||
print("Launch to ready took \((CFAbsoluteTimeGetCurrent() - launchStartTime) * 1000.0) ms")
|
||||
|
||||
self.mainWindow.debugAction = nil
|
||||
|
||||
self.mainWindow.viewController = context.rootController
|
||||
if firstTime {
|
||||
let layer = context.rootController.view.layer
|
||||
|
Loading…
x
Reference in New Issue
Block a user