Upgrade to iOS 12

This commit is contained in:
Ali 2023-09-23 12:38:29 +04:00
parent e72ea579e8
commit b7fbcbf118
26 changed files with 117 additions and 70 deletions

View File

@ -127,7 +127,7 @@ genrule(
], ],
) )
minimum_os_version = "11.0" minimum_os_version = "12.0"
minimum_watchos_version="9.0" minimum_watchos_version="9.0"
empty_languages = [ empty_languages = [

View File

@ -549,9 +549,12 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__);
} }
// CAEAGLLayer // CAEAGLLayer
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if([[view.layer class] isSubclassOfClass:[CAEAGLLayer class]]){ if([[view.layer class] isSubclassOfClass:[CAEAGLLayer class]]){
_flags.canClearContentsOfLayer = NO; _flags.canClearContentsOfLayer = NO;
} }
#pragma clang diagnostic pop
} }
return view; return view;

View File

@ -31,12 +31,6 @@
NS_AVAILABLE_IOS(10) NS_AVAILABLE_IOS(10)
NS_INLINE void ASConfigureExtendedRange(UIGraphicsImageRendererFormat *format) NS_INLINE void ASConfigureExtendedRange(UIGraphicsImageRendererFormat *format)
{ {
if (AS_AVAILABLE_IOS_TVOS(12, 12)) {
// nop. We always use automatic range on iOS >= 12.
} else {
// Currently we never do wide color. One day we could pipe this information through from the ASImageNode if it was worth it.
format.prefersExtendedRange = NO;
}
} }
UIImage *ASGraphicsCreateImageWithOptions(CGSize size, BOOL opaque, CGFloat scale, UIImage *sourceImage, UIImage *ASGraphicsCreateImageWithOptions(CGSize size, BOOL opaque, CGFloat scale, UIImage *sourceImage,

View File

@ -1302,7 +1302,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail
public static func defaultCountryCode() -> Int32 { public static func defaultCountryCode() -> Int32 {
var countryId: String? = nil var countryId: String? = nil
let networkInfo = CTTelephonyNetworkInfo() let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.subscriberCellularProvider { if let carrier = networkInfo.serviceSubscriberCellularProviders?.values.first {
countryId = carrier.isoCountryCode countryId = carrier.isoCountryCode
} }

View File

@ -279,8 +279,6 @@ class ChatDocumentGalleryItemNode: ZoomableContentGalleryItemNode, WKNavigationD
webView.loadFileURL(URL(fileURLWithPath: data.path), allowingReadAccessTo: URL(fileURLWithPath: data.path)) webView.loadFileURL(URL(fileURLWithPath: data.path), allowingReadAccessTo: URL(fileURLWithPath: data.path))
} }
} }
} else if let webView = strongSelf.webView as? UIWebView {
webView.loadRequest(URLRequest(url: URL(fileURLWithPath: data.path)))
} }
} }
} }

View File

@ -70,10 +70,8 @@ public final class InAppPurchaseManager: NSObject {
public var isSubscription: Bool { public var isSubscription: Bool {
if #available(iOS 12.0, *) { if #available(iOS 12.0, *) {
return self.skProduct.subscriptionGroupIdentifier != nil return self.skProduct.subscriptionGroupIdentifier != nil
} else if #available(iOS 11.2, *) {
return self.skProduct.subscriptionPeriod != nil
} else { } else {
return self.id.hasSuffix(".monthly") || self.id.hasSuffix(".annual") || self.id.hasSuffix(".semiannual") return self.skProduct.subscriptionPeriod != nil
} }
} }

View File

@ -767,9 +767,11 @@ public func legacyAssetPickerEnqueueMessages(context: AccountContext, account: A
finalDuration = adjustments.trimEndValue - adjustments.trimStartValue finalDuration = adjustments.trimEndValue - adjustments.trimStartValue
} }
let adjustmentsData = MemoryBuffer(data: NSKeyedArchiver.archivedData(withRootObject: adjustments.dictionary()!)) if let dict = adjustments.dictionary(), let data = try? NSKeyedArchiver.archivedData(withRootObject: dict, requiringSecureCoding: false) {
let digest = MemoryBuffer(data: adjustmentsData.md5Digest()) let adjustmentsData = MemoryBuffer(data: data)
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false) let digest = MemoryBuffer(data: adjustmentsData.md5Digest())
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false)
}
} }
let resource: TelegramMediaResource let resource: TelegramMediaResource

View File

@ -5,7 +5,8 @@
@protocol MTKeychain <NSObject> @protocol MTKeychain <NSObject>
- (void)setObject:(id)object forKey:(NSString *)aKey group:(NSString *)group; - (void)setObject:(id)object forKey:(NSString *)aKey group:(NSString *)group;
- (id)objectForKey:(NSString *)aKey group:(NSString *)group; - (NSDictionary *)dictionaryForKey:(NSString *)aKey group:(NSString *)group;
- (NSNumber *)numberForKey:(NSString *)aKey group:(NSString *)group;
- (void)removeObjectForKey:(NSString *)aKey group:(NSString *)group; - (void)removeObjectForKey:(NSString *)aKey group:(NSString *)group;
@end @end

View File

@ -42,8 +42,22 @@
_dict[[self itemKeyForGroup:group key:aKey]] = object; _dict[[self itemKeyForGroup:group key:aKey]] = object;
} }
- (id)objectForKey:(NSString *)aKey group:(NSString *)group { - (NSDictionary *)dictionaryForKey:(NSString *)aKey group:(NSString *)group {
return _dict[[self itemKeyForGroup:group key:aKey]]; id result = _dict[[self itemKeyForGroup:group key:aKey]];
if ([result isKindOfClass:[NSDictionary class]]) {
return result;
} else {
return nil;
}
}
- (NSNumber *)numberForKey:(NSString *)aKey group:(NSString *)group {
id result = _dict[[self itemKeyForGroup:group key:aKey]];
if ([result isKindOfClass:[NSNumber class]]) {
return result;
} else {
return nil;
}
} }
- (void)removeObjectForKey:(NSString *)aKey group:(NSString *)group { - (void)removeObjectForKey:(NSString *)aKey group:(NSString *)group {

View File

@ -291,18 +291,25 @@ static int32_t fixedTimeDifferenceValue = 0;
} }
} }
static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key, id<MTKeychain> _Nonnull fromKeychain, id<MTKeychain> _Nonnull toKeychain) { static void copyKeychainNumberKey(NSString * _Nonnull group, NSString * _Nonnull key, id<MTKeychain> _Nonnull fromKeychain, id<MTKeychain> _Nonnull toKeychain) {
id value = [fromKeychain objectForKey:key group:group]; id value = [fromKeychain numberForKey:key group:group];
if (value) {
[toKeychain setObject:value forKey:key group:group];
}
}
static void copyKeychainDictionaryKey(NSString * _Nonnull group, NSString * _Nonnull key, id<MTKeychain> _Nonnull fromKeychain, id<MTKeychain> _Nonnull toKeychain) {
id value = [fromKeychain dictionaryForKey:key group:group];
if (value) { if (value) {
[toKeychain setObject:value forKey:key group:group]; [toKeychain setObject:value forKey:key group:group];
} }
} }
+ (void)copyAuthInfoFrom:(id<MTKeychain> _Nonnull)keychain toTempKeychain:(id<MTKeychain> _Nonnull)tempKeychain { + (void)copyAuthInfoFrom:(id<MTKeychain> _Nonnull)keychain toTempKeychain:(id<MTKeychain> _Nonnull)tempKeychain {
copyKeychainKey(@"temp", @"globalTimeDifference", keychain, tempKeychain); copyKeychainNumberKey(@"temp", @"globalTimeDifference", keychain, tempKeychain);
copyKeychainKey(@"persistent", @"datacenterAddressSetById", keychain, tempKeychain); copyKeychainDictionaryKey(@"persistent", @"datacenterAddressSetById", keychain, tempKeychain);
copyKeychainKey(@"persistent", @"datacenterAuthInfoById", keychain, tempKeychain); copyKeychainDictionaryKey(@"persistent", @"datacenterAuthInfoById", keychain, tempKeychain);
copyKeychainKey(@"ephemeral", @"datacenterPublicKeysById", keychain, tempKeychain); copyKeychainDictionaryKey(@"ephemeral", @"datacenterPublicKeysById", keychain, tempKeychain);
//copyKeychainKey(@"persistent", @"authTokenById", keychain, tempKeychain); //copyKeychainKey(@"persistent", @"authTokenById", keychain, tempKeychain);
} }
@ -375,11 +382,11 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
if (_keychain != nil) if (_keychain != nil)
{ {
NSNumber *nGlobalTimeDifference = [keychain objectForKey:@"globalTimeDifference" group:@"temp"]; NSNumber *nGlobalTimeDifference = [keychain numberForKey:@"globalTimeDifference" group:@"temp"];
if (nGlobalTimeDifference != nil) if (nGlobalTimeDifference != nil)
_globalTimeDifference = [nGlobalTimeDifference doubleValue]; _globalTimeDifference = [nGlobalTimeDifference doubleValue];
NSDictionary *datacenterAddressSetById = [keychain objectForKey:@"datacenterAddressSetById" group:@"persistent"]; NSDictionary *datacenterAddressSetById = [keychain dictionaryForKey:@"datacenterAddressSetById" group:@"persistent"];
if (datacenterAddressSetById != nil) { if (datacenterAddressSetById != nil) {
_datacenterAddressSetById = [[NSMutableDictionary alloc] initWithDictionary:datacenterAddressSetById]; _datacenterAddressSetById = [[NSMutableDictionary alloc] initWithDictionary:datacenterAddressSetById];
if (MTLogEnabled()) { if (MTLogEnabled()) {
@ -387,7 +394,7 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
} }
} }
NSDictionary *datacenterManuallySelectedSchemeById = [keychain objectForKey:@"datacenterManuallySelectedSchemeById_v1" group:@"persistent"]; NSDictionary *datacenterManuallySelectedSchemeById = [keychain dictionaryForKey:@"datacenterManuallySelectedSchemeById_v1" group:@"persistent"];
if (datacenterManuallySelectedSchemeById != nil) { if (datacenterManuallySelectedSchemeById != nil) {
_datacenterManuallySelectedSchemeById = [[NSMutableDictionary alloc] initWithDictionary:datacenterManuallySelectedSchemeById]; _datacenterManuallySelectedSchemeById = [[NSMutableDictionary alloc] initWithDictionary:datacenterManuallySelectedSchemeById];
if (MTLogEnabled()) { if (MTLogEnabled()) {
@ -399,7 +406,7 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
_datacenterAddressSetById[nDatacenterId] = [[MTDatacenterAddressSet alloc] initWithAddressList:@[address]]; _datacenterAddressSetById[nDatacenterId] = [[MTDatacenterAddressSet alloc] initWithAddressList:@[address]];
}]; }];
NSDictionary *datacenterAuthInfoById = [keychain objectForKey:@"datacenterAuthInfoById" group:@"persistent"]; NSDictionary *datacenterAuthInfoById = [keychain dictionaryForKey:@"datacenterAuthInfoById" group:@"persistent"];
if (datacenterAuthInfoById != nil) { if (datacenterAuthInfoById != nil) {
_datacenterAuthInfoById = [[NSMutableDictionary alloc] initWithDictionary:datacenterAuthInfoById]; _datacenterAuthInfoById = [[NSMutableDictionary alloc] initWithDictionary:datacenterAuthInfoById];
@ -417,12 +424,12 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
} }
} }
NSDictionary *datacenterPublicKeysById = [keychain objectForKey:@"datacenterPublicKeysById" group:@"ephemeral"]; NSDictionary *datacenterPublicKeysById = [keychain dictionaryForKey:@"datacenterPublicKeysById" group:@"ephemeral"];
if (datacenterPublicKeysById != nil) { if (datacenterPublicKeysById != nil) {
_datacenterPublicKeysById = [[NSMutableDictionary alloc] initWithDictionary:datacenterPublicKeysById]; _datacenterPublicKeysById = [[NSMutableDictionary alloc] initWithDictionary:datacenterPublicKeysById];
} }
NSDictionary *transportSchemeStats = [keychain objectForKey:@"transportSchemeStats_v1" group:@"temp"]; NSDictionary *transportSchemeStats = [keychain dictionaryForKey:@"transportSchemeStats_v1" group:@"temp"];
if (transportSchemeStats != nil) { if (transportSchemeStats != nil) {
[_transportSchemeStats removeAllObjects]; [_transportSchemeStats removeAllObjects];
[transportSchemeStats enumerateKeysAndObjectsUsingBlock:^(NSNumber *nDatacenterId, NSDictionary<MTDatacenterAddress *, MTTransportSchemeStats *> *values, __unused BOOL *stop) { [transportSchemeStats enumerateKeysAndObjectsUsingBlock:^(NSNumber *nDatacenterId, NSDictionary<MTDatacenterAddress *, MTTransportSchemeStats *> *values, __unused BOOL *stop) {
@ -433,11 +440,11 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
} }
} }
NSDictionary *authTokenById = [keychain objectForKey:@"authTokenById" group:@"persistent"]; NSDictionary *authTokenById = [keychain dictionaryForKey:@"authTokenById" group:@"persistent"];
if (authTokenById != nil) if (authTokenById != nil)
_authTokenById = [[NSMutableDictionary alloc] initWithDictionary:authTokenById]; _authTokenById = [[NSMutableDictionary alloc] initWithDictionary:authTokenById];
NSDictionary *cleanupSessionIdsByAuthKeyId = [keychain objectForKey:@"cleanupSessionIdsByAuthKeyId" group:@"cleanup"]; NSDictionary *cleanupSessionIdsByAuthKeyId = [keychain dictionaryForKey:@"cleanupSessionIdsByAuthKeyId" group:@"cleanup"];
if (cleanupSessionIdsByAuthKeyId != nil) if (cleanupSessionIdsByAuthKeyId != nil)
_cleanupSessionIdsByAuthKeyId = [[NSMutableDictionary alloc] initWithDictionary:cleanupSessionIdsByAuthKeyId]; _cleanupSessionIdsByAuthKeyId = [[NSMutableDictionary alloc] initWithDictionary:cleanupSessionIdsByAuthKeyId];

View File

@ -541,7 +541,7 @@ bool MTCheckIsSafePrime(id<EncryptionProvider> provider, NSData *numberBytes, id
{ {
NSString *primeKey = [[NSString alloc] initWithFormat:@"isPrimeSafe_%@", hexStringFromData(numberBytes)]; NSString *primeKey = [[NSString alloc] initWithFormat:@"isPrimeSafe_%@", hexStringFromData(numberBytes)];
NSNumber *nCachedResult = [keychain objectForKey:primeKey group:@"primes"]; NSNumber *nCachedResult = [keychain numberForKey:primeKey group:@"primes"];
if (nCachedResult != nil) { if (nCachedResult != nil) {
return [nCachedResult boolValue]; return [nCachedResult boolValue];
} }
@ -652,7 +652,7 @@ bool MTCheckIsSafeGAOrB(id<EncryptionProvider> provider, NSData *gAOrB, NSData *
bool MTCheckMod(id<EncryptionProvider> provider, NSData *numberBytes, unsigned int g, id<MTKeychain> keychain) bool MTCheckMod(id<EncryptionProvider> provider, NSData *numberBytes, unsigned int g, id<MTKeychain> keychain)
{ {
NSString *modKey = [[NSString alloc] initWithFormat:@"isPrimeModSafe_%@_%d", hexStringFromData(numberBytes), g]; NSString *modKey = [[NSString alloc] initWithFormat:@"isPrimeModSafe_%@_%d", hexStringFromData(numberBytes), g];
NSNumber *nCachedResult = [keychain objectForKey:modKey group:@"primes"]; NSNumber *nCachedResult = [keychain numberForKey:modKey group:@"primes"];
if (nCachedResult != nil) { if (nCachedResult != nil) {
return [nCachedResult boolValue]; return [nCachedResult boolValue];
} }

View File

@ -383,8 +383,7 @@ extension SecureIdPlaintextFormInnerState {
switch type { switch type {
case .phone: case .phone:
var countryId: String? = nil var countryId: String? = nil
let networkInfo = CTTelephonyNetworkInfo() if let carrier = CTTelephonyNetworkInfo().serviceSubscriberCellularProviders?.values.first {
if let carrier = networkInfo.subscriberCellularProvider {
countryId = carrier.isoCountryCode countryId = carrier.isoCountryCode
} }

View File

@ -7,8 +7,14 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#define GLES_SILENCE_DEPRECATION
#import <GLKit/GLKit.h> #import <GLKit/GLKit.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@class SSignal; @class SSignal;
@interface TGAvailableLocalization : NSObject <NSCoding> @interface TGAvailableLocalization : NSObject <NSCoding>
@ -74,3 +80,5 @@
- (void)stopTimer; - (void)stopTimer;
@end @end
#pragma clang diagnostic pop

View File

@ -601,6 +601,8 @@ typedef enum {
[[NSNotificationCenter defaultCenter] removeObserver:_didEnterBackgroundObserver]; [[NSNotificationCenter defaultCenter] removeObserver:_didEnterBackgroundObserver];
[[NSNotificationCenter defaultCenter] removeObserver:_willEnterBackgroundObserver]; [[NSNotificationCenter defaultCenter] removeObserver:_willEnterBackgroundObserver];
[_localizationsDisposable dispose];
[self freeGL]; [self freeGL];
} }

View File

@ -213,7 +213,7 @@ final class ChangePhoneNumberControllerNode: ASDisplayNode {
var countryId: String? = nil var countryId: String? = nil
let networkInfo = CTTelephonyNetworkInfo() let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.subscriberCellularProvider { if let carrier = networkInfo.serviceSubscriberCellularProviders?.values.first {
countryId = carrier.isoCountryCode countryId = carrier.isoCountryCode
} }

View File

@ -236,7 +236,7 @@ class DeleteAccountPhoneItemNode: ListViewItemNode, ItemListItemNode {
var countryId: String? = nil var countryId: String? = nil
let networkInfo = CTTelephonyNetworkInfo() let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.subscriberCellularProvider { if let carrier = networkInfo.serviceSubscriberCellularProviders?.values.first {
countryId = carrier.isoCountryCode countryId = carrier.isoCountryCode
} }

View File

@ -138,9 +138,11 @@ private func preparedShareItem(postbox: Postbox, network: Network, to peerId: Pe
finalDuration = adjustments.trimEndValue - adjustments.trimStartValue finalDuration = adjustments.trimEndValue - adjustments.trimStartValue
} }
let adjustmentsData = MemoryBuffer(data: NSKeyedArchiver.archivedData(withRootObject: adjustments.dictionary()!)) if let dict = adjustments.dictionary(), let data = try? NSKeyedArchiver.archivedData(withRootObject: dict, requiringSecureCoding: false) {
let digest = MemoryBuffer(data: adjustmentsData.md5Digest()) let adjustmentsData = MemoryBuffer(data: data)
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false) let digest = MemoryBuffer(data: adjustmentsData.md5Digest())
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false)
}
} }
let estimatedSize = TGMediaVideoConverter.estimatedSize(for: preset, duration: finalDuration, hasAudio: true) let estimatedSize = TGMediaVideoConverter.estimatedSize(for: preset, duration: finalDuration, hasAudio: true)

View File

@ -224,9 +224,10 @@ public func accountWithId(accountManager: AccountManager<TelegramAccountManagerT
)!, forKey: id as NSNumber) )!, forKey: id as NSNumber)
} }
let data = NSKeyedArchiver.archivedData(withRootObject: dict)
transaction.setState(backupState) transaction.setState(backupState)
transaction.setKeychainEntry(data, forKey: "persistent:datacenterAuthInfoById") if let data = try? NSKeyedArchiver.archivedData(withRootObject: dict, requiringSecureCoding: false) {
transaction.setKeychainEntry(data, forKey: "persistent:datacenterAuthInfoById")
}
} }
let appConfig = transaction.getPreferencesEntry(key: PreferencesKeys.appConfiguration)?.get(AppConfiguration.self) ?? .defaultValue let appConfig = transaction.getPreferencesEntry(key: PreferencesKeys.appConfiguration)?.get(AppConfiguration.self) ?? .defaultValue
@ -837,7 +838,7 @@ public func accountBackupData(postbox: Postbox) -> Signal<AccountBackupData?, No
guard let authInfoData = transaction.keychainEntryForKey("persistent:datacenterAuthInfoById") else { guard let authInfoData = transaction.keychainEntryForKey("persistent:datacenterAuthInfoById") else {
return nil return nil
} }
guard let authInfo = NSKeyedUnarchiver.unarchiveObject(with: authInfoData) as? NSDictionary else { guard let authInfo = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSDictionary.self, from: authInfoData) else {
return nil return nil
} }
guard let datacenterAuthInfo = authInfo.object(forKey: state.masterDatacenterId as NSNumber) as? MTDatacenterAuthInfo else { guard let datacenterAuthInfo = authInfo.object(forKey: state.masterDatacenterId as NSNumber) as? MTDatacenterAuthInfo else {

View File

@ -1126,19 +1126,36 @@ class Keychain: NSObject, MTKeychain {
return return
} }
MTContext.perform(objCTry: { MTContext.perform(objCTry: {
let data = NSKeyedArchiver.archivedData(withRootObject: object) if let data = try? NSKeyedArchiver.archivedData(withRootObject: object, requiringSecureCoding: false) {
self.set(group + ":" + aKey, data) self.set(group + ":" + aKey, data)
}
}) })
} }
func object(forKey aKey: String!, group: String!) -> Any! { func dictionary(forKey aKey: String!, group: String!) -> [AnyHashable : Any]? {
guard let aKey = aKey, let group = group else { guard let aKey = aKey, let group = group else {
return nil return nil
} }
if let data = self.get(group + ":" + aKey) { if let data = self.get(group + ":" + aKey) {
var result: Any? var result: NSDictionary?
MTContext.perform(objCTry: { MTContext.perform(objCTry: {
result = NSKeyedUnarchiver.unarchiveObject(with: data as Data) result = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSDictionary.self, from: data as Data)
})
if let result = result {
return result as? [AnyHashable : Any]
}
}
return nil
}
func number(forKey aKey: String!, group: String!) -> NSNumber? {
guard let aKey = aKey, let group = group else {
return nil
}
if let data = self.get(group + ":" + aKey) {
var result: NSNumber?
MTContext.perform(objCTry: {
result = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSNumber.self, from: data as Data)
}) })
return result return result
} }

View File

@ -82,15 +82,14 @@ private final class NetworkTypeManagerImpl {
self.updated = updated self.updated = updated
#if os(iOS) #if os(iOS)
let telephonyInfo = CTTelephonyNetworkInfo() let accessTechnology = CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology?.values.first ?? ""
let accessTechnology = telephonyInfo.currentRadioAccessTechnology ?? ""
self.currentCellularType = CellularNetworkType(accessTechnology: accessTechnology) self.currentCellularType = CellularNetworkType(accessTechnology: accessTechnology)
self.cellularTypeObserver = NotificationCenter.default.addObserver(forName: NSNotification.Name.CTRadioAccessTechnologyDidChange, object: nil, queue: nil, using: { [weak self] notification in self.cellularTypeObserver = NotificationCenter.default.addObserver(forName: NSNotification.Name.CTServiceRadioAccessTechnologyDidChange, object: nil, queue: nil, using: { [weak self] notification in
queue.async { queue.async {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
let accessTechnology = telephonyInfo.currentRadioAccessTechnology ?? "" let accessTechnology = CTTelephonyNetworkInfo().serviceCurrentRadioAccessTechnology?.values.first ?? ""
let cellularType = CellularNetworkType(accessTechnology: accessTechnology) let cellularType = CellularNetworkType(accessTechnology: accessTechnology)
if strongSelf.currentCellularType != cellularType { if strongSelf.currentCellularType != cellularType {
strongSelf.currentCellularType = cellularType strongSelf.currentCellularType = cellularType
@ -137,7 +136,7 @@ private final class NetworkTypeManagerImpl {
self.networkTypeDisposable?.dispose() self.networkTypeDisposable?.dispose()
#if os(iOS) #if os(iOS)
if let observer = self.cellularTypeObserver { if let observer = self.cellularTypeObserver {
NotificationCenter.default.removeObserver(observer, name: NSNotification.Name.CTRadioAccessTechnologyDidChange, object: nil) NotificationCenter.default.removeObserver(observer, name: NSNotification.Name.CTServiceRadioAccessTechnologyDidChange, object: nil)
} }
#endif #endif
} }

View File

@ -202,9 +202,11 @@ public func legacyInstantVideoController(theme: PresentationTheme, forStory: Boo
finalDuration = adjustments.trimEndValue - adjustments.trimStartValue finalDuration = adjustments.trimEndValue - adjustments.trimStartValue
} }
let adjustmentsData = MemoryBuffer(data: NSKeyedArchiver.archivedData(withRootObject: adjustments.dictionary()!)) if let dict = adjustments.dictionary(), let data = try? NSKeyedArchiver.archivedData(withRootObject: dict, requiringSecureCoding: false) {
let digest = MemoryBuffer(data: adjustmentsData.md5Digest()) let adjustmentsData = MemoryBuffer(data: data)
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false) let digest = MemoryBuffer(data: adjustmentsData.md5Digest())
resourceAdjustments = VideoMediaResourceAdjustments(data: adjustmentsData, digest: digest, isStory: false)
}
} }
if finalDuration.isZero || finalDuration.isNaN { if finalDuration.isZero || finalDuration.isNaN {

View File

@ -334,7 +334,7 @@ public func fetchVideoLibraryMediaResource(postbox: Postbox, resource: VideoLibr
if let values = try? JSONDecoder().decode(MediaEditorValues.self, from: adjustmentsValue.data.makeData()) { if let values = try? JSONDecoder().decode(MediaEditorValues.self, from: adjustmentsValue.data.makeData()) {
mediaEditorValues = values mediaEditorValues = values
} }
} else if let dict = NSKeyedUnarchiver.unarchiveObject(with: adjustmentsValue.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) { } else if let dict = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSDictionary.self, from: adjustmentsValue.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) {
if alwaysUseModernPipeline { if alwaysUseModernPipeline {
mediaEditorValues = MediaEditorValues(legacyAdjustments: legacyAdjustments, defaultPreset: qualityPreset) mediaEditorValues = MediaEditorValues(legacyAdjustments: legacyAdjustments, defaultPreset: qualityPreset)
} else { } else {
@ -500,7 +500,7 @@ public func fetchLocalFileVideoMediaResource(postbox: Postbox, resource: LocalFi
if let values = try? JSONDecoder().decode(MediaEditorValues.self, from: videoAdjustments.data.makeData()) { if let values = try? JSONDecoder().decode(MediaEditorValues.self, from: videoAdjustments.data.makeData()) {
mediaEditorValues = values mediaEditorValues = values
} }
} else if let dict = NSKeyedUnarchiver.unarchiveObject(with: videoAdjustments.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) { } else if let dict = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSDictionary.self, from: videoAdjustments.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) {
if alwaysUseModernPipeline && !isImage { if alwaysUseModernPipeline && !isImage {
mediaEditorValues = MediaEditorValues(legacyAdjustments: legacyAdjustments, defaultPreset: qualityPreset) mediaEditorValues = MediaEditorValues(legacyAdjustments: legacyAdjustments, defaultPreset: qualityPreset)
} else { } else {
@ -710,7 +710,7 @@ public func fetchVideoLibraryMediaResourceHash(resource: VideoLibraryMediaResour
adjustments = nil adjustments = nil
case let .compress(adjustmentsValue): case let .compress(adjustmentsValue):
if let adjustmentsValue = adjustmentsValue { if let adjustmentsValue = adjustmentsValue {
if let dict = NSKeyedUnarchiver.unarchiveObject(with: adjustmentsValue.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) { if let dict = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSDictionary.self, from: adjustmentsValue.data.makeData()) as? [AnyHashable : Any], let legacyAdjustments = TGVideoEditAdjustments(dictionary: dict) {
adjustments = legacyAdjustments adjustments = legacyAdjustments
} }
} }

View File

@ -134,8 +134,8 @@ public final class WatchCommunicationManager {
if fileManager.fileExists(atPath: presetsFileUrl.path) { if fileManager.fileExists(atPath: presetsFileUrl.path) {
try? fileManager.removeItem(atPath: presetsFileUrl.path) try? fileManager.removeItem(atPath: presetsFileUrl.path)
} }
let data = NSKeyedArchiver.archivedData(withRootObject: suggestions) let data = try? NSKeyedArchiver.archivedData(withRootObject: suggestions, requiringSecureCoding: false)
try? data.write(to: presetsFileUrl) try? data?.write(to: presetsFileUrl)
let _ = strongSelf.sendFile(url: presetsFileUrl, metadata: [TGBridgeIncomingFileIdentifierKey: "presets"]).start() let _ = strongSelf.sendFile(url: presetsFileUrl, metadata: [TGBridgeIncomingFileIdentifierKey: "presets"]).start()
})) }))

View File

@ -14,7 +14,7 @@ CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BE
if [ "$ARCH" = "arm64" ]; then if [ "$ARCH" = "arm64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneOS.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneOS.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build
@ -30,7 +30,7 @@ if [ "$ARCH" = "arm64" ]; then
elif [ "$ARCH" = "sim_arm64" ]; then elif [ "$ARCH" = "sim_arm64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk)
export CFLAGS="-Wall -arch arm64 --target=arm64-apple-ios11.0-simulator -miphonesimulator-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch arm64 --target=arm64-apple-ios12.0-simulator -miphonesimulator-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build
@ -46,7 +46,7 @@ elif [ "$ARCH" = "sim_arm64" ]; then
elif [ "$ARCH" = "x86_64" ]; then elif [ "$ARCH" = "x86_64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk)
export CFLAGS="-Wall -arch x86_64 -miphoneos-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch x86_64 -miphoneos-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build

View File

@ -14,7 +14,7 @@ COMMON_ARGS="-DWEBP_LINK_STATIC=1 -DWEBP_BUILD_CWEBP=0 -DWEBP_BUILD_DWEBP=0 -DWE
if [ "$ARCH" = "arm64" ]; then if [ "$ARCH" = "arm64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneOS.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneOS.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)
export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch arm64 -miphoneos-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build
@ -30,7 +30,7 @@ if [ "$ARCH" = "arm64" ]; then
elif [ "$ARCH" = "sim_arm64" ]; then elif [ "$ARCH" = "sim_arm64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk)
export CFLAGS="-Wall -arch arm64 --target=arm64-apple-ios11.0-simulator -miphonesimulator-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch arm64 --target=arm64-apple-ios12.0-simulator -miphonesimulator-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build
@ -46,7 +46,7 @@ elif [ "$ARCH" = "sim_arm64" ]; then
elif [ "$ARCH" = "x86_64" ]; then elif [ "$ARCH" = "x86_64" ]; then
IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform" IOS_PLATFORMDIR="$(xcode-select -p)/Platforms/iPhoneSimulator.platform"
IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk) IOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneSimulator*.sdk)
export CFLAGS="-Wall -arch x86_64 -miphoneos-version-min=11.0 -funwind-tables" export CFLAGS="-Wall -arch x86_64 -miphoneos-version-min=12.0 -funwind-tables"
cd "$BUILD_DIR" cd "$BUILD_DIR"
mkdir build mkdir build

View File

@ -1,5 +1,5 @@
{ {
"app": "10.2", "app": "10.2",
"bazel": "6.3.2", "bazel": "6.3.2",
"xcode": "14.3.1" "xcode": "14.5"
} }