Merge branch 'master' into cm/template-method

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Christian Melchior 2018-06-19 08:57:42 +02:00
commit 2db3ea5853
6 changed files with 48 additions and 12 deletions

View File

@ -1,4 +1,4 @@
2.9.0 Release notes (YYYY-MM-DD)
X.Y.Z Release notes
=============================================================
### Compatibility
* Sync protocol: 24
@ -6,9 +6,42 @@
* File format: 7
* Realm Object Server: 3.0.0 or later
### Breaking changes
* None.
### Enhancements
* Added support for compacting synchronized Realms and allowed setting the
`shouldCompactOnLaunch` config property for them.
* Added `Realm.createTemplateObject(objectSchema)' (#1870).
### Bug fixes
* Fix incorrect documentation of the `shouldCompactOnLaunch` parameters.
### Internals
* None.
2.8.5 Release notes (2018-6-18)
=============================================================
### Compatibility
* Sync protocol: 24
* Server-side history format: 4
* File format: 7
* Realm Object Server: 3.0.0 or later
### Breaking changes
* None.
### Enhancements
* None.
### Bug fixes
* [Sync] Fixed a bug that could result in a crash with the message "bad changeset error".
### Internals
* Upgraded to Realm Sync v3.5.5.
* Realm Core v5.6.2.
2.8.4 Release notes (2018-6-15)
=============================================================

View File

@ -1,5 +1,5 @@
PACKAGE_NAME=realm-js
VERSION=2.8.4
VERSION=2.8.5
REALM_CORE_VERSION=5.6.2
REALM_SYNC_VERSION=3.5.4
REALM_SYNC_VERSION=3.5.5
REALM_OBJECT_SERVER_VERSION=3.0.0

View File

@ -332,7 +332,7 @@ class Realm {
* a Realm for the first time during the life of a process to determine if it should be compacted
* before being returned to the user. The function takes two arguments:
* - `totalSize` - The total file size (data + free space)
* - `unusedSize` - The total bytes used by data in the file.
* - `usedSize` - The total bytes used by data in the file.
* It returns `true` to indicate that an attempt to compact the file should be made. The compaction
* will be skipped if another process is accessing it.
* @property {string} [path={@link Realm.defaultPath}] - The path to the file where the

View File

@ -1,7 +1,7 @@
{
"name": "realm",
"description": "Realm is a mobile database: an alternative to SQLite and key-value stores",
"version": "2.8.4",
"version": "2.8.5",
"license": "Apache-2.0",
"homepage": "https://realm.io",
"keywords": [

View File

@ -969,7 +969,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.8.4;
CURRENT_PROJECT_VERSION = 2.8.5;
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -1033,7 +1033,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.8.4;
CURRENT_PROJECT_VERSION = 2.8.5;
CXX = "$(SRCROOT)/../scripts/ccache-clang++.sh";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;

View File

@ -516,15 +516,12 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
if (config.schema_mode == SchemaMode::Immutable) {
throw std::invalid_argument("Cannot set 'shouldCompactOnLaunch' when 'readOnly' is set.");
}
if (config.sync_config) {
throw std::invalid_argument("Cannot set 'shouldCompactOnLaunch' when 'sync' is set.");
}
FunctionType should_compact_on_launch_function = Value::validated_to_function(ctx, compact_value, "shouldCompactOnLaunch");
config.should_compact_on_launch_function = [=](uint64_t total_bytes, uint64_t unused_bytes) {
config.should_compact_on_launch_function = [=](uint64_t total_bytes, uint64_t used_bytes) {
ValueType arguments[2] = {
Value::from_number(ctx, total_bytes),
Value::from_number(ctx, unused_bytes)
Value::from_number(ctx, used_bytes)
};
ValueType should_compact = Function<T>::callback(ctx, should_compact_on_launch_function, this_object, 2, arguments);
@ -571,6 +568,12 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
config.cache = Value::validated_to_boolean(ctx, cache_value, "_cache");
}
static const String automatic_change_notifications_string = "_automaticChangeNotifications";
ValueType automatic_change_notifications_value = Object::get_property(ctx, object, automatic_change_notifications_string);
if (!Value::is_undefined(ctx, automatic_change_notifications_value)) {
config.automatic_change_notifications = Value::validated_to_boolean(ctx, automatic_change_notifications_value, "_automaticChangeNotifications");
}
static const String disable_format_upgrade_string = "disableFormatUpgrade";
ValueType disable_format_upgrade_value = Object::get_property(ctx, object, disable_format_upgrade_string);
if (!Value::is_undefined(ctx, disable_format_upgrade_value)) {