From a9120fe09b3f5435222de0c06f742608776b5951 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 9 Mar 2017 21:17:33 -0800 Subject: [PATCH] fixes for latest object store --- dependencies.list | 4 ++-- src/RealmJS.xcodeproj/project.pbxproj | 7 ++++++- src/js_realm_object.hpp | 13 ++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dependencies.list b/dependencies.list index cc9f098c..7e10c387 100644 --- a/dependencies.list +++ b/dependencies.list @@ -1,5 +1,5 @@ PACKAGE_NAME=realm-js VERSION=1.1.1 -REALM_CORE_VERSION=2.3.2 -REALM_SYNC_VERSION=1.3.0 +REALM_CORE_VERSION=2.3.3 +REALM_SYNC_VERSION=1.3.1 REALM_OBJECT_SERVER_VERSION=1.0.3 diff --git a/src/RealmJS.xcodeproj/project.pbxproj b/src/RealmJS.xcodeproj/project.pbxproj index 7fdfb947..11575c54 100644 --- a/src/RealmJS.xcodeproj/project.pbxproj +++ b/src/RealmJS.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 02022A671DA47BD7000F0C4F /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02022A611DA47B8B000F0C4F /* parser.cpp */; }; 02022A681DA47BD7000F0C4F /* query_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02022A631DA47B8B000F0C4F /* query_builder.cpp */; }; 02022A7C1DA47EC8000F0C4F /* format.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02022A731DA47EC8000F0C4F /* format.cpp */; }; + 022BF1021E7266DF00F382F1 /* binding_callback_thread_observer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 022BF0FF1E7266C800F382F1 /* binding_callback_thread_observer.cpp */; }; 02409DC21BCF11D6005F3B3E /* RealmJSCoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 02409DC11BCF11D6005F3B3E /* RealmJSCoreTests.m */; }; 02414B881CE68CA200A8669F /* dates-v5.realm in Resources */ = {isa = PBXBuildFile; fileRef = 02414B871CE68CA200A8669F /* dates-v5.realm */; }; 02414BA51CE6ABCF00A8669F /* collection_change_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B991CE6AAEF00A8669F /* collection_change_builder.cpp */; }; @@ -43,7 +44,6 @@ 50C671001E1D2D31003CB63C /* thread_safe_reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D02C7791E1C83650048C13E /* thread_safe_reference.cpp */; }; 5D25F5A11D6284FD00EBBB30 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F63FF3301C16434400B3B8E0 /* libz.tbd */; }; 8507156E1E2CFCD000E548DB /* object_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8507156B1E2CFC0100E548DB /* object_notifier.cpp */; }; - 850715AF1E32366B00E548DB /* event_loop_dispatcher.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 850715AE1E32366B00E548DB /* event_loop_dispatcher.hpp */; }; F61378791C18EAC5008BFC51 /* js in Resources */ = {isa = PBXBuildFile; fileRef = F61378781C18EAAC008BFC51 /* js */; }; F63FF2C61C12469E00B3B8E0 /* jsc_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048011C0428DF00ABDED4 /* jsc_init.cpp */; }; F63FF2C91C12469E00B3B8E0 /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; }; @@ -98,6 +98,8 @@ 02022A741DA47EC8000F0C4F /* format.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = format.hpp; sourceTree = ""; }; 02022A761DA47EC8000F0C4F /* event_loop_signal.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = event_loop_signal.hpp; sourceTree = ""; }; 02022A781DA47EC8000F0C4F /* event_loop_signal.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = event_loop_signal.hpp; sourceTree = ""; }; + 022BF0FF1E7266C800F382F1 /* binding_callback_thread_observer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = binding_callback_thread_observer.cpp; path = src/binding_callback_thread_observer.cpp; sourceTree = ""; }; + 022BF1001E7266C800F382F1 /* binding_callback_thread_observer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = binding_callback_thread_observer.hpp; path = src/binding_callback_thread_observer.hpp; sourceTree = ""; }; 02409DC11BCF11D6005F3B3E /* RealmJSCoreTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RealmJSCoreTests.m; path = ios/RealmJSCoreTests.m; sourceTree = ""; }; 02414B871CE68CA200A8669F /* dates-v5.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dates-v5.realm"; sourceTree = ""; }; 02414B961CE6AADD00A8669F /* collection_notifications.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = collection_notifications.cpp; path = src/collection_notifications.cpp; sourceTree = ""; }; @@ -457,6 +459,8 @@ 02022A6B1DA47EC8000F0C4F /* util */, F63117EA1CEB0BFA00ECB2DE /* impl */, F63117EC1CEB0C8100ECB2DE /* parser */, + 022BF1001E7266C800F382F1 /* binding_callback_thread_observer.hpp */, + 022BF0FF1E7266C800F382F1 /* binding_callback_thread_observer.cpp */, 02F59EAE1C88F17D007F774C /* binding_context.hpp */, 02414B961CE6AADD00A8669F /* collection_notifications.cpp */, 02414B971CE6AADD00A8669F /* collection_notifications.hpp */, @@ -855,6 +859,7 @@ 02F59EC41C88F17D007F774C /* schema.cpp in Sources */, F63FF2CD1C12469E00B3B8E0 /* rpc.cpp in Sources */, 02E315D21DB80DF200555337 /* sync_file.cpp in Sources */, + 022BF1021E7266DF00F382F1 /* binding_callback_thread_observer.cpp in Sources */, 02F59EC21C88F17D007F774C /* object_store.cpp in Sources */, 02022A7C1DA47EC8000F0C4F /* format.cpp in Sources */, 02E315CB1DB80DDD00555337 /* sync_user.cpp in Sources */, diff --git a/src/js_realm_object.hpp b/src/js_realm_object.hpp index aa4b34ca..93405205 100644 --- a/src/js_realm_object.hpp +++ b/src/js_realm_object.hpp @@ -104,14 +104,17 @@ void RealmObjectClass::get_property(ContextType ctx, ObjectType object, const template bool RealmObjectClass::set_property(ContextType ctx, ObjectType object, const String &property, ValueType value) { auto realm_object = get_internal>(object); + + std::string property_name = property; + if (!realm_object->get_object_schema().property_for_name(property_name)) { + return false; + } + try { - realm_object->set_property_value(ctx, property, value, true); + realm_object->set_property_value(ctx, property_name, value, true); } catch (TypeErrorException &ex) { - throw TypeErrorException(realm_object->get_object_schema().name + "." + std::string(property), ex.type()); - } - catch (InvalidPropertyException &ex) { - return false; + throw TypeErrorException(realm_object->get_object_schema().name + "." + property_name, ex.type()); } return true; }