diff --git a/src/object-store/shared_realm.cpp b/src/object-store/shared_realm.cpp index fd85e8f9..7806dd2f 100644 --- a/src/object-store/shared_realm.cpp +++ b/src/object-store/shared_realm.cpp @@ -18,10 +18,13 @@ #include "shared_realm.hpp" +#if __APPLE__ #include "external_commit_helper.hpp" +#endif + #include "binding_context.hpp" #include "schema.hpp" -#include "transact_log_handler.hpp" +#include "impl/transact_log_handler.hpp" #include #include @@ -101,9 +104,11 @@ Realm::Realm(Config config) } Realm::~Realm() { +#if __APPLE__ if (m_notifier) { // might not exist yet if an error occurred during init m_notifier->remove_realm(this); } +#endif } Group *Realm::read_group() @@ -154,11 +159,15 @@ SharedRealm Realm::get_shared_realm(Config config) // FIXME - need to validate that schemas match realm->m_config.schema = std::make_unique(*existing->m_config.schema); +#if __APPLE__ realm->m_notifier = existing->m_notifier; realm->m_notifier->add_realm(realm.get()); +#endif } else { +#if __APPLE__ realm->m_notifier = std::make_shared(realm.get()); +#endif // otherwise get the schema from the group realm->m_config.schema = std::make_unique(ObjectStore::schema_from_group(realm->read_group())); @@ -290,7 +299,9 @@ void Realm::commit_transaction() m_in_transaction = false; transaction::commit(*m_shared_group, *m_history, m_binding_context.get()); +#if __APPLE__ m_notifier->notify_others(); +#endif } void Realm::cancel_transaction() @@ -398,15 +409,17 @@ uint64_t Realm::get_schema_version(const realm::Realm::Config &config) void Realm::close() { +#if __APPLE__ if (m_notifier) { m_notifier->remove_realm(this); } + m_notifier = nullptr; +#endif m_group = nullptr; m_shared_group = nullptr; m_history = nullptr; m_read_only_group = nullptr; - m_notifier = nullptr; m_binding_context = nullptr; } diff --git a/src/object-store/shared_realm.hpp b/src/object-store/shared_realm.hpp index 85e42224..e20f6fbd 100644 --- a/src/object-store/shared_realm.hpp +++ b/src/object-store/shared_realm.hpp @@ -124,8 +124,10 @@ namespace realm { Group *m_group = nullptr; +#if __APPLE__ std::shared_ptr<_impl::ExternalCommitHelper> m_notifier; - +#endif + public: std::unique_ptr m_binding_context; diff --git a/tests/react-test-app/android/app/src/main/jni/Android.mk b/tests/react-test-app/android/app/src/main/jni/Android.mk index 96ba7abf..5ef7c9ba 100644 --- a/tests/react-test-app/android/app/src/main/jni/Android.mk +++ b/tests/react-test-app/android/app/src/main/jni/Android.mk @@ -5,23 +5,35 @@ include $(CLEAR_VARS) LOCAL_MODULE := librealmreact LOCAL_SRC_FILES := \ - js_list.cpp \ - js_results.cpp \ - js_init.cpp \ - js_realm.cpp \ - js_util.cpp \ - js_object.cpp \ - js_schema.cpp \ - rpc.cpp \ + src/js_list.cpp \ + src/js_results.cpp \ + src/js_init.cpp \ + src/js_realm.cpp \ + src/js_util.cpp \ + src/js_object.cpp \ + src/js_schema.cpp \ + src/rpc.cpp \ + src/object-store/index_set.cpp \ + src/object-store/list.cpp \ + src/object-store/object_schema.cpp \ + src/object-store/object_store.cpp \ + src/object-store/results.cpp \ + src/object-store/schema.cpp \ + src/object-store/shared_realm.cpp \ + src/object-store/parser/parser.cpp \ + src/object-store/parser/query_builder.cpp \ + src/object-store/impl/transact_log_handler.cpp -LOCAL_CFLAGS += -Wall -Werror -fexceptions +LOCAL_C_INCLUDES := src/object-store +LOCAL_C_INCLUDES += src/object-store/parser +LOCAL_C_INCLUDES += ../../../../../../../vendor +LOCAL_C_INCLUDES += ../../../../../../../vendor/PEGTL +LOCAL_C_INCLUDES += ../../../../../../../core/include + +LOCAL_CFLAGS += -fexceptions -std=c++14 -frtti -Wno-extern-c-compat CXX11_FLAGS := -std=c++11 LOCAL_CFLAGS += $(CXX11_FLAGS) LOCAL_EXPORT_CPPFLAGS := $(CXX11_FLAGS) - -LOCAL_C_INCLUDES := ../../../../../../../vendor -LOCAL_C_INCLUDES += ../../../../../../../core/include - LOCAL_SHARED_LIBRARIES := libjsc include $(BUILD_SHARED_LIBRARY) diff --git a/tests/react-test-app/android/app/src/main/jni/binding_context.hpp b/tests/react-test-app/android/app/src/main/jni/binding_context.hpp deleted file mode 120000 index c5cda76e..00000000 --- a/tests/react-test-app/android/app/src/main/jni/binding_context.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/binding_context.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/index_set.cpp b/tests/react-test-app/android/app/src/main/jni/index_set.cpp deleted file mode 120000 index e59b0f52..00000000 --- a/tests/react-test-app/android/app/src/main/jni/index_set.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/index_set.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/index_set.hpp b/tests/react-test-app/android/app/src/main/jni/index_set.hpp deleted file mode 120000 index c1b02c7f..00000000 --- a/tests/react-test-app/android/app/src/main/jni/index_set.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/index_set.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_init.cpp b/tests/react-test-app/android/app/src/main/jni/js_init.cpp deleted file mode 120000 index 5dbc34bd..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_init.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_init.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_init.h b/tests/react-test-app/android/app/src/main/jni/js_init.h deleted file mode 120000 index 904b6881..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_init.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_init.h \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_list.cpp b/tests/react-test-app/android/app/src/main/jni/js_list.cpp deleted file mode 120000 index 5a9624cd..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_list.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_list.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_list.hpp b/tests/react-test-app/android/app/src/main/jni/js_list.hpp deleted file mode 120000 index 66870d89..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_list.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_list.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_object.cpp b/tests/react-test-app/android/app/src/main/jni/js_object.cpp deleted file mode 120000 index 77cd10b6..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_object.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_object.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_object.hpp b/tests/react-test-app/android/app/src/main/jni/js_object.hpp deleted file mode 120000 index ee70b698..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_object.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_object.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_realm.cpp b/tests/react-test-app/android/app/src/main/jni/js_realm.cpp deleted file mode 120000 index bfb79f5b..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_realm.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_realm.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_realm.hpp b/tests/react-test-app/android/app/src/main/jni/js_realm.hpp deleted file mode 120000 index 6ee625aa..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_realm.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_realm.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_results.cpp b/tests/react-test-app/android/app/src/main/jni/js_results.cpp deleted file mode 120000 index adc6fb57..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_results.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_results.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_results.hpp b/tests/react-test-app/android/app/src/main/jni/js_results.hpp deleted file mode 120000 index 0f6d3f19..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_results.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_results.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_schema.cpp b/tests/react-test-app/android/app/src/main/jni/js_schema.cpp deleted file mode 120000 index f28579e2..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_schema.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_schema.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_schema.hpp b/tests/react-test-app/android/app/src/main/jni/js_schema.hpp deleted file mode 120000 index 9094c9e2..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_schema.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_schema.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_util.cpp b/tests/react-test-app/android/app/src/main/jni/js_util.cpp deleted file mode 120000 index 31806c26..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_util.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_util.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/js_util.hpp b/tests/react-test-app/android/app/src/main/jni/js_util.hpp deleted file mode 120000 index 868d03f3..00000000 --- a/tests/react-test-app/android/app/src/main/jni/js_util.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/js_util.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/list.cpp b/tests/react-test-app/android/app/src/main/jni/list.cpp deleted file mode 120000 index c1a7432e..00000000 --- a/tests/react-test-app/android/app/src/main/jni/list.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/list.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/list.hpp b/tests/react-test-app/android/app/src/main/jni/list.hpp deleted file mode 120000 index ca3672b5..00000000 --- a/tests/react-test-app/android/app/src/main/jni/list.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/list.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/object_accessor.hpp b/tests/react-test-app/android/app/src/main/jni/object_accessor.hpp deleted file mode 120000 index 998ea825..00000000 --- a/tests/react-test-app/android/app/src/main/jni/object_accessor.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/object_accessor.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/object_schema.cpp b/tests/react-test-app/android/app/src/main/jni/object_schema.cpp deleted file mode 120000 index d2552190..00000000 --- a/tests/react-test-app/android/app/src/main/jni/object_schema.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/object_schema.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/object_schema.hpp b/tests/react-test-app/android/app/src/main/jni/object_schema.hpp deleted file mode 120000 index 2fca9fe8..00000000 --- a/tests/react-test-app/android/app/src/main/jni/object_schema.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/object_schema.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/object_store.cpp b/tests/react-test-app/android/app/src/main/jni/object_store.cpp deleted file mode 120000 index c920e6c6..00000000 --- a/tests/react-test-app/android/app/src/main/jni/object_store.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/object_store.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/object_store.hpp b/tests/react-test-app/android/app/src/main/jni/object_store.hpp deleted file mode 120000 index 4ec89882..00000000 --- a/tests/react-test-app/android/app/src/main/jni/object_store.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/object_store.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/parser.hpp b/tests/react-test-app/android/app/src/main/jni/parser.hpp deleted file mode 120000 index 429cecb5..00000000 --- a/tests/react-test-app/android/app/src/main/jni/parser.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/parser/parser.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/platform.hpp b/tests/react-test-app/android/app/src/main/jni/platform.hpp deleted file mode 120000 index ec9bfa50..00000000 --- a/tests/react-test-app/android/app/src/main/jni/platform.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/platform.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/property.hpp b/tests/react-test-app/android/app/src/main/jni/property.hpp deleted file mode 120000 index 13a97feb..00000000 --- a/tests/react-test-app/android/app/src/main/jni/property.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/property.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/query_builder.hpp b/tests/react-test-app/android/app/src/main/jni/query_builder.hpp deleted file mode 120000 index ea572938..00000000 --- a/tests/react-test-app/android/app/src/main/jni/query_builder.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/parser/query_builder.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/results.cpp b/tests/react-test-app/android/app/src/main/jni/results.cpp deleted file mode 120000 index e88f81e1..00000000 --- a/tests/react-test-app/android/app/src/main/jni/results.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/results.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/results.hpp b/tests/react-test-app/android/app/src/main/jni/results.hpp deleted file mode 120000 index fbbea38f..00000000 --- a/tests/react-test-app/android/app/src/main/jni/results.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/results.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/rpc.cpp b/tests/react-test-app/android/app/src/main/jni/rpc.cpp deleted file mode 120000 index 14753a54..00000000 --- a/tests/react-test-app/android/app/src/main/jni/rpc.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/rpc.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/rpc.hpp b/tests/react-test-app/android/app/src/main/jni/rpc.hpp deleted file mode 120000 index 5009073c..00000000 --- a/tests/react-test-app/android/app/src/main/jni/rpc.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/rpc.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/schema.cpp b/tests/react-test-app/android/app/src/main/jni/schema.cpp deleted file mode 120000 index 27fd2c49..00000000 --- a/tests/react-test-app/android/app/src/main/jni/schema.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/schema.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/schema.hpp b/tests/react-test-app/android/app/src/main/jni/schema.hpp deleted file mode 120000 index dd6ee90b..00000000 --- a/tests/react-test-app/android/app/src/main/jni/schema.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/schema.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/shared_realm.cpp b/tests/react-test-app/android/app/src/main/jni/shared_realm.cpp deleted file mode 120000 index 60d694a0..00000000 --- a/tests/react-test-app/android/app/src/main/jni/shared_realm.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/shared_realm.cpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/shared_realm.hpp b/tests/react-test-app/android/app/src/main/jni/shared_realm.hpp deleted file mode 120000 index 727de551..00000000 --- a/tests/react-test-app/android/app/src/main/jni/shared_realm.hpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../src/object-store/shared_realm.hpp \ No newline at end of file diff --git a/tests/react-test-app/android/app/src/main/jni/src b/tests/react-test-app/android/app/src/main/jni/src new file mode 120000 index 00000000..43fced61 --- /dev/null +++ b/tests/react-test-app/android/app/src/main/jni/src @@ -0,0 +1 @@ +../../../../../../../src \ No newline at end of file