use of io.realm.mongodb.sync.SubscriptionSet in project realm-java by realm.
the class SyncObjectServerFacade method downloadInitialFlexibleSyncData.
@Override
public void downloadInitialFlexibleSyncData(Realm realm, RealmConfiguration configuration) {
if (configuration instanceof SyncConfiguration) {
SyncConfiguration syncConfig = (SyncConfiguration) configuration;
if (syncConfig.isFlexibleSyncConfiguration()) {
SyncConfiguration.InitialFlexibleSyncSubscriptions handler = syncConfig.getInitialSubscriptionsHandler();
if (handler != null) {
SubscriptionSet subscriptions = realm.getSubscriptions();
subscriptions.update(new SubscriptionSet.UpdateCallback() {
@Override
public void update(MutableSubscriptionSet subscriptions) {
handler.configure(realm, subscriptions);
}
});
if (!subscriptions.waitForSynchronization()) {
throw new IllegalStateException("Realm couldn't be fully opened because " + "flexible sync encountered an error when bootstrapping initial" + "subscriptions: " + subscriptions.getErrorMessage());
}
}
}
}
}
Aggregations