36
36
import com .google .android .gms .tasks .TaskCompletionSource ;
37
37
import com .google .android .gms .tasks .Tasks ;
38
38
import com .google .firebase .FirebaseApp ;
39
+ import com .google .firebase .annotations .concurrent .Blocking ;
39
40
import com .google .firebase .annotations .concurrent .Lightweight ;
40
41
import com .google .firebase .appdistribution .AppDistributionRelease ;
41
42
import com .google .firebase .appdistribution .BinaryType ;
@@ -65,22 +66,23 @@ class FirebaseAppDistributionImpl implements FirebaseAppDistribution {
65
66
private final ApkUpdater apkUpdater ;
66
67
private final AabUpdater aabUpdater ;
67
68
private final SignInStorage signInStorage ;
68
- private final SequentialReference <AppDistributionReleaseInternal > cachedNewRelease ;
69
69
private final ReleaseIdentifier releaseIdentifier ;
70
70
private final ScreenshotTaker screenshotTaker ;
71
- private final Executor blockingExecutor ;
71
+ @ Lightweight private final Executor lightweightExecutor ;
72
+ @ Blocking private final Executor blockingExecutor ;
73
+ private final SequentialReference <AppDistributionReleaseInternal > cachedNewRelease ;
74
+ private final TaskCache <AppDistributionRelease > checkForNewReleaseTaskCache ;
75
+ private final UpdateTaskCache updateIfNewReleaseAvailableTaskCache ;
72
76
private final FirebaseAppDistributionNotificationsManager notificationsManager ;
73
- private TaskCache <UpdateTask > updateIfNewReleaseAvailableTaskCache = new TaskCache <>();
74
- private TaskCache <Task <AppDistributionRelease >> checkForNewReleaseTaskCache = new TaskCache <>();
75
- @ Lightweight private Executor lightweightExecutor ;
76
- private AlertDialog updateConfirmationDialog ;
77
- private AlertDialog signInConfirmationDialog ;
78
- @ Nullable private Activity dialogHostActivity = null ;
77
+ private final AtomicBoolean feedbackInProgress = new AtomicBoolean (false );
78
+
79
+ @ Nullable private AlertDialog updateConfirmationDialog ;
80
+ @ Nullable private AlertDialog signInConfirmationDialog ;
81
+ @ Nullable private Activity dialogHostActivity ;
79
82
private boolean remakeSignInConfirmationDialog = false ;
80
83
private boolean remakeUpdateConfirmationDialog = false ;
81
- private TaskCompletionSource <Void > showSignInDialogTask = null ;
82
- private TaskCompletionSource <Void > showUpdateDialogTask = null ;
83
- private final AtomicBoolean feedbackInProgress = new AtomicBoolean (false );
84
+ @ Nullable private TaskCompletionSource <Void > showSignInDialogTask ;
85
+ @ Nullable private TaskCompletionSource <Void > showUpdateDialogTask ;
84
86
85
87
@ VisibleForTesting
86
88
FirebaseAppDistributionImpl (
@@ -94,7 +96,7 @@ class FirebaseAppDistributionImpl implements FirebaseAppDistribution {
94
96
@ NonNull ReleaseIdentifier releaseIdentifier ,
95
97
@ NonNull ScreenshotTaker screenshotTaker ,
96
98
@ NonNull @ Lightweight Executor lightweightExecutor ,
97
- @ NonNull Executor blockingExecutor ) {
99
+ @ NonNull @ Blocking Executor blockingExecutor ) {
98
100
this .firebaseApp = firebaseApp ;
99
101
this .testerSignInManager = testerSignInManager ;
100
102
this .newReleaseFetcher = newReleaseFetcher ;
@@ -103,10 +105,12 @@ class FirebaseAppDistributionImpl implements FirebaseAppDistribution {
103
105
this .signInStorage = signInStorage ;
104
106
this .releaseIdentifier = releaseIdentifier ;
105
107
this .lifecycleNotifier = lifecycleNotifier ;
106
- this .cachedNewRelease = new SequentialReference <>(lightweightExecutor );
107
- this .lightweightExecutor = lightweightExecutor ;
108
108
this .screenshotTaker = screenshotTaker ;
109
+ this .lightweightExecutor = lightweightExecutor ;
109
110
this .blockingExecutor = blockingExecutor ;
111
+ this .cachedNewRelease = new SequentialReference <>(lightweightExecutor );
112
+ this .checkForNewReleaseTaskCache = new TaskCache <>(lightweightExecutor );
113
+ this .updateIfNewReleaseAvailableTaskCache = new UpdateTaskCache (lightweightExecutor );
110
114
this .notificationsManager =
111
115
new FirebaseAppDistributionNotificationsManager (firebaseApp .getApplicationContext ());
112
116
lifecycleNotifier .addOnActivityDestroyedListener (this ::onActivityDestroyed );
@@ -117,7 +121,7 @@ class FirebaseAppDistributionImpl implements FirebaseAppDistribution {
117
121
@ Override
118
122
@ NonNull
119
123
public UpdateTask updateIfNewReleaseAvailable () {
120
- return updateIfNewReleaseAvailableTaskCache .getOrCreateTask (
124
+ return updateIfNewReleaseAvailableTaskCache .getOrCreateUpdateTask (
121
125
() -> {
122
126
UpdateTaskImpl updateTask = new UpdateTaskImpl ();
123
127
remakeSignInConfirmationDialog = false ;
0 commit comments