Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Mar 16, 2022
1 parent 40e8d52 commit 19f71c7
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ffigen/linux.yaml
Expand Up @@ -11,12 +11,14 @@ headers:
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
include-directives: #generate only for these headers
- 'realm.h'
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
compiler-opts:
- '-DRLM_NO_ANON_UNIONS'
Expand Down
2 changes: 2 additions & 0 deletions ffigen/macos.yaml
Expand Up @@ -9,12 +9,14 @@ headers:
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
include-directives: #generate only for these headers
- 'realm.h'
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
compiler-opts:
- '-DRLM_NO_ANON_UNIONS'
Expand Down
1 change: 1 addition & 0 deletions ffigen/realm_dart_http_transport.h
2 changes: 2 additions & 0 deletions ffigen/windows.yaml
Expand Up @@ -9,12 +9,14 @@ headers:
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
include-directives: #generate only for these headers
- 'realm.h'
- 'realm_dart.h'
- 'realm_dart_scheduler.h'
- 'realm_dart_collections.h'
- 'realm_dart_http_transport.h'
- 'realm_android_platform.h'
compiler-opts:
- '-DRLM_NO_ANON_UNIONS'
Expand Down
2 changes: 2 additions & 0 deletions flutter/realm_flutter/ios/Classes/RealmPlugin.m
Expand Up @@ -28,6 +28,7 @@
#import "realm_dart.h"
#import "realm_dart_scheduler.h"
#import "realm_dart_collections.h"
#import "realm_dart_http_transport.h"
#import "platform.h"
@implementation RealmPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
Expand All @@ -43,6 +44,7 @@ void dummy(void) {
realm_results_get_object(NULL, 0);
realm_list_size(NULL, 0);
realm_dart_results_add_notification_callback(NULL, NULL, NULL, NULL);
realm_dart_http_transport_new(NULL, NULL);
realm_results_snapshot(NULL);
}

Expand Down
1 change: 1 addition & 0 deletions flutter/realm_flutter/ios/realm.podspec
Expand Up @@ -25,6 +25,7 @@ Pod::Spec.new do |s|
'src/realm_dart.cpp'
'src/realm_dart_scheduler.cpp'
'src/realm_dart_collections.cpp'
'src/realm_dart_http_transport.cpp'
s.public_header_files = 'Classes/**/*.h',
s.vendored_frameworks = 'realm_flutter_ios.xcframework'
s.dependency 'Flutter'
Expand Down
39 changes: 38 additions & 1 deletion lib/src/native/realm_bindings.dart
Expand Up @@ -3,7 +3,7 @@
// Generated by `package:ffigen`.
import 'dart:ffi' as ffi;

/// A Windows config for ffigen Usage: dart run ffigen --config windows.yaml
/// A MacOs config for ffigen Usage: dart run ffigen --config macos.yaml
class RealmLibrary {
/// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
Expand Down Expand Up @@ -7555,6 +7555,29 @@ class RealmLibrary {
realm_dart_on_object_change_func_t,
ffi.Pointer<realm_scheduler_t>)>();

/// Create a new HTTP transport with these callbacks implementing its functionality.
///
/// This is a dart specific wrapper for realm_http_transport_new.
ffi.Pointer<realm_http_transport_t> realm_dart_http_transport_new(
realm_dart_http_request_func_t request_callback,
Object userdata,
) {
return _realm_dart_http_transport_new(
request_callback,
userdata,
);
}

late final _realm_dart_http_transport_newPtr = _lookup<
ffi.NativeFunction<
ffi.Pointer<realm_http_transport_t> Function(
realm_dart_http_request_func_t,
ffi.Handle)>>('realm_dart_http_transport_new');
late final _realm_dart_http_transport_new =
_realm_dart_http_transport_newPtr.asFunction<
ffi.Pointer<realm_http_transport_t> Function(
realm_dart_http_request_func_t, Object)>();

ffi.Pointer<ffi.Int8> realm_dart_get_files_path() {
return _realm_dart_get_files_path();
}
Expand Down Expand Up @@ -8478,3 +8501,17 @@ typedef realm_dart_on_collection_change_func_t = ffi.Pointer<
typedef realm_dart_on_object_change_func_t = ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Handle, ffi.Pointer<realm_object_changes_t>)>>;

/// Callback function used by Core to make a HTTP request.
///
/// Complete the request by calling realm_dart_http_transport_complete_request(),
/// passing in the request_context pointer here and the received response.
/// Network request are expected to be asynchronous and can be completed on any thread.
///
/// @param userdata The userdata pointer passed to realm_dart_http_transport_new().
/// @param request The request to send.
/// @param request_context Internal state pointer of Core, needed by realm_http_transport_complete_request().
typedef realm_dart_http_request_func_t = ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(
ffi.Handle, realm_http_request_t, ffi.Pointer<ffi.Void>)>>;
1 change: 1 addition & 0 deletions scripts/build-ios.sh
Expand Up @@ -114,6 +114,7 @@ cp "$PROJECT_ROOT"/src/realm-core/src/realm.h _include/realm_dart_ios/
cp "$PROJECT_ROOT"/src/realm_dart.h _include/realm_dart_ios/
cp "$PROJECT_ROOT"/src/realm_dart_scheduler.h _include/realm_dart_ios/
cp "$PROJECT_ROOT"/src/realm_dart_collections.h _include/realm_dart_ios/
cp "$PROJECT_ROOT"/src/realm_dart_http_transport.h _include/realm_dart_ios/
cp -r "$PROJECT_ROOT"/src/dart-include _include/realm_dart_ios/


Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Expand Up @@ -2,13 +2,15 @@ set(SOURCES
realm_dart.cpp
realm_dart_scheduler.cpp
realm_dart_collections.cpp
realm_dart_http_transport.cpp
dart-include/dart_api_dl.c
)

set(HEADERS
realm_dart.h
realm_dart_scheduler.h
realm_dart_collections.h
realm_dart_http_transport.h
realm-core/src/realm.h
)

Expand Down

0 comments on commit 19f71c7

Please sign in to comment.