32
32
import com .google .android .gms .tasks .TaskCompletionSource ;
33
33
import com .google .android .gms .tasks .Tasks ;
34
34
import com .google .firebase .FirebaseApp ;
35
- import com .google .firebase .appdistribution .Constants .ErrorMessages ;
36
35
import com .google .firebase .appdistribution .FirebaseAppDistributionException .Status ;
37
36
import com .google .firebase .appdistribution .internal .LogWrapper ;
38
37
import com .google .firebase .appdistribution .internal .SignInStorage ;
@@ -81,7 +80,7 @@ public class FirebaseAppDistribution {
81
80
private TaskCompletionSource <Void > showSignInDialogTask = null ;
82
81
private TaskCompletionSource <Void > showUpdateDialogTask = null ;
83
82
84
- /** Constructor for FirebaseAppDistribution */
83
+ /** Constructor for FirebaseAppDistribution. */
85
84
@ VisibleForTesting
86
85
FirebaseAppDistribution (
87
86
@ NonNull FirebaseApp firebaseApp ,
@@ -103,7 +102,7 @@ public class FirebaseAppDistribution {
103
102
lifecycleNotifier .addOnActivityResumedListener (this ::onActivityResumed );
104
103
}
105
104
106
- /** Constructor for FirebaseAppDistribution */
105
+ /** Constructor for FirebaseAppDistribution. */
107
106
FirebaseAppDistribution (
108
107
@ NonNull FirebaseApp firebaseApp ,
109
108
@ NonNull Provider <FirebaseInstallationsApi > firebaseInstallationsApiProvider ,
@@ -122,7 +121,7 @@ public class FirebaseAppDistribution {
122
121
lifecycleNotifier );
123
122
}
124
123
125
- /** Constructor for FirebaseAppDistribution */
124
+ /** Constructor for FirebaseAppDistribution. */
126
125
FirebaseAppDistribution (
127
126
@ NonNull FirebaseApp firebaseApp ,
128
127
@ NonNull Provider <FirebaseInstallationsApi > firebaseInstallationsApiProvider ) {
@@ -142,15 +141,16 @@ public static FirebaseAppDistribution getInstance() {
142
141
/**
143
142
* Updates the app to the newest release, if one is available.
144
143
*
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:
147
146
*
148
147
* <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.
150
149
* <li>Checks if a newer release is available. If so, presents the tester with a confirmation
151
150
* 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.
154
154
* </ol>
155
155
*/
156
156
@ NonNull
@@ -239,20 +239,22 @@ private Task<Void> showSignInConfirmationDialog(Activity hostActivity) {
239
239
(dialogInterface , i ) ->
240
240
showSignInDialogTask .setException (
241
241
new FirebaseAppDistributionException (
242
- ErrorMessages .AUTHENTICATION_CANCELED , AUTHENTICATION_CANCELED )));
242
+ FirebaseAppDistributionException .ErrorMessages .AUTHENTICATION_CANCELED ,
243
+ AUTHENTICATION_CANCELED )));
243
244
244
245
signInConfirmationDialog .setOnCancelListener (
245
246
dialogInterface ->
246
247
showSignInDialogTask .setException (
247
248
new FirebaseAppDistributionException (
248
- ErrorMessages .AUTHENTICATION_CANCELED , AUTHENTICATION_CANCELED )));
249
+ FirebaseAppDistributionException .ErrorMessages .AUTHENTICATION_CANCELED ,
250
+ AUTHENTICATION_CANCELED )));
249
251
250
252
signInConfirmationDialog .show ();
251
253
});
252
254
return showSignInDialogTask .getTask ();
253
255
}
254
256
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. */
256
258
@ NonNull
257
259
public Task <Void > signInTester () {
258
260
return this .testerSignInManager .signInTester ();
@@ -329,13 +331,14 @@ private UpdateTask updateApp(boolean showDownloadInNotificationManager) {
329
331
LogWrapper .getInstance ().v ("New release not found." );
330
332
return getErrorUpdateTask (
331
333
new FirebaseAppDistributionException (
332
- Constants .ErrorMessages .NOT_FOUND_ERROR , UPDATE_NOT_AVAILABLE ));
334
+ FirebaseAppDistributionException .ErrorMessages .NOT_FOUND_ERROR ,
335
+ UPDATE_NOT_AVAILABLE ));
333
336
}
334
337
if (cachedNewRelease .getDownloadUrl () == null ) {
335
- LogWrapper .getInstance ().v ("Download failed to execute" );
338
+ LogWrapper .getInstance ().v ("Download failed to execute. " );
336
339
return getErrorUpdateTask (
337
340
new FirebaseAppDistributionException (
338
- Constants .ErrorMessages .DOWNLOAD_URL_NOT_FOUND ,
341
+ FirebaseAppDistributionException .ErrorMessages .DOWNLOAD_URL_NOT_FOUND ,
339
342
FirebaseAppDistributionException .Status .DOWNLOAD_FAILURE ));
340
343
}
341
344
@@ -352,7 +355,7 @@ public boolean isTesterSignedIn() {
352
355
return this .signInStorage .getSignInStatus ();
353
356
}
354
357
355
- /** Signs out the App Distribution tester */
358
+ /** Signs out the App Distribution tester. */
356
359
public void signOutTester () {
357
360
setCachedNewRelease (null );
358
361
this .signInStorage .setSignInStatus (false );
@@ -364,7 +367,8 @@ void onActivityResumed(Activity activity) {
364
367
if (dialogHostActivity != null && dialogHostActivity != activity ) {
365
368
showSignInDialogTask .setException (
366
369
new FirebaseAppDistributionException (
367
- ErrorMessages .HOST_ACTIVITY_INTERRUPTED , HOST_ACTIVITY_INTERRUPTED ));
370
+ FirebaseAppDistributionException .ErrorMessages .HOST_ACTIVITY_INTERRUPTED ,
371
+ HOST_ACTIVITY_INTERRUPTED ));
368
372
} else {
369
373
showSignInConfirmationDialog (activity );
370
374
}
@@ -374,7 +378,8 @@ void onActivityResumed(Activity activity) {
374
378
if (dialogHostActivity != null && dialogHostActivity != activity ) {
375
379
showUpdateDialogTask .setException (
376
380
new FirebaseAppDistributionException (
377
- ErrorMessages .HOST_ACTIVITY_INTERRUPTED , HOST_ACTIVITY_INTERRUPTED ));
381
+ FirebaseAppDistributionException .ErrorMessages .HOST_ACTIVITY_INTERRUPTED ,
382
+ HOST_ACTIVITY_INTERRUPTED ));
378
383
} else {
379
384
synchronized (cachedNewReleaseLock ) {
380
385
showUpdateConfirmationDialog (
@@ -457,13 +462,15 @@ private Task<Void> showUpdateConfirmationDialog(
457
462
(dialogInterface , i ) ->
458
463
showUpdateDialogTask .setException (
459
464
new FirebaseAppDistributionException (
460
- ErrorMessages .UPDATE_CANCELED , Status .INSTALLATION_CANCELED )));
465
+ FirebaseAppDistributionException .ErrorMessages .UPDATE_CANCELED ,
466
+ Status .INSTALLATION_CANCELED )));
461
467
462
468
updateConfirmationDialog .setOnCancelListener (
463
469
dialogInterface ->
464
470
showUpdateDialogTask .setException (
465
471
new FirebaseAppDistributionException (
466
- ErrorMessages .UPDATE_CANCELED , Status .INSTALLATION_CANCELED )));
472
+ FirebaseAppDistributionException .ErrorMessages .UPDATE_CANCELED ,
473
+ Status .INSTALLATION_CANCELED )));
467
474
468
475
updateConfirmationDialog .show ();
469
476
});
0 commit comments