mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Support Xcode 16
This commit is contained in:
parent
ba352f9b6e
commit
46646a41a9
@ -2,7 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import WebKit
|
||||
@preconcurrency import WebKit
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
||||
|
@ -9,7 +9,7 @@ import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import WebKit
|
||||
@preconcurrency import WebKit
|
||||
import AppBundle
|
||||
import PromptUI
|
||||
import SafariServices
|
||||
|
@ -9,7 +9,7 @@ import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import WebKit
|
||||
@preconcurrency import WebKit
|
||||
import AppBundle
|
||||
import PromptUI
|
||||
import SafariServices
|
||||
|
@ -123,6 +123,8 @@ private final class VideoRecorderImpl {
|
||||
private var previousAppendTime: Double?
|
||||
|
||||
public func appendVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
||||
nonisolated(unsafe) let sampleBuffer = sampleBuffer
|
||||
|
||||
self.queue.async {
|
||||
guard self.hasError() == nil && !self.stopped else {
|
||||
return
|
||||
@ -246,6 +248,8 @@ private final class VideoRecorderImpl {
|
||||
}
|
||||
|
||||
public func appendAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer) {
|
||||
nonisolated(unsafe) let sampleBuffer = sampleBuffer
|
||||
|
||||
self.queue.async {
|
||||
guard self.hasError() == nil && !self.stopped else {
|
||||
return
|
||||
|
@ -132,20 +132,24 @@ public func iCloudFileDescription(_ url: URL) -> Signal<ICloudFileDescription?,
|
||||
subscriber.putCompletion()
|
||||
return EmptyDisposable
|
||||
} else {
|
||||
let query = NSMetadataQuery()
|
||||
query.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope, NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope]
|
||||
query.predicate = NSPredicate(format: "%K.lastPathComponent == %@", NSMetadataItemFSNameKey, url.lastPathComponent)
|
||||
query.valueListAttributes = [NSMetadataItemFSSizeKey]
|
||||
final class WrappedQuery {
|
||||
let query = NSMetadataQuery()
|
||||
}
|
||||
|
||||
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
|
||||
query.disableUpdates()
|
||||
query.query.disableUpdates()
|
||||
|
||||
guard let metadataItem = query.results.first as? NSMetadataItem else {
|
||||
query.enableUpdates()
|
||||
guard let metadataItem = query.query.results.first as? NSMetadataItem else {
|
||||
query.query.enableUpdates()
|
||||
return
|
||||
}
|
||||
|
||||
query.stop()
|
||||
query.query.stop()
|
||||
|
||||
guard let fileSize = metadataItem.value(forAttribute: NSMetadataItemFSSizeKey) as? NSNumber, fileSize != 0 else {
|
||||
subscriber.putNext(nil)
|
||||
@ -157,11 +161,11 @@ public func iCloudFileDescription(_ url: URL) -> Signal<ICloudFileDescription?,
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
|
||||
query.start()
|
||||
query.query.start()
|
||||
|
||||
return ActionDisposable {
|
||||
Queue.mainQueue().async {
|
||||
query.stop()
|
||||
query.query.stop()
|
||||
NotificationCenter.default.removeObserver(observer)
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include <AssertMacros.h>
|
||||
|
||||
#import <sys/types.h>
|
||||
|
||||
#pragma mark * PingFoundation
|
||||
|
||||
@protocol PingFoundationDelegate;
|
||||
@ -59,7 +61,7 @@ typedef NS_ENUM(NSInteger, PingFoundationAddressStyle) {
|
||||
/*! 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.
|
||||
* \details When you create an instance of this object it generates a random identifier
|
||||
|
@ -159,10 +159,6 @@ extension _AdaptedPostboxEncoder.UnkeyedContainer: UnkeyedEncodingContainer {
|
||||
func encode(_ value: String) throws {
|
||||
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 {
|
||||
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 {
|
||||
func makeData() -> Data {
|
||||
preconditionFailure()
|
||||
|
@ -2500,7 +2500,7 @@ public func channelStatsController(context: AccountContext, updatedPresentationD
|
||||
}))
|
||||
}
|
||||
var tooltipScreen: UndoOverlayController?
|
||||
var timer: Foundation.Timer?
|
||||
nonisolated(unsafe) var timer: Foundation.Timer?
|
||||
showTimeoutTooltipImpl = { cooldownUntilTimestamp in
|
||||
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)
|
||||
instruction.layerInstructions = [layerInstruction]
|
||||
|
||||
guard let export = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality) else {
|
||||
guard let exportValue = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetHighestQuality) else {
|
||||
completion(nil)
|
||||
return
|
||||
}
|
||||
nonisolated(unsafe) let export = exportValue
|
||||
|
||||
let videoName = UUID().uuidString
|
||||
let exportURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoName).appendingPathExtension("mp4")
|
||||
|
@ -1808,14 +1808,19 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
self.isActiveValue = false
|
||||
self.isActivePromise.set(false)
|
||||
|
||||
var taskId: UIBackgroundTaskIdentifier?
|
||||
taskId = application.beginBackgroundTask(withName: "lock", expirationHandler: {
|
||||
if let taskId = taskId {
|
||||
final class TaskIdHolder {
|
||||
var taskId: UIBackgroundTaskIdentifier?
|
||||
}
|
||||
|
||||
let taskIdHolder = TaskIdHolder()
|
||||
|
||||
taskIdHolder.taskId = application.beginBackgroundTask(withName: "lock", expirationHandler: {
|
||||
if let taskId = taskIdHolder.taskId {
|
||||
UIApplication.shared.endBackgroundTask(taskId)
|
||||
}
|
||||
})
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 5.0, execute: {
|
||||
if let taskId = taskId {
|
||||
if let taskId = taskIdHolder.taskId {
|
||||
UIApplication.shared.endBackgroundTask(taskId)
|
||||
}
|
||||
})
|
||||
|
@ -2,7 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import WebKit
|
||||
@preconcurrency import WebKit
|
||||
import TelegramCore
|
||||
import UniversalMediaPlayer
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import WebKit
|
||||
@preconcurrency import WebKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import Postbox
|
||||
|
Loading…
x
Reference in New Issue
Block a user