From bf48ada4aad54afeb2d05fd1f4a7fb3255ed98a3 Mon Sep 17 00:00:00 2001 From: Dana Silver Date: Tue, 21 Mar 2023 13:06:03 -0700 Subject: [PATCH 1/3] Improve real-time reference docs. --- .../com/google/firebase/remoteconfig/ConfigUpdate.java | 5 +---- .../firebase/remoteconfig/ConfigUpdateListener.java | 7 ++++--- .../firebase/remoteconfig/FirebaseRemoteConfig.java | 8 ++++---- .../FirebaseRemoteConfigClientException.java | 2 +- .../FirebaseRemoteConfigServerException.java | 10 +++++----- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdate.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdate.java index 7aba7b0e0e5..e51391067d4 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdate.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdate.java @@ -18,10 +18,7 @@ import com.google.auto.value.AutoValue; import java.util.Set; -/** - * Information about the updated config passed to the {@code onUpdate} callback of {@link - * ConfigUpdateListener}. - */ +/** Information about the updated config passed to {@link ConfigUpdateListener#onUpdate}. */ @AutoValue public abstract class ConfigUpdate { @NonNull diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java index 363dfd66779..b0da55f3777 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java @@ -18,8 +18,9 @@ import javax.annotation.Nonnull; /** - * Event listener interface for real-time RC updates. Implement {@code ConfigUpdateListner} to call - * {@link com.google.firebase.remoteconfig.FirebaseRemoteConfig#addOnConfigUpdateListener}. + * Event listener interface for real-time Remote Config updates. Implement {@link + * ConfigUpdateListener} to call {@link + * com.google.firebase.remoteconfig.FirebaseRemoteConfig#addOnConfigUpdateListener}. */ public interface ConfigUpdateListener { /** @@ -32,7 +33,7 @@ public interface ConfigUpdateListener { void onUpdate(@NonNull ConfigUpdate configUpdate); /** - * Callback for when an error occurs while listening or fetching a config update. + * Callback for when an error occurs while listening for or fetching a config update. * * @param error A {@link FirebaseRemoteConfigException} with information about the error. */ diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java index 74b2d4cb173..3ba0a4478ec 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java @@ -549,16 +549,16 @@ public Task reset() { } /** - * Start listening for real-time config updates from the Remote Config backend and automatically - * fetch updates from the RC backend when they are available. + * Starts listening for real-time config updates from the Remote Config backend and automatically + * fetches updates from the RC backend when they are available. * *

If a connection to the Remote Config backend is not already open, calling this method will * open it. Multiple listeners can be added by calling this method again, but subsequent calls * re-use the same connection to the backend. * *

Note: Real-time Remote Config requires the Firebase Remote Config Realtime API. See the Remote Config Get Started - * guide to enable the API. + * href="https://firebase.google.com/docs/remote-config/get-started#add-real-time-listener">Remote + * Config Get Started guide to enable the API. * * @param configUpdateListener A {@link ConfigUpdateListener} that can be used to respond to * config updates when they're fetched. diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientException.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientException.java index f6333681a82..cb41c28a741 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientException.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientException.java @@ -45,7 +45,7 @@ public FirebaseRemoteConfigClientException(@NonNull String detailMessage, @NonNu /** * Creates a Firebase Remote Config client exception with the given message, exception cause, and - * FirebaseRemoteConfigException code. + * {@code FirebaseRemoteConfigException} code. */ public FirebaseRemoteConfigClientException( @NonNull String detailMessage, @Nullable Throwable cause, @NonNull Code code) { diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigServerException.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigServerException.java index 8caf47d3992..5afee365f3d 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigServerException.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigServerException.java @@ -45,8 +45,8 @@ public FirebaseRemoteConfigServerException( } /** - * Creates a Firebase Remote Config server exception with the given message and - * FirebaseRemoteConfigException code. + * Creates a Firebase Remote Config server exception with the given message and {@code + * FirebaseRemoteConfigException} code. */ public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnull Code code) { super(detailMessage, code); @@ -55,7 +55,7 @@ public FirebaseRemoteConfigServerException(@NonNull String detailMessage, @Nonnu /** * Creates a Firebase Remote Config server exception with the HTTP status code, given message, and - * FirebaseRemoteConfigException code. + * {@code FirebaseRemoteConfigException} code. */ public FirebaseRemoteConfigServerException( int httpStatusCode, @NonNull String detailMessage, @Nonnull Code code) { @@ -65,7 +65,7 @@ public FirebaseRemoteConfigServerException( /** * Creates a Firebase Remote Config server exception with the given message, exception cause, and - * FirebaseRemoteConfigException code. + * {@code FirebaseRemoteConfigException} code. */ public FirebaseRemoteConfigServerException( @NonNull String detailMessage, @Nullable Throwable cause, @NonNull Code code) { @@ -75,7 +75,7 @@ public FirebaseRemoteConfigServerException( /** * Creates a Firebase Remote Config server exception with the HTTP status code, given message, - * exception cause, and FirebaseRemoteConfigException code. + * exception cause, and {@code FirebaseRemoteConfigException} code. */ public FirebaseRemoteConfigServerException( int httpStatusCode, From 7af9388141f730c5194ae4cd308dd62eb734e3f8 Mon Sep 17 00:00:00 2001 From: Dana Silver Date: Tue, 21 Mar 2023 13:11:38 -0700 Subject: [PATCH 2/3] Change 'the user' to 'you'. --- .../google/firebase/remoteconfig/FirebaseRemoteConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java index 3ba0a4478ec..62d2ea10787 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java @@ -562,8 +562,8 @@ public Task reset() { * * @param configUpdateListener A {@link ConfigUpdateListener} that can be used to respond to * config updates when they're fetched. - * @return A {@link ConfigUpdateListenerRegistration} that allows the user to remove the added - * {@code configUpdateListener} and close the connection when there are no more listeners. + * @return A {@link ConfigUpdateListenerRegistration} that allows you to remove the added {@code + * configUpdateListener} and close the connection when there are no more listeners. */ @NonNull public ConfigUpdateListenerRegistration addOnConfigUpdateListener( From fa5be7587557753d26662284c4a0c4148df927aa Mon Sep 17 00:00:00 2001 From: Dana Silver Date: Tue, 21 Mar 2023 13:51:57 -0700 Subject: [PATCH 3/3] Separate listening and fetching. --- .../firebase/remoteconfig/ConfigUpdateListener.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java index b0da55f3777..b215b7ac81d 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/ConfigUpdateListener.java @@ -24,16 +24,17 @@ */ public interface ConfigUpdateListener { /** - * Callback for when a new config has been automatically fetched from the backend and has changed - * from the activated config. + * Callback for when a new config version has been automatically fetched from the backend and has + * changed from the activated config. * - * @param configUpdate A {@link ConfigUpdate} with information about the updated config, including - * the set of updated parameters. + * @param configUpdate A {@link ConfigUpdate} with information about the updated config version, + * including the set of updated parameters. */ void onUpdate(@NonNull ConfigUpdate configUpdate); /** - * Callback for when an error occurs while listening for or fetching a config update. + * Callback for when an error occurs while listening for updates or fetching the latest version of + * the config. * * @param error A {@link FirebaseRemoteConfigException} with information about the error. */