From c21640931268c7ade0948a0aec59e9bf98a0e4f6 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 26 Oct 2020 16:33:07 +0100 Subject: [PATCH 01/20] add SyncClient basic APIs and C bindings --- lib/src/bindings/bindings.dart | 24 +++++ lib/src/bindings/constants.dart | 40 +++++++ lib/src/bindings/signatures.dart | 17 +++ lib/src/sync.dart | 173 +++++++++++++++++++++++++++++++ 4 files changed, 254 insertions(+) create mode 100644 lib/src/sync.dart diff --git a/lib/src/bindings/bindings.dart b/lib/src/bindings/bindings.dart index 16d852586..86826f596 100644 --- a/lib/src/bindings/bindings.dart +++ b/lib/src/bindings/bindings.dart @@ -213,6 +213,16 @@ class _ObjectBoxBindings { obx_bytes_array_t obx_bytes_array; obx_bytes_array_set_t obx_bytes_array_set; + // Sync + int Function() obx_sync_available; + obx_sync_native_t obx_sync; + obx_fn_nullary_dart obx_sync_close; + obx_sync_credentials_dart_t obx_sync_credentials; + obx_fn_nullary_dart obx_sync_state; + obx_fn_unary_dart obx_sync_request_updates_mode; + obx_fn_nullary_dart obx_sync_start; + obx_fn_nullary_dart obx_sync_stop; + // TODO return .asFunction() -> requires properly determined static return type Pointer> _fn(String name) { return lib.lookup>(name); @@ -596,6 +606,20 @@ class _ObjectBoxBindings { obx_bytes_array_set = _fn>('obx_bytes_array_set') .asFunction(); + + // Sync + obx_sync_available = + _fn('obx_sync_available').asFunction(); + obx_sync = _fn('obx_sync').asFunction(); + obx_sync_close = _fn('obx_sync_close').asFunction(); + obx_sync_credentials = + _fn('obx_sync_credentials').asFunction(); + obx_sync_state = _fn('obx_sync_state').asFunction(); + obx_sync_request_updates_mode = + _fn>('obx_sync_request_updates_mode') + .asFunction(); + obx_sync_start = _fn('obx_sync_start').asFunction(); + obx_sync_stop = _fn('obx_sync_stop').asFunction(); } } diff --git a/lib/src/bindings/constants.dart b/lib/src/bindings/constants.dart index 741f53ac1..dd34aac39 100644 --- a/lib/src/bindings/constants.dart +++ b/lib/src/bindings/constants.dart @@ -91,3 +91,43 @@ class OBXError { /// A requested schema object (e.g. entity or property) was not found in the schema static const int OBX_ERROR_SCHEMA_OBJECT_NOT_FOUND = 10503; } + +class OBXSyncCredentialsType { + static const int NONE = 0; + static const int SHARED_SECRET = 1; + static const int GOOGLE_AUTH = 2; +} + +// TODO sync prefix +class OBXRequestUpdatesMode { + /// no updates by default, obx_sync_updates_request() must be called manually + static const int MANUAL = 0; + + /// same as calling obx_sync_updates_request(sync, TRUE) + /// default mode unless overridden by obx_sync_request_updates_mode + static const int AUTO = 1; + + /// same as calling obx_sync_updates_request(sync, FALSE) + static const int AUTO_NO_PUSHES = 2; +} + +class OBXSyncState { + static const int CREATED = 1; + static const int STARTED = 2; + static const int CONNECTED = 3; + static const int LOGGED_IN = 4; + static const int DISCONNECTED = 5; + static const int STOPPED = 6; + static const int DEAD = 7; +} + +class OBXSyncCode { + static const int OK = 20; + static const int REQ_REJECTED = 40; + static const int CREDENTIALS_REJECTED = 43; + static const int UNKNOWN = 50; + static const int AUTH_UNREACHABLE = 53; + static const int BAD_VERSION = 55; + static const int CLIENT_ID_TAKEN = 61; + static const int TX_VIOLATED_UNIQUE = 71; +} diff --git a/lib/src/bindings/signatures.dart b/lib/src/bindings/signatures.dart index a0bbf70f8..c425230f6 100644 --- a/lib/src/bindings/signatures.dart +++ b/lib/src/bindings/signatures.dart @@ -6,6 +6,14 @@ import 'structs.dart'; // ignore_for_file: non_constant_identifier_names +// typedefs for common signatures for different "classes", like store, box, ... +// err fn(objectPtr) +typedef obx_fn_nullary_native = Int32 Function(Pointer obj); +typedef obx_fn_nullary_dart = int Function(Pointer obj); +// err fn(void* objectPtr, Arg1 arg) +typedef obx_fn_unary_native = Int32 Function(Pointer obj, Arg1 arg); +typedef obx_fn_unary_dart = int Function(Pointer obj, Arg1 arg); + // common functions typedef obx_version_native_t = Void Function( Pointer major, Pointer minor, Pointer patch); @@ -266,3 +274,12 @@ typedef obx_bytes_array_set_t = Ret Function( obx_qb_param_alias_dart_t obx_qb_param_alias; */ + +// Sync +typedef obx_sync_available_native_t = Uint8 Function(); +typedef obx_sync_native_t = Pointer Function( + Pointer store, Pointer serverUri); +typedef obx_sync_credentials_native_t = Int32 Function( + Pointer sync, Int32 type, Pointer data, IntPtr size); +typedef obx_sync_credentials_dart_t = int Function( + Pointer sync, int type, Pointer data, int size); diff --git a/lib/src/sync.dart b/lib/src/sync.dart new file mode 100644 index 000000000..eff468248 --- /dev/null +++ b/lib/src/sync.dart @@ -0,0 +1,173 @@ +import 'dart:ffi'; +import 'dart:typed_data' show Uint8List; + +import 'package:ffi/ffi.dart'; + +import 'store.dart'; +import 'bindings/bindings.dart'; +import 'bindings/constants.dart'; +import 'bindings/data_visitor.dart'; +import 'bindings/flatbuffers.dart'; +import 'bindings/helpers.dart'; +import 'bindings/structs.dart'; +import 'store.dart'; + +/// Credentials used to authenticate a sync client against a server. +class SyncCredentials { + final int _type; + final Uint8List _data; + + SyncCredentials(this._type, this._data); + + SyncCredentials.none() + : _type = OBXSyncCredentialsType.NONE, + _data = Uint8List(0); + + SyncCredentials.sharedSecretUint8List(this._data) + : _type = OBXSyncCredentialsType.SHARED_SECRET; + + SyncCredentials.sharedSecretString(String data) + : _type = OBXSyncCredentialsType.SHARED_SECRET, + _data = Uint8List.fromList(data.codeUnits); + + SyncCredentials.googleAuthUint8List(this._data) + : _type = OBXSyncCredentialsType.GOOGLE_AUTH; + + SyncCredentials.googleAuthString(String data) + : _type = OBXSyncCredentialsType.GOOGLE_AUTH, + _data = Uint8List.fromList(data.codeUnits); +} + +// TODO check enum name/align with other bindings - maybe SyncClientState? +enum SyncState { + created, + started, + connected, + loggedIn, + disconnected, + stopped, + dead +} + +enum SyncRequestUpdatesMode { + /// no updates by default, SyncClient::requestUpdates() must be called manually + manual, + + /// same as calling SyncClient::requestUpdates(true) + /// default mode unless overridden by SyncClient::setRequestUpdatesMode() + auto, + + /// same as calling SyncClient::requestUpdates(false) + autoNoPushes +} + +/// Sync client is used to provide ObjectBox Sync client capabilities to your application. +class SyncClient { + final Store _store; + Pointer _cSync; + + /// Creates a sync client associated with the given store and options. + /// This does not initiate any connection attempts yet: call start() to do so. + SyncClient(this._store, String serverUri, SyncCredentials creds) { + if (!Sync.isAvailable()) { + throw Exception('Sync is not available in the given runtime library'); + } + + final cServerUri = Utf8.toUtf8(serverUri); + try { + _cSync = checkObxPtr(bindings.obx_sync(_store.ptr, cServerUri), + 'failed to create sync client'); + } finally { + free(cServerUri); + } + + setCredentials(creds); + } + + /// Closes and cleans up all resources used by this sync client. + /// It can no longer be used afterwards, make a new sync client instead. + /// Does nothing if this sync client has already been closed. + void close() { + checkObx(bindings.obx_sync_close(_cSync)); + } + + /// Gets the current sync client state. + SyncState state() { + final state = bindings.obx_sync_state(_cSync); + switch (state) { + case OBXSyncState.CREATED: + return SyncState.created; + case OBXSyncState.STARTED: + return SyncState.started; + case OBXSyncState.CONNECTED: + return SyncState.connected; + case OBXSyncState.LOGGED_IN: + return SyncState.loggedIn; + case OBXSyncState.DISCONNECTED: + return SyncState.disconnected; + case OBXSyncState.STOPPED: + return SyncState.stopped; + case OBXSyncState.DEAD: + return SyncState.dead; + default: + throw Exception('Unknown sync state: ' + state.toString()); + } + } + + /// Configure authentication credentials. + /// The accepted OBXSyncCredentials type depends on your sync-server configuration. + void setCredentials(SyncCredentials creds) { + final cCreds = OBX_bytes.managedCopyOf(creds._data); + try { + checkObx(bindings.obx_sync_credentials( + _cSync, + creds._type, + creds._type == OBXSyncCredentialsType.NONE ? null : cCreds.ref.ptr, + cCreds.ref.length)); + } finally { + OBX_bytes.freeManaged(cCreds); + } + } + + /// Configures how sync updates are received from the server. + /// If automatic sync updates are turned off, they will need to be requested manually. + void setRequestUpdatesMode(SyncRequestUpdatesMode mode) { + int cMode; + switch (mode) { + case SyncRequestUpdatesMode.manual: + cMode = OBXRequestUpdatesMode.MANUAL; + break; + case SyncRequestUpdatesMode.auto: + cMode = OBXRequestUpdatesMode.AUTO; + break; + case SyncRequestUpdatesMode.autoNoPushes: + cMode = OBXRequestUpdatesMode.AUTO_NO_PUSHES; + break; + default: + throw Exception('Unknown mode argument: ' + mode.toString()); + } + checkObx(bindings.obx_sync_request_updates_mode(_cSync, cMode)); + } + + /// Once the sync client is configured, you can "start" it to initiate synchronization. + /// This method triggers communication in the background and will return immediately. + /// If the synchronization destination is reachable, this background thread will connect to the server, + /// log in (authenticate) and, depending on "update request mode", start syncing data. + /// If the device, network or server is currently offline, connection attempts will be retried later using + /// increasing backoff intervals. + /// If you haven't set the credentials in the options during construction, call setCredentials() before start(). + void start() { + checkObx(bindings.obx_sync_start(_cSync)); + } + + /// Stops this sync client. Does nothing if it is already stopped. + void stop() { + checkObx(bindings.obx_sync_stop(_cSync)); + } +} + +class Sync { + static bool isAvailable() { + return bindings.obx_sync_available() != 0; + } +} From 6b92ca13d24e391539b7aa935ba931efc2902759 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 26 Oct 2020 19:08:10 +0100 Subject: [PATCH 02/20] add SyncedStore extension and some more SyncClient functionality --- lib/src/bindings/bindings.dart | 12 +++++++ lib/src/bindings/signatures.dart | 9 +++-- lib/src/sync.dart | 60 ++++++++++++++++++++++++++++++-- 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/lib/src/bindings/bindings.dart b/lib/src/bindings/bindings.dart index 86826f596..b3b276498 100644 --- a/lib/src/bindings/bindings.dart +++ b/lib/src/bindings/bindings.dart @@ -222,6 +222,9 @@ class _ObjectBoxBindings { obx_fn_unary_dart obx_sync_request_updates_mode; obx_fn_nullary_dart obx_sync_start; obx_fn_nullary_dart obx_sync_stop; + obx_fn_unary_dart obx_sync_updates_request; + obx_fn_nullary_dart obx_sync_updates_cancel; + obx_fn_binary_dart> obx_sync_outgoing_message_count; // TODO return .asFunction() -> requires properly determined static return type Pointer> _fn(String name) { @@ -620,6 +623,15 @@ class _ObjectBoxBindings { .asFunction(); obx_sync_start = _fn('obx_sync_start').asFunction(); obx_sync_stop = _fn('obx_sync_stop').asFunction(); + obx_sync_updates_request = + _fn>('obx_sync_updates_request') + .asFunction(); + obx_sync_updates_cancel = + _fn('obx_sync_updates_cancel').asFunction(); + obx_sync_outgoing_message_count = + _fn>>( + 'obx_sync_outgoing_message_count') + .asFunction(); } } diff --git a/lib/src/bindings/signatures.dart b/lib/src/bindings/signatures.dart index c425230f6..04b75243b 100644 --- a/lib/src/bindings/signatures.dart +++ b/lib/src/bindings/signatures.dart @@ -7,12 +7,17 @@ import 'structs.dart'; // ignore_for_file: non_constant_identifier_names // typedefs for common signatures for different "classes", like store, box, ... -// err fn(objectPtr) +// obx_err fn(objectPtr) typedef obx_fn_nullary_native = Int32 Function(Pointer obj); typedef obx_fn_nullary_dart = int Function(Pointer obj); -// err fn(void* objectPtr, Arg1 arg) +// obx_err fn(void* objectPtr, Arg1 arg) typedef obx_fn_unary_native = Int32 Function(Pointer obj, Arg1 arg); typedef obx_fn_unary_dart = int Function(Pointer obj, Arg1 arg); +// obx_err fn(void* objectPtr, Arg1 arg1, Arg2 arg2) +typedef obx_fn_binary_native = Int32 Function( + Pointer obj, Arg1 arg1, Arg2 arg2); +typedef obx_fn_binary_dart = int Function( + Pointer obj, Arg1 arg1, Arg2 arg2); // common functions typedef obx_version_native_t = Void Function( diff --git a/lib/src/sync.dart b/lib/src/sync.dart index eff468248..613c0d9da 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -6,11 +6,8 @@ import 'package:ffi/ffi.dart'; import 'store.dart'; import 'bindings/bindings.dart'; import 'bindings/constants.dart'; -import 'bindings/data_visitor.dart'; -import 'bindings/flatbuffers.dart'; import 'bindings/helpers.dart'; import 'bindings/structs.dart'; -import 'store.dart'; /// Credentials used to authenticate a sync client against a server. class SyncCredentials { @@ -164,10 +161,67 @@ class SyncClient { void stop() { checkObx(bindings.obx_sync_stop(_cSync)); } + + /// Request updates since we last synchronized our database. + /// @param subscribeForFuturePushes to keep sending us future updates as they come in. + /// @see updatesCancel() to stop the updates + bool requestUpdates(bool subscribeForFuturePushes) { + return checkObxSuccess(bindings.obx_sync_updates_request( + _cSync, subscribeForFuturePushes ? 1 : 0)); + } + + /// Cancel updates from the server so that it will stop sending updates. + /// @see updatesRequest() + bool cancelUpdates() { + return checkObxSuccess(bindings.obx_sync_updates_cancel(_cSync)); + } + + /// Count the number of messages in the outgoing queue, i.e. those waiting to be sent to the server. + /// Note: This calls uses a (read) transaction internally: 1) it's not just a "cheap" return of a single number. + /// While this will still be fast, avoid calling this function excessively. + /// 2) the result follows transaction view semantics, thus it may not always match the actual value. + /// @return the number of messages in the outgoing queue + int outgoingMessageCount({int limit = 0}) { + final count = allocate(); + try { + checkObx(bindings.obx_sync_outgoing_message_count(_cSync, limit, count)); + return count.value; + } finally { + free(count); + } + } } class Sync { + static final Map _clients = {}; + static bool isAvailable() { return bindings.obx_sync_available() != 0; } + + /// Creates a sync client associated with the given store and configures it with the given options. + /// This does not initiate any connection attempts yet: call SyncClient::start() to do so. + /// Before start(), you can still configure some aspects of the sync client, e.g. its "request update" mode. + /// @note While you may not interact with SyncClient directly after start(), you need to hold on to the object. + /// Make sure the SyncClient is not destroyed and thus synchronization can keep running in the background. + static SyncClient client( + Store store, String serverUri, SyncCredentials creds) { + if (_clients.containsKey(store)) { + throw Exception('Only one sync client can be active for a store'); + } + _clients[store] = SyncClient(store, serverUri, creds); + return _clients[store]; + } +} + +extension SyncedStore on Store { + /// Return an existing SyncClient associated with the store or throws if not available. + /// See Sync::client() to create one first. + SyncClient syncClient() { + if (!Sync._clients.containsKey(this)) { + throw Exception( + 'No sync client associated with this store yet. Use Sync::client() to start one first.'); + } + return Sync._clients[this]; + } } From c472e15df815c710c5da79868bcad850d9f7de40 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 27 Oct 2020 13:05:16 +0100 Subject: [PATCH 03/20] SyncClient tests and lifecycle management --- lib/objectbox.dart | 1 + lib/src/sync.dart | 51 ++++++++++++++++++------------ test/sync_test.dart | 75 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 20 deletions(-) create mode 100644 test/sync_test.dart diff --git a/lib/objectbox.dart b/lib/objectbox.dart index e3b693bcf..ac65ae0c7 100644 --- a/lib/objectbox.dart +++ b/lib/objectbox.dart @@ -12,3 +12,4 @@ export 'src/model.dart'; export 'src/modelinfo/index.dart'; export 'src/query/query.dart'; export 'src/store.dart'; +export 'src/sync.dart'; diff --git a/lib/src/sync.dart b/lib/src/sync.dart index 613c0d9da..f8cd4197e 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -4,6 +4,7 @@ import 'dart:typed_data' show Uint8List; import 'package:ffi/ffi.dart'; import 'store.dart'; +import 'util.dart'; import 'bindings/bindings.dart'; import 'bindings/constants.dart'; import 'bindings/helpers.dart'; @@ -63,6 +64,11 @@ class SyncClient { final Store _store; Pointer _cSync; + /// The low-level pointer to this box. + Pointer get ptr => (_cSync.address != 0) + ? _cSync + : throw Exception('SyncClient already closed'); + /// Creates a sync client associated with the given store and options. /// This does not initiate any connection attempts yet: call start() to do so. SyncClient(this._store, String serverUri, SyncCredentials creds) { @@ -85,12 +91,21 @@ class SyncClient { /// It can no longer be used afterwards, make a new sync client instead. /// Does nothing if this sync client has already been closed. void close() { - checkObx(bindings.obx_sync_close(_cSync)); + final err = bindings.obx_sync_close(_cSync); + _cSync = nullptr; + Sync._clients.remove(_store); + StoreCloseObserver.removeListener(_store, this); + checkObx(err); + } + + /// Returns if this sync client is closed and can no longer be used. + bool isClosed() { + return _cSync.address == 0; } /// Gets the current sync client state. SyncState state() { - final state = bindings.obx_sync_state(_cSync); + final state = bindings.obx_sync_state(ptr); switch (state) { case OBXSyncState.CREATED: return SyncState.created; @@ -117,9 +132,9 @@ class SyncClient { final cCreds = OBX_bytes.managedCopyOf(creds._data); try { checkObx(bindings.obx_sync_credentials( - _cSync, + ptr, creds._type, - creds._type == OBXSyncCredentialsType.NONE ? null : cCreds.ref.ptr, + creds._type == OBXSyncCredentialsType.NONE ? nullptr : cCreds.ref.ptr, cCreds.ref.length)); } finally { OBX_bytes.freeManaged(cCreds); @@ -143,7 +158,7 @@ class SyncClient { default: throw Exception('Unknown mode argument: ' + mode.toString()); } - checkObx(bindings.obx_sync_request_updates_mode(_cSync, cMode)); + checkObx(bindings.obx_sync_request_updates_mode(ptr, cMode)); } /// Once the sync client is configured, you can "start" it to initiate synchronization. @@ -154,12 +169,12 @@ class SyncClient { /// increasing backoff intervals. /// If you haven't set the credentials in the options during construction, call setCredentials() before start(). void start() { - checkObx(bindings.obx_sync_start(_cSync)); + checkObx(bindings.obx_sync_start(ptr)); } /// Stops this sync client. Does nothing if it is already stopped. void stop() { - checkObx(bindings.obx_sync_stop(_cSync)); + checkObx(bindings.obx_sync_stop(ptr)); } /// Request updates since we last synchronized our database. @@ -167,13 +182,13 @@ class SyncClient { /// @see updatesCancel() to stop the updates bool requestUpdates(bool subscribeForFuturePushes) { return checkObxSuccess(bindings.obx_sync_updates_request( - _cSync, subscribeForFuturePushes ? 1 : 0)); + ptr, subscribeForFuturePushes ? 1 : 0)); } /// Cancel updates from the server so that it will stop sending updates. /// @see updatesRequest() bool cancelUpdates() { - return checkObxSuccess(bindings.obx_sync_updates_cancel(_cSync)); + return checkObxSuccess(bindings.obx_sync_updates_cancel(ptr)); } /// Count the number of messages in the outgoing queue, i.e. those waiting to be sent to the server. @@ -184,7 +199,7 @@ class SyncClient { int outgoingMessageCount({int limit = 0}) { final count = allocate(); try { - checkObx(bindings.obx_sync_outgoing_message_count(_cSync, limit, count)); + checkObx(bindings.obx_sync_outgoing_message_count(ptr, limit, count)); return count.value; } finally { free(count); @@ -209,19 +224,15 @@ class Sync { if (_clients.containsKey(store)) { throw Exception('Only one sync client can be active for a store'); } - _clients[store] = SyncClient(store, serverUri, creds); - return _clients[store]; + final client = SyncClient(store, serverUri, creds); + _clients[store] = client; + StoreCloseObserver.addListener(store, client, client.close); + return client; } } extension SyncedStore on Store { - /// Return an existing SyncClient associated with the store or throws if not available. + /// Return an existing SyncClient associated with the store or null if not available. /// See Sync::client() to create one first. - SyncClient syncClient() { - if (!Sync._clients.containsKey(this)) { - throw Exception( - 'No sync client associated with this store yet. Use Sync::client() to start one first.'); - } - return Sync._clients[this]; - } + SyncClient syncClient() => Sync._clients[this]; } diff --git a/test/sync_test.dart b/test/sync_test.dart new file mode 100644 index 000000000..c0f14c1e7 --- /dev/null +++ b/test/sync_test.dart @@ -0,0 +1,75 @@ +import 'package:test/test.dart'; +import 'package:objectbox/objectbox.dart'; +import 'test_env.dart'; + +// We want to have types explicit - verifying the return types of functions. +// ignore_for_file: omit_local_variable_types + +void main() { + TestEnv env; + Store store; + + setUp(() { + env = TestEnv('sync'); + store = env.store; + }); + + tearDown(() { + env.close(); + }); + + // lambda to easily create clients in the test below + SyncClient createClient(Store s) => + Sync.client(s, 'ws://127.0.0.1:9999', SyncCredentials.none()); + + test('SyncClient lifecycle', () { + expect(store.syncClient(), isNull); + + SyncClient c1 = createClient(store); + + // Store now has the client available in cache. + expect(store.syncClient(), equals(c1)); + + // Can't have two clients on the same store. + expect( + () => createClient(store), + throwsA(predicate( + (Exception e) => e.toString().contains('one sync client')))); + + // But we can have another one after the previous is closed or destroyed. + expect(c1.isClosed(), isFalse); + c1.close(); + expect(c1.isClosed(), isTrue); + expect(store.syncClient(), isNull); + + { + // Just losing the variable scope doesn't close the client automatically. + // Store holds onto the same instance. + final c2 = createClient(store); + expect(c2.isClosed(), isFalse); + } + + // But we can still get a handle of the client in the store - we're never + // completely without an option to close it. + final c2 = store.syncClient(); + expect(c2, isNotNull); + expect(c2.isClosed(), isFalse); + c2.close(); + expect(store.syncClient(), isNull); + + // closing a store closes a client + final env2 = TestEnv('sync2'); + final c3 = createClient(env2.store); + env2.close(); + expect(c3.isClosed(), isTrue); + }); + + test('different Store => different SyncClient', () { + SyncClient c1 = createClient(store); + + final env2 = TestEnv('sync2'); + SyncClient c2 = createClient(env2.store); + expect(c1, isNot(equals(c2))); + env2.close(); + }); +} From 04fc0c30c3a1d5c7a15cc745fcc790b4a18fc263 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 27 Oct 2020 18:42:11 +0100 Subject: [PATCH 04/20] SyncClient more tests --- test/sync_test.dart | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/sync_test.dart b/test/sync_test.dart index c0f14c1e7..86ecd8653 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -72,4 +72,50 @@ void main() { expect(c1, isNot(equals(c2))); env2.close(); }); + + test('SyncClient states (no server available)', () { + SyncClient client = createClient(store); + expect(client.state(), equals(SyncState.created)); + client.start(); + expect(client.state(), equals(SyncState.started)); + client.stop(); + expect(client.state(), equals(SyncState.stopped)); + }); + + test('SyncClient access after closing must throw', () { + SyncClient c = createClient(store); + c.close(); + expect(c.isClosed(), isTrue); + + final error = throwsA(predicate( + (Exception e) => e.toString().contains('SyncClient already closed'))); + expect(() => c.start(), error); + expect(() => c.stop(), error); + expect(() => c.state(), error); + expect(() => c.cancelUpdates(), error); + expect(() => c.requestUpdates(true), error); + expect(() => c.outgoingMessageCount(), error); + expect(() => c.setCredentials(SyncCredentials.none()), error); + expect(() => c.setRequestUpdatesMode(SyncRequestUpdatesMode.auto), error); + }); + + test('SyncClient simple coverage (no server available)', () { + SyncClient c = createClient(store); + expect(c.isClosed(), isFalse); + c.setCredentials(SyncCredentials.none()); + c.setCredentials(SyncCredentials.googleAuthString('secret')); + c.setCredentials(SyncCredentials.sharedSecretString('secret')); + c.setCredentials( + SyncCredentials.googleAuthUint8List(Uint8List.fromList([13, 0, 25]))); + c.setCredentials(SyncCredentials.sharedSecretUint8List( + Uint8List.fromList([13, 0, 25]))); + c.setCredentials(SyncCredentials.none()); + c.setRequestUpdatesMode(SyncRequestUpdatesMode.manual); + c.start(); + expect(c.requestUpdates(true), isFalse); // false because not connected + expect(c.requestUpdates(false), isFalse); // false because not connected + expect(c.outgoingMessageCount(), isZero); + c.stop(); + expect(c.state(), equals(SyncState.stopped)); + }); } From 863be5a8830e839f80de773ae619514ffa28f500 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 27 Oct 2020 18:57:45 +0100 Subject: [PATCH 05/20] SyncClient handle sync not available during runtime --- lib/src/bindings/bindings.dart | 46 ++++---- test/sync_test.dart | 195 ++++++++++++++++++--------------- 2 files changed, 132 insertions(+), 109 deletions(-) diff --git a/lib/src/bindings/bindings.dart b/lib/src/bindings/bindings.dart index b3b276498..b637e3324 100644 --- a/lib/src/bindings/bindings.dart +++ b/lib/src/bindings/bindings.dart @@ -613,25 +613,33 @@ class _ObjectBoxBindings { // Sync obx_sync_available = _fn('obx_sync_available').asFunction(); - obx_sync = _fn('obx_sync').asFunction(); - obx_sync_close = _fn('obx_sync_close').asFunction(); - obx_sync_credentials = - _fn('obx_sync_credentials').asFunction(); - obx_sync_state = _fn('obx_sync_state').asFunction(); - obx_sync_request_updates_mode = - _fn>('obx_sync_request_updates_mode') - .asFunction(); - obx_sync_start = _fn('obx_sync_start').asFunction(); - obx_sync_stop = _fn('obx_sync_stop').asFunction(); - obx_sync_updates_request = - _fn>('obx_sync_updates_request') - .asFunction(); - obx_sync_updates_cancel = - _fn('obx_sync_updates_cancel').asFunction(); - obx_sync_outgoing_message_count = - _fn>>( - 'obx_sync_outgoing_message_count') - .asFunction(); + try { + obx_sync = _fn('obx_sync').asFunction(); + obx_sync_close = + _fn('obx_sync_close').asFunction(); + obx_sync_credentials = + _fn('obx_sync_credentials') + .asFunction(); + obx_sync_state = + _fn('obx_sync_state').asFunction(); + obx_sync_request_updates_mode = + _fn>('obx_sync_request_updates_mode') + .asFunction(); + obx_sync_start = + _fn('obx_sync_start').asFunction(); + obx_sync_stop = _fn('obx_sync_stop').asFunction(); + obx_sync_updates_request = + _fn>('obx_sync_updates_request') + .asFunction(); + obx_sync_updates_cancel = + _fn('obx_sync_updates_cancel').asFunction(); + obx_sync_outgoing_message_count = + _fn>>( + 'obx_sync_outgoing_message_count') + .asFunction(); + } catch (e) { + // sync functions may be undefined when in non-sync lib + } } } diff --git a/test/sync_test.dart b/test/sync_test.dart index 86ecd8653..536d47ddc 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -1,3 +1,5 @@ +import 'dart:typed_data'; + import 'package:test/test.dart'; import 'package:objectbox/objectbox.dart'; import 'test_env.dart'; @@ -15,107 +17,120 @@ void main() { }); tearDown(() { - env.close(); + if (env != null) env.close(); }); // lambda to easily create clients in the test below SyncClient createClient(Store s) => Sync.client(s, 'ws://127.0.0.1:9999', SyncCredentials.none()); - test('SyncClient lifecycle', () { - expect(store.syncClient(), isNull); - - SyncClient c1 = createClient(store); + if (Sync.isAvailable()) { + // TESTS to run when SYNC is available - // Store now has the client available in cache. - expect(store.syncClient(), equals(c1)); + test('SyncClient lifecycle', () { + expect(store.syncClient(), isNull); - // Can't have two clients on the same store. - expect( - () => createClient(store), - throwsA(predicate( - (Exception e) => e.toString().contains('one sync client')))); + SyncClient c1 = createClient(store); - // But we can have another one after the previous is closed or destroyed. - expect(c1.isClosed(), isFalse); - c1.close(); - expect(c1.isClosed(), isTrue); - expect(store.syncClient(), isNull); + // Store now has the client available in cache. + expect(store.syncClient(), equals(c1)); - { - // Just losing the variable scope doesn't close the client automatically. - // Store holds onto the same instance. - final c2 = createClient(store); - expect(c2.isClosed(), isFalse); - } - - // But we can still get a handle of the client in the store - we're never - // completely without an option to close it. - final c2 = store.syncClient(); - expect(c2, isNotNull); - expect(c2.isClosed(), isFalse); - c2.close(); - expect(store.syncClient(), isNull); - - // closing a store closes a client - final env2 = TestEnv('sync2'); - final c3 = createClient(env2.store); - env2.close(); - expect(c3.isClosed(), isTrue); - }); + // Can't have two clients on the same store. + expect( + () => createClient(store), + throwsA(predicate( + (Exception e) => e.toString().contains('one sync client')))); - test('different Store => different SyncClient', () { - SyncClient c1 = createClient(store); + // But we can have another one after the previous is closed or destroyed. + expect(c1.isClosed(), isFalse); + c1.close(); + expect(c1.isClosed(), isTrue); + expect(store.syncClient(), isNull); - final env2 = TestEnv('sync2'); - SyncClient c2 = createClient(env2.store); - expect(c1, isNot(equals(c2))); - env2.close(); - }); + { + // Just losing the variable scope doesn't close the client automatically. + // Store holds onto the same instance. + final c2 = createClient(store); + expect(c2.isClosed(), isFalse); + } - test('SyncClient states (no server available)', () { - SyncClient client = createClient(store); - expect(client.state(), equals(SyncState.created)); - client.start(); - expect(client.state(), equals(SyncState.started)); - client.stop(); - expect(client.state(), equals(SyncState.stopped)); - }); - - test('SyncClient access after closing must throw', () { - SyncClient c = createClient(store); - c.close(); - expect(c.isClosed(), isTrue); - - final error = throwsA(predicate( - (Exception e) => e.toString().contains('SyncClient already closed'))); - expect(() => c.start(), error); - expect(() => c.stop(), error); - expect(() => c.state(), error); - expect(() => c.cancelUpdates(), error); - expect(() => c.requestUpdates(true), error); - expect(() => c.outgoingMessageCount(), error); - expect(() => c.setCredentials(SyncCredentials.none()), error); - expect(() => c.setRequestUpdatesMode(SyncRequestUpdatesMode.auto), error); - }); - - test('SyncClient simple coverage (no server available)', () { - SyncClient c = createClient(store); - expect(c.isClosed(), isFalse); - c.setCredentials(SyncCredentials.none()); - c.setCredentials(SyncCredentials.googleAuthString('secret')); - c.setCredentials(SyncCredentials.sharedSecretString('secret')); - c.setCredentials( - SyncCredentials.googleAuthUint8List(Uint8List.fromList([13, 0, 25]))); - c.setCredentials(SyncCredentials.sharedSecretUint8List( - Uint8List.fromList([13, 0, 25]))); - c.setCredentials(SyncCredentials.none()); - c.setRequestUpdatesMode(SyncRequestUpdatesMode.manual); - c.start(); - expect(c.requestUpdates(true), isFalse); // false because not connected - expect(c.requestUpdates(false), isFalse); // false because not connected - expect(c.outgoingMessageCount(), isZero); - c.stop(); - expect(c.state(), equals(SyncState.stopped)); - }); + // But we can still get a handle of the client in the store - we're never + // completely without an option to close it. + final c2 = store.syncClient(); + expect(c2, isNotNull); + expect(c2.isClosed(), isFalse); + c2.close(); + expect(store.syncClient(), isNull); + + // closing a store closes a client + final env2 = TestEnv('sync2'); + final c3 = createClient(env2.store); + env2.close(); + expect(c3.isClosed(), isTrue); + }); + + test('different Store => different SyncClient', () { + SyncClient c1 = createClient(store); + + final env2 = TestEnv('sync2'); + SyncClient c2 = createClient(env2.store); + expect(c1, isNot(equals(c2))); + env2.close(); + }); + + test('SyncClient states (no server available)', () { + SyncClient client = createClient(store); + expect(client.state(), equals(SyncState.created)); + client.start(); + expect(client.state(), equals(SyncState.started)); + client.stop(); + expect(client.state(), equals(SyncState.stopped)); + }); + + test('SyncClient access after closing must throw', () { + SyncClient c = createClient(store); + c.close(); + expect(c.isClosed(), isTrue); + + final error = throwsA(predicate( + (Exception e) => e.toString().contains('SyncClient already closed'))); + expect(() => c.start(), error); + expect(() => c.stop(), error); + expect(() => c.state(), error); + expect(() => c.cancelUpdates(), error); + expect(() => c.requestUpdates(true), error); + expect(() => c.outgoingMessageCount(), error); + expect(() => c.setCredentials(SyncCredentials.none()), error); + expect(() => c.setRequestUpdatesMode(SyncRequestUpdatesMode.auto), error); + }); + + test('SyncClient simple coverage (no server available)', () { + SyncClient c = createClient(store); + expect(c.isClosed(), isFalse); + c.setCredentials(SyncCredentials.none()); + c.setCredentials(SyncCredentials.googleAuthString('secret')); + c.setCredentials(SyncCredentials.sharedSecretString('secret')); + c.setCredentials( + SyncCredentials.googleAuthUint8List(Uint8List.fromList([13, 0, 25]))); + c.setCredentials(SyncCredentials.sharedSecretUint8List( + Uint8List.fromList([13, 0, 25]))); + c.setCredentials(SyncCredentials.none()); + c.setRequestUpdatesMode(SyncRequestUpdatesMode.manual); + c.start(); + expect(c.requestUpdates(true), isFalse); // false because not connected + expect(c.requestUpdates(false), isFalse); // false because not connected + expect(c.outgoingMessageCount(), isZero); + c.stop(); + expect(c.state(), equals(SyncState.stopped)); + }); + } else { + // TESTS to run when SYNC isn't available + + test('SyncClient cannot be created when running with non-sync library', () { + expect( + () => createClient(store), + throwsA(predicate((Exception e) => e.toString().contains( + 'Sync is not available in the given runtime library')))); + }); + } } From 5d258f11f310ae0b70b2c0426823c540b1768bb7 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 2 Nov 2020 14:38:17 +0100 Subject: [PATCH 06/20] add model entity flags and sync annotation support in the generator --- generator/integration-tests/basics/1.dart | 13 ++++++++++++- .../integration-tests/basics/lib/lib.dart | 9 +++++++++ generator/integration-tests/common.dart | 4 ++++ generator/lib/src/code_builder.dart | 5 +++-- generator/lib/src/entity_resolver.dart | 19 +++++++++++++------ lib/integration_test.dart | 2 +- lib/src/annotations.dart | 9 +++++++++ lib/src/bindings/constants.dart | 5 +++++ lib/src/modelinfo/modelentity.dart | 11 +++++++++-- lib/src/modelinfo/modelinfo.dart | 2 +- lib/src/modelinfo/modelproperty.dart | 4 ++++ lib/src/sync.dart | 3 +++ test/entity.dart | 1 + test/objectbox-model.json | 1 + 14 files changed, 75 insertions(+), 13 deletions(-) diff --git a/generator/integration-tests/basics/1.dart b/generator/integration-tests/basics/1.dart index 0a42f411b..bcd2fc74e 100644 --- a/generator/integration-tests/basics/1.dart +++ b/generator/integration-tests/basics/1.dart @@ -4,10 +4,13 @@ import 'lib/objectbox.g.dart'; import 'package:test/test.dart'; import '../test_env.dart'; import '../common.dart'; +import 'package:objectbox/src/bindings/constants.dart'; void main() { TestEnv env; + final jsonModel = readModelJson('lib'); final defs = getObjectBoxModel(); + final model = defs.model; setUp(() { env = TestEnv(defs); @@ -17,11 +20,19 @@ void main() { env.close(); }); - commonModelTests(defs, readModelJson('lib')); + commonModelTests(defs, jsonModel); test('project must be generated properly', () { expect(TestEnv.dir.existsSync(), true); expect(File('lib/objectbox.g.dart').existsSync(), true); expect(File('lib/objectbox-model.json').existsSync(), true); }); + + test('sync annotation', () { + expect(entity(model, 'A').flags, equals(0)); + expect(entity(jsonModel, 'A').flags, equals(0)); + + expect(entity(model, 'D').flags, equals(OBXEntityFlag.SYNC_ENABLED)); + expect(entity(jsonModel, 'D').flags, equals(OBXEntityFlag.SYNC_ENABLED)); + }); } diff --git a/generator/integration-tests/basics/lib/lib.dart b/generator/integration-tests/basics/lib/lib.dart index 279de42bc..99aad18c8 100644 --- a/generator/integration-tests/basics/lib/lib.dart +++ b/generator/integration-tests/basics/lib/lib.dart @@ -18,3 +18,12 @@ class B { B(); } + +@Entity() +@Sync() +class D { + @Id() + int id; + + D(); +} diff --git a/generator/integration-tests/common.dart b/generator/integration-tests/common.dart index 7585f6590..8509e1bab 100644 --- a/generator/integration-tests/common.dart +++ b/generator/integration-tests/common.dart @@ -69,3 +69,7 @@ commonModelTests(ModelDefinition defs, ModelInfo jsonModel) { // testLastId(defs.model.lastRelationId, defs.model.entities.map((el) => ...), jsonModel.retiredRelationUids); // }); } + +ModelEntity entity(ModelInfo model, String name) { + return model.entities.firstWhere((ModelEntity e) => e.name == name); +} diff --git a/generator/lib/src/code_builder.dart b/generator/lib/src/code_builder.dart index 607c688a7..1d8a42450 100644 --- a/generator/lib/src/code_builder.dart +++ b/generator/lib/src/code_builder.dart @@ -153,10 +153,11 @@ class CodeBuilder extends Builder { // in case the entity is created (i.e. when its given UID or name that does not yet exist), we are done, as nothing needs to be merged final createdEntity = modelInfo.addEntity(entity); return createdEntity.id; + } else { + entityInModel.name = entity.name; + entityInModel.flags = entity.flags; } - entityInModel.name = entity.name; - // here, the entity was found already and entityInModel and readEntity might differ, i.e. conflicts need to be resolved, so merge all properties first entity.properties.forEach((p) => mergeProperty(entityInModel, p)); diff --git a/generator/lib/src/entity_resolver.dart b/generator/lib/src/entity_resolver.dart index dd533b62d..4690fb1f6 100644 --- a/generator/lib/src/entity_resolver.dart +++ b/generator/lib/src/entity_resolver.dart @@ -21,6 +21,7 @@ class EntityResolver extends Builder { final _propertyChecker = const TypeChecker.fromRuntime(obx.Property); final _idChecker = const TypeChecker.fromRuntime(obx.Id); final _transientChecker = const TypeChecker.fromRuntime(obx.Transient); + final _syncChecker = const TypeChecker.fromRuntime(obx.Sync); @override FutureOr build(BuildStep buildStep) async { @@ -49,16 +50,22 @@ class EntityResolver extends Builder { throw InvalidGenerationSourceError( "in target ${elementBare.name}: annotated element isn't a class"); } + var element = elementBare as ClassElement; // process basic entity (note that allModels.createEntity is not used, as the entity will be merged) - final readEntity = ModelEntity(IdUid.empty(), null, element.name, [], null); + final entity = ModelEntity(IdUid.empty(), null, element.name, 0, [], null); var entityUid = annotation.read('uid'); if (entityUid != null && !entityUid.isNull) { - readEntity.id.uid = entityUid.intValue; + entity.id.uid = entityUid.intValue; + } + + if (_syncChecker.hasAnnotationOfExact(element)) { + entity.flags |= OBXEntityFlag.SYNC_ENABLED; } - log.info('entity ${readEntity.name}(${readEntity.id})'); + log.info('entity ${entity.name}(${entity.id}), sync=' + + (entity.hasFlag(OBXEntityFlag.SYNC_ENABLED) ? 'ON' : 'OFF')); // getters, ... (anything else?) final readOnlyFields = {}; @@ -134,9 +141,9 @@ class EntityResolver extends Builder { // create property (do not use readEntity.createProperty in order to avoid generating new ids) final prop = - ModelProperty(IdUid.empty(), f.name, fieldType, flags, readEntity); + ModelProperty(IdUid.empty(), f.name, fieldType, flags, entity); if (propUid != null) prop.id.uid = propUid; - readEntity.properties.add(prop); + entity.properties.add(prop); log.info( ' property ${prop.name}(${prop.id}) type:${prop.type} flags:${prop.flags}'); @@ -148,6 +155,6 @@ class EntityResolver extends Builder { 'in target ${elementBare.name}: has no properties annotated with @Id'); } - return readEntity; + return entity; } } diff --git a/lib/integration_test.dart b/lib/integration_test.dart index 5442ffdbc..78f667cdf 100644 --- a/lib/integration_test.dart +++ b/lib/integration_test.dart @@ -22,7 +22,7 @@ class IntegrationTest { final property = ModelProperty( IdUid(1, int64_max - 1), 'id', OBXPropertyType.Long, 0, null); final entity = - ModelEntity(IdUid(1, int64_max), null, 'entity', [], modelInfo); + ModelEntity(IdUid(1, int64_max), null, 'entity', 0, [], modelInfo); property.entity = entity; entity.properties.add(property); entity.lastPropertyId = property.id; diff --git a/lib/src/annotations.dart b/lib/src/annotations.dart index aff1fd12b..b4d5638e0 100644 --- a/lib/src/annotations.dart +++ b/lib/src/annotations.dart @@ -1,5 +1,6 @@ class Entity { final int uid; + const Entity({this.uid}); } @@ -13,14 +14,22 @@ class Entity { /// Use OBXPropertyType and OBXPropertyFlag values, resp. for type and flag. class Property { final int uid, type, flag; + const Property({this.type, this.flag, this.uid}); } class Id { final int uid; + const Id({this.uid}); } class Transient { const Transient(); } + +/// See Sync() in sync.dart. +/// Defining a class with the same name here would couse a duplicate export. +// class Sync { +// const Sync(); +// } diff --git a/lib/src/bindings/constants.dart b/lib/src/bindings/constants.dart index dd34aac39..75765490a 100644 --- a/lib/src/bindings/constants.dart +++ b/lib/src/bindings/constants.dart @@ -14,6 +14,11 @@ class OBXPropertyType { static const int StringVector = 30; } +// see objectbox.h for more info +class OBXEntityFlag { + static const int SYNC_ENABLED = 2; +} + // see objectbox.h for more info class OBXPropertyFlag { static const int ID = 1; diff --git a/lib/src/modelinfo/modelentity.dart b/lib/src/modelinfo/modelentity.dart index c7240cd44..4db18dbb5 100644 --- a/lib/src/modelinfo/modelentity.dart +++ b/lib/src/modelinfo/modelentity.dart @@ -9,6 +9,7 @@ import 'package:objectbox/src/bindings/constants.dart'; class ModelEntity { IdUid id, lastPropertyId; String name; + int flags; List properties; ModelProperty idProperty; ModelInfo _model; @@ -16,8 +17,8 @@ class ModelEntity { ModelInfo get model => (_model == null) ? throw Exception('model is null') : _model; - ModelEntity( - this.id, this.lastPropertyId, this.name, this.properties, this._model) { + ModelEntity(this.id, this.lastPropertyId, this.name, this.flags, + this.properties, this._model) { validate(); } @@ -27,6 +28,7 @@ class ModelEntity { id = IdUid.fromString(data['id']); lastPropertyId = IdUid.fromString(data['lastPropertyId']); name = data['name']; + flags = data['flags'] ?? 0; properties = data['properties'] .map((p) => ModelProperty.fromMap(p, this, check: check)) .toList(); @@ -83,6 +85,7 @@ class ModelEntity { ret['lastPropertyId'] = lastPropertyId == null ? null : lastPropertyId.toString(); ret['name'] = name; + if (flags != 0) ret['flags'] = flags; ret['properties'] = properties.map((p) => p.toMap()).toList(); return ret; } @@ -150,4 +153,8 @@ class ModelEntity { } return false; } + + bool hasFlag(int flag) { + return (flags & flag) == flag; + } } diff --git a/lib/src/modelinfo/modelinfo.dart b/lib/src/modelinfo/modelinfo.dart index 3b42ea895..7f437a8f8 100644 --- a/lib/src/modelinfo/modelinfo.dart +++ b/lib/src/modelinfo/modelinfo.dart @@ -183,7 +183,7 @@ class ModelInfo { } final uniqueUid = uid == 0 ? generateUid() : uid; - var entity = ModelEntity(IdUid(id, uniqueUid), null, name, [], this); + var entity = ModelEntity(IdUid(id, uniqueUid), null, name, 0, [], this); entities.add(entity); lastEntityId = entity.id; return entity; diff --git a/lib/src/modelinfo/modelproperty.dart b/lib/src/modelinfo/modelproperty.dart index 717014750..032bb60b6 100644 --- a/lib/src/modelinfo/modelproperty.dart +++ b/lib/src/modelinfo/modelproperty.dart @@ -42,4 +42,8 @@ class ModelProperty { bool containsUid(int searched) { return id.uid == searched; } + + bool hasFlag(int flag) { + return (flags & flag) == flag; + } } diff --git a/lib/src/sync.dart b/lib/src/sync.dart index f8cd4197e..cb97fdb9b 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -210,6 +210,9 @@ class SyncClient { class Sync { static final Map _clients = {}; + /// Sync() annotation enables synchronization for an entity. + const Sync(); + static bool isAvailable() { return bindings.obx_sync_available() != 0; } diff --git a/test/entity.dart b/test/entity.dart index aaaeef2d4..e8e20defc 100644 --- a/test/entity.dart +++ b/test/entity.dart @@ -7,6 +7,7 @@ class TestingUnknownAnnotation { @Entity() @TestingUnknownAnnotation() +@Sync() class TestEntity { @Id() @TestingUnknownAnnotation() diff --git a/test/objectbox-model.json b/test/objectbox-model.json index 658cfbaa9..c081e636a 100644 --- a/test/objectbox-model.json +++ b/test/objectbox-model.json @@ -7,6 +7,7 @@ "id": "1:4630700155272683157", "lastPropertyId": "14:2723176855509462268", "name": "TestEntity", + "flags": 2, "properties": [ { "id": "1:1502777149103994787", From 73d279906f04a3348489e259c988bfd889cf10d2 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 2 Nov 2020 16:09:26 +0100 Subject: [PATCH 07/20] pass entity flags to C during model setup --- lib/src/bindings/bindings.dart | 6 ++++-- lib/src/bindings/signatures.dart | 2 +- lib/src/model.dart | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/src/bindings/bindings.dart b/lib/src/bindings/bindings.dart index b637e3324..5c20627c8 100644 --- a/lib/src/bindings/bindings.dart +++ b/lib/src/bindings/bindings.dart @@ -43,6 +43,7 @@ class _ObjectBoxBindings { Pointer Function(Pointer model) obx_model_error_message; int Function(Pointer model, Pointer name, int entity_id, int entity_uid) obx_model_entity; + int Function(Pointer model, int flags) obx_model_entity_flags; int Function(Pointer model, Pointer name, int type, int property_id, int property_uid) obx_model_property; int Function(Pointer model, int flags) obx_model_property_flags; @@ -310,11 +311,12 @@ class _ObjectBoxBindings { .asFunction(); obx_model_entity = _fn('obx_model_entity').asFunction(); + obx_model_entity_flags = + _fn('obx_model_entity_flags').asFunction(); obx_model_property = _fn('obx_model_property').asFunction(); obx_model_property_flags = - _fn('obx_model_property_flags') - .asFunction(); + _fn('obx_model_property_flags').asFunction(); obx_model_entity_last_property_id = _fn( 'obx_model_entity_last_property_id') diff --git a/lib/src/bindings/signatures.dart b/lib/src/bindings/signatures.dart index 04b75243b..c7601eb29 100644 --- a/lib/src/bindings/signatures.dart +++ b/lib/src/bindings/signatures.dart @@ -48,7 +48,7 @@ typedef obx_model_entity_native_t = Int32 Function(Pointer model, Pointer name, Uint32 entity_id, Uint64 entity_uid); typedef obx_model_property_native_t = Int32 Function(Pointer model, Pointer name, Uint32 type, Uint32 property_id, Uint64 property_uid); -typedef obx_model_property_flags_native_t = Int32 Function( +typedef obx_model_flags_native_t = Int32 Function( Pointer model, Uint32 flags); typedef obx_model_entity_last_property_id_native_t = Int32 Function( Pointer model, Uint32 property_id, Uint64 property_uid); diff --git a/lib/src/model.dart b/lib/src/model.dart index e6ababf2b..79180d870 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -46,6 +46,10 @@ class Model { free(name); } + if (entity.flags != 0) { + _check(bindings.obx_model_entity_flags(_cModel, entity.flags)); + } + // add all properties entity.properties.forEach(addProperty); From be04072b0d9e6ffe4dae936d0ae7b38c3bb7f13b Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 2 Nov 2020 17:49:57 +0100 Subject: [PATCH 08/20] SyncClient - add simple data synchronization test skipped unless run manually against a local sync-server --- test/sync_test.dart | 30 ++++++++++++++++++++++++++++++ test/test_env.dart | 12 ++++++++++++ 2 files changed, 42 insertions(+) diff --git a/test/sync_test.dart b/test/sync_test.dart index 536d47ddc..45084c997 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -1,7 +1,9 @@ +import 'dart:math'; import 'dart:typed_data'; import 'package:test/test.dart'; import 'package:objectbox/objectbox.dart'; +import 'entity.dart'; import 'test_env.dart'; // We want to have types explicit - verifying the return types of functions. @@ -24,6 +26,14 @@ void main() { SyncClient createClient(Store s) => Sync.client(s, 'ws://127.0.0.1:9999', SyncCredentials.none()); + // lambda to easily create clients in the test below + SyncClient loggedInClient(Store s) { + final client = createClient(s); + client.start(); + expect(waitUntil(() => client.state() == SyncState.loggedIn), isTrue); + return client; + } + if (Sync.isAvailable()) { // TESTS to run when SYNC is available @@ -123,6 +133,26 @@ void main() { c.stop(); expect(c.state(), equals(SyncState.stopped)); }); + + test('SyncClient - data test (requires manual server setup)', () { + final env2 = TestEnv('sync2'); + + loggedInClient(env.store); + loggedInClient(env2.store); + + int id = env.box.put(TestEntity(tLong: Random().nextInt(1 << 32))); + expect(waitUntil(() => env2.box.get(id) != null), isTrue); + + final read1 = env.box.get(id); + final read2 = env2.box.get(id); + expect(read1.id, equals(read2.id)); + expect(read1.tLong, equals(read2.tLong)); + }, + // Note: only available when you start a sync server manually. + // Comment out the `skip: ` argument in tthe test-case definition. + // run sync-server --unsecured-no-authentication --model=/path/objectbox-dart/test/objectbox-model.json + // skip: 'Data sync test is disabled, Enable after running sync-server.' // + ); } else { // TESTS to run when SYNC isn't available diff --git a/test/test_env.dart b/test/test_env.dart index dfa2e9929..16321bedf 100644 --- a/test/test_env.dart +++ b/test/test_env.dart @@ -19,3 +19,15 @@ class TestEnv { if (dir.existsSync()) dir.deleteSync(recursive: true); } } + +/// "Busy-waits" until the predicate returns true. +bool waitUntil(bool Function() predicate, {int timeoutMs = 1000}) { + var success = false; + final until = DateTime.now().millisecondsSinceEpoch + timeoutMs; + + while (!(success = predicate()) && + until > DateTime.now().millisecondsSinceEpoch) { + sleep(Duration(milliseconds: 1)); + } + return success; +} From 6f27164b71be206c3f757f33819ab9d504579c9b Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 3 Nov 2020 10:56:54 +0100 Subject: [PATCH 09/20] Sync cleanup and review changes --- generator/lib/src/code_builder.dart | 31 +++++++++++++++-------------- lib/src/annotations.dart | 2 +- lib/src/sync.dart | 18 ++++++++++------- test/sync_test.dart | 30 +++++++++++++++++++--------- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/generator/lib/src/code_builder.dart b/generator/lib/src/code_builder.dart index 1d8a42450..a8c8dfcec 100644 --- a/generator/lib/src/code_builder.dart +++ b/generator/lib/src/code_builder.dart @@ -146,29 +146,30 @@ class CodeBuilder extends Builder { IdUid mergeEntity(ModelInfo modelInfo, ModelEntity entity) { // 'readEntity' only contains the entity info directly read from the annotations and Dart source (i.e. with missing ID, lastPropertyId etc.) // 'entityInModel' is the entity from the model with all correct id/uid, lastPropertyId etc. - final entityInModel = modelInfo.findSameEntity(entity); + var entityInModel = modelInfo.findSameEntity(entity); if (entityInModel == null) { log.info('Found new entity ${entity.name}'); // in case the entity is created (i.e. when its given UID or name that does not yet exist), we are done, as nothing needs to be merged - final createdEntity = modelInfo.addEntity(entity); - return createdEntity.id; + entityInModel = modelInfo.addEntity(entity); + } else { entityInModel.name = entity.name; entityInModel.flags = entity.flags; - } - - // here, the entity was found already and entityInModel and readEntity might differ, i.e. conflicts need to be resolved, so merge all properties first - entity.properties.forEach((p) => mergeProperty(entityInModel, p)); - // then remove all properties not present anymore in readEntity - entityInModel.properties - .where((p) => entity.findSameProperty(p) == null) - .forEach((p) { - log.warning( - 'Property ${entity.name}.${p.name}(${p.id.toString()}) not found in the code, removing from the model'); - entityInModel.removeProperty(p); - }); + // here, the entity was found already and entityInModel and readEntity might differ, i.e. conflicts need to be resolved, so merge all properties first + entity.properties.forEach((p) => mergeProperty(entityInModel, p)); + + // then remove all properties not present anymore in readEntity + entityInModel.properties + .where((p) => entity.findSameProperty(p) == null) + .forEach((p) { + log.warning( + 'Property ${entity.name}.${p.name}(${p.id + .toString()}) not found in the code, removing from the model'); + entityInModel.removeProperty(p); + }); + } return entityInModel.id; } diff --git a/lib/src/annotations.dart b/lib/src/annotations.dart index b4d5638e0..fb5c61500 100644 --- a/lib/src/annotations.dart +++ b/lib/src/annotations.dart @@ -29,7 +29,7 @@ class Transient { } /// See Sync() in sync.dart. -/// Defining a class with the same name here would couse a duplicate export. +/// Defining a class with the same name here would cause a duplicate export. // class Sync { // const Sync(); // } diff --git a/lib/src/sync.dart b/lib/src/sync.dart index cb97fdb9b..683fea732 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -1,5 +1,6 @@ import 'dart:ffi'; import 'dart:typed_data' show Uint8List; +import 'dart:convert' show utf8; import 'package:ffi/ffi.dart'; @@ -15,8 +16,13 @@ class SyncCredentials { final int _type; final Uint8List _data; + Uint8List get data => _data; + SyncCredentials(this._type, this._data); + SyncCredentials._(this._type, String data) + : _data = Uint8List.fromList(utf8.encode(data)); + SyncCredentials.none() : _type = OBXSyncCredentialsType.NONE, _data = Uint8List(0); @@ -25,19 +31,17 @@ class SyncCredentials { : _type = OBXSyncCredentialsType.SHARED_SECRET; SyncCredentials.sharedSecretString(String data) - : _type = OBXSyncCredentialsType.SHARED_SECRET, - _data = Uint8List.fromList(data.codeUnits); + : this._(OBXSyncCredentialsType.SHARED_SECRET, data); SyncCredentials.googleAuthUint8List(this._data) : _type = OBXSyncCredentialsType.GOOGLE_AUTH; SyncCredentials.googleAuthString(String data) - : _type = OBXSyncCredentialsType.GOOGLE_AUTH, - _data = Uint8List.fromList(data.codeUnits); + : this._(OBXSyncCredentialsType.GOOGLE_AUTH, data); } -// TODO check enum name/align with other bindings - maybe SyncClientState? enum SyncState { + unknown, created, started, connected, @@ -122,7 +126,7 @@ class SyncClient { case OBXSyncState.DEAD: return SyncState.dead; default: - throw Exception('Unknown sync state: ' + state.toString()); + return SyncState.unknown; } } @@ -220,7 +224,7 @@ class Sync { /// Creates a sync client associated with the given store and configures it with the given options. /// This does not initiate any connection attempts yet: call SyncClient::start() to do so. /// Before start(), you can still configure some aspects of the sync client, e.g. its "request update" mode. - /// @note While you may not interact with SyncClient directly after start(), you need to hold on to the object. + /// Note: While you may not interact with SyncClient directly after start(), you need to hold on to the object. /// Make sure the SyncClient is not destroyed and thus synchronization can keep running in the background. static SyncClient client( Store store, String serverUri, SyncCredentials creds) { diff --git a/test/sync_test.dart b/test/sync_test.dart index 45084c997..916e442d4 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -34,6 +34,15 @@ void main() { return client; } + test('SyncCredentials string encoding', () { + // Let's check some special characters and verify the data is how it would + // look like if the same shared secret was provided to the sync-server via + // an utf-8 encoded json file (i.e. the usual way). + final str = 'uũú'; + expect(SyncCredentials.sharedSecretString(str).data, + equals(Uint8List.fromList([117, 197, 169, 195, 186]))); + }); + if (Sync.isAvailable()) { // TESTS to run when SYNC is available @@ -56,27 +65,30 @@ void main() { c1.close(); expect(c1.isClosed(), isTrue); expect(store.syncClient(), isNull); + }); + test('SyncClient instance caching', () { { // Just losing the variable scope doesn't close the client automatically. // Store holds onto the same instance. - final c2 = createClient(store); - expect(c2.isClosed(), isFalse); + final client = createClient(store); + expect(client.isClosed(), isFalse); } // But we can still get a handle of the client in the store - we're never // completely without an option to close it. - final c2 = store.syncClient(); - expect(c2, isNotNull); - expect(c2.isClosed(), isFalse); - c2.close(); + final client = store.syncClient(); + expect(client, isNotNull); + expect(client.isClosed(), isFalse); + client.close(); expect(store.syncClient(), isNull); + }); - // closing a store closes a client + test('SyncClient is closed when a store is closed', () { final env2 = TestEnv('sync2'); - final c3 = createClient(env2.store); + final client = createClient(env2.store); env2.close(); - expect(c3.isClosed(), isTrue); + expect(client.isClosed(), isTrue); }); test('different Store => different SyncClient', () { From 983340c92f8bd988ecd59800d383a5e1ac19759c Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 3 Nov 2020 15:45:10 +0100 Subject: [PATCH 10/20] Sync docs improvements --- lib/src/sync.dart | 32 +++++++++++++++++++------------- test/sync_test.dart | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/src/sync.dart b/lib/src/sync.dart index 683fea732..75d78b82e 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -52,14 +52,14 @@ enum SyncState { } enum SyncRequestUpdatesMode { - /// no updates by default, SyncClient::requestUpdates() must be called manually + /// no updates by default, [SyncClient.requestUpdates()] must be called manually manual, - /// same as calling SyncClient::requestUpdates(true) - /// default mode unless overridden by SyncClient::setRequestUpdatesMode() + /// same as calling [SyncClient.requestUpdates(true)] + /// default mode unless overridden by [SyncClient.setRequestUpdatesMode()] auto, - /// same as calling SyncClient::requestUpdates(false) + /// same as calling [SyncClient.requestUpdates(false)] autoNoPushes } @@ -77,7 +77,9 @@ class SyncClient { /// This does not initiate any connection attempts yet: call start() to do so. SyncClient(this._store, String serverUri, SyncCredentials creds) { if (!Sync.isAvailable()) { - throw Exception('Sync is not available in the given runtime library'); + throw Exception( + 'Sync is not available in the loaded ObjectBox runtime library. ' + 'Please visit https://objectbox.io/sync/ for options.'); } final cServerUri = Utf8.toUtf8(serverUri); @@ -131,7 +133,7 @@ class SyncClient { } /// Configure authentication credentials. - /// The accepted OBXSyncCredentials type depends on your sync-server configuration. + /// The accepted [SyncCredentials] type depends on your sync-server configuration. void setCredentials(SyncCredentials creds) { final cCreds = OBX_bytes.managedCopyOf(creds._data); try { @@ -171,7 +173,7 @@ class SyncClient { /// log in (authenticate) and, depending on "update request mode", start syncing data. /// If the device, network or server is currently offline, connection attempts will be retried later using /// increasing backoff intervals. - /// If you haven't set the credentials in the options during construction, call setCredentials() before start(). + /// If you haven't set the credentials in the options during construction, call [setCredentials()] before start(). void start() { checkObx(bindings.obx_sync_start(ptr)); } @@ -182,15 +184,16 @@ class SyncClient { } /// Request updates since we last synchronized our database. - /// @param subscribeForFuturePushes to keep sending us future updates as they come in. - /// @see updatesCancel() to stop the updates + /// Additionally, you can subscribe for future pushes from the server, to let + /// it send us future updates as they come in. + /// Call [cancelUpdates()] to stop the updates. bool requestUpdates(bool subscribeForFuturePushes) { return checkObxSuccess(bindings.obx_sync_updates_request( ptr, subscribeForFuturePushes ? 1 : 0)); } /// Cancel updates from the server so that it will stop sending updates. - /// @see updatesRequest() + /// See also [requestUpdates()]. bool cancelUpdates() { return checkObxSuccess(bindings.obx_sync_updates_cancel(ptr)); } @@ -199,7 +202,6 @@ class SyncClient { /// Note: This calls uses a (read) transaction internally: 1) it's not just a "cheap" return of a single number. /// While this will still be fast, avoid calling this function excessively. /// 2) the result follows transaction view semantics, thus it may not always match the actual value. - /// @return the number of messages in the outgoing queue int outgoingMessageCount({int limit = 0}) { final count = allocate(); try { @@ -211,18 +213,22 @@ class SyncClient { } } +/// [ObjectBox Sync](https://objectbox.io/sync/) makes data available on other devices. +/// +/// Start building a sync client using [Sync.client()] and connect to a remote server. class Sync { static final Map _clients = {}; /// Sync() annotation enables synchronization for an entity. const Sync(); + /// Returns true if the loaded ObjectBox native library supports Sync. static bool isAvailable() { return bindings.obx_sync_available() != 0; } /// Creates a sync client associated with the given store and configures it with the given options. - /// This does not initiate any connection attempts yet: call SyncClient::start() to do so. + /// This does not initiate any connection attempts yet: call [SyncClient.start()] to do so. /// Before start(), you can still configure some aspects of the sync client, e.g. its "request update" mode. /// Note: While you may not interact with SyncClient directly after start(), you need to hold on to the object. /// Make sure the SyncClient is not destroyed and thus synchronization can keep running in the background. @@ -240,6 +246,6 @@ class Sync { extension SyncedStore on Store { /// Return an existing SyncClient associated with the store or null if not available. - /// See Sync::client() to create one first. + /// See [Sync.client()] to create one first. SyncClient syncClient() => Sync._clients[this]; } diff --git a/test/sync_test.dart b/test/sync_test.dart index 916e442d4..f4fcd132b 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -172,7 +172,7 @@ void main() { expect( () => createClient(store), throwsA(predicate((Exception e) => e.toString().contains( - 'Sync is not available in the given runtime library')))); + 'Sync is not available in the loaded ObjectBox runtime library')))); }); } } From 6f8ea89cc8008d86341f5d02255ad3d272053cb0 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 14:59:41 +0100 Subject: [PATCH 11/20] Sync C-API bindings - backward compatibility with older C-API v0.10.0 --- lib/src/bindings/bindings.dart | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/src/bindings/bindings.dart b/lib/src/bindings/bindings.dart index 5c20627c8..6f32eba0d 100644 --- a/lib/src/bindings/bindings.dart +++ b/lib/src/bindings/bindings.dart @@ -311,8 +311,14 @@ class _ObjectBoxBindings { .asFunction(); obx_model_entity = _fn('obx_model_entity').asFunction(); - obx_model_entity_flags = - _fn('obx_model_entity_flags').asFunction(); + + // TODO remove try-catch after an update to objectbox-c v0.11.0 + try { + obx_model_entity_flags = + _fn('obx_model_entity_flags').asFunction(); + } catch (e) { + obx_model_entity_flags = (_, __) => 0; + } obx_model_property = _fn('obx_model_property').asFunction(); obx_model_property_flags = @@ -613,8 +619,13 @@ class _ObjectBoxBindings { .asFunction(); // Sync - obx_sync_available = - _fn('obx_sync_available').asFunction(); + // TODO remove try-catch after an update to objectbox-c v0.11.0 + try { + obx_sync_available = + _fn('obx_sync_available').asFunction(); + } catch (e) { + obx_sync_available = () => 0; + } try { obx_sync = _fn('obx_sync').asFunction(); obx_sync_close = From bf4541a4fce78c4a601583b8a4d1b72ed32ec303 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 15:39:24 +0100 Subject: [PATCH 12/20] flutter_libs - update dependency to objectbox-android:2.8.0 --- flutter_libs/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter_libs/android/build.gradle b/flutter_libs/android/build.gradle index 6dcc6bbc2..36c67690e 100644 --- a/flutter_libs/android/build.gradle +++ b/flutter_libs/android/build.gradle @@ -12,5 +12,5 @@ android { dependencies { // https://github.com/objectbox/objectbox-java/releases - implementation "io.objectbox:objectbox-android:2.7.1" + implementation "io.objectbox:objectbox-android:2.8.0" } From 6d63ea21be9002610aa807673cf3305f7e9c13ce Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 15:39:49 +0100 Subject: [PATCH 13/20] add sync_flutter_libs - with sync-enabled android library --- sync_flutter_libs/.gitignore | 101 +++++++++ sync_flutter_libs/CHANGELOG.md | 1 + sync_flutter_libs/LICENSE | 201 ++++++++++++++++++ sync_flutter_libs/README.md | 7 + sync_flutter_libs/android/.gitignore | 8 + sync_flutter_libs/android/README.md | 4 + sync_flutter_libs/android/build.gradle | 16 ++ sync_flutter_libs/android/settings.gradle | 1 + .../android/src/main/AndroidManifest.xml | 3 + .../flutter/ObjectBoxFlutterPlugin.java | 53 +++++ sync_flutter_libs/example/README.md | 1 + .../lib/objectbox_sync_flutter_libs.dart | 2 + sync_flutter_libs/pubspec.yaml | 21 ++ 13 files changed, 419 insertions(+) create mode 100644 sync_flutter_libs/.gitignore create mode 100644 sync_flutter_libs/CHANGELOG.md create mode 100644 sync_flutter_libs/LICENSE create mode 100644 sync_flutter_libs/README.md create mode 100644 sync_flutter_libs/android/.gitignore create mode 100644 sync_flutter_libs/android/README.md create mode 100644 sync_flutter_libs/android/build.gradle create mode 100644 sync_flutter_libs/android/settings.gradle create mode 100644 sync_flutter_libs/android/src/main/AndroidManifest.xml create mode 100644 sync_flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java create mode 100644 sync_flutter_libs/example/README.md create mode 100644 sync_flutter_libs/lib/objectbox_sync_flutter_libs.dart create mode 100644 sync_flutter_libs/pubspec.yaml diff --git a/sync_flutter_libs/.gitignore b/sync_flutter_libs/.gitignore new file mode 100644 index 000000000..ab1ff08fc --- /dev/null +++ b/sync_flutter_libs/.gitignore @@ -0,0 +1,101 @@ +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.classpath +.project +.settings/ +.vscode/ + +# packages file containing multi-root paths +.packages.generated + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart +.packages +.pub-cache/ +.pub/ +build/ +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/.last_build_id +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# macOS +**/macos/Flutter/GeneratedPluginRegistrant.swift +**/macos/Flutter/Flutter-Debug.xcconfig +**/macos/Flutter/Flutter-Release.xcconfig +**/macos/Flutter/Flutter-Profile.xcconfig + +# Coverage +coverage/ + +# Symbols +app.*.symbols + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +!/dev/ci/**/Gemfile.lock \ No newline at end of file diff --git a/sync_flutter_libs/CHANGELOG.md b/sync_flutter_libs/CHANGELOG.md new file mode 100644 index 000000000..5bb8cfa4e --- /dev/null +++ b/sync_flutter_libs/CHANGELOG.md @@ -0,0 +1 @@ +See [ObjectBox changelog](https://pub.dev/packages/objectbox/changelog). \ No newline at end of file diff --git a/sync_flutter_libs/LICENSE b/sync_flutter_libs/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/sync_flutter_libs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sync_flutter_libs/README.md b/sync_flutter_libs/README.md new file mode 100644 index 000000000..6f44b6893 --- /dev/null +++ b/sync_flutter_libs/README.md @@ -0,0 +1,7 @@ +ObjectBox (with Sync) libraries for Flutter +=========================================== +This package provides native ObjectBox library as a flutter plugin for supported platforms. +You should add this package as a dependency when using [ObjectBox](https://pub.dev/packages/objectbox) with Flutter. + +See package [ObjectBox](https://pub.dev/packages/objectbox) for more details and information how to use ObjectBox it. + diff --git a/sync_flutter_libs/android/.gitignore b/sync_flutter_libs/android/.gitignore new file mode 100644 index 000000000..c6cbe562a --- /dev/null +++ b/sync_flutter_libs/android/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/sync_flutter_libs/android/README.md b/sync_flutter_libs/android/README.md new file mode 100644 index 000000000..09bf2262c --- /dev/null +++ b/sync_flutter_libs/android/README.md @@ -0,0 +1,4 @@ +Contents of this folder is based on `flutter create --template=plugin`. +It was reduced to the minimum that works for library inclusion by client apps. + +Notably, the package depends on `io.objectbox:objectbox-android`, a native ObjectBox library distribution. \ No newline at end of file diff --git a/sync_flutter_libs/android/build.gradle b/sync_flutter_libs/android/build.gradle new file mode 100644 index 000000000..3346d3933 --- /dev/null +++ b/sync_flutter_libs/android/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'com.android.library' +android { + compileSdkVersion 28 + + defaultConfig { + minSdkVersion 16 + } + lintOptions { + disable 'InvalidPackage' + } +} + +dependencies { + // https://github.com/objectbox/objectbox-java/releases + implementation "io.objectbox:objectbox-android:2.8.0-sync" +} diff --git a/sync_flutter_libs/android/settings.gradle b/sync_flutter_libs/android/settings.gradle new file mode 100644 index 000000000..55c707b41 --- /dev/null +++ b/sync_flutter_libs/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'objectbox_sync_flutter_libs' diff --git a/sync_flutter_libs/android/src/main/AndroidManifest.xml b/sync_flutter_libs/android/src/main/AndroidManifest.xml new file mode 100644 index 000000000..30de5b159 --- /dev/null +++ b/sync_flutter_libs/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/sync_flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java b/sync_flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java new file mode 100644 index 000000000..ad9bfb501 --- /dev/null +++ b/sync_flutter_libs/android/src/main/java/io/objectbox/flutter/ObjectBoxFlutterPlugin.java @@ -0,0 +1,53 @@ +package io.objectbox.flutter; + +import androidx.annotation.NonNull; + +import io.flutter.embedding.engine.plugins.FlutterPlugin; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import io.flutter.plugin.common.PluginRegistry.Registrar; + +/** ObjectBoxFlutterPlugin */ +public class ObjectBoxFlutterPlugin implements FlutterPlugin, MethodCallHandler { + /// The MethodChannel that will the communication between Flutter and native Android + /// + /// This local reference serves to register the plugin with the Flutter Engine and unregister it + /// when the Flutter Engine is detached from the Activity + private MethodChannel channel; + + @Override + public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { + channel = new MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "objectbox"); + channel.setMethodCallHandler(this); + } + + // This static function is optional and equivalent to onAttachedToEngine. It supports the old + // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting + // plugin registration via this function while apps migrate to use the new Android APIs + // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. + // + // It is encouraged to share logic between onAttachedToEngine and registerWith to keep + // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called + // depending on the user's project. onAttachedToEngine or registerWith must both be defined + // in the same class. + public static void registerWith(Registrar registrar) { + final MethodChannel channel = new MethodChannel(registrar.messenger(), "objectbox"); + channel.setMethodCallHandler(new ObjectBoxFlutterPlugin()); + } + + @Override + public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { + if (call.method.equals("getPlatformVersion")) { + result.success("Android " + android.os.Build.VERSION.RELEASE); + } else { + result.notImplemented(); + } + } + + @Override + public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { + channel.setMethodCallHandler(null); + } +} diff --git a/sync_flutter_libs/example/README.md b/sync_flutter_libs/example/README.md new file mode 100644 index 000000000..c3a4a8844 --- /dev/null +++ b/sync_flutter_libs/example/README.md @@ -0,0 +1 @@ +See [ObjectBox](https://pub.dev/packages/objectbox). \ No newline at end of file diff --git a/sync_flutter_libs/lib/objectbox_sync_flutter_libs.dart b/sync_flutter_libs/lib/objectbox_sync_flutter_libs.dart new file mode 100644 index 000000000..84890f314 --- /dev/null +++ b/sync_flutter_libs/lib/objectbox_sync_flutter_libs.dart @@ -0,0 +1,2 @@ +/// This package only contains platform-specific native libraries for flutter. +/// All the dart code is in package "objectbox". diff --git a/sync_flutter_libs/pubspec.yaml b/sync_flutter_libs/pubspec.yaml new file mode 100644 index 000000000..6d56382e6 --- /dev/null +++ b/sync_flutter_libs/pubspec.yaml @@ -0,0 +1,21 @@ +name: objectbox_sync_flutter_libs +version: 0.8.1 +repository: https://github.com/objectbox/objectbox-dart +homepage: https://objectbox.io +description: ObjectBox is a super-fast NoSQL ACID compliant object database. This package contains flutter runtime libraries for ObjectBox, including ObjectBox Sync. + +environment: + sdk: ">=2.6.0 <3.0.0" + flutter: ">=1.12.0 <2.0.0" + +dependencies: + # This is here just to ensure compatibility between objectbox-dart code and the libraries used + # You should still depend on objectbox directly in your Flutter application. + objectbox: 0.8.1 + +flutter: + plugin: + platforms: + android: + package: io.objectbox.flutter + pluginClass: ObjectBoxFlutterPlugin From 20433f362e2f29448561e08671ed872fb31dad56 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 16:53:04 +0100 Subject: [PATCH 14/20] Store.syncClient() - avoid "extension" to keep SDK requirement low --- lib/src/store.dart | 5 +++++ lib/src/sync.dart | 14 +++----------- lib/src/util.dart | 4 ++++ test/sync_test.dart | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/src/store.dart b/lib/src/store.dart index 1f63dc64c..9c44170c1 100644 --- a/lib/src/store.dart +++ b/lib/src/store.dart @@ -6,6 +6,7 @@ import 'modelinfo/index.dart'; import 'model.dart'; import 'common.dart'; import 'util.dart'; +import 'sync.dart'; enum TxMode { Read, @@ -127,6 +128,10 @@ class Store { } } + /// Return an existing SyncClient associated with the store or null if not available. + /// See [Sync.client()] to create one first. + SyncClient syncClient() => SyncClientsStorage[this]; + /// The low-level pointer to this store. Pointer get ptr => _cStore; } diff --git a/lib/src/sync.dart b/lib/src/sync.dart index 75d78b82e..c075bf3ed 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -99,7 +99,7 @@ class SyncClient { void close() { final err = bindings.obx_sync_close(_cSync); _cSync = nullptr; - Sync._clients.remove(_store); + SyncClientsStorage.remove(_store); StoreCloseObserver.removeListener(_store, this); checkObx(err); } @@ -217,8 +217,6 @@ class SyncClient { /// /// Start building a sync client using [Sync.client()] and connect to a remote server. class Sync { - static final Map _clients = {}; - /// Sync() annotation enables synchronization for an entity. const Sync(); @@ -234,18 +232,12 @@ class Sync { /// Make sure the SyncClient is not destroyed and thus synchronization can keep running in the background. static SyncClient client( Store store, String serverUri, SyncCredentials creds) { - if (_clients.containsKey(store)) { + if (SyncClientsStorage.containsKey(store)) { throw Exception('Only one sync client can be active for a store'); } final client = SyncClient(store, serverUri, creds); - _clients[store] = client; + SyncClientsStorage[store] = client; StoreCloseObserver.addListener(store, client, client.close); return client; } } - -extension SyncedStore on Store { - /// Return an existing SyncClient associated with the store or null if not available. - /// See [Sync.client()] to create one first. - SyncClient syncClient() => Sync._clients[this]; -} diff --git a/lib/src/util.dart b/lib/src/util.dart index 755f017b1..31c4ca72a 100644 --- a/lib/src/util.dart +++ b/lib/src/util.dart @@ -1,4 +1,5 @@ import 'store.dart'; +import 'sync.dart'; bool listContains(List list, T item) => list.indexWhere((x) => x == item) != -1; @@ -38,3 +39,6 @@ class StoreCloseObserver { return listeners; } } + +/// Global internal storage of sync clients - one client per store. +final Map SyncClientsStorage = {}; diff --git a/test/sync_test.dart b/test/sync_test.dart index f4fcd132b..e710eeea6 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -3,6 +3,7 @@ import 'dart:typed_data'; import 'package:test/test.dart'; import 'package:objectbox/objectbox.dart'; + import 'entity.dart'; import 'test_env.dart'; From 092f9ae55a2c62cac5b380058bb506da544509f5 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 17:00:27 +0100 Subject: [PATCH 15/20] Sync - add objectbox_demo_sync - minimally updated copy of an existing objectbox_demo --- example/flutter/objectbox_demo/lib/main.dart | 10 +- .../flutter/objectbox_demo_sync/.gitignore | 38 ++ example/flutter/objectbox_demo_sync/.metadata | 10 + example/flutter/objectbox_demo_sync/README.md | 5 + .../objectbox_demo_sync/android/.gitignore | 7 + .../android/app/build.gradle | 66 +++ .../android/app/src/debug/AndroidManifest.xml | 7 + .../android/app/src/main/AndroidManifest.xml | 34 ++ .../example/objectbox_demo/MainActivity.kt | 6 + .../main/res/drawable/launch_background.xml | 12 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 544 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 442 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 721 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1031 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 1443 bytes .../app/src/main/res/values/styles.xml | 11 + .../app/src/profile/AndroidManifest.xml | 7 + .../objectbox_demo_sync/android/build.gradle | 31 ++ .../android/gradle.properties | 4 + .../gradle/wrapper/gradle-wrapper.properties | 6 + .../android/settings.gradle | 15 + .../objectbox_demo_sync/ios/.gitignore | 32 ++ .../ios/Flutter/AppFrameworkInfo.plist | 26 + .../ios/Flutter/Debug.xcconfig | 1 + .../ios/Flutter/Release.xcconfig | 1 + .../ios/Runner.xcodeproj/project.pbxproj | 518 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/xcschemes/Runner.xcscheme | 91 +++ .../contents.xcworkspacedata | 7 + .../ios/Runner/AppDelegate.swift | 13 + .../AppIcon.appiconset/Contents.json | 122 +++++ .../Icon-App-1024x1024@1x.png | Bin 0 -> 10932 bytes .../AppIcon.appiconset/Icon-App-20x20@1x.png | Bin 0 -> 564 bytes .../AppIcon.appiconset/Icon-App-20x20@2x.png | Bin 0 -> 1283 bytes .../AppIcon.appiconset/Icon-App-20x20@3x.png | Bin 0 -> 1588 bytes .../AppIcon.appiconset/Icon-App-29x29@1x.png | Bin 0 -> 1025 bytes .../AppIcon.appiconset/Icon-App-29x29@2x.png | Bin 0 -> 1716 bytes .../AppIcon.appiconset/Icon-App-29x29@3x.png | Bin 0 -> 1920 bytes .../AppIcon.appiconset/Icon-App-40x40@1x.png | Bin 0 -> 1283 bytes .../AppIcon.appiconset/Icon-App-40x40@2x.png | Bin 0 -> 1895 bytes .../AppIcon.appiconset/Icon-App-40x40@3x.png | Bin 0 -> 2665 bytes .../AppIcon.appiconset/Icon-App-60x60@2x.png | Bin 0 -> 2665 bytes .../AppIcon.appiconset/Icon-App-60x60@3x.png | Bin 0 -> 3831 bytes .../AppIcon.appiconset/Icon-App-76x76@1x.png | Bin 0 -> 1888 bytes .../AppIcon.appiconset/Icon-App-76x76@2x.png | Bin 0 -> 3294 bytes .../Icon-App-83.5x83.5@2x.png | Bin 0 -> 3612 bytes .../LaunchImage.imageset/Contents.json | 23 + .../LaunchImage.imageset/LaunchImage.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/LaunchImage@2x.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/LaunchImage@3x.png | Bin 0 -> 68 bytes .../LaunchImage.imageset/README.md | 5 + .../Runner/Base.lproj/LaunchScreen.storyboard | 37 ++ .../ios/Runner/Base.lproj/Main.storyboard | 26 + .../objectbox_demo_sync/ios/Runner/Info.plist | 45 ++ .../ios/Runner/Runner-Bridging-Header.h | 1 + .../flutter/objectbox_demo_sync/lib/main.dart | 221 ++++++++ .../lib/objectbox-model.json | 46 ++ .../flutter/objectbox_demo_sync/pubspec.yaml | 33 ++ 58 files changed, 1520 insertions(+), 4 deletions(-) create mode 100644 example/flutter/objectbox_demo_sync/.gitignore create mode 100644 example/flutter/objectbox_demo_sync/.metadata create mode 100644 example/flutter/objectbox_demo_sync/README.md create mode 100644 example/flutter/objectbox_demo_sync/android/.gitignore create mode 100644 example/flutter/objectbox_demo_sync/android/app/build.gradle create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/debug/AndroidManifest.xml create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/AndroidManifest.xml create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/kotlin/com/example/objectbox_demo/MainActivity.kt create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/drawable/launch_background.xml create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/main/res/values/styles.xml create mode 100644 example/flutter/objectbox_demo_sync/android/app/src/profile/AndroidManifest.xml create mode 100644 example/flutter/objectbox_demo_sync/android/build.gradle create mode 100644 example/flutter/objectbox_demo_sync/android/gradle.properties create mode 100644 example/flutter/objectbox_demo_sync/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 example/flutter/objectbox_demo_sync/android/settings.gradle create mode 100644 example/flutter/objectbox_demo_sync/ios/.gitignore create mode 100644 example/flutter/objectbox_demo_sync/ios/Flutter/AppFrameworkInfo.plist create mode 100644 example/flutter/objectbox_demo_sync/ios/Flutter/Debug.xcconfig create mode 100644 example/flutter/objectbox_demo_sync/ios/Flutter/Release.xcconfig create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.pbxproj create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner.xcworkspace/contents.xcworkspacedata create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/AppDelegate.swift create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/LaunchScreen.storyboard create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/Main.storyboard create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Info.plist create mode 100644 example/flutter/objectbox_demo_sync/ios/Runner/Runner-Bridging-Header.h create mode 100644 example/flutter/objectbox_demo_sync/lib/main.dart create mode 100644 example/flutter/objectbox_demo_sync/lib/objectbox-model.json create mode 100644 example/flutter/objectbox_demo_sync/pubspec.yaml diff --git a/example/flutter/objectbox_demo/lib/main.dart b/example/flutter/objectbox_demo/lib/main.dart index 3678d8d4b..4229a7fcc 100644 --- a/example/flutter/objectbox_demo/lib/main.dart +++ b/example/flutter/objectbox_demo/lib/main.dart @@ -1,11 +1,13 @@ +import 'dart:async'; +import 'dart:io'; + import 'package:flutter/material.dart'; -import 'package:objectbox/objectbox.dart'; import 'package:intl/intl.dart'; import 'package:path_provider/path_provider.dart'; -import 'objectbox.g.dart'; +import 'package:objectbox/objectbox.dart'; import 'package:objectbox/observable.dart'; -import 'dart:async'; -import 'dart:io'; + +import 'objectbox.g.dart'; @Entity() class Note { diff --git a/example/flutter/objectbox_demo_sync/.gitignore b/example/flutter/objectbox_demo_sync/.gitignore new file mode 100644 index 000000000..6285fbbd7 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/.gitignore @@ -0,0 +1,38 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins* +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Exceptions to above rules. +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +objectbox diff --git a/example/flutter/objectbox_demo_sync/.metadata b/example/flutter/objectbox_demo_sync/.metadata new file mode 100644 index 000000000..21ebdba99 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: a4d5266b769e92286a48f6b6714e538f2c4578dc + channel: master + +project_type: app diff --git a/example/flutter/objectbox_demo_sync/README.md b/example/flutter/objectbox_demo_sync/README.md new file mode 100644 index 000000000..d5141ddb3 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/README.md @@ -0,0 +1,5 @@ +# objectbox_demo + +## Getting Started + +This project contains the Flutter version of the main example from the [objectbox-examples](https://github.com/objectbox/objectbox-examples) repository. diff --git a/example/flutter/objectbox_demo_sync/android/.gitignore b/example/flutter/objectbox_demo_sync/android/.gitignore new file mode 100644 index 000000000..bc2100d8f --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/.gitignore @@ -0,0 +1,7 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java diff --git a/example/flutter/objectbox_demo_sync/android/app/build.gradle b/example/flutter/objectbox_demo_sync/android/app/build.gradle new file mode 100644 index 000000000..97d10d66b --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/build.gradle @@ -0,0 +1,66 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 28 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + applicationId "com.example.objectbox_demo" + minSdkVersion 16 + targetSdkVersion 28 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +} diff --git a/example/flutter/objectbox_demo_sync/android/app/src/debug/AndroidManifest.xml b/example/flutter/objectbox_demo_sync/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..75d39438e --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/AndroidManifest.xml b/example/flutter/objectbox_demo_sync/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..fb9b3e129 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/kotlin/com/example/objectbox_demo/MainActivity.kt b/example/flutter/objectbox_demo_sync/android/app/src/main/kotlin/com/example/objectbox_demo/MainActivity.kt new file mode 100644 index 000000000..cc868d541 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/main/kotlin/com/example/objectbox_demo/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.objectbox_demo + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/drawable/launch_background.xml b/example/flutter/objectbox_demo_sync/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..db77bb4b7b0906d62b1847e87f15cdcacf6a4f29 GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..17987b79bb8a35cc66c3c1fd44f5a5526c1b78be GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d5f1c8d34e7a88e3f88bea192c3a370d44689c3c GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/flutter/objectbox_demo_sync/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6372eebdb28e45604e46eeda8dd24651419bc0 GIT binary patch literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/android/app/src/main/res/values/styles.xml b/example/flutter/objectbox_demo_sync/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..c745a5ef2 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/example/flutter/objectbox_demo_sync/android/app/src/profile/AndroidManifest.xml b/example/flutter/objectbox_demo_sync/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..75d39438e --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/flutter/objectbox_demo_sync/android/build.gradle b/example/flutter/objectbox_demo_sync/android/build.gradle new file mode 100644 index 000000000..3100ad2d5 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/example/flutter/objectbox_demo_sync/android/gradle.properties b/example/flutter/objectbox_demo_sync/android/gradle.properties new file mode 100644 index 000000000..38c8d4544 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.enableR8=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/flutter/objectbox_demo_sync/android/gradle/wrapper/gradle-wrapper.properties b/example/flutter/objectbox_demo_sync/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..296b146b7 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/example/flutter/objectbox_demo_sync/android/settings.gradle b/example/flutter/objectbox_demo_sync/android/settings.gradle new file mode 100644 index 000000000..5a2f14fb1 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/example/flutter/objectbox_demo_sync/ios/.gitignore b/example/flutter/objectbox_demo_sync/ios/.gitignore new file mode 100644 index 000000000..e96ef602b --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/flutter/objectbox_demo_sync/ios/Flutter/AppFrameworkInfo.plist b/example/flutter/objectbox_demo_sync/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..6b4c0f78a --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/example/flutter/objectbox_demo_sync/ios/Flutter/Debug.xcconfig b/example/flutter/objectbox_demo_sync/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/flutter/objectbox_demo_sync/ios/Flutter/Release.xcconfig b/example/flutter/objectbox_demo_sync/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.pbxproj b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..886775291 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,518 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.objectboxDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.objectboxDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.objectboxDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..a28140cfd --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/flutter/objectbox_demo_sync/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/AppDelegate.swift b/example/flutter/objectbox_demo_sync/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..dc9ada4725e9b0ddb1deab583e5b5102493aa332 GIT binary patch literal 10932 zcmeHN2~<R zh`|8`A_PQ1nSu(UMFx?8j8PC!!VDphaL#`F42fd#7Vlc`zIE4n%Y~eiz4y1j|NDpi z?<@|pSJ-HM`qifhf@m%MamgwK83`XpBA<+azdF#2QsT{X@z0A9Bq>~TVErigKH1~P zRX-!h-f0NJ4Mh++{D}J+K>~~rq}d%o%+4dogzXp7RxX4C>Km5XEI|PAFDmo;DFm6G zzjVoB`@qW98Yl0Kvc-9w09^PrsobmG*Eju^=3f?0o-t$U)TL1B3;sZ^!++3&bGZ!o-*6w?;oOhf z=A+Qb$scV5!RbG+&2S}BQ6YH!FKb0``VVX~T$dzzeSZ$&9=X$3)_7Z{SspSYJ!lGE z7yig_41zpQ)%5dr4ff0rh$@ky3-JLRk&DK)NEIHecf9c*?Z1bUB4%pZjQ7hD!A0r-@NF(^WKdr(LXj|=UE7?gBYGgGQV zidf2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ner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..f091b6b0bca859a3f474b03065bef75ba58a9e4c GIT binary patch literal 1588 zcmV-42Fv-0P)C1SqPt}wig>|5Crh^=oyX$BK<}M8eLU3e2hGT;=G|!_SP)7zNI6fqUMB=)y zRAZ>eDe#*r`yDAVgB_R*LB*MAc)8(b{g{9McCXW!lq7r(btRoB9!8B-#AI6JMb~YFBEvdsV)`mEQO^&#eRKx@b&x- z5lZm*!WfD8oCLzfHGz#u7sT0^VLMI1MqGxF^v+`4YYnVYgk*=kU?HsSz{v({E3lb9 z>+xILjBN)t6`=g~IBOelGQ(O990@BfXf(DRI5I$qN$0Gkz-FSc$3a+2fX$AedL4u{ z4V+5Ong(9LiGcIKW?_352sR;LtDPmPJXI{YtT=O8=76o9;*n%_m|xo!i>7$IrZ-{l z-x3`7M}qzHsPV@$v#>H-TpjDh2UE$9g6sysUREDy_R(a)>=eHw-WAyfIN z*qb!_hW>G)Tu8nSw9yn#3wFMiLcfc4pY0ek1}8(NqkBR@t4{~oC>ryc-h_ByH(Cg5 z>ao-}771+xE3um9lWAY1FeQFxowa1(!J(;Jg*wrg!=6FdRX+t_<%z&d&?|Bn){>zm zZQj(aA_HeBY&OC^jj*)N`8fa^ePOU72VpInJoI1?`ty#lvlNzs(&MZX+R%2xS~5Kh zX*|AU4QE#~SgPzOXe9>tRj>hjU@c1k5Y_mW*Jp3fI;)1&g3j|zDgC+}2Q_v%YfDax z!?umcN^n}KYQ|a$Lr+51Nf9dkkYFSjZZjkma$0KOj+;aQ&721~t7QUKx61J3(P4P1 zstI~7-wOACnWP4=8oGOwz%vNDqD8w&Q`qcNGGrbbf&0s9L0De{4{mRS?o0MU+nR_! zrvshUau0G^DeMhM_v{5BuLjb#Hh@r23lDAk8oF(C+P0rsBpv85EP>4CVMx#04M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G+mq_~Qqto~ahA+K`|lyv3(-e}00000NkvXXu0mjfd`9t{ literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d0ef06e7edb86cdfe0d15b4b0d98334a86163658 GIT binary patch literal 1716 zcmds$`#;kQ7{|XelZftyR5~xW7?MLxS4^|Hw3&P7^y)@A9Fj{Xm1~_CIV^XZ%SLBn zA;!r`GqGHg=7>xrB{?psZQs88ZaedDoagm^KF{a*>G|dJWRSe^I$DNW008I^+;Kjt z>9p3GNR^I;v>5_`+91i(*G;u5|L+Bu6M=(afLjtkya#yZ175|z$pU~>2#^Z_pCZ7o z1c6UNcv2B3?; zX%qdxCXQpdKRz=#b*q0P%b&o)5ZrNZt7$fiETSK_VaY=mb4GK`#~0K#~9^ zcY!`#Af+4h?UMR-gMKOmpuYeN5P*RKF!(tb`)oe0j2BH1l?=>y#S5pMqkx6i{*=V9JF%>N8`ewGhRE(|WohnD59R^$_36{4>S zDFlPC5|k?;SPsDo87!B{6*7eqmMdU|QZ84>6)Kd9wNfh90=y=TFQay-0__>=<4pk& zYDjgIhL-jQ9o>z32K)BgAH+HxamL{ZL~ozu)Qqe@a`FpH=oQRA8=L-m-1dam(Ix2V z?du;LdMO+ooBelr^_y4{|44tmgH^2hSzPFd;U^!1p>6d|o)(-01z{i&Kj@)z-yfWQ)V#3Uo!_U}q3u`(fOs`_f^ueFii1xBNUB z6MecwJN$CqV&vhc+)b(p4NzGGEgwWNs z@*lUV6LaduZH)4_g!cE<2G6#+hJrWd5(|p1Z;YJ7ifVHv+n49btR}dq?HHDjl{m$T z!jLZcGkb&XS2OG~u%&R$(X+Z`CWec%QKt>NGYvd5g20)PU(dOn^7%@6kQb}C(%=vr z{?RP(z~C9DPnL{q^@pVw@|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.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..c8f9ed8f5cee1c98386d13b17e89f719e83555b2 GIT binary patch literal 1895 zcmV-t2blPYP)FQtfgmafE#=YDCq`qUBt#QpG%*H6QHY765~R=q zZ6iudfM}q!Pz#~9JgOi8QJ|DSu?1-*(kSi1K4#~5?#|rh?sS)(-JQqX*}ciXJ56_H zdw=^s_srbAdqxlvGyrgGet#6T7_|j;95sL%MtM;q86vOxKM$f#puR)Bjv9Zvz9-di zXOTSsZkM83)E9PYBXC<$6(|>lNLVBb&&6y{NByFCp%6+^ALR@NCTse_wqvNmSWI-m z!$%KlHFH2omF!>#%1l3LTZg(s7eof$7*xB)ZQ0h?ejh?Ta9fDv59+u#MokW+1t8Zb zgHv%K(u9G^Lv`lh#f3<6!JVTL3(dCpxHbnbA;kKqQyd1~^Xe0VIaYBSWm6nsr;dFj z4;G-RyL?cYgsN1{L4ZFFNa;8)Rv0fM0C(~Tkit94 zz#~A)59?QjD&pAPSEQ)p8gP|DS{ng)j=2ux)_EzzJ773GmQ_Cic%3JJhC0t2cx>|v zJcVusIB!%F90{+}8hG3QU4KNeKmK%T>mN57NnCZ^56=0?&3@!j>a>B43pi{!u z7JyDj7`6d)qVp^R=%j>UIY6f+3`+qzIc!Y_=+uN^3BYV|o+$vGo-j-Wm<10%A=(Yk^beI{t%ld@yhKjq0iNjqN4XMGgQtbKubPM$JWBz}YA65k%dm*awtC^+f;a-x4+ddbH^7iDWGg&N0n#MW{kA|=8iMUiFYvMoDY@sPC#t$55gn6ykUTPAr`a@!(;np824>2xJthS z*ZdmT`g5-`BuJs`0LVhz+D9NNa3<=6m;cQLaF?tCv8)zcRSh66*Z|vXhG@$I%U~2l z?`Q zykI#*+rQ=z6Jm=Bui-SfpDYLA=|vzGE(dYm=OC8XM&MDo7ux4UF1~0J1+i%aCUpRe zt3L_uNyQ*cE(38Uy03H%I*)*Bh=Lb^Xj3?I^Hnbeq72(EOK^Y93CNp*uAA{5Lc=ky zx=~RKa4{iTm{_>_vSCm?$Ej=i6@=m%@VvAITnigVg{&@!7CDgs908761meDK5azA} z4?=NOH|PdvabgJ&fW2{Mo$Q0CcD8Qc84%{JPYt5EiG{MdLIAeX%T=D7NIP4%Hw}p9 zg)==!2Lbp#j{u_}hMiao9=!VSyx0gHbeCS`;q&vzeq|fs`y&^X-lso(Ls@-706qmA z7u*T5PMo_w3{se1t2`zWeO^hOvTsohG_;>J0wVqVe+n)AbQCx)yh9;w+J6?NF5Lmo zecS@ieAKL8%bVd@+-KT{yI|S}O>pYckUFs;ry9Ow$CD@ztz5K-*D$^{i(_1llhSh^ zEkL$}tsQt5>QA^;QgjgIfBDmcOgi5YDyu?t6vSnbp=1+@6D& z5MJ}B8q;bRlVoxasyhcUF1+)o`&3r0colr}QJ3hcSdLu;9;td>kf@Tcn<@9sIx&=m z;AD;SCh95=&p;$r{Xz3iWCO^MX83AGJ(yH&eTXgv|0=34#-&WAmw{)U7OU9!Wz^!7 zZ%jZFi@JR;>Mhi7S>V7wQ176|FdW2m?&`qa(ScO^CFPR80HucLHOTy%5s*HR0^8)i h0WYBP*#0Ks^FNSabJA*5${_#%002ovPDHLkV1oKhTl@e3 literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b8609df07bf62e5100a53a01510388bd2b22 GIT binary patch literal 2665 zcmV-v3YPVWP)oFh3q0MFesq&64WThn3$;G69TfjsAv=f2G9}p zgSx99+!YV6qME!>9MD13x)k(+XE7W?_O4LoLb5ND8 zaV{9+P@>42xDfRiYBMSgD$0!vssptcb;&?u9u(LLBKmkZ>RMD=kvD3h`sk6!QYtBa ztlZI#nu$8l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9}tWG^aovK2eX z1aL1%7;KRDrA@eG-Wr6w+;*H_VD~qLiVI`{_;>o)k`{8xa3EJT1O_>#iy_?va0eR? zDV=N%;Zjb%Z2s$@O>w@iqt!I}tLjGk!=p`D23I}N4Be@$(|iSA zf3Ih7b<{zqpDB4WF_5X1(peKe+rASze%u8eKLn#KKXt;UZ+Adf$_TO+vTqshLLJ5c z52HucO=lrNVae5XWOLm!V@n-ObU11!b+DN<$RuU+YsrBq*lYT;?AwJpmNKniF0Q1< zJCo>Q$=v$@&y=sj6{r!Y&y&`0$-I}S!H_~pI&2H8Z1C|BX4VgZ^-! zje3-;x0PBD!M`v*J_)rL^+$<1VJhH*2Fi~aA7s&@_rUHYJ9zD=M%4AFQ`}k8OC$9s XsPq=LnkwKG00000NkvXXu0mjfhAk5^ literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d6b8609df07bf62e5100a53a01510388bd2b22 GIT binary patch literal 2665 zcmV-v3YPVWP)oFh3q0MFesq&64WThn3$;G69TfjsAv=f2G9}p zgSx99+!YV6qME!>9MD13x)k(+XE7W?_O4LoLb5ND8 zaV{9+P@>42xDfRiYBMSgD$0!vssptcb;&?u9u(LLBKmkZ>RMD=kvD3h`sk6!QYtBa ztlZI#nu$8lJ^q2Z79UTgZe>BU73(Aospiq+?SdMt8lDZ;*?@tyWVZVS_Q7S&*tJaiRlJ z+aSMOmbg3@h5}v;A*c8SbqM3icg-`Cnwl;7Ts%A1RkNIp+Txl-Ckkvg4oxrqGA5ewEgYqwtECD<_3Egu)xGllKt&J8g&+=ac@Jq4-?w6M3b*>w5 z69N3O%=I^6&UL5gZ!}trC7bUj*12xLdkNs~Bz4QdJJ*UDZox2UGR}SNg@lmOvhCc~ z*f_UeXv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NKniF0Q1< zJCo>Q$=v$@&y=sj6{r!Y&y&`0$-I}S!H_~pI&2H8Z1C|BX4VgZ^-! zje3-;x0PBD!M`v*J_)rL^+$<1VJhH*2Fi~aA7s&@_rUHYJ9zD=M%4AFQ`}k8OC$9s XsPq=LnkwKG00000NkvXXu0mjfhAk5^ literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..75b2d164a5a98e212cca15ea7bf2ab5de5108680 GIT binary patch literal 3831 zcmVjJBgitF5mAp-i>4+KS_oR{|13AP->1TD4=w)g|)JHOx|a2Wk1Va z!k)vP$UcQ#mdj%wNQoaJ!w>jv_6&JPyutpQps?s5dmDQ>`%?Bvj>o<%kYG!YW6H-z zu`g$@mp`;qDR!51QaS}|ZToSuAGcJ7$2HF0z`ln4t!#Yg46>;vGG9N9{V@9z#}6v* zfP?}r6b{*-C*)(S>NECI_E~{QYzN5SXRmVnP<=gzP+_Sp(Aza_hKlZ{C1D&l*(7IKXxQC1Z9#6wx}YrGcn~g%;icdw>T0Rf^w0{ z$_wn1J+C0@!jCV<%Go5LA45e{5gY9PvZp8uM$=1}XDI+9m7!A95L>q>>oe0$nC->i zeexUIvq%Uk<-$>DiDb?!In)lAmtuMWxvWlk`2>4lNuhSsjAf2*2tjT`y;@d}($o)S zn(+W&hJ1p0xy@oxP%AM15->wPLp{H!k)BdBD$toBpJh+crWdsNV)qsHaqLg2_s|Ih z`8E9z{E3sA!}5aKu?T!#enD(wLw?IT?k-yWVHZ8Akz4k5(TZJN^zZgm&zM28sfTD2BYJ|Fde3Xzh;;S` z=GXTnY4Xc)8nYoz6&vF;P7{xRF-{|2Xs5>a5)@BrnQ}I(_x7Cgpx#5&Td^4Q9_FnQ zX5so*;#8-J8#c$OlA&JyP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H1ooeI&v?=?v7?1n~P(wZ~0>xWxd_Aw;+}9#eULM7M8&E?Y zC-ZLhi3RoM92SXUb-5i-Lmt5_rfjE{6y^+24`y$1lywLyHO!)Boa7438K4#iLe?rh z2O~YGSgFUBH?og*6=r9rme=peP~ah`(8Zt7V)j5!V0KPFf_mebo3z95U8(up$-+EA^9dTRLq>Yl)YMBuch9%=e5B`Vnb>o zt03=kq;k2TgGe4|lGne&zJa~h(UGutjP_zr?a7~#b)@15XNA>Dj(m=gg2Q5V4-$)D|Q9}R#002ovPDHLkV1o7DH3k3x literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..c4df70d39da7941ef3f6dcb7f06a192d8dcb308d GIT binary patch literal 1888 zcmV-m2cP(fP)x~L`~4d)Rspd&<9kFh{hn*KP1LP0~$;u(LfAu zp%fx&qLBcRHx$G|3q(bv@+b;o0*D|jwD-Q9uQR(l*ST}s+uPgQ-MeFwZ#GS?b332? z&Tk$&_miXn3IGq)AmQ)3sisq{raD4(k*bHvpCe-TdWq^NRTEVM)i9xbgQ&ccnUVx* zEY%vS%gDcSg=!tuIK8$Th2_((_h^+7;R|G{n06&O2#6%LK`a}n?h_fL18btz<@lFG za}xS}u?#DBMB> zw^b($1Z)`9G?eP95EKi&$eOy@K%h;ryrR3la%;>|o*>CgB(s>dDcNOXg}CK9SPmD? zmr-s{0wRmxUnbDrYfRvnZ@d z6johZ2sMX{YkGSKWd}m|@V7`Degt-43=2M?+jR%8{(H$&MLLmS;-|JxnX2pnz;el1jsvqQz}pGSF<`mqEXRQ5sC4#BbwnB_4` zc5bFE-Gb#JV3tox9fp-vVEN{(tOCpRse`S+@)?%pz+zVJXSooTrNCUg`R6`hxwb{) zC@{O6MKY8tfZ5@!yy=p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/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9da19eacad3b03bb08bbddbbf4ac48dd78b3d838 GIT binary patch literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx0wlM}@Gt=>Zci7-kcv6Uzs@r-FtIZ-&5|)J Q1PU{Fy85}Sb4q9e0B4a5jsO4v literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..9da19eacad3b03bb08bbddbbf4ac48dd78b3d838 GIT binary patch literal 68 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx0wlM}@Gt=>Zci7-kcv6Uzs@r-FtIZ-&5|)J Q1PU{Fy85}Sb4q9e0B4a5jsO4v literal 0 HcmV?d00001 diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/Main.storyboard b/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Info.plist b/example/flutter/objectbox_demo_sync/ios/Runner/Info.plist new file mode 100644 index 000000000..43cf18a9a --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + objectbox_demo + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/example/flutter/objectbox_demo_sync/ios/Runner/Runner-Bridging-Header.h b/example/flutter/objectbox_demo_sync/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..7335fdf90 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/example/flutter/objectbox_demo_sync/lib/main.dart b/example/flutter/objectbox_demo_sync/lib/main.dart new file mode 100644 index 000000000..a9b681945 --- /dev/null +++ b/example/flutter/objectbox_demo_sync/lib/main.dart @@ -0,0 +1,221 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:objectbox/objectbox.dart'; +import 'package:objectbox/observable.dart'; + +import 'objectbox.g.dart'; + +@Entity() +class Note { + @Id() + int id; + + String text; + String comment; + int date; + + Note(); + + Note.construct(this.text) { + date = DateTime.now().millisecondsSinceEpoch; + print('constructed date: $date'); + } + + String get dateFormat => DateFormat('dd.MM.yyyy hh:mm:ss') + .format(DateTime.fromMillisecondsSinceEpoch(date)); +} + +void main() => runApp(MyApp()); + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'OB Example', + theme: ThemeData(primarySwatch: Colors.blue), + home: MyHomePage(title: 'OB Example'), + ); + } +} + +class MyHomePage extends StatefulWidget { + MyHomePage({Key key, this.title}) : super(key: key); + + final String title; + + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class ViewModel { + Store _store; + Box _box; + Query _query; + + ViewModel(Directory dir) { + _store = Store(getObjectBoxModel(), directory: dir.path + '/objectbox'); + _box = Box(_store); + + final dateProp = Note_.date; + + _query = _box.query().order(dateProp, flags: Order.descending).build(); + + // TODO configure actual sync server address and authentication + // 10.0.2.2 is your host PC if an app is run in an emulator. + // For other options, see objectbox/lib/src/sync.dart + final syncClient = + Sync.client(_store, 'ws://10.0.2.2:9999', SyncCredentials.none()); + syncClient.start(); + } + + void addNote(Note note) => _box.put(note); + + void removeNote(Note note) => _box.remove(note.id); + + Stream> get queryStream => _query.findStream(); + + List get allNotes => _query.find(); + + void dispose() { + _query.close(); + _store.close(); + } +} + +class _MyHomePageState extends State { + final _noteInputController = TextEditingController(); + final _listController = StreamController>(sync: true); + Stream> _stream; + ViewModel _vm; + + void _addNote() { + if (_noteInputController.text.isEmpty) return; + _vm.addNote(Note.construct(_noteInputController.text)); + _noteInputController.text = ''; + } + + @override + void initState() { + super.initState(); + + getApplicationDocumentsDirectory().then((dir) { + _vm = ViewModel(dir); + _stream = _listController.stream; + + setState(() {}); + + _listController.add(_vm.allNotes); + _listController.addStream(_vm.queryStream); + }); + } + + @override + void dispose() { + _noteInputController.dispose(); + _listController.close(); + _vm.dispose(); + super.dispose(); + } + + GestureDetector Function(BuildContext, int) _itemBuilder(List notes) { + return (BuildContext context, int index) { + return GestureDetector( + onTap: () => _vm.removeNote(notes[index]), + child: Row( + children: [ + Expanded( + child: Container( + child: Padding( + padding: + EdgeInsets.symmetric(vertical: 18.0, horizontal: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + notes[index].text, + style: TextStyle( + fontSize: 15.0, + ), + ), + Padding( + padding: EdgeInsets.only(top: 5.0), + child: Text( + 'Added on ${notes[index].dateFormat}', + style: TextStyle( + fontSize: 12.0, + ), + ), + ), + ], + ), + ), + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.black12))), + ), + ), + ], + ), + ); + }; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Column(children: [ + Padding( + padding: EdgeInsets.all(20.0), + child: Row( + children: [ + Expanded( + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: TextField( + decoration: + InputDecoration(hintText: 'Enter a new note'), + controller: _noteInputController, + onSubmitted: (value) => _addNote(), + ), + ), + Padding( + padding: EdgeInsets.only(top: 10.0, right: 10.0), + child: Align( + alignment: Alignment.centerRight, + child: Text( + 'Tap a note to remove it', + style: TextStyle( + fontSize: 11.0, + color: Colors.grey, + ), + ), + ), + ), + ], + ), + ) + ], + ), + ), + Expanded( + child: StreamBuilder>( + stream: _stream, + builder: (context, snapshot) { + return ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.symmetric(horizontal: 20.0), + itemCount: snapshot.hasData ? snapshot.data.length : 0, + itemBuilder: _itemBuilder(snapshot.data)); + })) + ]), + ); + } +} diff --git a/example/flutter/objectbox_demo_sync/lib/objectbox-model.json b/example/flutter/objectbox_demo_sync/lib/objectbox-model.json new file mode 100644 index 000000000..fb99e5d8d --- /dev/null +++ b/example/flutter/objectbox_demo_sync/lib/objectbox-model.json @@ -0,0 +1,46 @@ +{ + "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.", + "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.", + "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.", + "entities": [ + { + "id": "1:2802681814019499133", + "lastPropertyId": "4:6451339597165131221", + "name": "Note", + "properties": [ + { + "id": "1:3178873177797362769", + "name": "id", + "type": 6, + "flags": 1 + }, + { + "id": "2:4285343053028527696", + "name": "text", + "type": 9 + }, + { + "id": "3:2606273611209948020", + "name": "comment", + "type": 9 + }, + { + "id": "4:6451339597165131221", + "name": "date", + "type": 6 + } + ] + } + ], + "lastEntityId": "1:2802681814019499133", + "lastIndexId": "0:0", + "lastRelationId": "0:0", + "lastSequenceId": "0:0", + "modelVersion": 5, + "modelVersionParserMinimum": 5, + "retiredEntityUids": [], + "retiredIndexUids": [], + "retiredPropertyUids": [], + "retiredRelationUids": [], + "version": 1 +} \ No newline at end of file diff --git a/example/flutter/objectbox_demo_sync/pubspec.yaml b/example/flutter/objectbox_demo_sync/pubspec.yaml new file mode 100644 index 000000000..a43f24ccf --- /dev/null +++ b/example/flutter/objectbox_demo_sync/pubspec.yaml @@ -0,0 +1,33 @@ +name: objectbox_demo +description: An example project for the objectbox-dart binding. +version: 0.3.0+1 + +environment: + sdk: ">=2.1.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^0.1.2 + path_provider: any + intl: any + objectbox: ^0.8.1 + objectbox_sync_flutter_libs: ^0.8.1 + +dev_dependencies: + flutter_test: + sdk: flutter + build_runner: ^1.0.0 + objectbox_generator: ^0.8.1 + +flutter: + uses-material-design: true + +# Note: these overrides are only for ObjectBox internal development, don't use them in your app. +dependency_overrides: + objectbox: + path: ../../.. + objectbox_generator: + path: ../../../generator + objectbox_sync_flutter_libs: + path: ../../../sync_flutter_libs \ No newline at end of file From b8ebbb0628cb274f945d208de96dd3ccd14d7d34 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 17:55:14 +0100 Subject: [PATCH 16/20] Sync - example - annotate the entity with @Sync() --- example/flutter/objectbox_demo_sync/lib/main.dart | 1 + example/flutter/objectbox_demo_sync/lib/objectbox-model.json | 1 + 2 files changed, 2 insertions(+) diff --git a/example/flutter/objectbox_demo_sync/lib/main.dart b/example/flutter/objectbox_demo_sync/lib/main.dart index a9b681945..3d92d60f1 100644 --- a/example/flutter/objectbox_demo_sync/lib/main.dart +++ b/example/flutter/objectbox_demo_sync/lib/main.dart @@ -10,6 +10,7 @@ import 'package:objectbox/observable.dart'; import 'objectbox.g.dart'; @Entity() +@Sync() class Note { @Id() int id; diff --git a/example/flutter/objectbox_demo_sync/lib/objectbox-model.json b/example/flutter/objectbox_demo_sync/lib/objectbox-model.json index fb99e5d8d..61204203a 100644 --- a/example/flutter/objectbox_demo_sync/lib/objectbox-model.json +++ b/example/flutter/objectbox_demo_sync/lib/objectbox-model.json @@ -7,6 +7,7 @@ "id": "1:2802681814019499133", "lastPropertyId": "4:6451339597165131221", "name": "Note", + "flags": 2, "properties": [ { "id": "1:3178873177797362769", From 7f9563bb7907108a2ca22567d104559fb8303a1e Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 5 Nov 2020 17:56:02 +0100 Subject: [PATCH 17/20] Sync test - make sure the generated model is updated to avoid obscure test failures --- test/sync_test.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/sync_test.dart b/test/sync_test.dart index e710eeea6..7411375ea 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -3,8 +3,10 @@ import 'dart:typed_data'; import 'package:test/test.dart'; import 'package:objectbox/objectbox.dart'; +import 'package:objectbox/src/bindings/constants.dart'; import 'entity.dart'; +import 'objectbox.g.dart'; import 'test_env.dart'; // We want to have types explicit - verifying the return types of functions. @@ -35,6 +37,13 @@ void main() { return client; } + test('Model Entity has sync enabled', () { + final model = getObjectBoxModel().model; + final entity = + model.entities.firstWhere((ModelEntity e) => e.name == "TestEntity"); + expect(entity.hasFlag(OBXEntityFlag.SYNC_ENABLED), isTrue); + }); + test('SyncCredentials string encoding', () { // Let's check some special characters and verify the data is how it would // look like if the same shared secret was provided to the sync-server via @@ -164,7 +173,7 @@ void main() { // Note: only available when you start a sync server manually. // Comment out the `skip: ` argument in tthe test-case definition. // run sync-server --unsecured-no-authentication --model=/path/objectbox-dart/test/objectbox-model.json - // skip: 'Data sync test is disabled, Enable after running sync-server.' // + skip: 'Data sync test is disabled, Enable after running sync-server.' // ); } else { // TESTS to run when SYNC isn't available From ba96ccf32e0f1ba024f6d229da3ebe557a8e230b Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Sat, 7 Nov 2020 14:40:06 +0100 Subject: [PATCH 18/20] Sync - make sure Observers (query stream) and SyncClient can't be used at the same time --- .../flutter/objectbox_demo_sync/lib/main.dart | 6 +++++- lib/src/observable.dart | 13 +++++++----- lib/src/sync.dart | 2 ++ lib/src/util.dart | 20 +++++++++++++++++++ test/sync_test.dart | 19 ++++++++++++++++++ 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/example/flutter/objectbox_demo_sync/lib/main.dart b/example/flutter/objectbox_demo_sync/lib/main.dart index 3d92d60f1..9c0bebf04 100644 --- a/example/flutter/objectbox_demo_sync/lib/main.dart +++ b/example/flutter/objectbox_demo_sync/lib/main.dart @@ -77,7 +77,11 @@ class ViewModel { void removeNote(Note note) => _box.remove(note.id); - Stream> get queryStream => _query.findStream(); + // Note: using query.findStream() and sync.client() in the same app is + // currently not supported so this app is currently not working and only + // servers as an example on how and when to start a sync client. + // Stream> get queryStream => _query.findStream(); + Stream> get queryStream => Stream>.empty(); List get allNotes => _query.find(); diff --git a/lib/src/observable.dart b/lib/src/observable.dart index e081e515c..4250305d0 100644 --- a/lib/src/observable.dart +++ b/lib/src/observable.dart @@ -35,6 +35,8 @@ class _Observable { } static void subscribe(Store store) { + syncOrObserversExclusive.mark(store); + final callback = Pointer.fromFunction(_anyCallback); final storePtr = store.ptr; _anyObserver[storePtr.address] = @@ -53,18 +55,19 @@ class _Observable { StoreCloseObserver.removeListener(store, _anyObserver[storeAddress]); bindings.obx_observer_close(_anyObserver[storeAddress]); _anyObserver.remove(storeAddress); + syncOrObserversExclusive.unmark(store); } + + static bool isSubscribed(Store store) => + _Observable._anyObserver.containsKey(store.ptr.address); } extension Streamable on Query { void _setup() { - final storePtr = store.ptr; - - if (!_Observable._anyObserver.containsKey(storePtr)) { + if (!_Observable.isSubscribed(store)) { _Observable.subscribe(store); } - - final storeAddress = storePtr.address; + final storeAddress = store.ptr.address; _Observable._any[storeAddress] ??= {}; _Observable._any[storeAddress][entityId] ??= (u, _, __) { diff --git a/lib/src/sync.dart b/lib/src/sync.dart index c075bf3ed..61d26374b 100644 --- a/lib/src/sync.dart +++ b/lib/src/sync.dart @@ -101,6 +101,7 @@ class SyncClient { _cSync = nullptr; SyncClientsStorage.remove(_store); StoreCloseObserver.removeListener(_store, this); + syncOrObserversExclusive.unmark(_store); checkObx(err); } @@ -235,6 +236,7 @@ class Sync { if (SyncClientsStorage.containsKey(store)) { throw Exception('Only one sync client can be active for a store'); } + syncOrObserversExclusive.mark(store); final client = SyncClient(store, serverUri, creds); SyncClientsStorage[store] = client; StoreCloseObserver.addListener(store, client, client.close); diff --git a/lib/src/util.dart b/lib/src/util.dart index 31c4ca72a..9a3280ce0 100644 --- a/lib/src/util.dart +++ b/lib/src/util.dart @@ -42,3 +42,23 @@ class StoreCloseObserver { /// Global internal storage of sync clients - one client per store. final Map SyncClientsStorage = {}; + +// Currently, either SyncClient or Observers can be used at the same time. +// TODO: lift this condition after #142 is fixed. +class SyncOrObserversExclusive { + final _map = {}; + + void mark(Store store) { + if (_map.containsKey(store)) { + throw Exception( + 'Using observers/query streams in combination with SyncClient is currently not supported'); + } + _map[store] = true; + } + + void unmark(Store store) { + _map.remove(store); + } +} + +final syncOrObserversExclusive = SyncOrObserversExclusive(); diff --git a/test/sync_test.dart b/test/sync_test.dart index 7411375ea..466969c43 100644 --- a/test/sync_test.dart +++ b/test/sync_test.dart @@ -3,6 +3,7 @@ import 'dart:typed_data'; import 'package:test/test.dart'; import 'package:objectbox/objectbox.dart'; +import 'package:objectbox/observable.dart'; import 'package:objectbox/src/bindings/constants.dart'; import 'entity.dart'; @@ -56,6 +57,24 @@ void main() { if (Sync.isAvailable()) { // TESTS to run when SYNC is available + group('Circumvent issue #142 - async callbacks error', () { + final error = throwsA(predicate((Exception e) => e.toString().contains( + 'Using observers/query streams in combination with SyncClient is currently not supported'))); + + test('Must not start an Observer when SyncClient is active', () { + createClient(store); + expect(() => env.box.query().build().findStream(), error); + }); + + test('Must not start SyncClient when an Observer is active', () { + final error = throwsA(predicate((Exception e) => e.toString().contains( + 'Using observers/query streams in combination with SyncClient is currently not supported'))); + + SyncClient c = createClient(store); + expect(() => env.box.query().build().findStream(), error); + }); + }); + test('SyncClient lifecycle', () { expect(store.syncClient(), isNull); From dcb3718a9afc866d3bfe27dfd4d35279a1530714 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 9 Nov 2020 12:45:21 +0100 Subject: [PATCH 19/20] Sync flutter_libs - add iOS support --- sync_flutter_libs/ios/.gitignore | 3 ++ .../ios/Classes/ObjectBoxFlutterPlugin.h | 4 +++ .../ios/Classes/ObjectBoxFlutterPlugin.m | 15 ++++++++++ .../ios/Classes/SwiftObjectboxPlugin.swift | 14 +++++++++ sync_flutter_libs/ios/README.md | 16 ++++++++++ sync_flutter_libs/ios/download-framework.sh | 22 ++++++++++++++ .../ios/objectbox_sync_flutter_libs.podspec | 29 +++++++++++++++++++ sync_flutter_libs/pubspec.yaml | 2 ++ 8 files changed, 105 insertions(+) create mode 100644 sync_flutter_libs/ios/.gitignore create mode 100644 sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.h create mode 100644 sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.m create mode 100644 sync_flutter_libs/ios/Classes/SwiftObjectboxPlugin.swift create mode 100644 sync_flutter_libs/ios/README.md create mode 100755 sync_flutter_libs/ios/download-framework.sh create mode 100644 sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec diff --git a/sync_flutter_libs/ios/.gitignore b/sync_flutter_libs/ios/.gitignore new file mode 100644 index 000000000..5110b001f --- /dev/null +++ b/sync_flutter_libs/ios/.gitignore @@ -0,0 +1,3 @@ +# NOTE: comment out before publishing - the binaries need to be uploaded +Carthage +*.zip \ No newline at end of file diff --git a/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.h b/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.h new file mode 100644 index 000000000..324f488de --- /dev/null +++ b/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.h @@ -0,0 +1,4 @@ +#import + +@interface ObjectBoxFlutterPlugin : NSObject +@end diff --git a/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.m b/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.m new file mode 100644 index 000000000..7fb96a956 --- /dev/null +++ b/sync_flutter_libs/ios/Classes/ObjectBoxFlutterPlugin.m @@ -0,0 +1,15 @@ +#import "ObjectBoxFlutterPlugin.h" +#if __has_include() +#import +#else +// Support project import fallback if the generated compatibility header +// is not copied when this plugin is created as a library. +// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 +#import "objectbox_sync_flutter_libs-Swift.h" +#endif + +@implementation ObjectBoxFlutterPlugin ++ (void)registerWithRegistrar:(NSObject*)registrar { + [SwiftObjectBoxFlutterPlugin registerWithRegistrar:registrar]; +} +@end diff --git a/sync_flutter_libs/ios/Classes/SwiftObjectboxPlugin.swift b/sync_flutter_libs/ios/Classes/SwiftObjectboxPlugin.swift new file mode 100644 index 000000000..45141988e --- /dev/null +++ b/sync_flutter_libs/ios/Classes/SwiftObjectboxPlugin.swift @@ -0,0 +1,14 @@ +import Flutter +import UIKit + +public class SwiftObjectBoxFlutterPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "objectbox_sync_flutter_libs", binaryMessenger: registrar.messenger()) + let instance = SwiftObjectBoxFlutterPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + result("iOS " + UIDevice.current.systemVersion) + } +} diff --git a/sync_flutter_libs/ios/README.md b/sync_flutter_libs/ios/README.md new file mode 100644 index 000000000..ab4ee1b86 --- /dev/null +++ b/sync_flutter_libs/ios/README.md @@ -0,0 +1,16 @@ +Contents of this folder is based on `flutter create --template=plugin`. +It was reduced to the minimum that works for library inclusion by client apps. + +Notably, the package depends on `ObjectBox.framework` from ObjectBox Swift distribution, downloading +a released `ObjectBox-framework-X.Y.Z.zip` archive. + +## Current limitations/TODOs +There's currently an [issue](https://github.com/flutter/flutter/issues/45778) with Flutter tooling and/or its integration +with Cocoapods. In short, an "http" source in the podspec doesn't work - the file has to be available locally. + +To circumvent this, we're currently including the extracted `ObjectBox.framework` for iOS in the package when publishing +to pub.dev. Therefore, you need to run ./ios/download-framework.sh before publishing the package. +This has the benefit of a "no-setup" iOS support for the ObjectBox users - it works out of the box. +Also notably, we're only including the bare minimum from the ObjectBox Swift release which means smaller final app size. + +Note for contributors: you need to run the above-mentioned script as well to be able to test ObjectBox on iOS. diff --git a/sync_flutter_libs/ios/download-framework.sh b/sync_flutter_libs/ios/download-framework.sh new file mode 100755 index 000000000..302fcfcca --- /dev/null +++ b/sync_flutter_libs/ios/download-framework.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +# NOTE: run this script before publishing + +# https://github.com/objectbox/objectbox-swift/releases/ +obxSwiftVersion="1.4.0" + +dir=$(dirname "$0") + +url="https://github.com/objectbox/objectbox-swift/releases/download/v${obxSwiftVersion}/ObjectBox-framework-${obxSwiftVersion}.zip" +zip="${dir}/fw.zip" + +curl --location --fail --output "${zip}" "${url}" + +rm -rf "${dir}/Carthage" +unzip "${zip}" -d "${dir}" \ + "Carthage/Build/iOS/ObjectBox.framework/Headers/*" \ + "Carthage/Build/iOS/ObjectBox.framework/ObjectBox" \ + "Carthage/Build/iOS/ObjectBox.framework/Info.plist" + +rm "${zip}" \ No newline at end of file diff --git a/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec b/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec new file mode 100644 index 000000000..67d1dfe2f --- /dev/null +++ b/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec @@ -0,0 +1,29 @@ +# Provides the compiled framework as released in objectbox-swift. No dart-related sources. +# Run `pod lib lint objectbox_sync_flutter_libs.podspec' to validate before publishing. +# This package is not distributed as a CocoaPod, rather it's automatically used by Flutter when creating +# ios/{app}.podspec in client applications using objectbox-dart as a dependency. +# Some of the lines from the original podspec are commented out but left for future reference, in case it stops working. +Pod::Spec.new do |s| + s.name = 'objectbox_sync_flutter_libs' + s.version = '0.0.1' # not used anywhere - official flutter plugins use the same + s.summary = 'ObjectBox is a super-fast NoSQL ACID compliant object database.' + s.homepage = 'https://objectbox.io' + s.license = 'Apache 2.0, ObjectBox Binary License' + s.author = 'ObjectBox' + s.platform = :ios, '8.0' + + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + + s.dependency 'Flutter' + + # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } + s.swift_version = '5.0' + + # Get the ObjectBoxC.framework from the objectbox-swift release (see README.md) + s.ios.vendored_frameworks = 'Carthage/Build/iOS/ObjectBox.framework' + + # Fail early during build instead of not finding the library during runtime + s.xcconfig = { 'OTHER_LDFLAGS' => '-framework ObjectBox' } +end diff --git a/sync_flutter_libs/pubspec.yaml b/sync_flutter_libs/pubspec.yaml index 6d56382e6..e62a832d3 100644 --- a/sync_flutter_libs/pubspec.yaml +++ b/sync_flutter_libs/pubspec.yaml @@ -19,3 +19,5 @@ flutter: android: package: io.objectbox.flutter pluginClass: ObjectBoxFlutterPlugin + ios: + pluginClass: ObjectBoxFlutterPlugin From a7252df23be3ee9ec2e40163987abcd0241c7b9b Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 9 Nov 2020 19:12:27 +0100 Subject: [PATCH 20/20] Sync - docs updates --- example/flutter/objectbox_demo_sync/lib/main.dart | 3 ++- sync_flutter_libs/README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/example/flutter/objectbox_demo_sync/lib/main.dart b/example/flutter/objectbox_demo_sync/lib/main.dart index 9c0bebf04..cf11f0c7c 100644 --- a/example/flutter/objectbox_demo_sync/lib/main.dart +++ b/example/flutter/objectbox_demo_sync/lib/main.dart @@ -66,7 +66,8 @@ class ViewModel { _query = _box.query().order(dateProp, flags: Order.descending).build(); // TODO configure actual sync server address and authentication - // 10.0.2.2 is your host PC if an app is run in an emulator. + // 10.0.2.2 is your host PC if an app is run in an Android emulator. + // 127.0.0.1 is your host PC if an app is run in an iOS simulator. // For other options, see objectbox/lib/src/sync.dart final syncClient = Sync.client(_store, 'ws://10.0.2.2:9999', SyncCredentials.none()); diff --git a/sync_flutter_libs/README.md b/sync_flutter_libs/README.md index 6f44b6893..1bead157d 100644 --- a/sync_flutter_libs/README.md +++ b/sync_flutter_libs/README.md @@ -1,6 +1,6 @@ -ObjectBox (with Sync) libraries for Flutter +ObjectBox (with [Sync](https://objectbox.io/sync)) libraries for Flutter =========================================== -This package provides native ObjectBox library as a flutter plugin for supported platforms. +This package provides native ObjectBox library, including [Sync](https://objectbox.io/sync) client, as a flutter plugin for supported platforms. You should add this package as a dependency when using [ObjectBox](https://pub.dev/packages/objectbox) with Flutter. See package [ObjectBox](https://pub.dev/packages/objectbox) for more details and information how to use ObjectBox it.