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
|
private var shouldNotAnimateLikelyKeyboardAutocorrectionSwitch: Bool = false
|
||||||
|
|
||||||
public private(set) var forceInCallStatusBarText: String? = nil
|
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 {
|
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?()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,6 +1406,8 @@ public final class Postbox {
|
|||||||
self.basePath = basePath
|
self.basePath = basePath
|
||||||
self.seedConfiguration = seedConfiguration
|
self.seedConfiguration = seedConfiguration
|
||||||
self.tempDir = tempDir
|
self.tempDir = tempDir
|
||||||
|
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
print("MediaBox path: \(self.basePath + "/media")")
|
print("MediaBox path: \(self.basePath + "/media")")
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import AccountUtils
|
|||||||
import CoreSpotlight
|
import CoreSpotlight
|
||||||
import LightweightAccountData
|
import LightweightAccountData
|
||||||
import TelegramAudio
|
import TelegramAudio
|
||||||
|
import DebugSettingsUI
|
||||||
|
|
||||||
#if canImport(BackgroundTasks)
|
#if canImport(BackgroundTasks)
|
||||||
import BackgroundTasks
|
import BackgroundTasks
|
||||||
@ -813,6 +814,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)
|
presentationDataPromise.set(sharedContext.presentationData)
|
||||||
|
|
||||||
@ -1083,6 +1093,8 @@ final class SharedApplicationContext {
|
|||||||
print("Application: context took \(readyTime) to become ready")
|
print("Application: context took \(readyTime) to become ready")
|
||||||
}
|
}
|
||||||
print("Launch to ready took \((CFAbsoluteTimeGetCurrent() - launchStartTime) * 1000.0) ms")
|
print("Launch to ready took \((CFAbsoluteTimeGetCurrent() - launchStartTime) * 1000.0) ms")
|
||||||
|
|
||||||
|
self.mainWindow.debugAction = nil
|
||||||
|
|
||||||
self.mainWindow.viewController = context.rootController
|
self.mainWindow.viewController = context.rootController
|
||||||
if firstTime {
|
if firstTime {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user