mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: folder web (#4580)
* chore: folder wasm * chore: folder wasm * chore: resolve deps * chore: fix trait * chore: try localset * chore: fix * chore: fix * chore: fix * chore: async init sdk * chore: fix test * chore: fix test
This commit is contained in:
@ -29,8 +29,16 @@ class FlowySDK {
|
||||
Future<void> init(String configuration) async {
|
||||
final port = RustStreamReceiver.shared.port;
|
||||
ffi.set_stream_port(port);
|
||||
|
||||
ffi.store_dart_post_cobject(NativeApi.postCObject);
|
||||
ffi.init_sdk(configuration.toNativeUtf8());
|
||||
|
||||
// final completer = Completer<Uint8List>();
|
||||
// // Create a SendPort that accepts only one message.
|
||||
// final sendPort = singleCompletePort(completer);
|
||||
|
||||
final code = ffi.init_sdk(0, configuration.toNativeUtf8());
|
||||
if (code != 0) {
|
||||
throw Exception('Failed to initialize the SDK');
|
||||
}
|
||||
// return completer.future;
|
||||
}
|
||||
}
|
||||
|
@ -77,17 +77,20 @@ typedef _invoke_sync_Dart = Pointer<Uint8> Function(
|
||||
|
||||
/// C function `init_sdk`.
|
||||
int init_sdk(
|
||||
int port,
|
||||
Pointer<ffi.Utf8> data,
|
||||
) {
|
||||
return _init_sdk(data);
|
||||
return _init_sdk(port, data);
|
||||
}
|
||||
|
||||
final _init_sdk_Dart _init_sdk =
|
||||
_dart_ffi_lib.lookupFunction<_init_sdk_C, _init_sdk_Dart>('init_sdk');
|
||||
typedef _init_sdk_C = Int64 Function(
|
||||
Int64 port,
|
||||
Pointer<ffi.Utf8> path,
|
||||
);
|
||||
typedef _init_sdk_Dart = int Function(
|
||||
int port,
|
||||
Pointer<ffi.Utf8> path,
|
||||
);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int64_t init_sdk(char *data);
|
||||
int64_t init_sdk(int64_t port, char *data);
|
||||
|
||||
void async_event(int64_t port, const uint8_t *input, uintptr_t len);
|
||||
|
||||
|
Reference in New Issue
Block a user