Skip to content

Commit ccd1cb6

Browse files
author
rachaprince
authored
Edit java docs for Firebase App Distribution (#3393)
* Edit java docs for Firebase App Distribution * Respond to PR review comments * Responding to PR feedback
1 parent bce1a75 commit ccd1cb6

File tree

8 files changed

+90
-58
lines changed

8 files changed

+90
-58
lines changed

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/AppDistributionRelease.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@
1919
import com.google.auto.value.AutoValue;
2020

2121
/**
22-
* This class represents the AppDistributionRelease object returned by checkForUpdate() and
23-
* updateToLatestRelease()
24-
*
25-
* <p>It is an immutable value class implemented by AutoValue.
26-
*
27-
* @see <a
28-
* href="https://github.com/google/auto/tree/master/value">https://github.com/google/auto/tree/master/value</a>
22+
* The release information returned by {@link FirebaseAppDistribution#checkForNewRelease} when a new
23+
* version is available for the signed in tester.
2924
*/
3025
@AutoValue
3126
public abstract class AppDistributionRelease {
@@ -35,19 +30,19 @@ static Builder builder() {
3530
return new com.google.firebase.appdistribution.AutoValue_AppDistributionRelease.Builder();
3631
}
3732

38-
/** The short bundle version of this build (example 1.0.0) */
33+
/** The short bundle version of this build (example 1.0.0). */
3934
@NonNull
4035
public abstract String getDisplayVersion();
4136

42-
/** The version code of this build (example: 123) */
37+
/** The version code of this build (example: 123). */
4338
@NonNull
4439
public abstract long getVersionCode();
4540

46-
/** The release notes for this build */
41+
/** The release notes for this build. */
4742
@Nullable
4843
public abstract String getReleaseNotes();
4944

50-
/** The binary type for this build */
45+
/** The binary type for this build. */
5146
@NonNull
5247
public abstract BinaryType getBinaryType();
5348

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/BinaryType.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414

1515
package com.google.firebase.appdistribution;
1616

17-
/** Enum of Android App Binary types, used in AppDistributionRelease */
17+
/** Enum of Android app binary types, used in {@link AppDistributionRelease} */
1818
public enum BinaryType {
19+
/** Android App Bundle. */
1920
AAB,
21+
22+
/** Android Application Package. */
2023
APK
2124
}

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/FirebaseAppDistribution.java

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@
3939
import com.google.firebase.inject.Provider;
4040
import com.google.firebase.installations.FirebaseInstallationsApi;
4141

42+
/**
43+
* The Firebase App Distribution API provides methods to update the app to the most recent
44+
* pre-release build.
45+
*
46+
* <p>By default, Firebase App Distribution is automatically initialized.
47+
*
48+
* <p>Call {@link FirebaseAppDistribution#getInstance()} to get the singleton instance of
49+
* FirebaseAppDistribution.
50+
*/
4251
public class FirebaseAppDistribution {
4352

4453
private static final int UNKNOWN_RELEASE_FILE_SIZE = -1;
@@ -124,19 +133,25 @@ public class FirebaseAppDistribution {
124133
FirebaseAppDistributionLifecycleNotifier.getInstance());
125134
}
126135

127-
/** @return a FirebaseAppDistribution instance */
136+
/** Gets the singleton {@link FirebaseAppDistribution} instance. */
128137
@NonNull
129138
public static FirebaseAppDistribution getInstance() {
130139
return FirebaseApp.getInstance().get(FirebaseAppDistribution.class);
131140
}
132141

133142
/**
134-
* Updates the app to the newest release, if one is available. Returns the release information or
135-
* null if no update is found. Performs the following actions: 1. If tester is not signed in,
136-
* presents the tester with a Google sign in UI 2. Checks if a newer release is available. If so,
137-
* presents the tester with a confirmation dialog to begin the download. 3. For APKs, downloads
138-
* the binary and starts an installation intent. 4. For AABs, directs the tester to the Play app
139-
* to complete the download and installation.
143+
* Updates the app to the newest release, if one is available.
144+
*
145+
* <p>Returns the release information or null if no update is found. Performs the following
146+
* actions:
147+
*
148+
* <ol>
149+
* <li>If tester is not signed in, presents the tester with a Google sign in UI.
150+
* <li>Checks if a newer release is available. If so, presents the tester with a confirmation
151+
* dialog to begin the download.
152+
* <li>For APKs, downloads the binary and starts an installation intent. For AABs, directs the
153+
* tester to the Play app to complete the download and installation.
154+
* </ol>
140155
*/
141156
@NonNull
142157
public UpdateTask updateIfNewReleaseAvailable() {
@@ -242,9 +257,8 @@ public Task<Void> signInTester() {
242257
}
243258

244259
/**
245-
* Returns an AppDistributionRelease if one is available for the current signed in tester. If no
246-
* update is found, returns null. If tester is not signed in, presents the tester with a Google
247-
* sign in UI
260+
* Returns an {@link AppDistributionRelease} if an update is available for the current signed in
261+
* tester, or {@code null} otherwise.
248262
*/
249263
@NonNull
250264
public synchronized Task<AppDistributionRelease> checkForNewRelease() {
@@ -277,12 +291,14 @@ public synchronized Task<AppDistributionRelease> checkForNewRelease() {
277291
}
278292

279293
/**
280-
* Updates app to the newest release. If the newest release is an APK, downloads the binary and
281-
* starts an installation If the newest release is an AAB, directs the tester to the Play app to
282-
* complete the download and installation.
294+
* Updates app to the {@link AppDistributionRelease} returned by {@link #checkForNewRelease}.
295+
*
296+
* <p>If the newest release is an APK, downloads the binary and starts an installation. If the
297+
* newest release is an AAB, directs the tester to the Play app to complete the download and
298+
* installation.
283299
*
284-
* <p>cancels task with FirebaseAppDistributionException with UPDATE_NOT_AVAILABLE exception if no
285-
* new release is cached from checkForNewRelease
300+
* <p>Cancels task with {@link Status#UPDATE_NOT_AVAILABLE} if no new release is cached from
301+
* {@link #checkForNewRelease}.
286302
*/
287303
@NonNull
288304
public UpdateTask updateApp() {
@@ -324,7 +340,7 @@ private UpdateTask updateApp(boolean showDownloadInNotificationManager) {
324340
}
325341
}
326342

327-
/** Returns true if the App Distribution tester is signed in */
343+
/** Returns {@code true} if the App Distribution tester is signed in. */
328344
public boolean isTesterSignedIn() {
329345
return this.signInStorage.getSignInStatus();
330346
}

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/FirebaseAppDistributionException.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,38 @@
1919
import com.google.firebase.FirebaseException;
2020
import com.google.firebase.appdistribution.Constants.ErrorMessages;
2121

22-
/** Possible exceptions thrown in FirebaseAppDistribution */
22+
/** The class for all Exceptions thrown by {@link FirebaseAppDistribution}. */
2323
public class FirebaseAppDistributionException extends FirebaseException {
24+
/** Enum for potential error statuses that caused the {@link FirebaseAppDistributionException}. */
2425
public enum Status {
2526
/** Unknown error. */
2627
UNKNOWN,
2728

28-
/** Authentication failed */
29+
/** The authentication process failed. */
2930
AUTHENTICATION_FAILURE,
3031

31-
/** Authentication canceled */
32+
/** The authentication process was canceled. */
3233
AUTHENTICATION_CANCELED,
3334

34-
/** No Network available to make requests or the request timed out */
35+
/** No network is available to make requests or the request timed out. */
3536
NETWORK_FAILURE,
3637

37-
/** Download failed */
38+
/** The new release failed to download. */
3839
DOWNLOAD_FAILURE,
3940

40-
/** Installation failed */
41+
/** The new release failed to install. */
4142
INSTALLATION_FAILURE,
4243

43-
/** Installation canceled */
44+
/** The installation was canceled. */
4445
INSTALLATION_CANCELED,
4546

46-
/** Update not available for the current tester and app */
47+
/** An update is not available for the current tester and app. */
4748
UPDATE_NOT_AVAILABLE,
4849

49-
/** App is in production */
50+
/** The app is running in production. */
5051
APP_RUNNING_IN_PRODUCTION,
5152

52-
/** Host activity for confirmation dialog destroyed or pushed to the backstack */
53+
/** The host activity for a confirmation dialog was destroyed or pushed to the backstack. */
5354
HOST_ACTIVITY_INTERRUPTED,
5455
}
5556

@@ -86,12 +87,13 @@ public enum Status {
8687
this.release = release;
8788
}
8889

89-
/** Get cached release when error was thrown */
90+
/** Returns the release that was ready to be installed when the error was thrown. */
9091
@Nullable
9192
public AppDistributionRelease getRelease() {
9293
return release;
9394
}
9495

96+
/** Returns the {@link FirebaseAppDistributionException.Status} that caused the exception. */
9597
@NonNull
9698
public Status getErrorCode() {
9799
return status;

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/OnProgressListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818

1919
/** A listener that is called periodically during execution of the {@link UpdateTask}. */
2020
public interface OnProgressListener {
21+
/** Called periodically for progress update and state changes of the {@link UpdateTask}. */
2122
void onProgressUpdate(@NonNull UpdateProgress updateState);
2223
}

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/UpdateProgress.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import androidx.annotation.Nullable;
1919
import com.google.auto.value.AutoValue;
2020

21-
/** Data class to get download progress for APKs and the status of the update. Used in updateApp. */
21+
/** Represents a progress update or a final state from updating an app. */
2222
@AutoValue
2323
public abstract class UpdateProgress {
2424

@@ -28,21 +28,25 @@ static UpdateProgress.Builder builder() {
2828
}
2929

3030
/**
31-
* The number of bytes downloaded so far for the APK. Returns -1 if called on an AAB or if no new
32-
* release is available.
31+
* The number of bytes downloaded so far for an APK.
32+
*
33+
* @returns the number of bytes downloaded, or -1 if called when updating to an AAB or if no new
34+
* release is available.
3335
*/
3436
@NonNull
3537
public abstract long getApkBytesDownloaded();
3638

3739
/**
38-
* The file size of the APK file to download in bytes. Returns -1 if called on an AAB or if no new
39-
* release is available.
40+
* The file size of the APK file to download in bytes.
41+
*
42+
* @returns the file size in bytes, or -1 if called when updating to an AAB or if no new release
43+
* is available.
4044
*/
4145
@NonNull
4246
public abstract long getApkFileTotalBytes();
4347

48+
/** Returns the current {@link UpdateStatus} of the update. */
4449
@NonNull
45-
/** returns the current state of the update */
4650
public abstract UpdateStatus getUpdateStatus();
4751

4852
/** Builder for {@link UpdateProgress}. */

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/UpdateStatus.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414

1515
package com.google.firebase.appdistribution;
1616

17-
/** Enum for possible states during Update, used in UpdateProgress. */
17+
/** Enum for possible states during Update, used in {@link UpdateProgress}. */
1818
public enum UpdateStatus {
19-
/** Update queued but not started */
19+
/** The update is queued but not started. */
2020
PENDING,
2121

22-
/** Download in progress */
22+
/** The new release download is in progress. */
2323
DOWNLOADING,
2424

25-
/** Download completed */
25+
/** The new release was downloaded successfully. */
2626
DOWNLOADED,
2727

28-
/** Download failed */
28+
/** The new release failed to download. */
2929
DOWNLOAD_FAILED,
3030

31-
/** Installation canceled */
31+
/** The new release installation was canceled. */
3232
INSTALL_CANCELED,
3333

34-
/** Installation failed */
34+
/** The new release installation failed. */
3535
INSTALL_FAILED,
3636

37-
/** AAB flow (directed to Play) */
37+
/** The tester was redirected to Play to download an {@link BinaryType#AAB} file. */
3838
REDIRECTED_TO_PLAY,
3939

40-
/** Currently on the latest release */
40+
/** The tester is currently on the latest release they have access to for the current app. */
4141
NEW_RELEASE_NOT_AVAILABLE,
4242

43-
/** Release check failed before download started */
43+
/** The call to {@link FirebaseAppDistribution#checkForNewRelease} failed. */
4444
NEW_RELEASE_CHECK_FAILED,
4545

46-
/** Customer canceled the update */
46+
/** The tester canceled the update. */
4747
UPDATE_CANCELED,
4848
}

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/UpdateTask.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,26 @@
1919
import com.google.android.gms.tasks.Task;
2020
import java.util.concurrent.Executor;
2121

22+
/**
23+
* Represents an asynchronous operation to update an app.
24+
*
25+
* <p>This task also receives progress and other state change notifications.
26+
*/
2227
public abstract class UpdateTask extends Task<Void> {
2328
/**
24-
* Adds a listener that is called periodically while the UpdateTask executes.
29+
* Adds a listener that is called periodically while this {@link UpdateTask} executes.
2530
*
26-
* @return this Task
31+
* @return this {@link UpdateTask}
2732
*/
2833
@NonNull
2934
public abstract UpdateTask addOnProgressListener(@NonNull OnProgressListener listener);
3035

36+
/**
37+
* Adds a listener that is called periodically while {@link UpdateTask} executes.
38+
*
39+
* @param executor the executor to use to call the listener
40+
* @return this {@link UpdateTask}
41+
*/
3142
@NonNull
3243
public abstract UpdateTask addOnProgressListener(
3344
@Nullable Executor executor, @NonNull OnProgressListener listener);

0 commit comments

Comments
 (0)