Skip to content

Update AppDistributionRelease and FirebaseAppDistributionException #2782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions firebase-app-distribution/firebase-app-distribution.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ dependencies {

implementation 'com.google.android.gms:play-services-tasks:17.0.0'

compileOnly 'com.google.auto.value:auto-value-annotations:1.6.5'
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'

implementation 'com.android.support:customtabs:28.0.0'
implementation "androidx.browser:browser:1.3.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,59 @@
package com.google.firebase.appdistribution;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.auto.value.AutoValue;

/**
* Data class for AppDistributionRelease object returned by checkForUpdate() and
* This class represents the AppDistributionRelease object returned by checkForUpdate() and
* updateToLatestRelease()
*
* <p>It is an immutable value class implemented by AutoValue.
*
* @see <a
* href="https://github.com/google/auto/tree/master/value">https://github.com/google/auto/tree/master/value</a>
*/
public final class AppDistributionRelease {
private final String displayVersion;
private final String buildVersion;
private final String releaseNotes;
private final BinaryType binaryType;

AppDistributionRelease(
String displayVersion, String buildVersion, String releaseNotes, BinaryType binaryType) {
this.displayVersion = displayVersion;
this.buildVersion = buildVersion;
this.releaseNotes = releaseNotes;
this.binaryType = binaryType;
@AutoValue
public abstract class AppDistributionRelease {

@NonNull
public static Builder builder() {
return new AutoValue_AppDistributionRelease.Builder();
}

/** The short bundle version of this build (example 1.0.0) */
@NonNull
public String getDisplayVersion() {
return displayVersion;
}
public abstract String getDisplayVersion();

/** The bundle version of this build (example: 123) */
@NonNull
public String getBuildVersion() {
return buildVersion;
}
public abstract String getBuildVersion();

/** The release notes for this build */
@NonNull
public String getReleaseNotes() {
return releaseNotes;
}
@Nullable
public abstract String getReleaseNotes();

/** The binary type for this build */
@NonNull
public BinaryType getBinaryType() {
return binaryType;
public abstract BinaryType getBinaryType();

/** Builder for {@link AppDistributionRelease}. */
@AutoValue.Builder
public abstract static class Builder {

@NonNull
public abstract Builder setDisplayVersion(@NonNull String value);

@NonNull
public abstract Builder setBuildVersion(@NonNull String value);

@NonNull
public abstract Builder setReleaseNotes(@Nullable String value);

@NonNull
public abstract Builder setBinaryType(@NonNull BinaryType value);

@NonNull
public abstract AppDistributionRelease build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ public enum Status {
this.release = null;
}

public FirebaseAppDistributionException(
@NonNull String message, @NonNull Status status, @Nullable AppDistributionRelease release) {
super(message);
this.status = status;
this.release = release;
}

public FirebaseAppDistributionException(
@NonNull String message,
@NonNull Status status,
@Nullable AppDistributionRelease release,
@NonNull Throwable cause) {
super(message, cause);
this.status = status;
this.release = release;
}

/** Get cached release when error was thrown */
@NonNull
public AppDistributionRelease getRelease() {
Expand Down