feat: Replace *NativeMap and *NativeArray with Map<K,V> and List<T> for faster JSI -> JNI calls (#1720)

Replaces `ReadableNativeMap`/`WritableNativeMap` with `Map<String, Object>` and `ReadableNativeArray`/`WritableNativeArray` with `List<Object>`, making the JSI -> JNI conversion a bit faster and more logical.
Also, we could now convert Array Buffers or HostObjects if we wanted to.
This commit is contained in:
Marc Rousavy
2023-08-25 12:22:44 +02:00
committed by GitHub
parent f87bc74de1
commit dfb86e174b
30 changed files with 125 additions and 167 deletions

View File

@@ -39,8 +39,8 @@ Similar to a TurboModule, the Frame Processor Plugin Registry API automatically
| `number` | `NSNumber*` (double) | `Double` |
| `boolean` | `NSNumber*` (boolean) | `Boolean` |
| `string` | `NSString*` | `String` |
| `[]` | `NSArray*` | `ReadableNativeArray` |
| `{}` | `NSDictionary*` | `ReadableNativeMap` |
| `[]` | `NSArray*` | `List<Object>` |
| `{}` | `NSDictionary*` | `Map<String, Object>` |
| `undefined` / `null` | `nil` | `null` |
| `(any, any) => void` | [`RCTResponseSenderBlock`][4] | `(Object, Object) -> void` |
| [`Frame`][1] | [`Frame*`][2] | [`Frame`][3] |

View File

@@ -61,7 +61,7 @@ import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin;
public class FaceDetectorFrameProcessorPlugin extends FrameProcessorPlugin {
@Override
public Object callback(Frame frame, ReadableNativeMap arguments) {
public Object callback(Frame frame, Map<String, Object> arguments) {
// code goes here
return null;
}
@@ -126,7 +126,7 @@ import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin
class FaceDetectorFrameProcessorPlugin: FrameProcessorPlugin() {
override fun callback(frame: Frame, arguments: ReadableNativeMap): Any? {
override fun callback(frame: Frame, arguments: Map<String, Object>): Any? {
// code goes here
return null
}