mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Support Xcode 16
This commit is contained in:
parent
ba352f9b6e
commit
46646a41a9
@ -2,7 +2,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Display
|
import Display
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import WebKit
|
@preconcurrency import WebKit
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import AccountContext
|
import AccountContext
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import TelegramPresentationData
|
|||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import WebKit
|
@preconcurrency import WebKit
|
||||||
import AppBundle
|
import AppBundle
|
||||||
import PromptUI
|
import PromptUI
|
||||||
import SafariServices
|
import SafariServices
|
||||||
|
@ -9,7 +9,7 @@ import TelegramPresentationData
|
|||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import WebKit
|
@preconcurrency import WebKit
|
||||||
import AppBundle
|
import AppBundle
|
||||||
import PromptUI
|
import PromptUI
|
||||||
import SafariServices
|
import SafariServices
|
||||||
|
@ -123,6 +123,8 @@ private final class VideoRecorderImpl {
|
|||||||
private var previousAppendTime: Double?
|
private var previousAppendTime: Double?
|
||||||
|
|
||||||
public func appendVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
public func appendVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
||||||
|
nonisolated(unsafe) let sampleBuffer = sampleBuffer
|
||||||
|
|
||||||
self.queue.async {
|
self.queue.async {
|
||||||
guard self.hasError() == nil && !self.stopped else {
|
guard self.hasError() == nil && !self.stopped else {
|
||||||
return
|
return
|
||||||
@ -246,6 +248,8 @@ private final class VideoRecorderImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func appendAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
public func appendAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
||||||
|
nonisolated(unsafe) let sampleBuffer = sampleBuffer
|
||||||
|
|
||||||
self.queue.async {
|
self.queue.async {
|
||||||
guard self.hasError() == nil && !self.stopped else {
|
guard self.hasError() == nil && !self.stopped else {
|
||||||
return
|
return
|
||||||
|
@ -132,20 +132,24 @@ public func iCloudFileDescription(_ url: URL) -> Signal<ICloudFileDescription?,
|
|||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
return EmptyDisposable
|
return EmptyDisposable
|
||||||
} else {
|
} else {
|
||||||
|
final class WrappedQuery {
|
||||||
let query = NSMetadataQuery()
|
let query = NSMetadataQuery()
|
||||||
query.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope, NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope]
|
}
|
||||||
query.predicate = NSPredicate(format: "%K.lastPathComponent == %@", NSMetadataItemFSNameKey, url.lastPathComponent)
|
|
||||||
query.valueListAttributes = [NSMetadataItemFSSizeKey]
|
let query = WrappedQuery()
|
||||||
|
query.query.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope, NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope]
|
||||||
|
query.query.predicate = NSPredicate(format: "%K.lastPathComponent == %@", NSMetadataItemFSNameKey, url.lastPathComponent)
|
||||||
|
query.query.valueListAttributes = [NSMetadataItemFSSizeKey]
|
||||||
|
|
||||||
let observer = NotificationCenter.default.addObserver(forName: NSNotification.Name.NSMetadataQueryDidFinishGathering, object: query, queue: OperationQueue.main, using: { notification in
|
let observer = NotificationCenter.default.addObserver(forName: NSNotification.Name.NSMetadataQueryDidFinishGathering, object: query, queue: OperationQueue.main, using: { notification in
|
||||||
query.disableUpdates()
|
query.query.disableUpdates()
|
||||||
|
|
||||||
guard let metadataItem = query.results.first as? NSMetadataItem else {
|
guard let metadataItem = query.query.results.first as? NSMetadataItem else {
|
||||||
query.enableUpdates()
|
query.query.enableUpdates()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
query.stop()
|
query.query.stop()
|
||||||
|
|
||||||
guard let fileSize = metadataItem.value(forAttribute: NSMetadataItemFSSizeKey) as? NSNumber, fileSize != 0 else {
|
guard let fileSize = metadataItem.value(forAttribute: NSMetadataItemFSSizeKey) as? NSNumber, fileSize != 0 else {
|
||||||
subscriber.putNext(nil)
|
subscriber.putNext(nil)
|
||||||
@ -157,11 +161,11 @@ public func iCloudFileDescription(_ url: URL) -> Signal<ICloudFileDescription?,
|
|||||||
subscriber.putCompletion()
|
subscriber.putCompletion()
|
||||||
})
|
})
|
||||||
|
|
||||||
query.start()
|
query.query.start()
|
||||||
|
|
||||||
return ActionDisposable {
|
return ActionDisposable {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
query.stop()
|
query.query.stop()
|
||||||
NotificationCenter.default.removeObserver(observer)
|
NotificationCenter.default.removeObserver(observer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <AssertMacros.h>
|
#include <AssertMacros.h>
|
||||||
|
|
||||||
|
#import <sys/types.h>
|
||||||
|
|
||||||
#pragma mark * PingFoundation
|
#pragma mark * PingFoundation
|
||||||
|
|
||||||
@protocol PingFoundationDelegate;
|
@protocol PingFoundationDelegate;
|
||||||
@ -59,7 +61,7 @@ typedef NS_ENUM(NSInteger, PingFoundationAddressStyle) {
|
|||||||
/*! The address family for `hostAddress`, or `AF_UNSPEC` if that's nil.
|
/*! The address family for `hostAddress`, or `AF_UNSPEC` if that's nil.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@property (nonatomic, assign, readonly) sa_family_t hostAddressFamily;
|
@property (nonatomic, assign, readonly) __uint8_t hostAddressFamily;
|
||||||
|
|
||||||
/*! The identifier used by pings by this object.
|
/*! The identifier used by pings by this object.
|
||||||
* \details When you create an instance of this object it generates a random identifier
|
* \details When you create an instance of this object it generates a random identifier
|
||||||
|
@ -160,10 +160,6 @@ extension _AdaptedPostboxEncoder.UnkeyedContainer: UnkeyedEncodingContainer {
|
|||||||
self.items.append(.string(value))
|
self.items.append(.string(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(_ value: Data) throws {
|
|
||||||
self.items.append(.data(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
|
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
|
||||||
preconditionFailure()
|
preconditionFailure()
|
||||||
}
|
}
|
||||||
@ -177,6 +173,12 @@ extension _AdaptedPostboxEncoder.UnkeyedContainer: UnkeyedEncodingContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private extension _AdaptedPostboxEncoder.UnkeyedContainer {
|
||||||
|
func encode(_ value: Data) throws {
|
||||||
|
self.items.append(.data(value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension _AdaptedPostboxEncoder.UnkeyedContainer: AdaptedPostboxEncodingContainer {
|
extension _AdaptedPostboxEncoder.UnkeyedContainer: AdaptedPostboxEncodingContainer {
|
||||||
func makeData() -> Data {
|
func makeData() -> Data {
|
||||||
preconditionFailure()
|
preconditionFailure()
|
||||||
|
@ -2500,7 +2500,7 @@ public func channelStatsController(context: AccountContext, updatedPresentationD
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
var tooltipScreen: UndoOverlayController?
|
var tooltipScreen: UndoOverlayController?
|
||||||
var timer: Foundation.Timer?
|
nonisolated(unsafe) var timer: Foundation.Timer?
|
||||||
showTimeoutTooltipImpl = { cooldownUntilTimestamp in
|
showTimeoutTooltipImpl = { cooldownUntilTimestamp in
|
||||||
let remainingCooldownSeconds = cooldownUntilTimestamp - Int32(Date().timeIntervalSince1970)
|
let remainingCooldownSeconds = cooldownUntilTimestamp - Int32(Date().timeIntervalSince1970)
|
||||||
|
|
||||||
|
@ -2477,10 +2477,11 @@ private func renderVideo(context: AccountContext, backgroundImage: UIImage, user
|
|||||||
let layerInstruction = compositionLayerInstruction(for: compositionTrack, assetTrack: assetTrack)
|
let layerInstruction = compositionLayerInstruction(for: compositionTrack, assetTrack: assetTrack)
|
||||||
instruction.layerInstructions = [layerInstruction]
|
instruction.layerInstructions = [layerInstruction]
|
||||||
|
|
||||||
guard let export = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality) else {
|
guard let exportValue = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality) else {
|
||||||
completion(nil)
|
completion(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
nonisolated(unsafe) let export = exportValue
|
||||||
|
|
||||||
let videoName = UUID().uuidString
|
let videoName = UUID().uuidString
|
||||||
let exportURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoName).appendingPathExtension("mp4")
|
let exportURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoName).appendingPathExtension("mp4")
|
||||||
|
@ -1808,14 +1808,19 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
|||||||
self.isActiveValue = false
|
self.isActiveValue = false
|
||||||
self.isActivePromise.set(false)
|
self.isActivePromise.set(false)
|
||||||
|
|
||||||
|
final class TaskIdHolder {
|
||||||
var taskId: UIBackgroundTaskIdentifier?
|
var taskId: UIBackgroundTaskIdentifier?
|
||||||
taskId = application.beginBackgroundTask(withName: "lock", expirationHandler: {
|
}
|
||||||
if let taskId = taskId {
|
|
||||||
|
let taskIdHolder = TaskIdHolder()
|
||||||
|
|
||||||
|
taskIdHolder.taskId = application.beginBackgroundTask(withName: "lock", expirationHandler: {
|
||||||
|
if let taskId = taskIdHolder.taskId {
|
||||||
UIApplication.shared.endBackgroundTask(taskId)
|
UIApplication.shared.endBackgroundTask(taskId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 5.0, execute: {
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 5.0, execute: {
|
||||||
if let taskId = taskId {
|
if let taskId = taskIdHolder.taskId {
|
||||||
UIApplication.shared.endBackgroundTask(taskId)
|
UIApplication.shared.endBackgroundTask(taskId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import WebKit
|
@preconcurrency import WebKit
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import UniversalMediaPlayer
|
import UniversalMediaPlayer
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
import WebKit
|
@preconcurrency import WebKit
|
||||||
import Display
|
import Display
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Postbox
|
import Postbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user