| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2023-07-21 17:52:30 +02:00
										 |  |  | //  JSINSObjectConversion.mm | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | //  VisionCamera | 
					
						
							|  |  |  | // | 
					
						
							| 
									
										
										
										
											2021-09-29 12:54:51 +02:00
										 |  |  | //  Forked and Adjusted by Marc Rousavy on 02.05.21. | 
					
						
							|  |  |  | //  Copyright © 2021 mrousavy & Facebook. All rights reserved. | 
					
						
							|  |  |  | // | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | //  Forked and adjusted from: | 
					
						
							|  |  |  | //  https://github.com/facebook/react-native/blob/900210cacc4abca0079e3903781bc223c80c8ac7/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm | 
					
						
							| 
									
										
										
										
											2021-09-29 12:54:51 +02:00
										 |  |  | //  Original Copyright Notice: | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | //  Copyright (c) Facebook, Inc. and its affiliates. | 
					
						
							|  |  |  | // | 
					
						
							|  |  |  | //  This source code is licensed under the MIT license found in the | 
					
						
							|  |  |  | //  LICENSE file in the root directory of this source tree. | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2021-09-29 12:52:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-21 17:52:30 +02:00
										 |  |  | #import "JSINSObjectConversion.h" | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | #import "../Frame Processor/Frame.h" | 
					
						
							|  |  |  | #import "../Frame Processor/FrameHostObject.h" | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  | #import "../Frame Processor/SharedArray.h" | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | #import <Foundation/Foundation.h> | 
					
						
							|  |  |  | #import <React/RCTBridge.h> | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | #import <ReactCommon/CallInvoker.h> | 
					
						
							| 
									
										
										
										
											2023-07-20 15:30:04 +02:00
										 |  |  | #import <ReactCommon/RCTBlockGuard.h> | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | #import <ReactCommon/TurboModuleUtils.h> | 
					
						
							|  |  |  | #import <jsi/jsi.h> | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | using namespace facebook; | 
					
						
							|  |  |  | using namespace facebook::react; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 11:34:21 +02:00
										 |  |  | namespace JSINSObjectConversion { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Value convertNSNumberToJSIBoolean(jsi::Runtime& runtime, NSNumber* value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   return jsi::Value((bool)[value boolValue]); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Value convertNSNumberToJSINumber(jsi::Runtime& runtime, NSNumber* value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   return jsi::Value([value doubleValue]); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::String convertNSStringToJSIString(jsi::Runtime& runtime, NSString* value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   return jsi::String::createFromUtf8(runtime, [value UTF8String] ?: ""); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime& runtime, NSDictionary* value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   jsi::Object result = jsi::Object(runtime); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   for (NSString* k in value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     result.setProperty(runtime, [k UTF8String], convertObjCObjectToJSIValue(runtime, value[k])); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Array convertNSArrayToJSIArray(jsi::Runtime& runtime, NSArray* value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   jsi::Array result = jsi::Array(runtime, value.count); | 
					
						
							|  |  |  |   for (size_t i = 0; i < value.count; i++) { | 
					
						
							|  |  |  |     result.setValueAtIndex(runtime, i, convertObjCObjectToJSIValue(runtime, value[i])); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  | jsi::Object convertSharedArrayToJSIArrayBuffer(jsi::Runtime& runtime, SharedArray* sharedArray) { | 
					
						
							| 
									
										
										
										
											2024-01-17 20:18:46 +01:00
										 |  |  |   return sharedArray.arrayBuffer->getArrayBuffer(runtime); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Value convertObjCObjectToJSIValue(jsi::Runtime& runtime, id value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   if (value == nil) { | 
					
						
							|  |  |  |     return jsi::Value::undefined(); | 
					
						
							|  |  |  |   } else if ([value isKindOfClass:[NSString class]]) { | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     return convertNSStringToJSIString(runtime, (NSString*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } else if ([value isKindOfClass:[NSNumber class]]) { | 
					
						
							|  |  |  |     if ([value isKindOfClass:[@YES class]]) { | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |       return convertNSNumberToJSIBoolean(runtime, (NSNumber*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     return convertNSNumberToJSINumber(runtime, (NSNumber*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } else if ([value isKindOfClass:[NSDictionary class]]) { | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     return convertNSDictionaryToJSIObject(runtime, (NSDictionary*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } else if ([value isKindOfClass:[NSArray class]]) { | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     return convertNSArrayToJSIArray(runtime, (NSArray*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } else if (value == (id)kCFNull) { | 
					
						
							|  |  |  |     return jsi::Value::null(); | 
					
						
							| 
									
										
										
										
											2021-06-09 10:57:05 +02:00
										 |  |  |   } else if ([value isKindOfClass:[Frame class]]) { | 
					
						
							|  |  |  |     auto frameHostObject = std::make_shared<FrameHostObject>((Frame*)value); | 
					
						
							|  |  |  |     return jsi::Object::createFromHostObject(runtime, frameHostObject); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   } else if ([value isKindOfClass:[SharedArray class]]) { | 
					
						
							|  |  |  |     return convertSharedArrayToJSIArrayBuffer(runtime, (SharedArray*)value); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   return jsi::Value::undefined(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | NSString* convertJSIStringToNSString(jsi::Runtime& runtime, const jsi::String& value) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   return [NSString stringWithUTF8String:value.utf8(runtime).c_str()]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  | NSArray* convertJSICStyleArrayToNSArray(jsi::Runtime& runtime, const jsi::Value* array, size_t length, | 
					
						
							|  |  |  |                                         std::shared_ptr<CallInvoker> jsInvoker) { | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   if (length < 1) | 
					
						
							|  |  |  |     return @[]; | 
					
						
							|  |  |  |   NSMutableArray* result = [NSMutableArray new]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   for (size_t i = 0; i < length; i++) { | 
					
						
							|  |  |  |     // Insert kCFNull when it's `undefined` value to preserve the indices. | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     [result addObject:convertJSIValueToObjCObject(runtime, array[i], jsInvoker) ?: (id)kCFNull]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   return [result copy]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | jsi::Value* convertNSArrayToJSICStyleArray(jsi::Runtime& runtime, NSArray* array) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   auto result = new jsi::Value[array.count]; | 
					
						
							|  |  |  |   for (size_t i = 0; i < array.count; i++) { | 
					
						
							|  |  |  |     result[i] = convertObjCObjectToJSIValue(runtime, array[i]); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  | NSArray* convertJSIArrayToNSArray(jsi::Runtime& runtime, const jsi::Array& value, std::shared_ptr<CallInvoker> jsInvoker) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   size_t size = value.size(runtime); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   NSMutableArray* result = [NSMutableArray new]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   for (size_t i = 0; i < size; i++) { | 
					
						
							|  |  |  |     // Insert kCFNull when it's `undefined` value to preserve the indices. | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  |     [result addObject:convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker) ?: (id)kCFNull]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   return [result copy]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  | NSDictionary* convertJSIObjectToNSDictionary(jsi::Runtime& runtime, const jsi::Object& value, std::shared_ptr<CallInvoker> jsInvoker) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   jsi::Array propertyNames = value.getPropertyNames(runtime); | 
					
						
							|  |  |  |   size_t size = propertyNames.size(runtime); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   NSMutableDictionary* result = [NSMutableDictionary new]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   for (size_t i = 0; i < size; i++) { | 
					
						
							|  |  |  |     jsi::String name = propertyNames.getValueAtIndex(runtime, i).getString(runtime); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |     NSString* k = convertJSIStringToNSString(runtime, name); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker); | 
					
						
							|  |  |  |     if (v) { | 
					
						
							|  |  |  |       result[k] = v; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return [result copy]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  | id convertJSIValueToObjCObject(jsi::Runtime& runtime, const jsi::Value& value, std::shared_ptr<CallInvoker> jsInvoker) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   if (value.isUndefined() || value.isNull()) { | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |     // undefined/null | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     return nil; | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   } else if (value.isBool()) { | 
					
						
							|  |  |  |     // bool | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     return @(value.getBool()); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   } else if (value.isNumber()) { | 
					
						
							|  |  |  |     // number | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     return @(value.getNumber()); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   } else if (value.isString()) { | 
					
						
							|  |  |  |     // string | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     return convertJSIStringToNSString(runtime, value.getString(runtime)); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   } else if (value.isObject()) { | 
					
						
							|  |  |  |     // object | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     jsi::Object o = value.getObject(runtime); | 
					
						
							|  |  |  |     if (o.isArray(runtime)) { | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |       // array[] | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |       return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |     } else if (o.isFunction(runtime)) { | 
					
						
							|  |  |  |       // function () => {} | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |       return convertJSIFunctionToCallback(runtime, std::move(o.getFunction(runtime)), jsInvoker); | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |     } else if (o.isHostObject(runtime)) { | 
					
						
							|  |  |  |       if (o.isHostObject<FrameHostObject>(runtime)) { | 
					
						
							|  |  |  |         // Frame | 
					
						
							|  |  |  |         auto hostObject = o.getHostObject<FrameHostObject>(runtime); | 
					
						
							|  |  |  |         return hostObject->frame; | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         throw std::runtime_error("The given HostObject is not supported by a Frame Processor Plugin!"); | 
					
						
							| 
									
										
										
										
											2021-06-08 14:20:07 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |     } else if (o.isArrayBuffer(runtime)) { | 
					
						
							|  |  |  |       // ArrayBuffer | 
					
						
							| 
									
										
										
										
											2024-01-17 20:18:46 +01:00
										 |  |  |       auto arrayBuffer = std::make_shared<jsi::ArrayBuffer>(o.getArrayBuffer(runtime)); | 
					
						
							| 
									
										
										
										
											2024-01-18 10:41:26 +01:00
										 |  |  |       return [[SharedArray alloc] initWithRuntime:runtime wrapArrayBuffer:arrayBuffer]; | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |     } else { | 
					
						
							|  |  |  |       // object | 
					
						
							|  |  |  |       return convertJSIObjectToNSDictionary(runtime, o, jsInvoker); | 
					
						
							| 
									
										
										
										
											2021-06-08 14:20:07 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |   auto stringRepresentation = value.toString(runtime).utf8(runtime); | 
					
						
							|  |  |  |   throw std::runtime_error("Failed to convert jsi::Value to JNI value - unsupported type! " + stringRepresentation); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  | RCTResponseSenderBlock convertJSIFunctionToCallback(jsi::Runtime& runtime, const jsi::Function& value, | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |                                                     std::shared_ptr<CallInvoker> jsInvoker) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   auto weakWrapper = CallbackWrapper::createWeak(value.getFunction(runtime), runtime, jsInvoker); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   RCTBlockGuard* blockGuard = [[RCTBlockGuard alloc] initWithCleanup:^() { | 
					
						
							| 
									
										
										
										
											2023-07-20 15:30:04 +02:00
										 |  |  |     auto strongWrapper = weakWrapper.lock(); | 
					
						
							|  |  |  |     if (strongWrapper) { | 
					
						
							|  |  |  |       strongWrapper->destroy(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }]; | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |   BOOL __block wrapperWasCalled = NO; | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  |   RCTResponseSenderBlock callback = ^(NSArray* responses) { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     if (wrapperWasCalled) { | 
					
						
							|  |  |  |       throw std::runtime_error("callback arg cannot be called more than once"); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     auto strongWrapper = weakWrapper.lock(); | 
					
						
							|  |  |  |     if (!strongWrapper) { | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 15:30:04 +02:00
										 |  |  |     strongWrapper->jsInvoker().invokeAsync([weakWrapper, responses, blockGuard]() { | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |       auto strongWrapper2 = weakWrapper.lock(); | 
					
						
							|  |  |  |       if (!strongWrapper2) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |       const jsi::Value* args = convertNSArrayToJSICStyleArray(strongWrapper2->runtime(), responses); | 
					
						
							| 
									
										
										
										
											2023-09-01 19:39:25 +02:00
										 |  |  |       strongWrapper2->callback().call(strongWrapper2->runtime(), args, static_cast<size_t>(responses.count)); | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |       strongWrapper2->destroy(); | 
					
						
							|  |  |  |       delete[] args; | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 15:30:04 +02:00
										 |  |  |       // Delete the CallbackWrapper when the block gets dealloced without being invoked. | 
					
						
							|  |  |  |       (void)blockGuard; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  |     wrapperWasCalled = YES; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-26 10:12:26 +02:00
										 |  |  |   return [callback copy]; | 
					
						
							| 
									
										
										
										
											2021-05-06 14:11:55 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-07-31 11:34:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | } // namespace JSINSObjectConversion |