Skip to content

Commit 9bafcdb

Browse files
SyncClient: support setting SyncFlags
1 parent 0805f1f commit 9bafcdb

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

objectbox-java/src/main/java/io/objectbox/sync/SyncBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public final class SyncBuilder {
6161

6262
@Nullable
6363
String[] trustedCertPaths;
64+
int flags;
6465
boolean uncommittedAcks;
6566

6667
RequestUpdatesMode requestUpdatesMode = RequestUpdatesMode.AUTO;
@@ -168,6 +169,16 @@ public SyncBuilder trustedCertificates(String[] paths) {
168169
return this;
169170
}
170171

172+
/**
173+
* Sets bit flags to adjust Sync behavior, like additional logging.
174+
*
175+
* @param flags One or multiple {@link SyncFlags}, combined with bitwise or.
176+
*/
177+
public SyncBuilder flags(int flags) {
178+
this.flags = flags;
179+
return this;
180+
}
181+
171182
/**
172183
* Configure automatic sync updates from the server.
173184
* If automatic sync updates are turned off, they will need to be requested using the sync client.

objectbox-java/src/main/java/io/objectbox/sync/SyncClientImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public final class SyncClientImpl implements SyncClient {
8383
nativeSyncOptAddCertPath(optHandle, certPath);
8484
}
8585
}
86+
87+
// Add Sync flags if set
88+
if (builder.flags != 0) {
89+
nativeSyncOptFlags(optHandle, builder.flags);
90+
}
8691
} catch (Exception e) {
8792
// Free the options if any option method call failed (like due to invalid arguments)
8893
nativeSyncOptFree(optHandle);

0 commit comments

Comments
 (0)