Skip to content

Commit 706561b

Browse files
author
rachaprince
authored
App Distribution Reference Docs Edits (#3427)
* Small syntax fixes; Standardize use of period in java docs * Improved error messages with error resolution guidance. * Fix formatting * Add resolution messages to ErrorMessages * Fix formatting * Update API and fix tests * Make java doc tense and language more consistent * Fix grammar
1 parent f8c28ca commit 706561b

26 files changed

+195
-161
lines changed

firebase-appdistribution/api.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ package com.google.firebase.appdistribution {
3030
}
3131

3232
public enum FirebaseAppDistributionException.Status {
33-
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status APP_RUNNING_IN_PRODUCTION;
3433
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_CANCELED;
3534
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_FAILURE;
3635
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status DOWNLOAD_FAILURE;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import androidx.annotation.GuardedBy;
2626
import androidx.annotation.NonNull;
2727
import androidx.annotation.VisibleForTesting;
28-
import com.google.firebase.appdistribution.Constants.ErrorMessages;
2928
import com.google.firebase.appdistribution.internal.InstallActivity;
3029
import com.google.firebase.appdistribution.internal.LogWrapper;
3130
import com.google.firebase.appdistribution.internal.SignInResultActivity;
@@ -181,7 +180,7 @@ void tryCancelAabUpdateTask() {
181180
safeSetTaskException(
182181
cachedUpdateTask,
183182
new FirebaseAppDistributionException(
184-
ErrorMessages.UPDATE_CANCELED,
183+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED,
185184
FirebaseAppDistributionException.Status.INSTALLATION_CANCELED,
186185
ReleaseUtils.convertToAppDistributionRelease(aabReleaseInProgress)));
187186
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ private void startInstallActivity(String path, Activity currentActivity) {
7979
Intent intent = new Intent(currentActivity, InstallActivity.class);
8080
intent.putExtra("INSTALL_PATH", path);
8181
currentActivity.startActivity(intent);
82-
LogWrapper.getInstance().v(TAG + "Prompting user with install activity ");
82+
LogWrapper.getInstance().v(TAG + "Prompting tester with install activity ");
8383
}
8484

8585
void trySetInstallTaskError() {
8686
synchronized (installTaskLock) {
8787
safeSetTaskException(
8888
installTaskCompletionSource,
8989
new FirebaseAppDistributionException(
90-
Constants.ErrorMessages.APK_INSTALLATION_FAILED,
90+
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED,
9191
FirebaseAppDistributionException.Status.INSTALLATION_FAILURE));
9292
}
9393
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.google.android.gms.tasks.Task;
2929
import com.google.android.gms.tasks.TaskCompletionSource;
3030
import com.google.firebase.FirebaseApp;
31-
import com.google.firebase.appdistribution.Constants.ErrorMessages;
3231
import com.google.firebase.appdistribution.FirebaseAppDistributionException.Status;
3332
import com.google.firebase.appdistribution.internal.LogWrapper;
3433
import java.io.BufferedOutputStream;
@@ -131,7 +130,9 @@ private void installApk(File file, boolean showDownloadNotificationManager) {
131130
UpdateStatus.INSTALL_FAILED,
132131
showDownloadNotificationManager);
133132
setUpdateTaskCompletionErrorWithDefault(
134-
e, ErrorMessages.APK_INSTALLATION_FAILED, Status.INSTALLATION_FAILURE);
133+
e,
134+
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED,
135+
Status.INSTALLATION_FAILURE);
135136
});
136137
}
137138

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ static Builder builder() {
3030
return new com.google.firebase.appdistribution.AutoValue_AppDistributionRelease.Builder();
3131
}
3232

33-
/** The short bundle version of this build (example 1.0.0). */
33+
/** Returns the short bundle version of this build (example: 1.0.0). */
3434
@NonNull
3535
public abstract String getDisplayVersion();
3636

37-
/** The version code of this build (example: 123). */
37+
/** Returns the version code of this build (example: 123). */
3838
@NonNull
3939
public abstract long getVersionCode();
4040

41-
/** The release notes for this build. */
41+
/** Returns the release notes for this build. */
4242
@Nullable
4343
public abstract String getReleaseNotes();
4444

45-
/** The binary type for this build. */
45+
/** Returns the binary type for this build. */
4646
@NonNull
4747
public abstract BinaryType getBinaryType();
4848

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
import com.google.auto.value.AutoValue;
2020

2121
/**
22-
* This class represents the AppDistributionRelease object returned by the App Distribution backend
23-
*
24-
* <p>It is an immutable value class implemented by AutoValue.
25-
*
26-
* @see <a
27-
* href="https://github.com/google/auto/tree/master/value">https://github.com/google/auto/tree/master/value</a>
22+
* This class represents the AppDistributionRelease object returned by the App Distribution backend.
2823
*/
2924
@AutoValue
3025
abstract class AppDistributionReleaseInternal {
@@ -34,38 +29,38 @@ static Builder builder() {
3429
return new AutoValue_AppDistributionReleaseInternal.Builder();
3530
}
3631

37-
/** The short bundle version of this build (example 1.0.0) */
32+
/** The short bundle version of this build (example: 1.0.0). */
3833
@NonNull
3934
abstract String getDisplayVersion();
4035

41-
/** The bundle version of this build (example: 123) */
36+
/** The bundle version of this build (example: 123). */
4237
@NonNull
4338
abstract String getBuildVersion();
4439

45-
/** The release notes for this build */
40+
/** The release notes for this build. */
4641
@Nullable
4742
abstract String getReleaseNotes();
4843

49-
/** The binary type for this build */
44+
/** The binary type for this build. */
5045
@NonNull
5146
abstract BinaryType getBinaryType();
5247

53-
/** Hash of binary of an Android app */
48+
/** Hash of binary of an Android app. */
5449
@Nullable
5550
abstract String getCodeHash();
5651

57-
/** Efficient hash of an Android apk. Used to identify a release */
52+
/** Efficient hash of an Android apk. Used to identify a release. */
5853
@Nullable
5954
abstract String getApkHash();
6055

6156
/**
6257
* IAS artifact id. This value is inserted into the manifest of APK's installed via Used to map a
63-
* release to an APK installed via an app bundle
58+
* release to an APK installed via an app bundle.
6459
*/
6560
@Nullable
6661
abstract String getIasArtifactId();
6762

68-
/** Short-lived download URL */
63+
/** Short-lived download URL. */
6964
@Nullable
7065
abstract String getDownloadUrl();
7166

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
package com.google.firebase.appdistribution;
1616

17-
/** Enum of Android app binary types, used in {@link AppDistributionRelease} */
17+
/** Enum of Android app binary types, used in {@link AppDistributionRelease}. */
1818
public enum BinaryType {
1919
/** Android App Bundle. */
2020
AAB,

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

Lines changed: 0 additions & 46 deletions
This file was deleted.

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

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com.google.android.gms.tasks.TaskCompletionSource;
3333
import com.google.android.gms.tasks.Tasks;
3434
import com.google.firebase.FirebaseApp;
35-
import com.google.firebase.appdistribution.Constants.ErrorMessages;
3635
import com.google.firebase.appdistribution.FirebaseAppDistributionException.Status;
3736
import com.google.firebase.appdistribution.internal.LogWrapper;
3837
import com.google.firebase.appdistribution.internal.SignInStorage;
@@ -81,7 +80,7 @@ public class FirebaseAppDistribution {
8180
private TaskCompletionSource<Void> showSignInDialogTask = null;
8281
private TaskCompletionSource<Void> showUpdateDialogTask = null;
8382

84-
/** Constructor for FirebaseAppDistribution */
83+
/** Constructor for FirebaseAppDistribution. */
8584
@VisibleForTesting
8685
FirebaseAppDistribution(
8786
@NonNull FirebaseApp firebaseApp,
@@ -103,7 +102,7 @@ public class FirebaseAppDistribution {
103102
lifecycleNotifier.addOnActivityResumedListener(this::onActivityResumed);
104103
}
105104

106-
/** Constructor for FirebaseAppDistribution */
105+
/** Constructor for FirebaseAppDistribution. */
107106
FirebaseAppDistribution(
108107
@NonNull FirebaseApp firebaseApp,
109108
@NonNull Provider<FirebaseInstallationsApi> firebaseInstallationsApiProvider,
@@ -122,7 +121,7 @@ public class FirebaseAppDistribution {
122121
lifecycleNotifier);
123122
}
124123

125-
/** Constructor for FirebaseAppDistribution */
124+
/** Constructor for FirebaseAppDistribution. */
126125
FirebaseAppDistribution(
127126
@NonNull FirebaseApp firebaseApp,
128127
@NonNull Provider<FirebaseInstallationsApi> firebaseInstallationsApiProvider) {
@@ -142,15 +141,16 @@ public static FirebaseAppDistribution getInstance() {
142141
/**
143142
* Updates the app to the newest release, if one is available.
144143
*
145-
* <p>Returns the release information or null if no update is found. Performs the following
146-
* actions:
144+
* <p>Returns the release information or {@code null} if no update is found. Performs the
145+
* following actions:
147146
*
148147
* <ol>
149-
* <li>If tester is not signed in, presents the tester with a Google sign in UI.
148+
* <li>If tester is not signed in, presents the tester with a Google Sign-in UI.
150149
* <li>Checks if a newer release is available. If so, presents the tester with a confirmation
151150
* 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.
151+
* <li>If the newest release is an APK, downloads the binary and starts an installation. If the
152+
* newest release is an AAB, directs the tester to the Play app to complete the download and
153+
* installation.
154154
* </ol>
155155
*/
156156
@NonNull
@@ -239,20 +239,22 @@ private Task<Void> showSignInConfirmationDialog(Activity hostActivity) {
239239
(dialogInterface, i) ->
240240
showSignInDialogTask.setException(
241241
new FirebaseAppDistributionException(
242-
ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED)));
242+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
243+
AUTHENTICATION_CANCELED)));
243244

244245
signInConfirmationDialog.setOnCancelListener(
245246
dialogInterface ->
246247
showSignInDialogTask.setException(
247248
new FirebaseAppDistributionException(
248-
ErrorMessages.AUTHENTICATION_CANCELED, AUTHENTICATION_CANCELED)));
249+
FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_CANCELED,
250+
AUTHENTICATION_CANCELED)));
249251

250252
signInConfirmationDialog.show();
251253
});
252254
return showSignInDialogTask.getTask();
253255
}
254256

255-
/** Signs in the App Distribution tester. Presents the tester with a Google sign in UI */
257+
/** Signs in the App Distribution tester. Presents the tester with a Google sign in UI. */
256258
@NonNull
257259
public Task<Void> signInTester() {
258260
return this.testerSignInManager.signInTester();
@@ -329,13 +331,14 @@ private UpdateTask updateApp(boolean showDownloadInNotificationManager) {
329331
LogWrapper.getInstance().v("New release not found.");
330332
return getErrorUpdateTask(
331333
new FirebaseAppDistributionException(
332-
Constants.ErrorMessages.NOT_FOUND_ERROR, UPDATE_NOT_AVAILABLE));
334+
FirebaseAppDistributionException.ErrorMessages.NOT_FOUND_ERROR,
335+
UPDATE_NOT_AVAILABLE));
333336
}
334337
if (cachedNewRelease.getDownloadUrl() == null) {
335-
LogWrapper.getInstance().v("Download failed to execute");
338+
LogWrapper.getInstance().v("Download failed to execute.");
336339
return getErrorUpdateTask(
337340
new FirebaseAppDistributionException(
338-
Constants.ErrorMessages.DOWNLOAD_URL_NOT_FOUND,
341+
FirebaseAppDistributionException.ErrorMessages.DOWNLOAD_URL_NOT_FOUND,
339342
FirebaseAppDistributionException.Status.DOWNLOAD_FAILURE));
340343
}
341344

@@ -352,7 +355,7 @@ public boolean isTesterSignedIn() {
352355
return this.signInStorage.getSignInStatus();
353356
}
354357

355-
/** Signs out the App Distribution tester */
358+
/** Signs out the App Distribution tester. */
356359
public void signOutTester() {
357360
setCachedNewRelease(null);
358361
this.signInStorage.setSignInStatus(false);
@@ -364,7 +367,8 @@ void onActivityResumed(Activity activity) {
364367
if (dialogHostActivity != null && dialogHostActivity != activity) {
365368
showSignInDialogTask.setException(
366369
new FirebaseAppDistributionException(
367-
ErrorMessages.HOST_ACTIVITY_INTERRUPTED, HOST_ACTIVITY_INTERRUPTED));
370+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED,
371+
HOST_ACTIVITY_INTERRUPTED));
368372
} else {
369373
showSignInConfirmationDialog(activity);
370374
}
@@ -374,7 +378,8 @@ void onActivityResumed(Activity activity) {
374378
if (dialogHostActivity != null && dialogHostActivity != activity) {
375379
showUpdateDialogTask.setException(
376380
new FirebaseAppDistributionException(
377-
ErrorMessages.HOST_ACTIVITY_INTERRUPTED, HOST_ACTIVITY_INTERRUPTED));
381+
FirebaseAppDistributionException.ErrorMessages.HOST_ACTIVITY_INTERRUPTED,
382+
HOST_ACTIVITY_INTERRUPTED));
378383
} else {
379384
synchronized (cachedNewReleaseLock) {
380385
showUpdateConfirmationDialog(
@@ -457,13 +462,15 @@ private Task<Void> showUpdateConfirmationDialog(
457462
(dialogInterface, i) ->
458463
showUpdateDialogTask.setException(
459464
new FirebaseAppDistributionException(
460-
ErrorMessages.UPDATE_CANCELED, Status.INSTALLATION_CANCELED)));
465+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED,
466+
Status.INSTALLATION_CANCELED)));
461467

462468
updateConfirmationDialog.setOnCancelListener(
463469
dialogInterface ->
464470
showUpdateDialogTask.setException(
465471
new FirebaseAppDistributionException(
466-
ErrorMessages.UPDATE_CANCELED, Status.INSTALLATION_CANCELED)));
472+
FirebaseAppDistributionException.ErrorMessages.UPDATE_CANCELED,
473+
Status.INSTALLATION_CANCELED)));
467474

468475
updateConfirmationDialog.show();
469476
});

0 commit comments

Comments
 (0)