Skip to content

Commit 988ea76

Browse files
lfkelloggkaibolay
andauthored
Add in-app feedback requests to FirebaseAppDistributionTesterApiClient (#3778)
* Add in-app feedback requests to FirebaseAppDistributionTesterApiClient Also refactors out low level API-specific HTTP and basic JSON parsing functionality into TesterApiHttpClient * Refactor error handling based on Kai's feedback * Chage test project id * ./gradlew :firebase-appdistribution:ktlintFormat :firebase-appdistribution:ktlintFormat :firebase-appdistribution-api:googleJavaFormat :firebase-appdistribution:googleJavaFormat Co-authored-by: Kai Bolay <[email protected]>
1 parent a489149 commit 988ea76

File tree

11 files changed

+786
-255
lines changed

11 files changed

+786
-255
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public enum Status {
2626
UNKNOWN,
2727

2828
/**
29-
* The authentication process failed. The tester was either not signed in, or something went
30-
* wrong. Try signing in again by calling {@link FirebaseAppDistribution#signInTester}.
29+
* The authentication process failed. The tester was either not signed in, does not have access,
30+
* or something went wrong. Try signing in again by calling {@link
31+
* FirebaseAppDistribution#signInTester}.
3132
*/
3233
AUTHENTICATION_FAILURE,
3334

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/ErrorMessages.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class ErrorMessages {
1818
static final String NETWORK_ERROR = "Request failed with unknown network error.";
1919

2020
static final String JSON_PARSING_ERROR =
21-
"Error parsing service response when checking for new release. This was most likely due to a transient condition and may be corrected by retrying.";
21+
"Error parsing service response. This was most likely due to a transient condition and may be corrected by retrying.";
22+
23+
static final String JSON_SERIALIZATION_ERROR = "Error building request body.";
2224

2325
static final String AUTHENTICATION_ERROR =
2426
"Failed to authenticate the tester. The tester was either not signed in, or something went wrong. Try signing in again.";
@@ -28,8 +30,10 @@ class ErrorMessages {
2830

2931
static final String AUTHENTICATION_CANCELED = "Tester canceled the authentication flow.";
3032

31-
static final String NOT_FOUND_ERROR =
32-
"Release not found. An update was not available for the current tester and app. Make sure that FirebaseAppDistribution#checkForNewRelease returns with a non-null AppDistributionRelease before calling FirebaseAppDistribution#updateApp";
33+
static final String RELEASE_NOT_FOUND_ERROR =
34+
"Release not found. An update was not available for the current tester and app. Make sure that checkForNewRelease() returns with a non-null AppDistributionRelease before calling updateApp()";
35+
36+
static final String NOT_FOUND_ERROR = "Resource not found (or the tester may not have access).";
3337

3438
static final String TIMEOUT_ERROR =
3539
"Request timed out. Check the tester's internet connection and try again.";
@@ -42,7 +46,7 @@ class ErrorMessages {
4246
"Download URL not found. This was a most likely due to a transient condition and may be corrected by retrying.";
4347

4448
static final String HOST_ACTIVITY_INTERRUPTED =
45-
"Host activity interrupted while dialog was showing. Try calling FirebaseAppDistribution#updateIfNewReleaseAvailable again.";
49+
"Host activity interrupted while dialog was showing. Try calling updateIfNewReleaseAvailable() again.";
4650

4751
static final String APK_INSTALLATION_FAILED =
4852
"The APK failed to install or installation was canceled by the tester.";

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FirebaseAppDistributionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private UpdateTask updateApp(boolean showDownloadInNotificationManager) {
276276
LogWrapper.getInstance().v("New release not found.");
277277
return getErrorUpdateTask(
278278
new FirebaseAppDistributionException(
279-
ErrorMessages.NOT_FOUND_ERROR, UPDATE_NOT_AVAILABLE));
279+
ErrorMessages.RELEASE_NOT_FOUND_ERROR, UPDATE_NOT_AVAILABLE));
280280
}
281281
if (cachedNewRelease.getDownloadUrl() == null) {
282282
LogWrapper.getInstance().v("Download failed to execute.");

firebase-appdistribution/src/main/java/com/google/firebase/appdistribution/impl/FirebaseAppDistributionRegistrar.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ private FirebaseAppDistribution buildFirebaseAppDistribution(ComponentContainer
6161
container.getProvider(FirebaseInstallationsApi.class);
6262
SignInStorage signInStorage = new SignInStorage(context);
6363
FirebaseAppDistributionTesterApiClient testerApiClient =
64-
new FirebaseAppDistributionTesterApiClient(firebaseApp, firebaseInstallationsApiProvider);
64+
new FirebaseAppDistributionTesterApiClient(
65+
firebaseApp, firebaseInstallationsApiProvider, new TesterApiHttpClient(firebaseApp));
6566
FirebaseAppDistributionLifecycleNotifier lifecycleNotifier =
6667
FirebaseAppDistributionLifecycleNotifier.getInstance();
6768
ApkHashExtractor apkHashExtractor = new ApkHashExtractor(firebaseApp.getApplicationContext());

0 commit comments

Comments
 (0)