Update the recently-added RealmClass::wait_for_download_completion to

use the new object accessor interface.
This commit is contained in:
Mark Rowe 2017-05-22 14:33:39 -07:00
parent 08052e12f6
commit 43200b1db5

View File

@ -553,8 +553,9 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType,
static const String encryption_key_string = "encryptionKey";
ValueType encryption_key_value = Object::get_property(ctx, config_object, encryption_key_string);
if (!Value::is_undefined(ctx, encryption_key_value)) {
std::string encryption_key = NativeAccessor::to_binary(ctx, encryption_key_value);
config.encryption_key = std::vector<char>(encryption_key.begin(), encryption_key.end());
NativeAccessor accessor(ctx);
auto encryption_key = accessor.template unbox<BinaryData>(encryption_key_value);
config.encryption_key.assign(encryption_key.data(), encryption_key.data() + encryption_key.size());
}
Protected<ObjectType> thiz(ctx, this_object);
@ -798,4 +799,4 @@ void RealmClass<T>::close(ContextType ctx, FunctionType, ObjectType this_object,
}
} // js
} // realm
} // realm