mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Update to iOS 13
This commit is contained in:
@@ -84,38 +84,48 @@ private func isKeyboardViewContainer(view: NSObject) -> Bool {
|
||||
}
|
||||
|
||||
private class ApplicationStatusBarHost: StatusBarHost {
|
||||
private let application = UIApplication.shared
|
||||
private let scene: UIWindowScene
|
||||
|
||||
init(scene: UIWindowScene) {
|
||||
self.scene = scene
|
||||
}
|
||||
|
||||
var isApplicationInForeground: Bool {
|
||||
switch self.application.applicationState {
|
||||
switch self.scene.activationState {
|
||||
case .unattached:
|
||||
return false
|
||||
case .foregroundActive:
|
||||
return true
|
||||
case .foregroundInactive:
|
||||
return true
|
||||
case .background:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
@unknown default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var statusBarFrame: CGRect {
|
||||
return self.application.statusBarFrame
|
||||
return self.scene.statusBarManager?.statusBarFrame ?? CGRect()
|
||||
}
|
||||
var statusBarStyle: UIStatusBarStyle {
|
||||
get {
|
||||
return self.application.statusBarStyle
|
||||
return self.scene.statusBarManager?.statusBarStyle ?? .default
|
||||
} set(value) {
|
||||
self.setStatusBarStyle(value, animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
func setStatusBarStyle(_ style: UIStatusBarStyle, animated: Bool) {
|
||||
if self.shouldChangeStatusBarStyle?(style) ?? true {
|
||||
/*if self.shouldChangeStatusBarStyle?(style) ?? true {
|
||||
self.application.internalSetStatusBarStyle(style, animated: animated)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
var shouldChangeStatusBarStyle: ((UIStatusBarStyle) -> Bool)?
|
||||
|
||||
func setStatusBarHidden(_ value: Bool, animated: Bool) {
|
||||
self.application.internalSetStatusBarHidden(value, animation: animated ? .fade : .none)
|
||||
//self.application.internalSetStatusBarHidden(value, animation: animated ? .fade : .none)
|
||||
}
|
||||
|
||||
var keyboardWindow: UIWindow? {
|
||||
@@ -158,17 +168,13 @@ protocol SupportedStartCallIntent {
|
||||
var contacts: [INPerson]? { get }
|
||||
}
|
||||
|
||||
@available(iOS 10.0, *)
|
||||
extension INStartAudioCallIntent: SupportedStartCallIntent {}
|
||||
extension INStartCallIntent: SupportedStartCallIntent {}
|
||||
|
||||
protocol SupportedStartVideoCallIntent {
|
||||
@available(iOS 10.0, *)
|
||||
var contacts: [INPerson]? { get }
|
||||
}
|
||||
|
||||
@available(iOS 10.0, *)
|
||||
extension INStartVideoCallIntent: SupportedStartVideoCallIntent {}
|
||||
|
||||
private enum QueuedWakeup: Int32 {
|
||||
case call
|
||||
case backgroundLocation
|
||||
@@ -235,7 +241,6 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
let hasActiveAudioSession = Promise<Bool>(false)
|
||||
|
||||
private let sharedContextPromise = Promise<SharedApplicationContext>()
|
||||
//private let watchCommunicationManagerPromise = Promise<WatchCommunicationManager?>()
|
||||
|
||||
private var accountManager: AccountManager<TelegramAccountManagerTypes>?
|
||||
private var accountManagerState: AccountManagerState?
|
||||
@@ -339,8 +344,8 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
|
||||
let launchStartTime = CFAbsoluteTimeGetCurrent()
|
||||
|
||||
let statusBarHost = ApplicationStatusBarHost()
|
||||
let (window, hostView) = nativeWindowHostView()
|
||||
let statusBarHost = ApplicationStatusBarHost(scene: window.windowScene!)
|
||||
self.mainWindow = Window1(hostView: hostView, statusBarHost: statusBarHost)
|
||||
if let traitCollection = window.rootViewController?.traitCollection {
|
||||
if #available(iOS 13.0, *) {
|
||||
@@ -1477,9 +1482,9 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
}
|
||||
}
|
||||
|
||||
if UIApplication.shared.isStatusBarHidden {
|
||||
/*if UIApplication.shared.isStatusBarHidden {
|
||||
UIApplication.shared.internalSetStatusBarHidden(false, animation: .none)
|
||||
}
|
||||
}*/
|
||||
|
||||
/*if #available(iOS 13.0, *) {
|
||||
BGTaskScheduler.shared.register(forTaskWithIdentifier: baseAppBundleId + ".refresh", using: nil, launchHandler: { task in
|
||||
|
||||
Reference in New Issue
Block a user