@@ -25,7 +25,6 @@ public class SyncBuilder {
25
25
@ Nullable
26
26
String [] trustedCertPaths ;
27
27
boolean uncommittedAcks ;
28
- boolean manualStart ;
29
28
30
29
RequestUpdatesMode requestUpdatesMode = RequestUpdatesMode .AUTO ;
31
30
@@ -103,18 +102,6 @@ public SyncBuilder uncommittedAcks() {
103
102
return this ;
104
103
}
105
104
106
-
107
- /**
108
- * Prevents the client from starting (connecting, logging in, syncing) automatically.
109
- * It will need to be started manually later.
110
- *
111
- * @see SyncClient#start()
112
- */
113
- public SyncBuilder manualStart () {
114
- manualStart = true ;
115
- return this ;
116
- }
117
-
118
105
/**
119
106
* Sets a listener to observe sync events like login or sync completion.
120
107
* This listener can also be set (or removed) on the sync client directly.
@@ -137,13 +124,22 @@ public SyncBuilder changesListener(SyncChangesListener changesListener) {
137
124
return this ;
138
125
}
139
126
127
+ /**
128
+ * Builds and returns a Sync client ready to {@link SyncClient#start()}.
129
+ */
140
130
public SyncClient build () {
141
- if (credentials == null ) {
142
- throw new IllegalStateException ("Credentials are required." );
143
- }
144
131
return new SyncClientImpl (this );
145
132
}
146
133
134
+ /**
135
+ * Builds, {@link SyncClient#start() starts} and returns a Sync client.
136
+ */
137
+ public SyncClient buildAndStart () {
138
+ SyncClient syncClient = build ();
139
+ syncClient .start ();
140
+ return syncClient ;
141
+ }
142
+
147
143
private void checkNotNull (Object object , String message ) {
148
144
//noinspection ConstantConditions Non-null annotation does not enforce, so check for null.
149
145
if (object == null ) {
0 commit comments