merge master
This commit is contained in:
parent
70a30484d8
commit
0ead1b5b1c
|
@ -454,14 +454,15 @@ void RealmClass<T>::schema_version(ContextType ctx, ObjectType this_object, size
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RealmClass<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
void RealmClass<T>::clear_test_state(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||||
validate_argument_count(argc, 0);
|
validate_argument_count(argc, 0);
|
||||||
|
|
||||||
|
delete_all_realms();
|
||||||
#if REALM_ENABLE_SYNC
|
#if REALM_ENABLE_SYNC
|
||||||
for(auto &user : SyncManager::shared().all_users()) {
|
for(auto &user : SyncManager::shared().all_logged_in_users()) {
|
||||||
user->log_out();
|
user->log_out();
|
||||||
}
|
}
|
||||||
SyncManager::shared().reset_for_testing();
|
SyncManager::shared().reset_for_testing();
|
||||||
SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption);
|
SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption);
|
||||||
#endif
|
#endif
|
||||||
delete_all_realms();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -127,8 +127,8 @@ void UserClass<T>::create_user(ContextType ctx, ObjectType this_object, size_t a
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void UserClass<T>::all_users(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
void UserClass<T>::all_users(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||||
auto users = Object::create_empty(ctx);
|
auto users = Object::create_empty(ctx);
|
||||||
for (auto user : SyncManager::shared().all_users()) {
|
for (auto user : SyncManager::shared().all_logged_in_users()) {
|
||||||
if (user->state() == SyncUser::State::Active) {
|
if (!user->is_admin()) {
|
||||||
Object::set_property(ctx, users, user->identity(), create_object<T, UserClass<T>>(ctx, new SharedUser(user)), ReadOnly | DontDelete);
|
Object::set_property(ctx, users, user->identity(), create_object<T, UserClass<T>>(ctx, new SharedUser(user)), ReadOnly | DontDelete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,8 @@ void UserClass<T>::all_users(ContextType ctx, ObjectType object, ReturnValue &re
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void UserClass<T>::current_user(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
void UserClass<T>::current_user(ContextType ctx, ObjectType object, ReturnValue &return_value) {
|
||||||
SharedUser *current = nullptr;
|
SharedUser *current = nullptr;
|
||||||
for (auto user : SyncManager::shared().all_users()) {
|
for (auto user : SyncManager::shared().all_logged_in_users()) {
|
||||||
if (user->state() == SyncUser::State::Active) {
|
if (!user->is_admin()) {
|
||||||
if (current != nullptr) {
|
if (current != nullptr) {
|
||||||
throw std::runtime_error("More than one user logged in currently.");
|
throw std::runtime_error("More than one user logged in currently.");
|
||||||
}
|
}
|
||||||
|
@ -302,8 +302,7 @@ void SyncClass<T>::populate_sync_config(ContextType ctx, ObjectType realm_constr
|
||||||
std::string raw_realm_url = Object::validated_get_string(ctx, sync_config_object, "url");
|
std::string raw_realm_url = Object::validated_get_string(ctx, sync_config_object, "url");
|
||||||
|
|
||||||
// FIXME - use make_shared
|
// FIXME - use make_shared
|
||||||
config.sync_config = std::shared_ptr<SyncConfig>(
|
config.sync_config = std::shared_ptr<SyncConfig>(new SyncConfig{shared_user, raw_realm_url, SyncSessionStopPolicy::AfterChangesUploaded, handler, [=](auto, int error_code, std::string message, SyncSessionError) {}}
|
||||||
new SyncConfig(shared_user, raw_realm_url, SyncSessionStopPolicy::AfterChangesUploaded, handler)
|
|
||||||
);
|
);
|
||||||
config.schema_mode = SchemaMode::Additive;
|
config.schema_mode = SchemaMode::Additive;
|
||||||
config.path = realm::SyncManager::shared().path_for_realm(shared_user->identity(), raw_realm_url);
|
config.path = realm::SyncManager::shared().path_for_realm(shared_user->identity(), raw_realm_url);
|
||||||
|
|
Loading…
Reference in New Issue