Differential Diff 43914
Diff 43914
Diff 43914
Properties
Properties
Path | Size | ||||
---|---|---|---|---|---|
| |||||
31 lines | |||||
6 lines |
Diff 43914
Diff 43914
lib/shared/dm-ops/change-thread-read-status-spec.js
// @flow | // @flow | ||||
'use strict'; | 'use strict'; | ||||
import { TurboModuleRegistry } from 'react-native'; | import { TurboModuleRegistry } from 'react-native'; | ||||
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js'; | import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js'; | ||||
// codegen doesn't understand ArrayBuffers, so we need to map them to Objects | // codegen doesn't understand ArrayBuffers, so we need to map them to Objects | ||||
type JSIArrayBuffer = Object; | type JSIArrayBuffer = Object; | ||||
interface Spec extends TurboModule { | interface Spec extends TurboModule { | ||||
// filesystem utils | // filesystem utils | ||||
+writeBufferToFile: (path: string, data: JSIArrayBuffer) => Promise<void>; | +writeBufferToFile: (path: string, data: JSIArrayBuffer) => Promise<void>; | ||||
+readBufferFromFile: (path: string) => Promise<JSIArrayBuffer>; | +readBufferFromFile: (path: string) => Promise<JSIArrayBuffer>; | ||||
+base64EncodeBuffer: (data: JSIArrayBuffer) => string; | +base64EncodeBuffer: (data: JSIArrayBuffer) => string; | ||||
+base64DecodeBuffer: (base64: string) => JSIArrayBuffer; | |||||
// crypto utils | // crypto utils | ||||
+sha256: (data: JSIArrayBuffer) => string; | +sha256: (data: JSIArrayBuffer) => string; | ||||
} | } | ||||
// for public interface, we use the correct types | // for public interface, we use the correct types | ||||
export interface UtilsModuleSpec { | export interface UtilsModuleSpec { | ||||
+writeBufferToFile: (path: string, data: ArrayBuffer) => Promise<void>; | +writeBufferToFile: (path: string, data: ArrayBuffer) => Promise<void>; | ||||
+readBufferFromFile: (path: string) => Promise<ArrayBuffer>; | +readBufferFromFile: (path: string) => Promise<ArrayBuffer>; | ||||
+base64EncodeBuffer: (data: ArrayBuffer) => string; | +base64EncodeBuffer: (data: ArrayBuffer) => string; | ||||
+base64DecodeBuffer: (base64: string) => ArrayBuffer; | |||||
+sha256: (data: ArrayBuffer) => string; | +sha256: (data: ArrayBuffer) => string; | ||||
} | } | ||||
export default (TurboModuleRegistry.getEnforcing<Spec>( | export default (TurboModuleRegistry.getEnforcing<Spec>( | ||||
'CommUtilsTurboModule', | 'CommUtilsTurboModule', | ||||
): Spec); | ): Spec); |
lib/shared/dm-ops/process-dm-ops.js
// @flow | // @flow | ||||
'use strict'; | 'use strict'; | ||||
import { TurboModuleRegistry } from 'react-native'; | import { TurboModuleRegistry } from 'react-native'; | ||||
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js'; | import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js'; | ||||
// codegen doesn't understand ArrayBuffers, so we need to map them to Objects | // codegen doesn't understand ArrayBuffers, so we need to map them to Objects | ||||
type JSIArrayBuffer = Object; | type JSIArrayBuffer = Object; | ||||
interface Spec extends TurboModule { | interface Spec extends TurboModule { | ||||
// filesystem utils | // filesystem utils | ||||
+writeBufferToFile: (path: string, data: JSIArrayBuffer) => Promise<void>; | +writeBufferToFile: (path: string, data: JSIArrayBuffer) => Promise<void>; | ||||
+readBufferFromFile: (path: string) => Promise<JSIArrayBuffer>; | +readBufferFromFile: (path: string) => Promise<JSIArrayBuffer>; | ||||
+base64EncodeBuffer: (data: JSIArrayBuffer) => string; | +base64EncodeBuffer: (data: JSIArrayBuffer) => string; | ||||
+base64DecodeBuffer: (base64: string) => JSIArrayBuffer; | |||||
// crypto utils | // crypto utils | ||||
+sha256: (data: JSIArrayBuffer) => string; | +sha256: (data: JSIArrayBuffer) => string; | ||||
} | } | ||||
// for public interface, we use the correct types | // for public interface, we use the correct types | ||||
export interface UtilsModuleSpec { | export interface UtilsModuleSpec { | ||||
+writeBufferToFile: (path: string, data: ArrayBuffer) => Promise<void>; | +writeBufferToFile: (path: string, data: ArrayBuffer) => Promise<void>; | ||||
+readBufferFromFile: (path: string) => Promise<ArrayBuffer>; | +readBufferFromFile: (path: string) => Promise<ArrayBuffer>; | ||||
+base64EncodeBuffer: (data: ArrayBuffer) => string; | +base64EncodeBuffer: (data: ArrayBuffer) => string; | ||||
+base64DecodeBuffer: (base64: string) => ArrayBuffer; | |||||
+sha256: (data: ArrayBuffer) => string; | +sha256: (data: ArrayBuffer) => string; | ||||
} | } | ||||
export default (TurboModuleRegistry.getEnforcing<Spec>( | export default (TurboModuleRegistry.getEnforcing<Spec>( | ||||
'CommUtilsTurboModule', | 'CommUtilsTurboModule', | ||||
): Spec); | ): Spec); |