From d08b03c172c857d80f89277b58e5ba157363f907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Chmiela?= Date: Wed, 1 Apr 2020 11:24:52 +0200 Subject: [PATCH] [ios] Backport removal of dispatch_once_t as an instance variable --- .../ABI34_0_0UMCore/ABI34_0_0UMExportedModule.m | 13 ++++--------- .../ABI35_0_0UMCore/ABI35_0_0UMExportedModule.m | 13 ++++--------- .../ABI36_0_0UMCore/ABI36_0_0UMExportedModule.m | 13 ++++--------- .../ABI37_0_0UMCore/ABI37_0_0UMExportedModule.m | 13 ++++--------- 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/ios/versioned-react-native/ABI34_0_0/UMCore/ABI34_0_0UMCore/ABI34_0_0UMExportedModule.m b/ios/versioned-react-native/ABI34_0_0/UMCore/ABI34_0_0UMCore/ABI34_0_0UMExportedModule.m index 619c638d4fe40..3c48d0cb58b21 100644 --- a/ios/versioned-react-native/ABI34_0_0/UMCore/ABI34_0_0UMCore/ABI34_0_0UMExportedModule.m +++ b/ios/versioned-react-native/ABI34_0_0/UMCore/ABI34_0_0UMCore/ABI34_0_0UMExportedModule.m @@ -18,7 +18,6 @@ @interface ABI34_0_0UMExportedModule () @property (nonatomic, strong) dispatch_queue_t methodQueue; -@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce; @property (nonatomic, strong) NSDictionary *exportedMethods; @end @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport - (dispatch_queue_t)methodQueue { - __weak ABI34_0_0UMExportedModule *weakSelf = self; - dispatch_once(&_methodQueueSetupOnce, ^{ - __strong ABI34_0_0UMExportedModule *strongSelf = weakSelf; - if (strongSelf) { - NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]]; - strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); - } - }); + if (!_methodQueue) { + NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]]; + _methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); + } return _methodQueue; } diff --git a/ios/versioned-react-native/ABI35_0_0/UMCore/ABI35_0_0UMCore/ABI35_0_0UMExportedModule.m b/ios/versioned-react-native/ABI35_0_0/UMCore/ABI35_0_0UMCore/ABI35_0_0UMExportedModule.m index 095bbdeacf389..0cff30f012ab7 100644 --- a/ios/versioned-react-native/ABI35_0_0/UMCore/ABI35_0_0UMCore/ABI35_0_0UMExportedModule.m +++ b/ios/versioned-react-native/ABI35_0_0/UMCore/ABI35_0_0UMCore/ABI35_0_0UMExportedModule.m @@ -18,7 +18,6 @@ @interface ABI35_0_0UMExportedModule () @property (nonatomic, strong) dispatch_queue_t methodQueue; -@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce; @property (nonatomic, strong) NSDictionary *exportedMethods; @end @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport - (dispatch_queue_t)methodQueue { - __weak ABI35_0_0UMExportedModule *weakSelf = self; - dispatch_once(&_methodQueueSetupOnce, ^{ - __strong ABI35_0_0UMExportedModule *strongSelf = weakSelf; - if (strongSelf) { - NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]]; - strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); - } - }); + if (!_methodQueue) { + NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]]; + _methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); + } return _methodQueue; } diff --git a/ios/versioned-react-native/ABI36_0_0/Expo/UMCore/ABI36_0_0UMCore/ABI36_0_0UMExportedModule.m b/ios/versioned-react-native/ABI36_0_0/Expo/UMCore/ABI36_0_0UMCore/ABI36_0_0UMExportedModule.m index 5011411953e68..f2a326b055574 100644 --- a/ios/versioned-react-native/ABI36_0_0/Expo/UMCore/ABI36_0_0UMCore/ABI36_0_0UMExportedModule.m +++ b/ios/versioned-react-native/ABI36_0_0/Expo/UMCore/ABI36_0_0UMCore/ABI36_0_0UMExportedModule.m @@ -18,7 +18,6 @@ @interface ABI36_0_0UMExportedModule () @property (nonatomic, strong) dispatch_queue_t methodQueue; -@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce; @property (nonatomic, strong) NSDictionary *exportedMethods; @end @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport - (dispatch_queue_t)methodQueue { - __weak ABI36_0_0UMExportedModule *weakSelf = self; - dispatch_once(&_methodQueueSetupOnce, ^{ - __strong ABI36_0_0UMExportedModule *strongSelf = weakSelf; - if (strongSelf) { - NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]]; - strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); - } - }); + if (!_methodQueue) { + NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]]; + _methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); + } return _methodQueue; } diff --git a/ios/versioned-react-native/ABI37_0_0/Expo/UMCore/ABI37_0_0UMCore/ABI37_0_0UMExportedModule.m b/ios/versioned-react-native/ABI37_0_0/Expo/UMCore/ABI37_0_0UMCore/ABI37_0_0UMExportedModule.m index 1102647fa1c35..a9a0b43059845 100644 --- a/ios/versioned-react-native/ABI37_0_0/Expo/UMCore/ABI37_0_0UMCore/ABI37_0_0UMExportedModule.m +++ b/ios/versioned-react-native/ABI37_0_0/Expo/UMCore/ABI37_0_0UMCore/ABI37_0_0UMExportedModule.m @@ -18,7 +18,6 @@ @interface ABI37_0_0UMExportedModule () @property (nonatomic, strong) dispatch_queue_t methodQueue; -@property (nonatomic, assign) dispatch_once_t methodQueueSetupOnce; @property (nonatomic, strong) NSDictionary *exportedMethods; @end @@ -55,14 +54,10 @@ - (NSDictionary *)constantsToExport - (dispatch_queue_t)methodQueue { - __weak ABI37_0_0UMExportedModule *weakSelf = self; - dispatch_once(&_methodQueueSetupOnce, ^{ - __strong ABI37_0_0UMExportedModule *strongSelf = weakSelf; - if (strongSelf) { - NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[strongSelf class] exportedModuleName]]; - strongSelf.methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); - } - }); + if (!_methodQueue) { + NSString *queueName = [NSString stringWithFormat:@"org.unimodules.%@Queue", [[self class] exportedModuleName]]; + _methodQueue = dispatch_queue_create(queueName.UTF8String, DISPATCH_QUEUE_SERIAL); + } return _methodQueue; }