Bump min iOS version to 11.0

This commit is contained in:
Ali 2022-09-17 01:08:04 +04:00
parent 11e11668e6
commit a14cd136c3
49 changed files with 378 additions and 329 deletions

View File

@ -115,6 +115,8 @@ genrule(
],
)
minimum_os_version = "11.0"
empty_languages = [
"ar",
"be",
@ -768,7 +770,7 @@ ios_framework(
":BuildNumberInfoPlist",
":VersionInfoPlist",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -808,7 +810,7 @@ ios_framework(
":BuildNumberInfoPlist",
":VersionInfoPlist",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -851,7 +853,7 @@ ios_framework(
frameworks = [
":SwiftSignalKitFramework",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -891,7 +893,7 @@ ios_framework(
":BuildNumberInfoPlist",
":VersionInfoPlist",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -936,7 +938,7 @@ ios_framework(
":SwiftSignalKitFramework",
":PostboxFramework",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -976,7 +978,7 @@ ios_framework(
":BuildNumberInfoPlist",
":VersionInfoPlist",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -1063,7 +1065,7 @@ ios_framework(
":SwiftSignalKitFramework",
":AsyncDisplayKitFramework",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -1111,7 +1113,7 @@ ios_framework(
":AsyncDisplayKitFramework",
":DisplayFramework",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
extension_safe = True,
ipa_post_processor = strip_framework,
deps = [
@ -1198,7 +1200,7 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Share.mobileprovision",
@ -1269,7 +1271,7 @@ swift_library(
],
)
genrule(
'''genrule(
name = "SetMinOsVersionNotificationContentExtension",
cmd_bash =
"""
@ -1286,7 +1288,7 @@ genrule(
visibility = [
"//visibility:public",
]
)
)'''
ios_extension(
name = "NotificationContentExtension",
@ -1303,8 +1305,8 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
ipa_post_processor = ":SetMinOsVersionNotificationContentExtension",
minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions
#ipa_post_processor = ":SetMinOsVersionNotificationContentExtension",
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:NotificationContent.mobileprovision",
@ -1407,7 +1409,7 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions
ipa_post_processor = ":SetMinOsVersionWidgetExtension",
#provides_main = True,
provisioning_profile = select({
@ -1506,7 +1508,7 @@ swift_library(
],
)
genrule(
'''genrule(
name = "SetMinOsVersionIntentsExtension",
cmd_bash =
"""
@ -1523,7 +1525,7 @@ genrule(
visibility = [
"//visibility:public",
]
)
)'''
ios_extension(
name = "IntentsExtension",
@ -1540,8 +1542,8 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
ipa_post_processor = ":SetMinOsVersionIntentsExtension",
minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions
#ipa_post_processor = ":SetMinOsVersionIntentsExtension",
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Intents.mobileprovision",
@ -1600,7 +1602,7 @@ swift_library(
],
)
genrule(
'''genrule(
name = "SetMinOsVersionBroadcastUploadExtension",
cmd_bash =
"""
@ -1617,7 +1619,7 @@ genrule(
visibility = [
"//visibility:public",
]
)
)'''
ios_extension(
name = "BroadcastUploadExtension",
@ -1634,8 +1636,8 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
ipa_post_processor = ":SetMinOsVersionBroadcastUploadExtension",
minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions
#ipa_post_processor = ":SetMinOsVersionBroadcastUploadExtension",
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:BroadcastUpload.mobileprovision",
@ -1679,7 +1681,7 @@ plist_fragment(
)
)
genrule(
'''genrule(
name = "SetMinOsVersionNotificationServiceExtension",
cmd_bash =
"""
@ -1696,7 +1698,7 @@ genrule(
visibility = [
"//visibility:public",
]
)
)'''
ios_extension(
name = "NotificationServiceExtension",
@ -1713,8 +1715,8 @@ ios_extension(
":BuildNumberInfoPlist",
":AppNameInfoPlist",
],
minimum_os_version = "9.0", # maintain the same minimum OS version across extensions
ipa_post_processor = ":SetMinOsVersionNotificationServiceExtension",
minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions
#ipa_post_processor = ":SetMinOsVersionNotificationServiceExtension",
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:NotificationService.mobileprovision",
@ -1912,7 +1914,7 @@ ios_application(
telegram_bundle_id = telegram_bundle_id,
),
families = ["iphone", "ipad"],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",
@ -1974,7 +1976,7 @@ ios_application(
telegram_bundle_id = telegram_bundle_id,
),
families = ["iphone", "ipad"],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",
@ -1997,7 +1999,7 @@ ios_application(
telegram_bundle_id = telegram_bundle_id,
),
families = ["iphone", "ipad"],
minimum_os_version = "9.0",
minimum_os_version = minimum_os_version,
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",

View File

@ -478,8 +478,28 @@ public extension DeviceContactExtendedData {
}
}
extension DeviceContactAddressData {
public var dictionary: [String: String] {
public extension DeviceContactAddressData {
var asPostalAddress: CNPostalAddress {
let address = CNMutablePostalAddress()
if !self.street1.isEmpty {
address.street = self.street1
}
if !self.city.isEmpty {
address.city = self.city
}
if !self.state.isEmpty {
address.state = self.state
}
if !self.country.isEmpty {
address.country = self.country
}
if !self.postcode.isEmpty {
address.postalCode = self.postcode
}
return address
}
var dictionary: [String: String] {
var dictionary: [String: String] = [:]
if !self.street1.isEmpty {
dictionary["Street"] = self.street1
@ -499,7 +519,7 @@ extension DeviceContactAddressData {
return dictionary
}
public var string: String {
var string: String {
var array: [String] = []
if !self.street1.isEmpty {
array.append(self.street1)
@ -519,7 +539,7 @@ extension DeviceContactAddressData {
return array.joined(separator: " ")
}
public var displayString: String {
var displayString: String {
var array: [String] = []
if !self.street1.isEmpty {
array.append(self.street1)

View File

@ -17,7 +17,7 @@ final class CameraDevice {
func configure(for session: AVCaptureSession, position: Camera.Position) {
self.position = position
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
self.videoDevice = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDuoCamera, .builtInWideAngleCamera, .builtInTelephotoCamera], mediaType: .video, position: position).devices.first
self.videoDevice = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera, .builtInWideAngleCamera, .builtInTelephotoCamera], mediaType: .video, position: position).devices.first
} else {
self.videoDevice = AVCaptureDevice.devices(for: .video).filter { $0.position == position }.first
}
@ -61,7 +61,7 @@ final class CameraDevice {
}
}
var isFlashActive: Signal<Bool, NoError> {
/*var isFlashActive: Signal<Bool, NoError> {
return self.videoDevicePromise.get()
|> mapToSignal { device -> Signal<Bool, NoError> in
return Signal { subscriber in
@ -75,7 +75,7 @@ final class CameraDevice {
}
|> distinctUntilChanged
}
}
}*/
var isFlashAvailable: Signal<Bool, NoError> {
return self.videoDevicePromise.get()

View File

@ -375,7 +375,7 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
}
}
self.navigationBar?.item = self.navigationItem
self.automaticallyAdjustsScrollViewInsets = false
//self.automaticallyAdjustsScrollViewInsets = false
self.scrollToTopWithTabBar = { [weak self] in
self?.scrollToTop?()

View File

@ -65,8 +65,6 @@ final class GameControllerNode: ViewControllerTracingNode {
configuration.allowsInlineMediaPlayback = true
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
configuration.mediaTypesRequiringUserActionForPlayback = []
} else if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
configuration.requiresUserActionForMediaPlayback = false
} else {
configuration.mediaPlaybackRequiresUserAction = false
}

View File

@ -1,4 +1,5 @@
import Foundation
import Contacts
import CoreLocation
import SwiftSignalKit
@ -15,10 +16,10 @@ public func geocodeLocation(address: String) -> Signal<[CLPlacemark]?, NoError>
}
}
public func geocodeLocation(dictionary: [String: String]) -> Signal<(Double, Double)?, NoError> {
public func geocodeLocation(address: CNPostalAddress) -> Signal<(Double, Double)?, NoError> {
return Signal { subscriber in
let geocoder = CLGeocoder()
geocoder.geocodeAddressDictionary(dictionary, completionHandler: { placemarks, _ in
geocoder.geocodePostalAddress(address, completionHandler: { placemarks, _ in
if let location = placemarks?.first?.location {
subscriber.putNext((location.coordinate.latitude, location.coordinate.longitude))
} else {

View File

@ -8,7 +8,10 @@
@interface PGCameraCaptureSession : AVCaptureSession
@property (nonatomic, readonly) AVCaptureDevice *videoDevice;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (nonatomic, readonly) AVCaptureStillImageOutput *imageOutput;
#pragma clang diagnostic pop
@property (nonatomic, readonly) AVCaptureVideoDataOutput *videoOutput;
@property (nonatomic, readonly) AVCaptureAudioDataOutput *audioOutput;
@property (nonatomic, readonly) AVCaptureMetadataOutput *metadataOutput;

View File

@ -6,7 +6,7 @@
#import "ASActor.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#include <vector>
#include <unordered_map>
@ -17,8 +17,8 @@ static dispatch_queue_t mainGraphQueue = nil;
static dispatch_queue_t globalGraphQueue = nil;
static dispatch_queue_t highPriorityGraphQueue = nil;
static volatile OSSpinLock removeWatcherRequestsLock = OS_SPINLOCK_INIT;
static volatile OSSpinLock removeWatcherFromPathRequestsLock = OS_SPINLOCK_INIT;
static os_unfair_lock removeWatcherRequestsLock = OS_UNFAIR_LOCK_INIT;
static os_unfair_lock removeWatcherFromPathRequestsLock = OS_UNFAIR_LOCK_INIT;
@interface ActionStage ()
{
@ -790,11 +790,11 @@ ActionStage *ActionStageInstance()
}
bool alreadyExecuting = false;
OSSpinLockLock(&removeWatcherRequestsLock);
os_unfair_lock_lock(&removeWatcherRequestsLock);
if (!_removeWatcherRequests.empty())
alreadyExecuting = true;
_removeWatcherRequests.push_back(watcherGraphHandle);
OSSpinLockUnlock(&removeWatcherRequestsLock);
os_unfair_lock_unlock(&removeWatcherRequestsLock);
if (alreadyExecuting && ![self isCurrentQueueStageQueue])
return;
@ -803,10 +803,10 @@ ActionStage *ActionStageInstance()
{
std::vector<ASHandle *> removeWatchers;
OSSpinLockLock(&removeWatcherRequestsLock);
os_unfair_lock_lock(&removeWatcherRequestsLock);
removeWatchers.insert(removeWatchers.begin(), _removeWatcherRequests.begin(), _removeWatcherRequests.end());
_removeWatcherRequests.clear();
OSSpinLockUnlock(&removeWatcherRequestsLock);
os_unfair_lock_unlock(&removeWatcherRequestsLock);
for (std::vector<ASHandle *>::iterator it = removeWatchers.begin(); it != removeWatchers.end(); it++)
{
@ -894,11 +894,11 @@ ActionStage *ActionStageInstance()
}
bool alreadyExecuting = false;
OSSpinLockLock(&removeWatcherFromPathRequestsLock);
os_unfair_lock_lock(&removeWatcherFromPathRequestsLock);
if (!_removeWatcherFromPathRequests.empty())
alreadyExecuting = true;
_removeWatcherFromPathRequests.push_back(std::pair<ASHandle *, NSString *>(watcherGraphHandle, watcherPath));
OSSpinLockUnlock(&removeWatcherFromPathRequestsLock);
os_unfair_lock_unlock(&removeWatcherFromPathRequestsLock);
if (alreadyExecuting && ![self isCurrentQueueStageQueue])
return;
@ -907,10 +907,10 @@ ActionStage *ActionStageInstance()
{
std::vector<std::pair<ASHandle *, NSString *> > removeWatchersFromPath;
OSSpinLockLock(&removeWatcherFromPathRequestsLock);
os_unfair_lock_lock(&removeWatcherFromPathRequestsLock);
removeWatchersFromPath.insert(removeWatchersFromPath.begin(), _removeWatcherFromPathRequests.begin(), _removeWatcherFromPathRequests.end());
_removeWatcherFromPathRequests.clear();
OSSpinLockUnlock(&removeWatcherFromPathRequestsLock);
os_unfair_lock_unlock(&removeWatcherFromPathRequestsLock);
if (removeWatchersFromPath.size() > 1)
{

View File

@ -21,9 +21,7 @@
#import "POPBasicAnimationInternal.h"
#import "POPDecayAnimation.h"
#if !TARGET_OS_IPHONE
#import <libkern/OSAtomic.h>
#endif
#import <os/lock.h>
using namespace std;
using namespace POP;
@ -97,7 +95,7 @@ static BOOL _disableBackgroundThread = YES;
CFTimeInterval _slowMotionLastTime;
CFTimeInterval _slowMotionAccumulator;
CFTimeInterval _beginTime;
OSSpinLock _lock;
os_unfair_lock _lock;
BOOL _disableDisplayLink;
}
@end
@ -263,7 +261,7 @@ static POPAnimation *deleteDictEntry(POPAnimator *self, id __unsafe_unretained o
POPAnimation *anim = nil;
// lock
OSSpinLockLock(&self->_lock);
os_unfair_lock_lock(&self->_lock);
NSMutableDictionary *keyAnimationsDict = (__bridge id)CFDictionaryGetValue(self->_dict, (__bridge void *)obj);
if (keyAnimationsDict) {
@ -282,7 +280,7 @@ static POPAnimation *deleteDictEntry(POPAnimator *self, id __unsafe_unretained o
}
// unlock
OSSpinLockUnlock(&self->_lock);
os_unfair_lock_unlock(&self->_lock);
return anim;
}
@ -299,7 +297,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
if (shouldRemove) {
// lock
OSSpinLockLock(&self->_lock);
os_unfair_lock_lock(&self->_lock);
// find item in list
// may have already been removed on animationDidStop:
@ -311,7 +309,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// unlock
OSSpinLockUnlock(&self->_lock);
os_unfair_lock_unlock(&self->_lock);
}
}
@ -352,7 +350,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
#endif
_dict = POPDictionaryCreateMutableWeakPointerToStrongObject(5);
_lock = OS_SPINLOCK_INIT;
_lock = OS_UNFAIR_LOCK_INIT;
return self;
}
@ -377,14 +375,14 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
[self _renderTime:(0 != _beginTime) ? _beginTime : time items:_pendingList];
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// clear list and observer
_pendingList.clear();
[self _clearPendingListObserver];
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)_clearPendingListObserver
@ -403,7 +401,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
static const CFIndex POPAnimationApplyRunLoopOrder = CATransactionCommitRunLoopOrder - 1;
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_pendingListObserver) {
__weak POPAnimator *weakSelf = self;
@ -418,7 +416,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)_renderTime:(CFTimeInterval)time items:(std::list<POPAnimatorItemRef>)items
@ -432,19 +430,19 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
[delegate animatorWillAnimate:self];
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// count active animations
const NSUInteger count = items.size();
if (0 == count) {
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
} else {
// copy list into vector
std::vector<POPAnimatorItemRef> vector{ std::begin(items), std::end(items) };
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (auto item : vector) {
[self _renderTime:time item:item];
@ -457,13 +455,13 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// update display link
updateDisplayLink(self);
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
// notify delegate and commit
[delegate animatorDidAnimate:self];
@ -541,13 +539,13 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
- (NSArray *)observers
{
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// get observers
NSArray *observers = 0 != _observers.count ? [_observers copy] : nil;
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return observers;
}
@ -563,7 +561,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// get key, animation dict associated with object
NSMutableDictionary *keyAnimationDict = (__bridge id)CFDictionaryGetValue(_dict, (__bridge void *)obj);
@ -577,7 +575,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
POPAnimation *existingAnim = keyAnimationDict[key];
if (existingAnim) {
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (existingAnim == anim) {
return;
@ -585,7 +583,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
[self removeAnimationForObject:obj key:key cleanupDict:NO];
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
}
}
keyAnimationDict[key] = anim;
@ -604,7 +602,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
updateDisplayLink(self);
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
// schedule runloop processing of pending animations
[self _scheduleProcessPendingList];
@ -613,13 +611,13 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
- (void)removeAllAnimationsForObject:(id)obj
{
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
NSArray *animations = [(__bridge id)CFDictionaryGetValue(_dict, (__bridge void *)obj) allValues];
CFDictionaryRemoveValue(_dict, (__bridge void *)obj);
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (0 == animations.count) {
return;
@ -631,7 +629,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
POPAnimatorItemRef item;
for (auto iter = _list.begin(); iter != _list.end();) {
@ -644,7 +642,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (POPAnimation *anim in animations) {
POPAnimationState *state = POPAnimationGetState(anim);
@ -660,7 +658,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// remove from list
POPAnimatorItemRef item;
@ -686,7 +684,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
// stop animation and callout
POPAnimationState *state = POPAnimationGetState(anim);
@ -701,27 +699,27 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
- (NSArray *)animationKeysForObject:(id)obj
{
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// get keys
NSArray *keys = [(__bridge id)CFDictionaryGetValue(_dict, (__bridge void *)obj) allKeys];
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return keys;
}
- (id)animationForObject:(id)obj key:(NSString *)key
{
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
// lookup animation
NSDictionary *keyAnimationsDict = (__bridge id)CFDictionaryGetValue(_dict, (__bridge void *)obj);
POPAnimation *animation = keyAnimationsDict[key];
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return animation;
}
@ -771,7 +769,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_observers) {
// use ordered collection for deterministic callout
@ -782,7 +780,7 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
updateDisplayLink(self);
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)removeObserver:(id<POPAnimatorObserving>)observer
@ -793,13 +791,13 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
}
// lock
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
[_observers removeObject:observer];
updateDisplayLink(self);
// unlock
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
@end

View File

@ -5,7 +5,7 @@
#import <Accelerate/Accelerate.h>
#import <CommonCrypto/CommonCrypto.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <map>
#import <objc/runtime.h>

View File

@ -2,7 +2,7 @@
#import "LegacyComponentsInternal.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <CoreMedia/CoreMedia.h>
#import <ImageIO/ImageIO.h>
#import <Accelerate/Accelerate.h>
@ -69,7 +69,7 @@ const NSInteger TGVideoCameraRetainedBufferCount = 16;
id<TGLiveUploadInterface> _watcher;
id _liveUploadData;
OSSpinLock _recordLock;
os_unfair_lock _recordLock;
bool _startRecordAfterAudioBuffer;
CVPixelBufferRef _currentPreviewPixelBuffer;
@ -404,7 +404,7 @@ const NSInteger TGVideoCameraRetainedBufferCount = 16;
CFRelease(blockBuffer);
OSSpinLockLock(&_recordLock);
os_unfair_lock_lock(&_recordLock);
if (_startRecordAfterAudioBuffer)
{
_startRecordAfterAudioBuffer = false;
@ -413,7 +413,7 @@ const NSInteger TGVideoCameraRetainedBufferCount = 16;
[self startRecording:_recordingURL preset:_preset liveUpload:_liveUpload];
});
}
OSSpinLockUnlock(&_recordLock);
os_unfair_lock_unlock(&_recordLock);
}
}
@ -669,14 +669,14 @@ const NSInteger TGVideoCameraRetainedBufferCount = 16;
_preset = preset;
_liveUpload = liveUpload;
OSSpinLockLock(&_recordLock);
os_unfair_lock_lock(&_recordLock);
if (self.outputAudioFormatDescription == NULL)
{
_startRecordAfterAudioBuffer = true;
OSSpinLockUnlock(&_recordLock);
os_unfair_lock_unlock(&_recordLock);
return;
}
OSSpinLockUnlock(&_recordLock);
os_unfair_lock_unlock(&_recordLock);
@synchronized (self)
{

View File

@ -57,7 +57,7 @@ public func geocodeAddress(engine: TelegramEngine, address: DeviceContactAddress
if let cached = cached {
return .single((cached.latitude, cached.longitude))
} else {
return geocodeLocation(dictionary: address.dictionary)
return geocodeLocation(address: address.asPostalAddress)
|> mapToSignal { coordinate in
if let (latitude, longitude) = coordinate {
return updateCachedGeocode(engine: engine, address: address, latitude: latitude, longitude: longitude)

View File

@ -3,7 +3,7 @@
#ifndef MtProtoKit_MTInternalId_h
#define MtProtoKit_MTInternalId_h
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#define MTInternalId(name) MT##name##InternalId

View File

@ -1,10 +1,10 @@
#import <MtProtoKit/MTAtomic.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface MTAtomic ()
{
volatile OSSpinLock _lock;
os_unfair_lock _lock;
id _value;
}
@ -25,19 +25,19 @@
- (id)swap:(id)newValue
{
id previousValue = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
previousValue = _value;
_value = newValue;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return previousValue;
}
- (id)value
{
id previousValue = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
previousValue = _value;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return previousValue;
}
@ -45,19 +45,19 @@
- (id)modify:(id (^)(id))f
{
id newValue = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
newValue = f(_value);
_value = newValue;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return newValue;
}
- (id)with:(id (^)(id))f
{
id result = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
result = f(_value);
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return result;
}

View File

@ -22,7 +22,7 @@
#import <MtProtoKit/MTApiEnvironment.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import "MTDiscoverConnectionSignals.h"
@ -176,7 +176,7 @@ static MTDatacenterAuthInfoMapKeyStruct parseAuthInfoMapKeyInteger(NSNumber *key
NSMutableDictionary *_periodicTasksTimerByDatacenterId;
volatile OSSpinLock _passwordEntryRequiredLock;
os_unfair_lock _passwordEntryRequiredLock;
NSMutableDictionary *_passwordRequiredByDatacenterId;
NSMutableDictionary *_transportSchemeDisposableByDatacenterId;
@ -680,20 +680,20 @@ static void copyKeychainKey(NSString * _Nonnull group, NSString * _Nonnull key,
- (bool)isPasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId
{
OSSpinLockLock(&_passwordEntryRequiredLock);
os_unfair_lock_lock(&_passwordEntryRequiredLock);
bool currentValue = [_passwordRequiredByDatacenterId[@(datacenterId)] boolValue];
OSSpinLockUnlock(&_passwordEntryRequiredLock);
os_unfair_lock_unlock(&_passwordEntryRequiredLock);
return currentValue;
}
- (bool)updatePasswordInputRequiredForDatacenterWithId:(NSInteger)datacenterId required:(bool)required
{
OSSpinLockLock(&_passwordEntryRequiredLock);
os_unfair_lock_lock(&_passwordEntryRequiredLock);
bool currentValue = [_passwordRequiredByDatacenterId[@(datacenterId)] boolValue];
bool updated = currentValue != required;
_passwordRequiredByDatacenterId[@(datacenterId)] = @(required);
OSSpinLockUnlock(&_passwordEntryRequiredLock);
os_unfair_lock_unlock(&_passwordEntryRequiredLock);
if (updated)
{

View File

@ -1,6 +1,8 @@
#import <MtProtoKit/MTDisposable.h>
#import <os/lock.h>
#import <libkern/OSAtomic.h>
#import <stdatomic.h>
#import <objc/runtime.h>
@interface MTBlockDisposable ()
@ -27,6 +29,8 @@
void *block = _block;
if (block != NULL)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (OSAtomicCompareAndSwapPtr(block, 0, &_block))
{
if (block != nil)
@ -35,6 +39,7 @@
strongBlock = nil;
}
}
#pragma clang diagnostic pop
}
}
@ -43,6 +48,8 @@
void *block = _block;
if (block != NULL)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (OSAtomicCompareAndSwapPtr(block, 0, &_block))
{
if (block != nil)
@ -52,6 +59,7 @@
strongBlock = nil;
}
}
#pragma clang diagnostic pop
}
}
@ -59,7 +67,7 @@
@interface MTMetaDisposable ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _disposed;
id<MTDisposable> _disposable;
}
@ -73,14 +81,14 @@
id<MTDisposable> previousDisposable = nil;
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
dispose = _disposed;
if (!dispose)
{
previousDisposable = _disposable;
_disposable = disposable;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (previousDisposable != nil)
[previousDisposable dispose];
@ -93,13 +101,13 @@
{
id<MTDisposable> disposable = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_disposed)
{
disposable = _disposable;
_disposed = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (disposable != nil)
[disposable dispose];
@ -109,7 +117,7 @@
@interface MTDisposableSet ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _disposed;
id<MTDisposable> _singleDisposable;
NSArray *_multipleDisposables;
@ -126,7 +134,7 @@
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
dispose = _disposed;
if (!dispose)
{
@ -147,14 +155,14 @@
_singleDisposable = disposable;
}
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (dispose)
[disposable dispose];
}
- (void)remove:(id<MTDisposable>)disposable {
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_multipleDisposables != nil)
{
NSMutableArray *multipleDisposables = [[NSMutableArray alloc] initWithArray:_multipleDisposables];
@ -165,7 +173,7 @@
{
_singleDisposable = nil;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)dispose
@ -173,7 +181,7 @@
id<MTDisposable> singleDisposable = nil;
NSArray *multipleDisposables = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_disposed)
{
_disposed = true;
@ -182,7 +190,7 @@
_singleDisposable = nil;
_multipleDisposables = nil;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (singleDisposable != nil)
[singleDisposable dispose];

View File

@ -2,7 +2,12 @@
#import <MtProtoKit/MTInternalId.h>
#import <libkern/OSAtomic.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
MTInternalIdClass(MTMessageTransaction)
#pragma clang diagnostic pop
@implementation MTMessageTransaction

View File

@ -1,7 +1,7 @@
#import <MtProtoKit/MTNetworkUsageManager.h>
#include <sys/mman.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <MtProtoKit/MTNetworkUsageCalculationInfo.h>
#import <MtProtoKit/MTSignal.h>

View File

@ -1,5 +1,6 @@
#import <MtProtoKit/MTOutgoingMessage.h>
#import <os/lock.h>
#import <libkern/OSAtomic.h>
@interface MTOutgoingMessageInternalId : NSObject <NSCopying>
@ -17,7 +18,10 @@
if (self != nil)
{
static int32_t nextValue = 1;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_value = OSAtomicIncrement32(&nextValue);
#pragma clang diagnostic pop
}
return self;
}

View File

@ -2,7 +2,12 @@
#import <MtProtoKit/MTInternalId.h>
#import <libkern/OSAtomic.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
MTInternalIdClass(MTPreparedMessage)
#pragma clang diagnostic pop
@implementation MTPreparedMessage

View File

@ -2,6 +2,7 @@
#import <MtProtoKit/MTRpcError.h>
#import <os/lock.h>
#import <libkern/OSAtomic.h>
@interface MTRequestInternalId : NSObject <NSCopying>
@ -19,7 +20,10 @@
if (self != nil)
{
static int32_t nextValue = 1;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_value = OSAtomicIncrement32(&nextValue);
#pragma clang diagnostic pop
}
return self;
}

View File

@ -1,6 +1,6 @@
#import <MtProtoKit/MTSignal.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <MtProtoKit/MTTimer.h>
#import <MtProtoKit/MTQueue.h>
#import <MtProtoKit/MTAtomic.h>
@ -55,7 +55,7 @@
@interface MTSignalQueueState : NSObject <MTDisposable>
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _executingSignal;
bool _terminated;
@ -92,7 +92,7 @@
- (void)enqueueSignal:(MTSignal *)signal
{
bool startSignal = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_queueMode && _executingSignal)
{
[_queuedSignals addObject:signal];
@ -102,7 +102,7 @@
_executingSignal = true;
startSignal = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (startSignal)
{
@ -130,7 +130,7 @@
MTSignal *nextSignal = nil;
bool terminated = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
_executingSignal = false;
if (_queueMode)
@ -146,7 +146,7 @@
}
else
terminated = _terminated;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (terminated)
[_subscriber putCompletion];
@ -174,10 +174,10 @@
- (void)beginCompletion
{
bool executingSignal = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
executingSignal = _executingSignal;
_terminated = true;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (!executingSignal)
[_subscriber putCompletion];

View File

@ -1,6 +1,6 @@
#import <MtProtoKit/MTSubscriber.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface MTSubscriberBlocks : NSObject {
@public
@ -28,7 +28,7 @@
@interface MTSubscriber ()
{
@protected
OSSpinLock _lock;
os_unfair_lock _lock;
bool _terminated;
id<MTDisposable> _disposable;
MTSubscriberBlocks *_blocks;
@ -51,13 +51,13 @@
- (void)_assignDisposable:(id<MTDisposable>)disposable
{
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_terminated) {
dispose = true;
} else {
_disposable = disposable;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (dispose) {
[disposable dispose];
@ -66,7 +66,7 @@
- (void)_markTerminatedWithoutDisposal
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
MTSubscriberBlocks *blocks = nil;
if (!_terminated)
{
@ -75,7 +75,7 @@
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks) {
blocks = nil;
@ -86,11 +86,11 @@
{
MTSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated) {
blocks = _blocks;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_next) {
blocks->_next(next);
@ -102,7 +102,7 @@
bool shouldDispose = false;
MTSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
blocks = _blocks;
@ -111,7 +111,7 @@
shouldDispose = true;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_error) {
blocks->_error(error);
@ -126,7 +126,7 @@
bool shouldDispose = false;
MTSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
blocks = _blocks;
@ -135,7 +135,7 @@
shouldDispose = true;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_completed)
blocks->_completed();

View File

@ -25,6 +25,8 @@
#import <EncryptionProvider/EncryptionProvider.h>
#import <libkern/OSAtomic.h>
static id<MTBignum> get_y2(id<MTBignum> x, id<MTBignum> mod, id<MTBignumContext> context) {
// returns y^2 = x^3 + 486662 * x^2 + x
id<MTBignum> y = [context clone:x];
@ -495,7 +497,10 @@ static NSData *executeGenerationCode(id<EncryptionProvider> provider, NSData *do
@end
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
MTInternalIdClass(MTTcpConnection)
#pragma clang diagnostic pop
struct socks5_ident_req
{

View File

@ -727,7 +727,7 @@ private func deviceContactInfoEntries(account: Account, engine: TelegramEngine,
var addressIndex = 0
for address in contactData.addresses {
let signal = geocodeLocation(dictionary: address.dictionary)
let signal = geocodeLocation(address: address.asPostalAddress)
|> mapToSignal { coordinates -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> in
if let (latitude, longitude) = coordinates {
let resource = MapSnapshotMediaResource(latitude: latitude, longitude: longitude, width: 90, height: 90)

View File

@ -17,6 +17,7 @@
#import <LegacyReachability/LegacyReachability.h>
#import <pthread.h>
#import <os/lock.h>
#import <libkern/OSAtomic.h>
#pragma mark IPv6 Support

View File

@ -1,7 +1,8 @@
#import "SBlockDisposable.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <objc/runtime.h>
#import <libkern/OSAtomic.h>
@interface SBlockDisposable ()
{
@ -27,6 +28,8 @@
void *block = _block;
if (block != NULL)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (OSAtomicCompareAndSwapPtr(block, 0, &_block))
{
if (block != nil)
@ -35,6 +38,7 @@
strongBlock = nil;
}
}
#pragma clang diagnostic pop
}
}
@ -43,6 +47,8 @@
void *block = _block;
if (block != NULL)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (OSAtomicCompareAndSwapPtr(block, 0, &_block))
{
if (block != nil)
@ -52,6 +58,7 @@
strongBlock = nil;
}
}
#pragma clang diagnostic pop
}
}

View File

@ -2,11 +2,11 @@
#import "SSignal.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface SDisposableSet ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _disposed;
id<SDisposable> _singleDisposable;
NSArray *_multipleDisposables;
@ -23,7 +23,7 @@
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
dispose = _disposed;
if (!dispose)
{
@ -44,14 +44,14 @@
_singleDisposable = disposable;
}
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (dispose)
[disposable dispose];
}
- (void)remove:(id<SDisposable>)disposable {
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_multipleDisposables != nil)
{
NSMutableArray *multipleDisposables = [[NSMutableArray alloc] initWithArray:_multipleDisposables];
@ -62,7 +62,7 @@
{
_singleDisposable = nil;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)dispose
@ -70,7 +70,7 @@
id<SDisposable> singleDisposable = nil;
NSArray *multipleDisposables = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_disposed)
{
_disposed = true;
@ -79,7 +79,7 @@
_singleDisposable = nil;
_multipleDisposables = nil;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (singleDisposable != nil)
[singleDisposable dispose];

View File

@ -1,10 +1,10 @@
#import "SMetaDisposable.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface SMetaDisposable ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _disposed;
id<SDisposable> _disposable;
}
@ -18,14 +18,14 @@
id<SDisposable> previousDisposable = nil;
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
dispose = _disposed;
if (!dispose)
{
previousDisposable = _disposable;
_disposable = disposable;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (previousDisposable != nil)
[previousDisposable dispose];
@ -38,13 +38,13 @@
{
id<SDisposable> disposable = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_disposed)
{
disposable = _disposable;
_disposed = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (disposable != nil)
[disposable dispose];

View File

@ -6,11 +6,11 @@
#import "SMetaDisposable.h"
#import "SBlockDisposable.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface SMulticastSignalManager ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
NSMutableDictionary *_multicastSignals;
NSMutableDictionary *_standaloneSignalDisposables;
NSMutableDictionary *_pipeListeners;
@ -35,9 +35,9 @@
- (void)dealloc
{
NSArray *disposables = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
disposables = [_standaloneSignalDisposables allValues];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (id<SDisposable> disposable in disposables)
{
@ -56,7 +56,7 @@
}
SSignal *signal = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
signal = _multicastSignals[key];
if (signal == nil)
{
@ -70,15 +70,15 @@
__strong SMulticastSignalManager *strongSelf = weakSelf;
if (strongSelf != nil)
{
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
[strongSelf->_multicastSignals removeObjectForKey:key];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
}
}] multicast];
_multicastSignals[key] = signal;
}
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return signal;
}
@ -89,13 +89,13 @@
return;
bool produce = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_standaloneSignalDisposables[key] == nil)
{
_standaloneSignalDisposables[key] = [[SMetaDisposable alloc] init];
produce = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (produce)
{
@ -105,24 +105,24 @@
__strong SMulticastSignalManager *strongSelf = weakSelf;
if (strongSelf != nil)
{
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
[strongSelf->_standaloneSignalDisposables removeObjectForKey:key];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
}
} completed:^
{
__strong SMulticastSignalManager *strongSelf = weakSelf;
if (strongSelf != nil)
{
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
[strongSelf->_standaloneSignalDisposables removeObjectForKey:key];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
}
}];
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
[(SMetaDisposable *)_standaloneSignalDisposables[key] setDisposable:disposable];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
}
@ -130,7 +130,7 @@
{
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
SBag *bag = _pipeListeners[key];
if (bag == nil)
{
@ -141,26 +141,26 @@
{
[subscriber putNext:next];
} copy]];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return [[SBlockDisposable alloc] initWithBlock:^
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
SBag *bag = _pipeListeners[key];
[bag removeItem:index];
if ([bag isEmpty]) {
[_pipeListeners removeObjectForKey:key];
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}];
}];
}
- (void)putNext:(id)next toMulticastedPipeForKey:(NSString *)key
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
NSArray *pipeListeners = [(SBag *)_pipeListeners[key] copyItems];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (void (^listener)(id) in pipeListeners)
{

View File

@ -6,11 +6,11 @@
#import "SAtomic.h"
#import "SSignal+Pipe.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface SSignalQueueState : NSObject <SDisposable>
{
OSSpinLock _lock;
os_unfair_lock _lock;
bool _executingSignal;
bool _terminated;
@ -49,7 +49,7 @@
- (void)enqueueSignal:(SSignal *)signal
{
bool startSignal = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_queueMode && _executingSignal) {
if (_throttleMode) {
[_queuedSignals removeAllObjects];
@ -61,7 +61,7 @@
_executingSignal = true;
startSignal = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (startSignal)
{
@ -89,7 +89,7 @@
SSignal *nextSignal = nil;
bool terminated = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
_executingSignal = false;
if (_queueMode)
@ -105,7 +105,7 @@
}
else
terminated = _terminated;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (terminated)
[_subscriber putCompletion];
@ -133,10 +133,10 @@
- (void)beginCompletion
{
bool executingSignal = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
executingSignal = _executingSignal;
_terminated = true;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (!executingSignal)
[_subscriber putCompletion];

View File

@ -1,6 +1,6 @@
#import "SSignal+Multicast.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import "SBag.h"
#import "SBlockDisposable.h"
@ -12,7 +12,7 @@ typedef enum {
@interface SSignalMulticastSubscribers : NSObject
{
volatile OSSpinLock _lock;
os_unfair_lock _lock;
SBag *_subscribers;
SSignalMulticastState _state;
id<SDisposable> _disposable;
@ -40,7 +40,7 @@ typedef enum {
- (id<SDisposable>)addSubscriber:(SSubscriber *)subscriber start:(bool *)start
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
NSInteger index = [_subscribers addItem:subscriber];
switch (_state) {
case SSignalMulticastStateReady:
@ -50,7 +50,7 @@ typedef enum {
default:
break;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
return [[SBlockDisposable alloc] initWithBlock:^
{
@ -62,7 +62,7 @@ typedef enum {
{
id<SDisposable> currentDisposable = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
[_subscribers removeItem:index];
switch (_state) {
case SSignalMulticastStateStarted:
@ -75,7 +75,7 @@ typedef enum {
default:
break;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
[currentDisposable dispose];
}
@ -83,9 +83,9 @@ typedef enum {
- (void)notifyNext:(id)next
{
NSArray *currentSubscribers = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
currentSubscribers = [_subscribers copyItems];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (SSubscriber *subscriber in currentSubscribers)
{
@ -96,10 +96,10 @@ typedef enum {
- (void)notifyError:(id)error
{
NSArray *currentSubscribers = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
currentSubscribers = [_subscribers copyItems];
_state = SSignalMulticastStateCompleted;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (SSubscriber *subscriber in currentSubscribers)
{
@ -110,10 +110,10 @@ typedef enum {
- (void)notifyCompleted
{
NSArray *currentSubscribers = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
currentSubscribers = [_subscribers copyItems];
_state = SSignalMulticastStateCompleted;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (SSubscriber *subscriber in currentSubscribers)
{

View File

@ -1,6 +1,6 @@
#import "SSubscriber.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
@interface SSubscriberBlocks : NSObject {
@public
@ -28,7 +28,7 @@
@interface SSubscriber ()
{
@protected
OSSpinLock _lock;
os_unfair_lock _lock;
bool _terminated;
id<SDisposable> _disposable;
SSubscriberBlocks *_blocks;
@ -51,13 +51,13 @@
- (void)_assignDisposable:(id<SDisposable>)disposable
{
bool dispose = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_terminated) {
dispose = true;
} else {
_disposable = disposable;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (dispose) {
[disposable dispose];
}
@ -65,7 +65,7 @@
- (void)_markTerminatedWithoutDisposal
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
SSubscriberBlocks *blocks = nil;
if (!_terminated)
{
@ -74,7 +74,7 @@
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks) {
blocks = nil;
@ -85,11 +85,11 @@
{
SSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated) {
blocks = _blocks;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_next) {
blocks->_next(next);
@ -101,7 +101,7 @@
bool shouldDispose = false;
SSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
blocks = _blocks;
@ -110,7 +110,7 @@
shouldDispose = true;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_error) {
blocks->_error(error);
@ -125,7 +125,7 @@
bool shouldDispose = false;
SSubscriberBlocks *blocks = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
blocks = _blocks;
@ -134,7 +134,7 @@
shouldDispose = true;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (blocks && blocks->_completed)
blocks->_completed();
@ -179,7 +179,7 @@
- (void)_markTerminatedWithoutDisposal
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
NSLog(@"trace(%@ terminated)", _name);
@ -188,17 +188,17 @@
_error = nil;
_completed = nil;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)putNext:(id)next
{
void (^fnext)(id) = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
fnext = self->_next;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (fnext)
{
@ -214,7 +214,7 @@
bool shouldDispose = false;
void (^ferror)(id) = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
ferror = self->_error;
@ -224,7 +224,7 @@
self->_completed = nil;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (ferror)
{
@ -243,7 +243,7 @@
bool shouldDispose = false;
void (^completed)() = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (!_terminated)
{
completed = self->_completed;
@ -253,7 +253,7 @@
self->_completed = nil;
_terminated = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (completed)
{

View File

@ -1,6 +1,6 @@
#import "SThreadPool.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <pthread.h>
#import "SQueue.h"

View File

@ -1,6 +1,6 @@
#import "SVariable.h"
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import "SSignal.h"
#import "SBag.h"
@ -9,7 +9,7 @@
@interface SVariable ()
{
OSSpinLock _lock;
os_unfair_lock _lock;
id _value;
bool _hasValue;
SBag *_subscribers;
@ -40,14 +40,14 @@
{
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)
{
OSSpinLockLock(&self->_lock);
os_unfair_lock_lock(&self->_lock);
id currentValue = _value;
bool hasValue = _hasValue;
NSInteger index = [self->_subscribers addItem:[^(id value)
{
[subscriber putNext:value];
} copy]];
OSSpinLockUnlock(&self->_lock);
os_unfair_lock_unlock(&self->_lock);
if (hasValue)
{
@ -56,18 +56,18 @@
return [[SBlockDisposable alloc] initWithBlock:^
{
OSSpinLockLock(&self->_lock);
os_unfair_lock_lock(&self->_lock);
[self->_subscribers removeItem:index];
OSSpinLockUnlock(&self->_lock);
os_unfair_lock_unlock(&self->_lock);
}];
}];
}
- (void)set:(SSignal *)signal
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
_hasValue = false;
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
__weak SVariable *weakSelf = self;
[_disposable setDisposable:[signal startWithNext:^(id next)
@ -76,11 +76,11 @@
if (strongSelf != nil)
{
NSArray *subscribers = nil;
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
strongSelf->_value = next;
strongSelf->_hasValue = true;
subscribers = [strongSelf->_subscribers copyItems];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
for (void (^subscriber)(id) in subscribers)
{

View File

@ -43,7 +43,7 @@ public enum Passthrough<T> {
}
private final class ReduceQueueState<T, E> : Disposable {
var lock: OSSpinLock = 0
var lock = os_unfair_lock()
var executingSignal = false
var terminated = false
@ -68,7 +68,7 @@ private final class ReduceQueueState<T, E> : Disposable {
func enqueueNext(_ next: T) {
var startSignal = false
var currentValue: T
OSSpinLockLock(&self.lock)
os_unfair_lock_lock(&self.lock)
currentValue = self.value
if self.executingSignal {
self.queuedValues.append(next)
@ -76,7 +76,7 @@ private final class ReduceQueueState<T, E> : Disposable {
self.executingSignal = true
startSignal = true
}
OSSpinLockUnlock(&self.lock)
os_unfair_lock_unlock(&self.lock)
if startSignal {
let disposable = generator(currentValue, next).start(next: { next in
@ -97,9 +97,9 @@ private final class ReduceQueueState<T, E> : Disposable {
}
func updateValue(_ value: T) {
OSSpinLockLock(&self.lock)
os_unfair_lock_lock(&self.lock)
self.value = value
OSSpinLockUnlock(&self.lock)
os_unfair_lock_unlock(&self.lock)
}
func headCompleted() {
@ -110,7 +110,7 @@ private final class ReduceQueueState<T, E> : Disposable {
var terminated = false
var currentValue: T!
OSSpinLockLock(&self.lock)
os_unfair_lock_lock(&self.lock)
self.executingSignal = false
if self.queuedValues.count != 0 {
nextSignal = self.generator(self.value, self.queuedValues[0])
@ -120,7 +120,7 @@ private final class ReduceQueueState<T, E> : Disposable {
currentValue = self.value
terminated = self.terminated
}
OSSpinLockUnlock(&self.lock)
os_unfair_lock_unlock(&self.lock)
if terminated {
self.subscriber.putNext(currentValue)
@ -154,11 +154,11 @@ private final class ReduceQueueState<T, E> : Disposable {
func beginCompletion() {
var executingSignal = false
let currentValue: T
OSSpinLockLock(&self.lock)
os_unfair_lock_lock(&self.lock)
executingSignal = self.executingSignal
self.terminated = true
currentValue = self.value
OSSpinLockUnlock(&self.lock)
os_unfair_lock_unlock(&self.lock)
if !executingSignal {
self.subscriber.putNext(currentValue)

View File

@ -140,7 +140,6 @@ public func copyToPasteboard(context: AccountContext, postbox: Postbox, mediaRef
if case let .data(data) = state, data.complete {
return Signal<Void, NoError> { subscriber in
let pasteboard = UIPasteboard.general
pasteboard.setPersistent(true)
if mediaReference.media is TelegramMediaImage {
if let fileData = try? Data(contentsOf: URL(fileURLWithPath: data.path), options: .mappedIfSafe) {

View File

@ -94,6 +94,6 @@ typedef NS_ENUM(NSUInteger, STPBillingAddressFields) {
- (BOOL)containsRequiredFields:(STPBillingAddressFields)requiredFields;
+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields; FAUXPAS_IGNORED_ON_LINE(APIAvailability);
//+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields; FAUXPAS_IGNORED_ON_LINE(APIAvailability);
@end

View File

@ -91,7 +91,7 @@
countryCode:self.country]);
}
+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields {
/*+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields {
FAUXPAS_IGNORED_IN_METHOD(APIAvailability);
switch (billingAddressFields) {
case STPBillingAddressFieldsNone:
@ -100,7 +100,7 @@
case STPBillingAddressFieldsFull:
return PKAddressFieldPostalAddress;
}
}
}*/
@end

View File

@ -99,7 +99,7 @@ public final class CallKitIntegration {
let handle = INPersonHandle(value: "tg\(peerId.id._internalGetInt64Value())", type: .unknown)
let contact = INPerson(personHandle: handle, nameComponents: nil, displayName: displayTitle, image: nil, contactIdentifier: localContactId, customIdentifier: "tg\(peerId.id._internalGetInt64Value())")
let intent = INStartAudioCallIntent(contacts: [contact])
let intent = INStartAudioCallIntent(destinationType: .normal, contacts: [contact])
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .outgoing

View File

@ -193,12 +193,14 @@ public func donateSendMessageIntent(account: Account, sharedContext: SharedAccou
nameComponents.givenName = displayTitle
}
let recipient = INPerson(personHandle: recipientHandle, nameComponents: nameComponents, displayName: displayTitle, image: nil, contactIdentifier: nil, customIdentifier: "tg\(peer.id.toInt64())")
var personImage: INImage?
if let avatarImage = avatarImage, let avatarImageData = avatarImage.jpegData(compressionQuality: 0.8) {
personImage = INImage(imageData: avatarImageData)
}
let recipient = INPerson(personHandle: recipientHandle, nameComponents: nameComponents, displayName: displayTitle, image: personImage, contactIdentifier: nil, customIdentifier: "tg\(peer.id.toInt64())")
let intent = INSendMessageIntent(recipients: [recipient], content: nil, speakableGroupName: INSpeakableString(spokenPhrase: displayTitle), conversationIdentifier: "tg\(peer.id.toInt64())", serviceName: nil, sender: nil)
if let avatarImage = avatarImage, let avatarImageData = avatarImage.jpegData(compressionQuality: 0.8) {
intent.setImage(INImage(imageData: avatarImageData), forParameterNamed: \.groupName)
}
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .outgoing
interaction.groupIdentifier = "sendMessage_\(peer.id.toInt64())"

View File

@ -529,7 +529,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
}, canOpenUrl: { url in
return UIApplication.shared.canOpenURL(url)
}, openUrl: { url in
UIApplication.shared.openURL(url)
UIApplication.shared.open(url, options: [:], completionHandler: nil)
})
if #available(iOS 10.0, *) {
@ -555,9 +555,9 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
}
if let parsedUrl = parsedUrl {
UIApplication.shared.openURL(parsedUrl)
UIApplication.shared.open(parsedUrl, options: [:], completionHandler: nil)
} else if let escapedUrl = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let parsedUrl = URL(string: escapedUrl) {
UIApplication.shared.openURL(parsedUrl)
UIApplication.shared.open(parsedUrl, options: [:], completionHandler: nil)
}
}, openUniversalUrl: { url, completion in
if #available(iOS 10.0, *) {
@ -633,12 +633,12 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
return disposable
}, openSettings: {
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.openURL(url)
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}, openAppStorePage: {
let appStoreId = buildConfig.appStoreId
if let url = URL(string: "itms-apps://itunes.apple.com/app/id\(appStoreId)") {
UIApplication.shared.openURL(url)
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}, openSubscriptions: {
if #available(iOS 15, *), let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
@ -646,7 +646,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
try await AppStore.showManageSubscriptions(in: scene)
}
} else if let url = URL(string: "https://apps.apple.com/account/subscriptions") {
UIApplication.shared.openURL(url)
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}, registerForNotifications: { completion in
let _ = (self.context.get()
@ -1434,11 +1434,11 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
})
}
func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
/*func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
if (application.applicationState == .inactive) {
Logger.shared.log("App \(self.episodeId)", "tap local notification \(String(describing: notification.userInfo)), applicationState \(application.applicationState)")
}
}
}*/
public func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, for type: PKPushType) {
if #available(iOS 9.0, *) {
@ -1697,7 +1697,7 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
let presentationData = authContext.sharedContext.currentPresentationData.with { $0 }
authContext.rootController.currentWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: presentationData.strings.Passport_NotLoggedInMessage, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Calls_NotNow, action: {
if let callbackUrl = URL(string: secureIdCallbackUrl(with: secureIdData.callbackUrl, peerId: secureIdData.peerId, result: .cancel, parameters: [:])) {
UIApplication.shared.openURL(callbackUrl)
UIApplication.shared.open(callbackUrl, options: [:], completionHandler: nil)
}
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), on: .root, blockInteraction: false, completion: {})
} else if let confirmationCode = parseConfirmationCodeUrl(url) {
@ -2153,14 +2153,9 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
reply.identifier = "reply"
reply.title = replyString
reply.isDestructive = false
if #available(iOS 9.0, *) {
reply.isAuthenticationRequired = false
reply.behavior = .textInput
reply.activationMode = .background
} else {
reply.isAuthenticationRequired = true
reply.activationMode = .foreground
}
let unknownMessageCategory = UIMutableUserNotificationCategory()
unknownMessageCategory.identifier = "unknown"

View File

@ -465,7 +465,7 @@ final class AuthorizedApplicationContext {
declineImpl?()
}, openUrl: { url in
if let parsedUrl = URL(string: url) {
UIApplication.shared.openURL(parsedUrl)
UIApplication.shared.open(parsedUrl, options: [:], completionHandler: nil)
}
})

View File

@ -464,16 +464,10 @@ public final class SharedNotificationManager {
} else {
let notification = UILocalNotification()
if #available(iOS 8.2, *) {
notification.alertTitle = title
notification.alertBody = body
} else {
if let title = title {
notification.alertBody = "\(title): \(body)"
} else {
notification.alertBody = body
}
}
notification.category = "incomingCall"
notification.userInfo = ["callId": String(describing: notificationCall.internalId)]
notification.soundName = "0.m4a"

View File

@ -259,7 +259,7 @@ private final class SystemVideoContentNode: ASDisplayNode, UniversalVideoContent
func seek(_ timestamp: Double) {
assert(Queue.mainQueue().isCurrent())
self.seekId += 1
self.playerItem.seek(to: CMTimeMake(value: Int64(timestamp) * 1000, timescale: 1000))
self.playerItem.seek(to: CMTimeMake(value: Int64(timestamp) * 1000, timescale: 1000), completionHandler: nil)
}
func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek, actionAtEnd: MediaPlayerPlayOnceWithSoundActionAtEnd) {

View File

@ -102,8 +102,6 @@ final class WebEmbedPlayerNode: ASDisplayNode, WKNavigationDelegate {
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
configuration.mediaTypesRequiringUserActionForPlayback = []
} else if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
configuration.requiresUserActionForMediaPlayback = false
} else {
configuration.mediaPlaybackRequiresUserAction = false
}

View File

@ -5,6 +5,8 @@
#import <MtProtoKit/MtProtoKit.h>
#include <memory>
#import <libkern/OSAtomic.h>
static void TGCallAesIgeEncrypt(uint8_t *inBytes, uint8_t *outBytes, size_t length, uint8_t *key, uint8_t *iv) {
MTAesEncryptRaw(inBytes, outBytes, length, key, iv);
}

View File

@ -2,7 +2,7 @@
#import <LegacyComponents/LegacyComponents.h>
#import <WatchConnectivity/WatchConnectivity.h>
#import <libkern/OSAtomic.h>
#import <os/lock.h>
#import <WatchCommon/WatchCommon.h>
@interface TGBridgeSignalManager : NSObject
@ -31,16 +31,16 @@
TGBridgeSignalManager *_signalManager;
OSSpinLock _incomingQueueLock;
os_unfair_lock _incomingQueueLock;
NSMutableArray *_incomingMessageQueue;
bool _requestSubscriptionList;
NSArray *_initialSubscriptionList;
OSSpinLock _outgoingQueueLock;
os_unfair_lock _outgoingQueueLock;
NSMutableArray *_outgoingMessageQueue;
OSSpinLock _replyHandlerMapLock;
os_unfair_lock _replyHandlerMapLock;
NSMutableDictionary *_replyHandlerMap;
SPipe *_appInstalled;
@ -102,14 +102,14 @@
if (self.isRunning)
return;
OSSpinLockLock(&_incomingQueueLock);
os_unfair_lock_lock(&_incomingQueueLock);
_isRunning = true;
for (id message in _incomingMessageQueue)
[self handleMessage:message replyHandler:nil finishTask:nil completion:nil];
[_incomingMessageQueue removeAllObjects];
OSSpinLockUnlock(&_incomingQueueLock);
os_unfair_lock_unlock(&_incomingQueueLock);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self dispatch:^{
@ -189,7 +189,7 @@
};
id message = [NSKeyedUnarchiver unarchiveObjectWithData:messageData];
OSSpinLockLock(&_incomingQueueLock);
os_unfair_lock_lock(&_incomingQueueLock);
if (!self.isRunning)
{
[_incomingMessageQueue addObject:message];
@ -199,10 +199,10 @@
finishTask(4.0);
OSSpinLockUnlock(&_incomingQueueLock);
os_unfair_lock_unlock(&_incomingQueueLock);
return;
}
OSSpinLockUnlock(&_incomingQueueLock);
os_unfair_lock_unlock(&_incomingQueueLock);
[self handleMessage:message replyHandler:replyHandler finishTask:finishTask completion:completion];
}
@ -261,9 +261,9 @@
//TGLog(@"[BridgeServer] Halt all active subscriptions");
[_signalManager haltAllSignals];
OSSpinLockLock(&_outgoingQueueLock);
os_unfair_lock_lock(&_outgoingQueueLock);
[_outgoingMessageQueue removeAllObjects];
OSSpinLockUnlock(&_outgoingQueueLock);
os_unfair_lock_unlock(&_outgoingQueueLock);
}
_sessionId = ping.sessionId;
@ -307,9 +307,9 @@
SSignal *subscriptionHandler = _handler(subscription);
if (replyHandler != nil)
{
OSSpinLockLock(&_replyHandlerMapLock);
os_unfair_lock_lock(&_replyHandlerMapLock);
_replyHandlerMap[@(subscription.identifier)] = replyHandler;
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
}
if (subscriptionHandler != nil)
@ -318,11 +318,11 @@
{
STimer *timer = [[STimer alloc] initWithTimeout:2.0 repeat:false completion:^
{
OSSpinLockLock(&_replyHandlerMapLock);
os_unfair_lock_lock(&_replyHandlerMapLock);
void (^reply)(NSData *) = _replyHandlerMap[@(subscription.identifier)];
if (reply == nil)
{
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
if (finishTask != nil)
finishTask(2.0);
@ -331,7 +331,7 @@
reply([NSData data]);
[_replyHandlerMap removeObjectForKey:@(subscription.identifier)];
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
if (finishTask != nil)
finishTask(4.0);
@ -369,11 +369,11 @@
}
else
{
OSSpinLockLock(&_replyHandlerMapLock);
os_unfair_lock_lock(&_replyHandlerMapLock);
void (^reply)(NSData *) = _replyHandlerMap[@(subscription.identifier)];
if (reply == nil)
{
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
if (finishTask != nil)
finishTask(2.0);
@ -382,7 +382,7 @@
reply([NSData data]);
[_replyHandlerMap removeObjectForKey:@(subscription.identifier)];
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
if (finishTask != nil)
finishTask(2.0);
@ -410,11 +410,11 @@
break;
}
OSSpinLockLock(&_replyHandlerMapLock);
os_unfair_lock_lock(&_replyHandlerMapLock);
void (^reply)(NSData *) = _replyHandlerMap[@(subscription.identifier)];
if (reply != nil)
[_replyHandlerMap removeObjectForKey:@(subscription.identifier)];
OSSpinLockUnlock(&_replyHandlerMapLock);
os_unfair_lock_unlock(&_replyHandlerMapLock);
if (_processingNotification)
{
@ -460,7 +460,7 @@
- (void)_enqueueResponse:(TGBridgeResponse *)response forSubscription:(TGBridgeSubscription *)subscription
{
OSSpinLockLock(&_outgoingQueueLock);
os_unfair_lock_lock(&_outgoingQueueLock);
NSMutableArray *updatedResponses = (_outgoingMessageQueue != nil) ? [_outgoingMessageQueue mutableCopy] : [[NSMutableArray alloc] init];
if (subscription.dropPreviouslyQueued)
@ -479,7 +479,7 @@
[updatedResponses addObject:response];
_outgoingMessageQueue = updatedResponses;
OSSpinLockUnlock(&_outgoingQueueLock);
os_unfair_lock_unlock(&_outgoingQueueLock);
}
- (void)_sendQueuedResponses
@ -487,7 +487,7 @@
if (_processingNotification)
return;
OSSpinLockLock(&_outgoingQueueLock);
os_unfair_lock_lock(&_outgoingQueueLock);
if (_outgoingMessageQueue.count > 0)
{
@ -501,7 +501,7 @@
[_outgoingMessageQueue removeAllObjects];
}
OSSpinLockUnlock(&_outgoingQueueLock);
os_unfair_lock_unlock(&_outgoingQueueLock);
}
- (void)_requestSubscriptionList
@ -669,7 +669,7 @@
@interface TGBridgeSignalManager()
{
OSSpinLock _lock;
os_unfair_lock _lock;
NSMutableDictionary *_disposables;
}
@end
@ -689,9 +689,9 @@
- (void)dealloc
{
NSArray *disposables = nil;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
disposables = [_disposables allValues];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
for (id<SDisposable> disposable in disposables)
{
@ -705,13 +705,13 @@
return false;
bool produce = false;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_disposables[key] == nil)
{
_disposables[key] = [[SMetaDisposable alloc] init];
produce = true;
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
if (produce)
{
@ -721,24 +721,24 @@
__strong TGBridgeSignalManager *strongSelf = weakSelf;
if (strongSelf != nil)
{
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
[strongSelf->_disposables removeObjectForKey:key];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
}
} completed:^
{
__strong TGBridgeSignalManager *strongSelf = weakSelf;
if (strongSelf != nil)
{
OSSpinLockLock(&strongSelf->_lock);
os_unfair_lock_lock(&strongSelf->_lock);
[strongSelf->_disposables removeObjectForKey:key];
OSSpinLockUnlock(&strongSelf->_lock);
os_unfair_lock_unlock(&strongSelf->_lock);
}
}];
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
[(SMetaDisposable *)_disposables[key] setDisposable:disposable];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
return produce;
@ -749,22 +749,22 @@
if (key == nil)
return;
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
if (_disposables[key] != nil)
{
[_disposables[key] dispose];
[_disposables removeObjectForKey:key];
}
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
- (void)haltAllSignals
{
OSSpinLockLock(&_lock);
os_unfair_lock_lock(&_lock);
for (NSObject <SDisposable> *disposable in _disposables.allValues)
[disposable dispose];
[_disposables removeAllObjects];
OSSpinLockUnlock(&_lock);
os_unfair_lock_unlock(&_lock);
}
@end

View File

@ -68,8 +68,6 @@ final class WebAppWebView: WKWebView {
configuration.allowsPictureInPictureMediaPlayback = false
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
configuration.mediaTypesRequiringUserActionForPlayback = .all
} else if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
configuration.requiresUserActionForMediaPlayback = true
} else {
configuration.mediaPlaybackRequiresUserAction = true
}