Skip to content

Commit 01b4f73

Browse files
committed
Update some variables and comments for FIS.
1 parent 512df9d commit 01b4f73

File tree

5 files changed

+43
-30
lines changed

5 files changed

+43
-30
lines changed

firebase-config/bandwagoner/src/main/java/com/googletest/firebase/remoteconfig/bandwagoner/ApiFragment.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,26 @@ public View onCreateView(
9696

9797
TextView iidText = rootView.findViewById(R.id.iid_text);
9898

99-
Task<String> idTask = firebaseInstallations.getId();
100-
Task<InstallationTokenResult> tokenTask = firebaseInstallations.getToken(false);
99+
Task<String> installationIdTask = firebaseInstallations.getId();
100+
Task<InstallationTokenResult> installationAuthTokenTask = firebaseInstallations.getToken(false);
101101

102-
Tasks.whenAllComplete(idTask, tokenTask)
102+
Tasks.whenAllComplete(installationIdTask, installationAuthTokenTask)
103103
.addOnCompleteListener(
104104
unusedCompletedTasks -> {
105-
if (idTask.isSuccessful()) {
106-
iidText.setText(String.format("Installation ID: %s", idTask.getResult()));
105+
if (installationIdTask.isSuccessful()) {
106+
iidText.setText(
107+
String.format("Installation ID: %s", installationIdTask.getResult()));
107108
} else {
108-
Log.e(TAG, "Error getting Installation ID", idTask.getException());
109+
Log.e(TAG, "Error getting installation ID", installationIdTask.getException());
109110
}
110111

111-
if (tokenTask.isSuccessful()) {
112-
apiCallResultsText.setText(tokenTask.getResult().getToken());
112+
if (installationAuthTokenTask.isSuccessful()) {
113+
apiCallResultsText.setText(installationAuthTokenTask.getResult().getToken());
113114
} else {
114-
Log.e(TAG, "Error getting Installation Token", tokenTask.getException());
115+
Log.e(
116+
TAG,
117+
"Error getting installation authentication token",
118+
installationAuthTokenTask.getException());
115119
}
116120
});
117121

firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ public class FirebaseRemoteConfig {
6666
* <p>{@link FirebaseRemoteConfig} uses the default {@link FirebaseApp}, so if no {@link
6767
* FirebaseApp} has been initialized yet, this method throws an {@link IllegalStateException}.
6868
*
69-
* <p>To identify the current app instance, the fetch request creates a Firebase installation ID,
70-
* which periodically sends data to the Firebase backend. To stop the periodic sync, call {@link
71-
* com.google.firebase.installations.FirebaseInstallations#delete}. To create a new token and
72-
* resume the periodic sync, call {@code fetch} again.
69+
* <p>Note: Also initializes the Firebase installations SDK that creates installation IDs to
70+
* identify Firebase installations and periodically sends data to Firebase servers. Remote Config
71+
* requires installation IDs for Fetch requests. To stop the periodic sync, call {@link
72+
* com.google.firebase.installations.FirebaseInstallations#delete}. Sending a Fetch request after
73+
* deletion will create a new installation ID for this Firebase installation and resume the
74+
* periodic sync.
7375
*
7476
* @return A singleton instance of {@link FirebaseRemoteConfig} for the default {@link
7577
* FirebaseApp}.
@@ -303,10 +305,12 @@ public Task<Boolean> activate() {
303305
* FirebaseRemoteConfigSettings.Builder#setMinimumFetchIntervalInSeconds(long)}; the static
304306
* default is 12 hours.
305307
*
306-
* <p>To identify the current app instance, the fetch request creates a Firebase installation ID,
307-
* which periodically sends data to the Firebase backend. To stop the periodic sync, call {@link
308-
* com.google.firebase.installations.FirebaseInstallations#delete}. To create a new token and
309-
* resume the periodic sync, call {@code fetch} again.
308+
* <p>Note: Also initializes the Firebase installations SDK that creates installation IDs to
309+
* identify Firebase installations and periodically sends data to Firebase servers. Remote Config
310+
* requires installation IDs for Fetch requests. To stop the periodic sync, call {@link
311+
* com.google.firebase.installations.FirebaseInstallations#delete}. Sending a Fetch request after
312+
* deletion will create a new installation ID for this Firebase installation and resume the
313+
* periodic sync.
310314
*
311315
* @return {@link Task} representing the {@code fetch} call.
312316
*/
@@ -326,10 +330,12 @@ public Task<Void> fetch() {
326330
* <p>Depending on the time elapsed since the last fetch from the Firebase Remote Config backend,
327331
* configs are either served from local storage, or fetched from the backend.
328332
*
329-
* <p>To identify the current app instance, the fetch request creates a Firebase installation ID,
330-
* which periodically sends data to the Firebase backend. To stop the periodic sync, call {@link
331-
* com.google.firebase.installations.FirebaseInstallations#delete}. To create a new token and
332-
* resume the periodic sync, call {@code fetch} again.
333+
* <p>Note: Also initializes the Firebase installations SDK that creates installation IDs to
334+
* identify Firebase installations and periodically sends data to Firebase servers. Remote Config
335+
* requires installation IDs for Fetch requests. To stop the periodic sync, call {@link
336+
* com.google.firebase.installations.FirebaseInstallations#delete}. Sending a Fetch request after
337+
* deletion will create a new installation ID for this Firebase installation and resume the
338+
* periodic sync.
333339
*
334340
* @param minimumFetchIntervalInSeconds If configs in the local storage were fetched more than
335341
* this many seconds ago, configs are served from the backend instead of local storage.

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigFetchHandler.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ && areCachedFetchConfigsValid(minimumFetchIntervalInSeconds, currentTime)) {
190190
backoffEndTime.getTime()));
191191
} else {
192192
Task<String> installationIdTask = firebaseInstallations.getId();
193-
Task<InstallationTokenResult> installationTokenTask = firebaseInstallations.getToken(false);
193+
Task<InstallationTokenResult> installationAuthTokenTask =
194+
firebaseInstallations.getToken(false);
194195
fetchResponseTask =
195-
Tasks.whenAllComplete(installationIdTask, installationTokenTask)
196+
Tasks.whenAllComplete(installationIdTask, installationAuthTokenTask)
196197
.continueWithTask(
197198
executor,
198199
(completedInstallationsTasks) -> {
@@ -203,15 +204,15 @@ && areCachedFetchConfigsValid(minimumFetchIntervalInSeconds, currentTime)) {
203204
installationIdTask.getException()));
204205
}
205206

206-
if (!installationTokenTask.isSuccessful()) {
207+
if (!installationAuthTokenTask.isSuccessful()) {
207208
return Tasks.forException(
208209
new FirebaseRemoteConfigClientException(
209210
"Failed to get Firebase Installation token for fetch.",
210-
installationTokenTask.getException()));
211+
installationAuthTokenTask.getException()));
211212
}
212213

213214
String installationId = installationIdTask.getResult();
214-
String installationToken = installationTokenTask.getResult().getToken();
215+
String installationToken = installationAuthTokenTask.getResult().getToken();
215216
return fetchFromBackendAndCacheResponse(
216217
installationId, installationToken, currentTime);
217218
});

firebase-config/src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ public final class FirebaseRemoteConfigTest {
9696

9797
private static final String ETAG = "ETag";
9898

99-
private static final String INSTALLATION_ID = "fake instance id";
100-
private static final String INSTALLATION_TOKEN = "fake instance id token";
99+
private static final String INSTALLATION_ID = "'fL71_VyL3uo9jNMWu1L60S";
100+
private static final String INSTALLATION_TOKEN =
101+
"eyJhbGciOiJF.eyJmaWQiOiJmaXMt.AB2LPV8wRQIhAPs4NvEgA3uhubH";
101102
private static final InstallationTokenResult INSTALLATION_TOKEN_RESULT =
102103
InstallationTokenResult.builder()
103104
.setToken(INSTALLATION_TOKEN)

firebase-config/src/test/java/com/google/firebase/remoteconfig/internal/ConfigFetchHandlerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@
9898
@RunWith(RobolectricTestRunner.class)
9999
@Config(manifest = Config.NONE)
100100
public class ConfigFetchHandlerTest {
101-
private static final String INSTALLATION_ID = "fake installation id";
102-
private static final String INSTALLATION_TOKEN = "fake installation token";
101+
private static final String INSTALLATION_ID = "'fL71_VyL3uo9jNMWu1L60S";
102+
private static final String INSTALLATION_TOKEN =
103+
"eyJhbGciOiJF.eyJmaWQiOiJmaXMt.AB2LPV8wRQIhAPs4NvEgA3uhubH";
103104
private static final InstallationTokenResult INSTALLATION_TOKEN_RESULT =
104105
InstallationTokenResult.builder()
105106
.setToken(INSTALLATION_TOKEN)

0 commit comments

Comments
 (0)