Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class BuildConfig {
|
||||
public static final String BUILD_TYPE = "release";
|
||||
public static final boolean DEBUG = false;
|
||||
public static final String LIBRARY_PACKAGE_NAME = "com.google.firebase.storage";
|
||||
public static final String VERSION_NAME = "20.2.1";
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class CancelException extends IOException {
|
||||
public CancelException() {
|
||||
super("The operation was canceled.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class CancellableTask<StateT> extends Task<StateT> {
|
||||
public abstract CancellableTask<StateT> addOnProgressListener(Activity activity, OnProgressListener<? super StateT> onProgressListener);
|
||||
|
||||
public abstract CancellableTask<StateT> addOnProgressListener(OnProgressListener<? super StateT> onProgressListener);
|
||||
|
||||
public abstract CancellableTask<StateT> addOnProgressListener(Executor executor, OnProgressListener<? super StateT> onProgressListener);
|
||||
|
||||
public abstract boolean cancel();
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public abstract boolean isCanceled();
|
||||
|
||||
public abstract boolean isInProgress();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.app.Activity;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class ControllableTask<StateT> extends CancellableTask<StateT> {
|
||||
public abstract ControllableTask<StateT> addOnPausedListener(Activity activity, OnPausedListener<? super StateT> onPausedListener);
|
||||
|
||||
public abstract ControllableTask<StateT> addOnPausedListener(OnPausedListener<? super StateT> onPausedListener);
|
||||
|
||||
public abstract ControllableTask<StateT> addOnPausedListener(Executor executor, OnPausedListener<? super StateT> onPausedListener);
|
||||
|
||||
public abstract boolean isPaused();
|
||||
|
||||
public abstract boolean pause();
|
||||
|
||||
public abstract boolean resume();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.DeleteNetworkRequest;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class DeleteStorageTask implements Runnable {
|
||||
private static final String TAG = "DeleteStorageTask";
|
||||
private TaskCompletionSource<Void> mPendingResult;
|
||||
private ExponentialBackoffSender mSender;
|
||||
private StorageReference mStorageRef;
|
||||
|
||||
public DeleteStorageTask(StorageReference storageReference, TaskCompletionSource<Void> taskCompletionSource) {
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(taskCompletionSource);
|
||||
this.mStorageRef = storageReference;
|
||||
this.mPendingResult = taskCompletionSource;
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.mSender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp());
|
||||
this.mSender.sendWithExponentialBackoff(deleteNetworkRequest);
|
||||
deleteNetworkRequest.completeTask(this.mPendingResult, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.GetNetworkRequest;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class FileDownloadTask extends StorageTask<TaskSnapshot> {
|
||||
static final int PREFERRED_CHUNK_SIZE = 262144;
|
||||
private static final String TAG = "FileDownloadTask";
|
||||
private long mBytesDownloaded;
|
||||
private final Uri mDestinationFile;
|
||||
private int mResultCode;
|
||||
private ExponentialBackoffSender mSender;
|
||||
private StorageReference mStorageRef;
|
||||
private long mTotalBytes = -1;
|
||||
private String mETagVerification = null;
|
||||
private volatile Exception mException = null;
|
||||
private long mResumeOffset = 0;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class TaskSnapshot extends StorageTask<TaskSnapshot>.SnapshotBase {
|
||||
private final long mBytesDownloaded;
|
||||
|
||||
public TaskSnapshot(Exception exc, long j4) {
|
||||
super(exc);
|
||||
this.mBytesDownloaded = j4;
|
||||
}
|
||||
|
||||
public long getBytesTransferred() {
|
||||
return this.mBytesDownloaded;
|
||||
}
|
||||
|
||||
public long getTotalByteCount() {
|
||||
return FileDownloadTask.this.getTotalBytes();
|
||||
}
|
||||
}
|
||||
|
||||
public FileDownloadTask(StorageReference storageReference, Uri uri) {
|
||||
this.mStorageRef = storageReference;
|
||||
this.mDestinationFile = uri;
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.mSender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
private int fillBuffer(InputStream inputStream, byte[] bArr) {
|
||||
int read;
|
||||
int i = 0;
|
||||
boolean z3 = false;
|
||||
while (i != bArr.length && (read = inputStream.read(bArr, i, bArr.length - i)) != -1) {
|
||||
try {
|
||||
i += read;
|
||||
z3 = true;
|
||||
} catch (IOException e4) {
|
||||
this.mException = e4;
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private boolean isValidHttpResponseCode(int i) {
|
||||
if (i != 308) {
|
||||
return i >= 200 && i < 300;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean processResponse(NetworkRequest networkRequest) throws IOException {
|
||||
FileOutputStream fileOutputStream;
|
||||
InputStream stream = networkRequest.getStream();
|
||||
if (stream == null) {
|
||||
this.mException = new IllegalStateException("Unable to open Firebase Storage stream.");
|
||||
return false;
|
||||
}
|
||||
File file = new File(this.mDestinationFile.getPath());
|
||||
if (!file.exists()) {
|
||||
if (this.mResumeOffset > 0) {
|
||||
throw new IOException("The file to download to has been deleted.");
|
||||
}
|
||||
if (!file.createNewFile()) {
|
||||
Log.w(TAG, "unable to create file:" + file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
boolean z3 = true;
|
||||
if (this.mResumeOffset > 0) {
|
||||
Log.d(TAG, "Resuming download file " + file.getAbsolutePath() + " at " + this.mResumeOffset);
|
||||
fileOutputStream = new FileOutputStream(file, true);
|
||||
} else {
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
}
|
||||
try {
|
||||
byte[] bArr = new byte[PREFERRED_CHUNK_SIZE];
|
||||
while (z3) {
|
||||
int fillBuffer = fillBuffer(stream, bArr);
|
||||
if (fillBuffer == -1) {
|
||||
break;
|
||||
}
|
||||
fileOutputStream.write(bArr, 0, fillBuffer);
|
||||
this.mBytesDownloaded += fillBuffer;
|
||||
if (this.mException != null) {
|
||||
Log.d(TAG, "Exception occurred during file download. Retrying.", this.mException);
|
||||
this.mException = null;
|
||||
z3 = false;
|
||||
}
|
||||
if (!tryChangeState(4, false)) {
|
||||
z3 = false;
|
||||
}
|
||||
}
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
stream.close();
|
||||
return z3;
|
||||
} catch (Throwable th) {
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
stream.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public long getDownloadedSizeInBytes() {
|
||||
return this.mBytesDownloaded;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public StorageReference getStorage() {
|
||||
return this.mStorageRef;
|
||||
}
|
||||
|
||||
public long getTotalBytes() {
|
||||
return this.mTotalBytes;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void onCanceled() {
|
||||
this.mSender.cancel();
|
||||
this.mException = StorageException.fromErrorStatus(Status.RESULT_CANCELED);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void run() {
|
||||
String str;
|
||||
if (this.mException != null) {
|
||||
tryChangeState(64, false);
|
||||
return;
|
||||
}
|
||||
if (!tryChangeState(4, false)) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
this.mBytesDownloaded = 0L;
|
||||
this.mException = null;
|
||||
this.mSender.reset();
|
||||
GetNetworkRequest getNetworkRequest = new GetNetworkRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mResumeOffset);
|
||||
this.mSender.sendWithExponentialBackoff(getNetworkRequest, false);
|
||||
this.mResultCode = getNetworkRequest.getResultCode();
|
||||
this.mException = getNetworkRequest.getException() != null ? getNetworkRequest.getException() : this.mException;
|
||||
boolean z3 = isValidHttpResponseCode(this.mResultCode) && this.mException == null && getInternalState() == 4;
|
||||
if (z3) {
|
||||
this.mTotalBytes = getNetworkRequest.getResultingContentLength() + this.mResumeOffset;
|
||||
String resultString = getNetworkRequest.getResultString("ETag");
|
||||
if (!TextUtils.isEmpty(resultString) && (str = this.mETagVerification) != null && !str.equals(resultString)) {
|
||||
Log.w(TAG, "The file at the server has changed. Restarting from the beginning.");
|
||||
this.mResumeOffset = 0L;
|
||||
this.mETagVerification = null;
|
||||
getNetworkRequest.performRequestEnd();
|
||||
schedule();
|
||||
return;
|
||||
}
|
||||
this.mETagVerification = resultString;
|
||||
try {
|
||||
z3 = processResponse(getNetworkRequest);
|
||||
} catch (IOException e4) {
|
||||
Log.e(TAG, "Exception occurred during file write. Aborting.", e4);
|
||||
this.mException = e4;
|
||||
}
|
||||
}
|
||||
getNetworkRequest.performRequestEnd();
|
||||
if (z3 && this.mException == null && getInternalState() == 4) {
|
||||
tryChangeState(128, false);
|
||||
return;
|
||||
}
|
||||
File file = new File(this.mDestinationFile.getPath());
|
||||
if (file.exists()) {
|
||||
this.mResumeOffset = file.length();
|
||||
} else {
|
||||
this.mResumeOffset = 0L;
|
||||
}
|
||||
if (getInternalState() == 8) {
|
||||
tryChangeState(16, false);
|
||||
return;
|
||||
} else if (getInternalState() == 32) {
|
||||
if (tryChangeState(256, false)) {
|
||||
return;
|
||||
}
|
||||
Log.w(TAG, "Unable to change download task to final state from " + getInternalState());
|
||||
return;
|
||||
}
|
||||
} while (this.mBytesDownloaded > 0);
|
||||
tryChangeState(64, false);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void schedule() {
|
||||
StorageTaskScheduler.getInstance().scheduleDownload(getRunnable());
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public TaskSnapshot snapStateImpl() {
|
||||
return new TaskSnapshot(StorageException.fromExceptionAndHttpCode(this.mException, this.mResultCode), this.mBytesDownloaded + this.mResumeOffset);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.appcheck.AppCheckTokenResult;
|
||||
import com.google.firebase.appcheck.interop.AppCheckTokenListener;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.emulators.EmulatedServiceSettings;
|
||||
import com.google.firebase.inject.Provider;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.internal.Util;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import kotlinx.coroutines.test.TestBuildersKt;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class FirebaseStorage {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
private static final String STORAGE_BUCKET_WITH_PATH_EXCEPTION = "The storage Uri cannot contain a path element.";
|
||||
private static final String STORAGE_URI_PARSE_EXCEPTION = "The storage Uri could not be parsed.";
|
||||
private static final String TAG = "FirebaseStorage";
|
||||
private EmulatedServiceSettings emulatorSettings;
|
||||
private final FirebaseApp mApp;
|
||||
private final Provider<InteropAppCheckTokenProvider> mAppCheckProvider;
|
||||
private final Provider<InternalAuthProvider> mAuthProvider;
|
||||
private final String mBucketName;
|
||||
private long sMaxUploadRetry = 600000;
|
||||
private long sMaxChunkUploadRetry = TestBuildersKt.DEFAULT_DISPATCH_TIMEOUT_MS;
|
||||
private long sMaxDownloadRetry = 600000;
|
||||
private long sMaxQueryRetry = 120000;
|
||||
|
||||
public FirebaseStorage(String str, FirebaseApp firebaseApp, Provider<InternalAuthProvider> provider, Provider<InteropAppCheckTokenProvider> provider2) {
|
||||
this.mBucketName = str;
|
||||
this.mApp = firebaseApp;
|
||||
this.mAuthProvider = provider;
|
||||
this.mAppCheckProvider = provider2;
|
||||
if (provider2 == null || provider2.get() == null) {
|
||||
return;
|
||||
}
|
||||
provider2.get().addAppCheckTokenListener(new AppCheckTokenListener() { // from class: com.google.firebase.storage.FirebaseStorage.1
|
||||
@Override // com.google.firebase.appcheck.interop.AppCheckTokenListener
|
||||
public void onAppCheckTokenChanged(AppCheckTokenResult appCheckTokenResult) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getBucketName() {
|
||||
return this.mBucketName;
|
||||
}
|
||||
|
||||
public static FirebaseStorage getInstance() {
|
||||
FirebaseApp firebaseApp = FirebaseApp.getInstance();
|
||||
Preconditions.checkArgument(firebaseApp != null, "You must call FirebaseApp.initialize() first.");
|
||||
return getInstance(firebaseApp);
|
||||
}
|
||||
|
||||
private static FirebaseStorage getInstanceImpl(FirebaseApp firebaseApp, Uri uri) {
|
||||
String host = uri != null ? uri.getHost() : null;
|
||||
if (uri != null && !TextUtils.isEmpty(uri.getPath())) {
|
||||
throw new IllegalArgumentException(STORAGE_BUCKET_WITH_PATH_EXCEPTION);
|
||||
}
|
||||
Preconditions.checkNotNull(firebaseApp, "Provided FirebaseApp must not be null.");
|
||||
FirebaseStorageComponent firebaseStorageComponent = (FirebaseStorageComponent) firebaseApp.get(FirebaseStorageComponent.class);
|
||||
Preconditions.checkNotNull(firebaseStorageComponent, "Firebase Storage component is not present.");
|
||||
return firebaseStorageComponent.get(host);
|
||||
}
|
||||
|
||||
public FirebaseApp getApp() {
|
||||
return this.mApp;
|
||||
}
|
||||
|
||||
public InteropAppCheckTokenProvider getAppCheckProvider() {
|
||||
Provider<InteropAppCheckTokenProvider> provider = this.mAppCheckProvider;
|
||||
if (provider != null) {
|
||||
return provider.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public InternalAuthProvider getAuthProvider() {
|
||||
Provider<InternalAuthProvider> provider = this.mAuthProvider;
|
||||
if (provider != null) {
|
||||
return provider.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public EmulatedServiceSettings getEmulatorSettings() {
|
||||
return this.emulatorSettings;
|
||||
}
|
||||
|
||||
public long getMaxChunkUploadRetry() {
|
||||
return this.sMaxChunkUploadRetry;
|
||||
}
|
||||
|
||||
public long getMaxDownloadRetryTimeMillis() {
|
||||
return this.sMaxDownloadRetry;
|
||||
}
|
||||
|
||||
public long getMaxOperationRetryTimeMillis() {
|
||||
return this.sMaxQueryRetry;
|
||||
}
|
||||
|
||||
public long getMaxUploadRetryTimeMillis() {
|
||||
return this.sMaxUploadRetry;
|
||||
}
|
||||
|
||||
public StorageReference getReference() {
|
||||
if (!TextUtils.isEmpty(getBucketName())) {
|
||||
return getReference(new Uri.Builder().scheme("gs").authority(getBucketName()).path(RemoteSettings.FORWARD_SLASH_STRING).build());
|
||||
}
|
||||
throw new IllegalStateException("FirebaseApp was not initialized with a bucket name.");
|
||||
}
|
||||
|
||||
public StorageReference getReferenceFromUrl(String str) {
|
||||
Preconditions.checkArgument(!TextUtils.isEmpty(str), "location must not be null or empty");
|
||||
String lowerCase = str.toLowerCase();
|
||||
if (!lowerCase.startsWith("gs://") && !lowerCase.startsWith("https://") && !lowerCase.startsWith("http://")) {
|
||||
throw new IllegalArgumentException(STORAGE_URI_PARSE_EXCEPTION);
|
||||
}
|
||||
try {
|
||||
Uri normalize = Util.normalize(this.mApp, str);
|
||||
if (normalize != null) {
|
||||
return getReference(normalize);
|
||||
}
|
||||
throw new IllegalArgumentException(STORAGE_URI_PARSE_EXCEPTION);
|
||||
} catch (UnsupportedEncodingException e4) {
|
||||
Log.e(TAG, "Unable to parse location:".concat(str), e4);
|
||||
throw new IllegalArgumentException(STORAGE_URI_PARSE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxChunkUploadRetry(long j4) {
|
||||
this.sMaxChunkUploadRetry = j4;
|
||||
}
|
||||
|
||||
public void setMaxDownloadRetryTimeMillis(long j4) {
|
||||
this.sMaxDownloadRetry = j4;
|
||||
}
|
||||
|
||||
public void setMaxOperationRetryTimeMillis(long j4) {
|
||||
this.sMaxQueryRetry = j4;
|
||||
}
|
||||
|
||||
public void setMaxUploadRetryTimeMillis(long j4) {
|
||||
this.sMaxUploadRetry = j4;
|
||||
}
|
||||
|
||||
public void useEmulator(String str, int i) {
|
||||
this.emulatorSettings = new EmulatedServiceSettings(str, i);
|
||||
}
|
||||
|
||||
public static FirebaseStorage getInstance(String str) {
|
||||
FirebaseApp firebaseApp = FirebaseApp.getInstance();
|
||||
Preconditions.checkArgument(firebaseApp != null, "You must call FirebaseApp.initialize() first.");
|
||||
return getInstance(firebaseApp, str);
|
||||
}
|
||||
|
||||
public StorageReference getReference(String str) {
|
||||
Preconditions.checkArgument(!TextUtils.isEmpty(str), "location must not be null or empty");
|
||||
String lowerCase = str.toLowerCase();
|
||||
if (!lowerCase.startsWith("gs://") && !lowerCase.startsWith("https://") && !lowerCase.startsWith("http://")) {
|
||||
return getReference().child(str);
|
||||
}
|
||||
throw new IllegalArgumentException("location should not be a full URL.");
|
||||
}
|
||||
|
||||
public static FirebaseStorage getInstance(FirebaseApp firebaseApp) {
|
||||
Preconditions.checkArgument(firebaseApp != null, "Null is not a valid value for the FirebaseApp.");
|
||||
String storageBucket = firebaseApp.getOptions().getStorageBucket();
|
||||
if (storageBucket == null) {
|
||||
return getInstanceImpl(firebaseApp, null);
|
||||
}
|
||||
try {
|
||||
return getInstanceImpl(firebaseApp, Util.normalize(firebaseApp, "gs://" + firebaseApp.getOptions().getStorageBucket()));
|
||||
} catch (UnsupportedEncodingException e4) {
|
||||
Log.e(TAG, "Unable to parse bucket:".concat(storageBucket), e4);
|
||||
throw new IllegalArgumentException(STORAGE_URI_PARSE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
private StorageReference getReference(Uri uri) {
|
||||
Preconditions.checkNotNull(uri, "uri must not be null");
|
||||
String bucketName = getBucketName();
|
||||
Preconditions.checkArgument(TextUtils.isEmpty(bucketName) || uri.getAuthority().equalsIgnoreCase(bucketName), "The supplied bucketname does not match the storage bucket of the current instance.");
|
||||
return new StorageReference(uri, this);
|
||||
}
|
||||
|
||||
public static FirebaseStorage getInstance(FirebaseApp firebaseApp, String str) {
|
||||
Preconditions.checkArgument(firebaseApp != null, "Null is not a valid value for the FirebaseApp.");
|
||||
Preconditions.checkArgument(str != null, "Null is not a valid value for the Firebase Storage URL.");
|
||||
if (str.toLowerCase().startsWith("gs://")) {
|
||||
try {
|
||||
return getInstanceImpl(firebaseApp, Util.normalize(firebaseApp, str));
|
||||
} catch (UnsupportedEncodingException e4) {
|
||||
Log.e(TAG, "Unable to parse url:".concat(str), e4);
|
||||
throw new IllegalArgumentException(STORAGE_URI_PARSE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Please use a gs:// URL for your Firebase Storage bucket.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.annotations.concurrent.Blocking;
|
||||
import com.google.firebase.annotations.concurrent.UiThread;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.inject.Provider;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes3.dex */
|
||||
public class FirebaseStorageComponent {
|
||||
private final FirebaseApp app;
|
||||
private final Provider<InteropAppCheckTokenProvider> appCheckProvider;
|
||||
private final Provider<InternalAuthProvider> authProvider;
|
||||
private final Map<String, FirebaseStorage> instances = new HashMap();
|
||||
|
||||
public FirebaseStorageComponent(FirebaseApp firebaseApp, Provider<InternalAuthProvider> provider, Provider<InteropAppCheckTokenProvider> provider2, @Blocking Executor executor, @UiThread Executor executor2) {
|
||||
this.app = firebaseApp;
|
||||
this.authProvider = provider;
|
||||
this.appCheckProvider = provider2;
|
||||
StorageTaskScheduler.initializeExecutors(executor, executor2);
|
||||
}
|
||||
|
||||
public synchronized void clearInstancesForTesting() {
|
||||
this.instances.clear();
|
||||
}
|
||||
|
||||
public synchronized FirebaseStorage get(String str) {
|
||||
FirebaseStorage firebaseStorage;
|
||||
firebaseStorage = this.instances.get(str);
|
||||
if (firebaseStorage == null) {
|
||||
firebaseStorage = new FirebaseStorage(str, this.app, this.authProvider, this.appCheckProvider);
|
||||
this.instances.put(str, firebaseStorage);
|
||||
}
|
||||
return firebaseStorage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.GetMetadataNetworkRequest;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class GetDownloadUrlTask implements Runnable {
|
||||
private static final String DOWNLOAD_TOKENS_KEY = "downloadTokens";
|
||||
private static final String TAG = "GetMetadataTask";
|
||||
private TaskCompletionSource<Uri> pendingResult;
|
||||
private ExponentialBackoffSender sender;
|
||||
private StorageReference storageRef;
|
||||
|
||||
public GetDownloadUrlTask(StorageReference storageReference, TaskCompletionSource<Uri> taskCompletionSource) {
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(taskCompletionSource);
|
||||
this.storageRef = storageReference;
|
||||
this.pendingResult = taskCompletionSource;
|
||||
if (storageReference.getRoot().getName().equals(storageReference.getName())) {
|
||||
throw new IllegalArgumentException("getDownloadUrl() is not supported at the root of the bucket.");
|
||||
}
|
||||
FirebaseStorage storage = this.storageRef.getStorage();
|
||||
this.sender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxOperationRetryTimeMillis());
|
||||
}
|
||||
|
||||
private Uri extractDownloadUrl(JSONObject jSONObject) {
|
||||
String optString = jSONObject.optString(DOWNLOAD_TOKENS_KEY);
|
||||
if (TextUtils.isEmpty(optString)) {
|
||||
return null;
|
||||
}
|
||||
String str = optString.split(",", -1)[0];
|
||||
Uri.Builder buildUpon = this.storageRef.getStorageReferenceUri().getHttpUri().buildUpon();
|
||||
buildUpon.appendQueryParameter("alt", "media");
|
||||
buildUpon.appendQueryParameter("token", str);
|
||||
return buildUpon.build();
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GetMetadataNetworkRequest getMetadataNetworkRequest = new GetMetadataNetworkRequest(this.storageRef.getStorageReferenceUri(), this.storageRef.getApp());
|
||||
this.sender.sendWithExponentialBackoff(getMetadataNetworkRequest);
|
||||
Uri extractDownloadUrl = getMetadataNetworkRequest.isResultSuccess() ? extractDownloadUrl(getMetadataNetworkRequest.getResultBody()) : null;
|
||||
TaskCompletionSource<Uri> taskCompletionSource = this.pendingResult;
|
||||
if (taskCompletionSource != null) {
|
||||
getMetadataNetworkRequest.completeTask(taskCompletionSource, extractDownloadUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.StorageMetadata;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.GetMetadataNetworkRequest;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class GetMetadataTask implements Runnable {
|
||||
private static final String TAG = "GetMetadataTask";
|
||||
private TaskCompletionSource<StorageMetadata> mPendingResult;
|
||||
private StorageMetadata mResultMetadata;
|
||||
private ExponentialBackoffSender mSender;
|
||||
private StorageReference mStorageRef;
|
||||
|
||||
public GetMetadataTask(StorageReference storageReference, TaskCompletionSource<StorageMetadata> taskCompletionSource) {
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(taskCompletionSource);
|
||||
this.mStorageRef = storageReference;
|
||||
this.mPendingResult = taskCompletionSource;
|
||||
if (storageReference.getRoot().getName().equals(storageReference.getName())) {
|
||||
throw new IllegalArgumentException("getMetadata() is not supported at the root of the bucket.");
|
||||
}
|
||||
FirebaseStorage storage = this.mStorageRef.getStorage();
|
||||
this.mSender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GetMetadataNetworkRequest getMetadataNetworkRequest = new GetMetadataNetworkRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp());
|
||||
this.mSender.sendWithExponentialBackoff(getMetadataNetworkRequest);
|
||||
if (getMetadataNetworkRequest.isResultSuccess()) {
|
||||
try {
|
||||
this.mResultMetadata = new StorageMetadata.Builder(getMetadataNetworkRequest.getResultBody(), this.mStorageRef).build();
|
||||
} catch (JSONException e4) {
|
||||
Log.e(TAG, "Unable to parse resulting metadata. " + getMetadataNetworkRequest.getRawResult(), e4);
|
||||
this.mPendingResult.setException(StorageException.fromException(e4));
|
||||
return;
|
||||
}
|
||||
}
|
||||
TaskCompletionSource<StorageMetadata> taskCompletionSource = this.mPendingResult;
|
||||
if (taskCompletionSource != null) {
|
||||
getMetadataNetworkRequest.completeTask(taskCompletionSource, this.mResultMetadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class ListResult {
|
||||
private static final String ITEMS_KEY = "items";
|
||||
private static final String NAME_KEY = "name";
|
||||
private static final String PAGE_TOKEN_KEY = "nextPageToken";
|
||||
private static final String PREFIXES_KEY = "prefixes";
|
||||
private final List<StorageReference> items;
|
||||
private final String pageToken;
|
||||
private final List<StorageReference> prefixes;
|
||||
|
||||
public ListResult(List<StorageReference> list, List<StorageReference> list2, String str) {
|
||||
this.prefixes = list;
|
||||
this.items = list2;
|
||||
this.pageToken = str;
|
||||
}
|
||||
|
||||
public static ListResult fromJSON(FirebaseStorage firebaseStorage, JSONObject jSONObject) throws JSONException {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
if (jSONObject.has(PREFIXES_KEY)) {
|
||||
JSONArray jSONArray = jSONObject.getJSONArray(PREFIXES_KEY);
|
||||
for (int i = 0; i < jSONArray.length(); i++) {
|
||||
String string = jSONArray.getString(i);
|
||||
if (string.endsWith(RemoteSettings.FORWARD_SLASH_STRING)) {
|
||||
string = string.substring(0, string.length() - 1);
|
||||
}
|
||||
arrayList.add(firebaseStorage.getReference(string));
|
||||
}
|
||||
}
|
||||
if (jSONObject.has("items")) {
|
||||
JSONArray jSONArray2 = jSONObject.getJSONArray("items");
|
||||
for (int i4 = 0; i4 < jSONArray2.length(); i4++) {
|
||||
arrayList2.add(firebaseStorage.getReference(jSONArray2.getJSONObject(i4).getString("name")));
|
||||
}
|
||||
}
|
||||
return new ListResult(arrayList, arrayList2, jSONObject.optString(PAGE_TOKEN_KEY, null));
|
||||
}
|
||||
|
||||
public List<StorageReference> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public String getPageToken() {
|
||||
return this.pageToken;
|
||||
}
|
||||
|
||||
public List<StorageReference> getPrefixes() {
|
||||
return this.prefixes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.ListNetworkRequest;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes3.dex */
|
||||
public class ListTask implements Runnable {
|
||||
private static final String TAG = "ListTask";
|
||||
private final Integer maxResults;
|
||||
private final String pageToken;
|
||||
private final TaskCompletionSource<ListResult> pendingResult;
|
||||
private final ExponentialBackoffSender sender;
|
||||
private final StorageReference storageRef;
|
||||
|
||||
public ListTask(StorageReference storageReference, Integer num, String str, TaskCompletionSource<ListResult> taskCompletionSource) {
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(taskCompletionSource);
|
||||
this.storageRef = storageReference;
|
||||
this.maxResults = num;
|
||||
this.pageToken = str;
|
||||
this.pendingResult = taskCompletionSource;
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.sender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ListResult fromJSON;
|
||||
ListNetworkRequest listNetworkRequest = new ListNetworkRequest(this.storageRef.getStorageReferenceUri(), this.storageRef.getApp(), this.maxResults, this.pageToken);
|
||||
this.sender.sendWithExponentialBackoff(listNetworkRequest);
|
||||
if (listNetworkRequest.isResultSuccess()) {
|
||||
try {
|
||||
fromJSON = ListResult.fromJSON(this.storageRef.getStorage(), listNetworkRequest.getResultBody());
|
||||
} catch (JSONException e4) {
|
||||
Log.e(TAG, "Unable to parse response body. " + listNetworkRequest.getRawResult(), e4);
|
||||
this.pendingResult.setException(StorageException.fromException(e4));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fromJSON = null;
|
||||
}
|
||||
TaskCompletionSource<ListResult> taskCompletionSource = this.pendingResult;
|
||||
if (taskCompletionSource != null) {
|
||||
listNetworkRequest.completeTask(taskCompletionSource, fromJSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface OnPausedListener<ProgressT> {
|
||||
void onPaused(ProgressT progresst);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface OnProgressListener<ProgressT> {
|
||||
void onProgress(ProgressT progresst);
|
||||
}
|
||||
361
apk_decompiled/sources/com/google/firebase/storage/R.java
Normal file
361
apk_decompiled/sources/com/google/firebase/storage/R.java
Normal file
@@ -0,0 +1,361 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class R {
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class attr {
|
||||
public static final int alpha = 0x7f030031;
|
||||
public static final int buttonSize = 0x7f0300a5;
|
||||
public static final int circleCrop = 0x7f0300e9;
|
||||
public static final int colorScheme = 0x7f030135;
|
||||
public static final int coordinatorLayoutStyle = 0x7f03016c;
|
||||
public static final int font = 0x7f03022d;
|
||||
public static final int fontProviderAuthority = 0x7f03022f;
|
||||
public static final int fontProviderCerts = 0x7f030230;
|
||||
public static final int fontProviderFetchStrategy = 0x7f030231;
|
||||
public static final int fontProviderFetchTimeout = 0x7f030232;
|
||||
public static final int fontProviderPackage = 0x7f030233;
|
||||
public static final int fontProviderQuery = 0x7f030234;
|
||||
public static final int fontStyle = 0x7f030236;
|
||||
public static final int fontVariationSettings = 0x7f030237;
|
||||
public static final int fontWeight = 0x7f030238;
|
||||
public static final int imageAspectRatio = 0x7f030271;
|
||||
public static final int imageAspectRatioAdjust = 0x7f030272;
|
||||
public static final int keylines = 0x7f0302b5;
|
||||
public static final int layout_anchor = 0x7f0302c6;
|
||||
public static final int layout_anchorGravity = 0x7f0302c7;
|
||||
public static final int layout_behavior = 0x7f0302c9;
|
||||
public static final int layout_dodgeInsetEdges = 0x7f0302fa;
|
||||
public static final int layout_insetEdge = 0x7f030305;
|
||||
public static final int layout_keyline = 0x7f030306;
|
||||
public static final int scopeUris = 0x7f03041a;
|
||||
public static final int statusBarBackground = 0x7f030488;
|
||||
public static final int ttcIndex = 0x7f030559;
|
||||
|
||||
private attr() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class color {
|
||||
public static final int common_google_signin_btn_text_dark = 0x7f050045;
|
||||
public static final int common_google_signin_btn_text_dark_default = 0x7f050046;
|
||||
public static final int common_google_signin_btn_text_dark_disabled = 0x7f050047;
|
||||
public static final int common_google_signin_btn_text_dark_focused = 0x7f050048;
|
||||
public static final int common_google_signin_btn_text_dark_pressed = 0x7f050049;
|
||||
public static final int common_google_signin_btn_text_light = 0x7f05004a;
|
||||
public static final int common_google_signin_btn_text_light_default = 0x7f05004b;
|
||||
public static final int common_google_signin_btn_text_light_disabled = 0x7f05004c;
|
||||
public static final int common_google_signin_btn_text_light_focused = 0x7f05004d;
|
||||
public static final int common_google_signin_btn_text_light_pressed = 0x7f05004e;
|
||||
public static final int common_google_signin_btn_tint = 0x7f05004f;
|
||||
public static final int notification_action_color_filter = 0x7f050315;
|
||||
public static final int notification_icon_bg_color = 0x7f050316;
|
||||
public static final int ripple_material_light = 0x7f050322;
|
||||
public static final int secondary_text_default_material_light = 0x7f050324;
|
||||
|
||||
private color() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class dimen {
|
||||
public static final int compat_button_inset_horizontal_material = 0x7f06006d;
|
||||
public static final int compat_button_inset_vertical_material = 0x7f06006e;
|
||||
public static final int compat_button_padding_horizontal_material = 0x7f06006f;
|
||||
public static final int compat_button_padding_vertical_material = 0x7f060070;
|
||||
public static final int compat_control_corner_material = 0x7f060071;
|
||||
public static final int compat_notification_large_icon_max_height = 0x7f060072;
|
||||
public static final int compat_notification_large_icon_max_width = 0x7f060073;
|
||||
public static final int notification_action_icon_size = 0x7f060385;
|
||||
public static final int notification_action_text_size = 0x7f060386;
|
||||
public static final int notification_big_circle_margin = 0x7f060387;
|
||||
public static final int notification_content_margin_start = 0x7f060388;
|
||||
public static final int notification_large_icon_height = 0x7f06038d;
|
||||
public static final int notification_large_icon_width = 0x7f06038e;
|
||||
public static final int notification_main_column_padding_top = 0x7f06038f;
|
||||
public static final int notification_media_narrow_margin = 0x7f060391;
|
||||
public static final int notification_right_icon_size = 0x7f060393;
|
||||
public static final int notification_right_side_padding_top = 0x7f060394;
|
||||
public static final int notification_small_icon_background_padding = 0x7f060395;
|
||||
public static final int notification_small_icon_size_as_large = 0x7f060396;
|
||||
public static final int notification_subtext_size = 0x7f060397;
|
||||
public static final int notification_top_pad = 0x7f06039b;
|
||||
public static final int notification_top_pad_large_text = 0x7f06039c;
|
||||
|
||||
private dimen() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class drawable {
|
||||
public static final int common_full_open_on_phone = 0x7f07008b;
|
||||
public static final int common_google_signin_btn_icon_dark = 0x7f07008c;
|
||||
public static final int common_google_signin_btn_icon_dark_focused = 0x7f07008d;
|
||||
public static final int common_google_signin_btn_icon_dark_normal = 0x7f07008e;
|
||||
public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f07008f;
|
||||
public static final int common_google_signin_btn_icon_disabled = 0x7f070090;
|
||||
public static final int common_google_signin_btn_icon_light = 0x7f070091;
|
||||
public static final int common_google_signin_btn_icon_light_focused = 0x7f070092;
|
||||
public static final int common_google_signin_btn_icon_light_normal = 0x7f070093;
|
||||
public static final int common_google_signin_btn_icon_light_normal_background = 0x7f070094;
|
||||
public static final int common_google_signin_btn_text_dark = 0x7f070095;
|
||||
public static final int common_google_signin_btn_text_dark_focused = 0x7f070096;
|
||||
public static final int common_google_signin_btn_text_dark_normal = 0x7f070097;
|
||||
public static final int common_google_signin_btn_text_dark_normal_background = 0x7f070098;
|
||||
public static final int common_google_signin_btn_text_disabled = 0x7f070099;
|
||||
public static final int common_google_signin_btn_text_light = 0x7f07009a;
|
||||
public static final int common_google_signin_btn_text_light_focused = 0x7f07009b;
|
||||
public static final int common_google_signin_btn_text_light_normal = 0x7f07009c;
|
||||
public static final int common_google_signin_btn_text_light_normal_background = 0x7f07009d;
|
||||
public static final int googleg_disabled_color_18 = 0x7f0700ac;
|
||||
public static final int googleg_standard_color_18 = 0x7f0700ad;
|
||||
public static final int notification_action_background = 0x7f070181;
|
||||
public static final int notification_bg = 0x7f070182;
|
||||
public static final int notification_bg_low = 0x7f070183;
|
||||
public static final int notification_bg_low_normal = 0x7f070184;
|
||||
public static final int notification_bg_low_pressed = 0x7f070185;
|
||||
public static final int notification_bg_normal = 0x7f070186;
|
||||
public static final int notification_bg_normal_pressed = 0x7f070187;
|
||||
public static final int notification_icon_background = 0x7f070188;
|
||||
public static final int notification_template_icon_bg = 0x7f07018a;
|
||||
public static final int notification_template_icon_low_bg = 0x7f07018b;
|
||||
public static final int notification_tile_bg = 0x7f07018c;
|
||||
public static final int notify_panel_notification_icon_bg = 0x7f07018d;
|
||||
|
||||
private drawable() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class id {
|
||||
public static final int accessibility_action_clickable_span = 0x7f090013;
|
||||
public static final int accessibility_custom_action_0 = 0x7f090014;
|
||||
public static final int accessibility_custom_action_1 = 0x7f090015;
|
||||
public static final int accessibility_custom_action_10 = 0x7f090016;
|
||||
public static final int accessibility_custom_action_11 = 0x7f090017;
|
||||
public static final int accessibility_custom_action_12 = 0x7f090018;
|
||||
public static final int accessibility_custom_action_13 = 0x7f090019;
|
||||
public static final int accessibility_custom_action_14 = 0x7f09001a;
|
||||
public static final int accessibility_custom_action_15 = 0x7f09001b;
|
||||
public static final int accessibility_custom_action_16 = 0x7f09001c;
|
||||
public static final int accessibility_custom_action_17 = 0x7f09001d;
|
||||
public static final int accessibility_custom_action_18 = 0x7f09001e;
|
||||
public static final int accessibility_custom_action_19 = 0x7f09001f;
|
||||
public static final int accessibility_custom_action_2 = 0x7f090020;
|
||||
public static final int accessibility_custom_action_20 = 0x7f090021;
|
||||
public static final int accessibility_custom_action_21 = 0x7f090022;
|
||||
public static final int accessibility_custom_action_22 = 0x7f090023;
|
||||
public static final int accessibility_custom_action_23 = 0x7f090024;
|
||||
public static final int accessibility_custom_action_24 = 0x7f090025;
|
||||
public static final int accessibility_custom_action_25 = 0x7f090026;
|
||||
public static final int accessibility_custom_action_26 = 0x7f090027;
|
||||
public static final int accessibility_custom_action_27 = 0x7f090028;
|
||||
public static final int accessibility_custom_action_28 = 0x7f090029;
|
||||
public static final int accessibility_custom_action_29 = 0x7f09002a;
|
||||
public static final int accessibility_custom_action_3 = 0x7f09002b;
|
||||
public static final int accessibility_custom_action_30 = 0x7f09002c;
|
||||
public static final int accessibility_custom_action_31 = 0x7f09002d;
|
||||
public static final int accessibility_custom_action_4 = 0x7f09002e;
|
||||
public static final int accessibility_custom_action_5 = 0x7f09002f;
|
||||
public static final int accessibility_custom_action_6 = 0x7f090030;
|
||||
public static final int accessibility_custom_action_7 = 0x7f090031;
|
||||
public static final int accessibility_custom_action_8 = 0x7f090032;
|
||||
public static final int accessibility_custom_action_9 = 0x7f090033;
|
||||
public static final int action_container = 0x7f090045;
|
||||
public static final int action_divider = 0x7f090048;
|
||||
public static final int action_image = 0x7f09004a;
|
||||
public static final int action_text = 0x7f090051;
|
||||
public static final int actions = 0x7f090052;
|
||||
public static final int adjust_height = 0x7f090058;
|
||||
public static final int adjust_width = 0x7f090059;
|
||||
public static final int async = 0x7f090071;
|
||||
public static final int auto = 0x7f090072;
|
||||
public static final int blocking = 0x7f090082;
|
||||
public static final int bottom = 0x7f090083;
|
||||
public static final int chronometer = 0x7f0900a9;
|
||||
public static final int dark = 0x7f0900ea;
|
||||
public static final int dialog_button = 0x7f09010b;
|
||||
public static final int end = 0x7f090133;
|
||||
public static final int forever = 0x7f090152;
|
||||
public static final int icon = 0x7f090195;
|
||||
public static final int icon_group = 0x7f090196;
|
||||
public static final int icon_only = 0x7f090198;
|
||||
public static final int info = 0x7f0901a9;
|
||||
public static final int italic = 0x7f0901be;
|
||||
public static final int left = 0x7f0901e2;
|
||||
public static final int light = 0x7f0901e7;
|
||||
public static final int line1 = 0x7f0901e9;
|
||||
public static final int line3 = 0x7f0901ea;
|
||||
public static final int none = 0x7f090264;
|
||||
public static final int normal = 0x7f090265;
|
||||
public static final int notification_background = 0x7f090269;
|
||||
public static final int notification_main_column = 0x7f09026a;
|
||||
public static final int notification_main_column_container = 0x7f09026b;
|
||||
public static final int right = 0x7f0902cd;
|
||||
public static final int right_icon = 0x7f0902cf;
|
||||
public static final int right_side = 0x7f0902d0;
|
||||
public static final int standard = 0x7f090321;
|
||||
public static final int start = 0x7f090322;
|
||||
public static final int tag_accessibility_actions = 0x7f09035c;
|
||||
public static final int tag_accessibility_clickable_spans = 0x7f09035d;
|
||||
public static final int tag_accessibility_heading = 0x7f09035e;
|
||||
public static final int tag_accessibility_pane_title = 0x7f09035f;
|
||||
public static final int tag_screen_reader_focusable = 0x7f090363;
|
||||
public static final int tag_transition_group = 0x7f090365;
|
||||
public static final int tag_unhandled_key_event_manager = 0x7f090366;
|
||||
public static final int tag_unhandled_key_listeners = 0x7f090367;
|
||||
public static final int text = 0x7f09036d;
|
||||
public static final int text2 = 0x7f09036e;
|
||||
public static final int time = 0x7f09038e;
|
||||
public static final int title = 0x7f090393;
|
||||
public static final int top = 0x7f0903ac;
|
||||
public static final int wide = 0x7f090401;
|
||||
|
||||
private id() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class integer {
|
||||
public static final int google_play_services_version = 0x7f0a0009;
|
||||
public static final int status_bar_notification_info_maxnum = 0x7f0a0045;
|
||||
|
||||
private integer() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class layout {
|
||||
public static final int custom_dialog = 0x7f0c0026;
|
||||
public static final int notification_action = 0x7f0c00a8;
|
||||
public static final int notification_action_tombstone = 0x7f0c00a9;
|
||||
public static final int notification_template_custom_big = 0x7f0c00aa;
|
||||
public static final int notification_template_icon_group = 0x7f0c00ab;
|
||||
public static final int notification_template_part_chronometer = 0x7f0c00ac;
|
||||
public static final int notification_template_part_time = 0x7f0c00ad;
|
||||
|
||||
private layout() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class raw {
|
||||
public static final int firebase_common_keep = 0x7f120000;
|
||||
|
||||
private raw() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class string {
|
||||
public static final int common_google_play_services_enable_button = 0x7f1300b4;
|
||||
public static final int common_google_play_services_enable_text = 0x7f1300b5;
|
||||
public static final int common_google_play_services_enable_title = 0x7f1300b6;
|
||||
public static final int common_google_play_services_install_button = 0x7f1300b7;
|
||||
public static final int common_google_play_services_install_text = 0x7f1300b8;
|
||||
public static final int common_google_play_services_install_title = 0x7f1300b9;
|
||||
public static final int common_google_play_services_notification_channel_name = 0x7f1300ba;
|
||||
public static final int common_google_play_services_notification_ticker = 0x7f1300bb;
|
||||
public static final int common_google_play_services_unknown_issue = 0x7f1300bc;
|
||||
public static final int common_google_play_services_unsupported_text = 0x7f1300bd;
|
||||
public static final int common_google_play_services_update_button = 0x7f1300be;
|
||||
public static final int common_google_play_services_update_text = 0x7f1300bf;
|
||||
public static final int common_google_play_services_update_title = 0x7f1300c0;
|
||||
public static final int common_google_play_services_updating_text = 0x7f1300c1;
|
||||
public static final int common_google_play_services_wear_update_text = 0x7f1300c2;
|
||||
public static final int common_open_on_phone = 0x7f1300c4;
|
||||
public static final int common_signin_button_text = 0x7f1300c5;
|
||||
public static final int common_signin_button_text_long = 0x7f1300c6;
|
||||
public static final int status_bar_notification_info_overflow = 0x7f13023b;
|
||||
|
||||
private string() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class style {
|
||||
public static final int TextAppearance_Compat_Notification = 0x7f1401fb;
|
||||
public static final int TextAppearance_Compat_Notification_Info = 0x7f1401fc;
|
||||
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1401fd;
|
||||
public static final int TextAppearance_Compat_Notification_Time = 0x7f1401fe;
|
||||
public static final int TextAppearance_Compat_Notification_Title = 0x7f1401ff;
|
||||
public static final int Widget_Compat_NotificationActionContainer = 0x7f1403a1;
|
||||
public static final int Widget_Compat_NotificationActionText = 0x7f1403a2;
|
||||
public static final int Widget_Support_CoordinatorLayout = 0x7f1404d7;
|
||||
|
||||
private style() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class styleable {
|
||||
public static final int ColorStateListItem_alpha = 0x00000003;
|
||||
public static final int ColorStateListItem_android_alpha = 0x00000001;
|
||||
public static final int ColorStateListItem_android_color = 0x00000000;
|
||||
public static final int ColorStateListItem_android_lStar = 0x00000002;
|
||||
public static final int ColorStateListItem_lStar = 0x00000004;
|
||||
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0x00000000;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchor = 0x00000001;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 0x00000002;
|
||||
public static final int CoordinatorLayout_Layout_layout_behavior = 0x00000003;
|
||||
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 0x00000004;
|
||||
public static final int CoordinatorLayout_Layout_layout_insetEdge = 0x00000005;
|
||||
public static final int CoordinatorLayout_Layout_layout_keyline = 0x00000006;
|
||||
public static final int CoordinatorLayout_keylines = 0x00000000;
|
||||
public static final int CoordinatorLayout_statusBarBackground = 0x00000001;
|
||||
public static final int FontFamilyFont_android_font = 0x00000000;
|
||||
public static final int FontFamilyFont_android_fontStyle = 0x00000002;
|
||||
public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004;
|
||||
public static final int FontFamilyFont_android_fontWeight = 0x00000001;
|
||||
public static final int FontFamilyFont_android_ttcIndex = 0x00000003;
|
||||
public static final int FontFamilyFont_font = 0x00000005;
|
||||
public static final int FontFamilyFont_fontStyle = 0x00000006;
|
||||
public static final int FontFamilyFont_fontVariationSettings = 0x00000007;
|
||||
public static final int FontFamilyFont_fontWeight = 0x00000008;
|
||||
public static final int FontFamilyFont_ttcIndex = 0x00000009;
|
||||
public static final int FontFamily_fontProviderAuthority = 0x00000000;
|
||||
public static final int FontFamily_fontProviderCerts = 0x00000001;
|
||||
public static final int FontFamily_fontProviderFetchStrategy = 0x00000002;
|
||||
public static final int FontFamily_fontProviderFetchTimeout = 0x00000003;
|
||||
public static final int FontFamily_fontProviderPackage = 0x00000004;
|
||||
public static final int FontFamily_fontProviderQuery = 0x00000005;
|
||||
public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006;
|
||||
public static final int GradientColorItem_android_color = 0x00000000;
|
||||
public static final int GradientColorItem_android_offset = 0x00000001;
|
||||
public static final int GradientColor_android_centerColor = 0x00000007;
|
||||
public static final int GradientColor_android_centerX = 0x00000003;
|
||||
public static final int GradientColor_android_centerY = 0x00000004;
|
||||
public static final int GradientColor_android_endColor = 0x00000001;
|
||||
public static final int GradientColor_android_endX = 0x0000000a;
|
||||
public static final int GradientColor_android_endY = 0x0000000b;
|
||||
public static final int GradientColor_android_gradientRadius = 0x00000005;
|
||||
public static final int GradientColor_android_startColor = 0x00000000;
|
||||
public static final int GradientColor_android_startX = 0x00000008;
|
||||
public static final int GradientColor_android_startY = 0x00000009;
|
||||
public static final int GradientColor_android_tileMode = 0x00000006;
|
||||
public static final int GradientColor_android_type = 0x00000002;
|
||||
public static final int LoadingImageView_circleCrop = 0x00000000;
|
||||
public static final int LoadingImageView_imageAspectRatio = 0x00000001;
|
||||
public static final int LoadingImageView_imageAspectRatioAdjust = 0x00000002;
|
||||
public static final int SignInButton_buttonSize = 0x00000000;
|
||||
public static final int SignInButton_colorScheme = 0x00000001;
|
||||
public static final int SignInButton_scopeUris = 0x00000002;
|
||||
public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, 16844359, com.adif.elcanomovil.R.attr.alpha, com.adif.elcanomovil.R.attr.lStar};
|
||||
public static final int[] CoordinatorLayout = {com.adif.elcanomovil.R.attr.keylines, com.adif.elcanomovil.R.attr.statusBarBackground};
|
||||
public static final int[] CoordinatorLayout_Layout = {android.R.attr.layout_gravity, com.adif.elcanomovil.R.attr.layout_anchor, com.adif.elcanomovil.R.attr.layout_anchorGravity, com.adif.elcanomovil.R.attr.layout_behavior, com.adif.elcanomovil.R.attr.layout_dodgeInsetEdges, com.adif.elcanomovil.R.attr.layout_insetEdge, com.adif.elcanomovil.R.attr.layout_keyline};
|
||||
public static final int[] FontFamily = {com.adif.elcanomovil.R.attr.fontProviderAuthority, com.adif.elcanomovil.R.attr.fontProviderCerts, com.adif.elcanomovil.R.attr.fontProviderFetchStrategy, com.adif.elcanomovil.R.attr.fontProviderFetchTimeout, com.adif.elcanomovil.R.attr.fontProviderPackage, com.adif.elcanomovil.R.attr.fontProviderQuery, com.adif.elcanomovil.R.attr.fontProviderSystemFontFamily};
|
||||
public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, com.adif.elcanomovil.R.attr.font, com.adif.elcanomovil.R.attr.fontStyle, com.adif.elcanomovil.R.attr.fontVariationSettings, com.adif.elcanomovil.R.attr.fontWeight, com.adif.elcanomovil.R.attr.ttcIndex};
|
||||
public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
|
||||
public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
|
||||
public static final int[] LoadingImageView = {com.adif.elcanomovil.R.attr.circleCrop, com.adif.elcanomovil.R.attr.imageAspectRatio, com.adif.elcanomovil.R.attr.imageAspectRatioAdjust};
|
||||
public static final int[] SignInButton = {com.adif.elcanomovil.R.attr.buttonSize, com.adif.elcanomovil.R.attr.colorScheme, com.adif.elcanomovil.R.attr.scopeUris};
|
||||
|
||||
private styleable() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.FirebaseException;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageException extends FirebaseException {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
public static final int ERROR_BUCKET_NOT_FOUND = -13011;
|
||||
public static final int ERROR_CANCELED = -13040;
|
||||
public static final int ERROR_INVALID_CHECKSUM = -13031;
|
||||
public static final int ERROR_NOT_AUTHENTICATED = -13020;
|
||||
public static final int ERROR_NOT_AUTHORIZED = -13021;
|
||||
public static final int ERROR_OBJECT_NOT_FOUND = -13010;
|
||||
public static final int ERROR_PROJECT_NOT_FOUND = -13012;
|
||||
public static final int ERROR_QUOTA_EXCEEDED = -13013;
|
||||
public static final int ERROR_RETRY_LIMIT_EXCEEDED = -13030;
|
||||
public static final int ERROR_UNKNOWN = -13000;
|
||||
private static final int NETWORK_UNAVAILABLE = -2;
|
||||
private static final String TAG = "StorageException";
|
||||
private Throwable cause;
|
||||
private final int errorCode;
|
||||
private final int httpResultCode;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
/* loaded from: classes3.dex */
|
||||
public @interface ErrorCode {
|
||||
}
|
||||
|
||||
public StorageException(int i, Throwable th, int i4) {
|
||||
super(getErrorMessageForCode(i));
|
||||
this.cause = th;
|
||||
this.errorCode = i;
|
||||
this.httpResultCode = i4;
|
||||
Log.e(TAG, "StorageException has occurred.\n" + getErrorMessageForCode(i) + "\n Code: " + i + " HttpResult: " + i4);
|
||||
Throwable th2 = this.cause;
|
||||
if (th2 != null) {
|
||||
Log.e(TAG, th2.getMessage(), this.cause);
|
||||
}
|
||||
}
|
||||
|
||||
private static int calculateErrorCode(Status status) {
|
||||
return status.isCanceled() ? ERROR_CANCELED : status.equals(Status.RESULT_TIMEOUT) ? ERROR_RETRY_LIMIT_EXCEEDED : ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
public static StorageException fromErrorStatus(Status status) {
|
||||
Preconditions.checkNotNull(status);
|
||||
Preconditions.checkArgument(!status.isSuccess());
|
||||
return new StorageException(calculateErrorCode(status), null, 0);
|
||||
}
|
||||
|
||||
public static StorageException fromException(Throwable th) {
|
||||
return fromExceptionAndHttpCode(th, 0);
|
||||
}
|
||||
|
||||
public static StorageException fromExceptionAndHttpCode(Throwable th, int i) {
|
||||
if (th instanceof StorageException) {
|
||||
return (StorageException) th;
|
||||
}
|
||||
if (isResultSuccess(i) && th == null) {
|
||||
return null;
|
||||
}
|
||||
return new StorageException(calculateErrorCode(th, i), th, i);
|
||||
}
|
||||
|
||||
public static String getErrorMessageForCode(int i) {
|
||||
if (i == -13040) {
|
||||
return "The operation was cancelled.";
|
||||
}
|
||||
if (i == -13031) {
|
||||
return "Object has a checksum which does not match. Please retry the operation.";
|
||||
}
|
||||
if (i == -13030) {
|
||||
return "The operation retry limit has been exceeded.";
|
||||
}
|
||||
if (i == -13021) {
|
||||
return "User does not have permission to access this object.";
|
||||
}
|
||||
if (i == -13020) {
|
||||
return "User is not authenticated, please authenticate using Firebase Authentication and try again.";
|
||||
}
|
||||
switch (i) {
|
||||
case ERROR_QUOTA_EXCEEDED /* -13013 */:
|
||||
return "Quota for bucket exceeded, please view quota on www.firebase.google.com/storage.";
|
||||
case ERROR_PROJECT_NOT_FOUND /* -13012 */:
|
||||
return "Project does not exist.";
|
||||
case ERROR_BUCKET_NOT_FOUND /* -13011 */:
|
||||
return "Bucket does not exist.";
|
||||
case ERROR_OBJECT_NOT_FOUND /* -13010 */:
|
||||
return "Object does not exist at location.";
|
||||
default:
|
||||
return "An unknown error occurred, please check the HTTP result code and inner exception for server response.";
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isResultSuccess(int i) {
|
||||
if (i != 0) {
|
||||
return i >= 200 && i < 300;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public synchronized Throwable getCause() {
|
||||
Throwable th = this.cause;
|
||||
if (th == this) {
|
||||
return null;
|
||||
}
|
||||
return th;
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public int getHttpResultCode() {
|
||||
return this.httpResultCode;
|
||||
}
|
||||
|
||||
public boolean getIsRecoverableException() {
|
||||
return getErrorCode() == -13030;
|
||||
}
|
||||
|
||||
private static int calculateErrorCode(Throwable th, int i) {
|
||||
return th instanceof CancelException ? ERROR_CANCELED : i != -2 ? i != 401 ? i != 409 ? i != 403 ? i != 404 ? ERROR_UNKNOWN : ERROR_OBJECT_NOT_FOUND : ERROR_NOT_AUTHORIZED : ERROR_INVALID_CHECKSUM : ERROR_NOT_AUTHENTICATED : ERROR_RETRY_LIMIT_EXCEEDED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.storage.internal.Slashes;
|
||||
import com.google.firebase.storage.internal.Util;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageMetadata {
|
||||
private static final String BUCKET_KEY = "bucket";
|
||||
private static final String CACHE_CONTROL = "cacheControl";
|
||||
private static final String CONTENT_DISPOSITION = "contentDisposition";
|
||||
private static final String CONTENT_ENCODING = "contentEncoding";
|
||||
private static final String CONTENT_LANGUAGE = "contentLanguage";
|
||||
private static final String CONTENT_TYPE_KEY = "contentType";
|
||||
private static final String CUSTOM_METADATA_KEY = "metadata";
|
||||
private static final String GENERATION_KEY = "generation";
|
||||
private static final String MD5_HASH_KEY = "md5Hash";
|
||||
private static final String META_GENERATION_KEY = "metageneration";
|
||||
private static final String NAME_KEY = "name";
|
||||
private static final String SIZE_KEY = "size";
|
||||
private static final String TAG = "StorageMetadata";
|
||||
private static final String TIME_CREATED_KEY = "timeCreated";
|
||||
private static final String TIME_UPDATED_KEY = "updated";
|
||||
private String mBucket;
|
||||
private MetadataValue<String> mCacheControl;
|
||||
private MetadataValue<String> mContentDisposition;
|
||||
private MetadataValue<String> mContentEncoding;
|
||||
private MetadataValue<String> mContentLanguage;
|
||||
private MetadataValue<String> mContentType;
|
||||
private String mCreationTime;
|
||||
private MetadataValue<Map<String, String>> mCustomMetadata;
|
||||
private String mGeneration;
|
||||
private String mMD5Hash;
|
||||
private String mMetadataGeneration;
|
||||
private String mPath;
|
||||
private long mSize;
|
||||
private FirebaseStorage mStorage;
|
||||
private StorageReference mStorageRef;
|
||||
private String mUpdatedTime;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class MetadataValue<T> {
|
||||
private final boolean userProvided;
|
||||
private final T value;
|
||||
|
||||
public MetadataValue(T t2, boolean z3) {
|
||||
this.userProvided = z3;
|
||||
this.value = t2;
|
||||
}
|
||||
|
||||
public static <T> MetadataValue<T> withDefaultValue(T t2) {
|
||||
return new MetadataValue<>(t2, false);
|
||||
}
|
||||
|
||||
public static <T> MetadataValue<T> withUserValue(T t2) {
|
||||
return new MetadataValue<>(t2, true);
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public boolean isUserProvided() {
|
||||
return this.userProvided;
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject createJSONObject() {
|
||||
HashMap hashMap = new HashMap();
|
||||
if (this.mContentType.isUserProvided()) {
|
||||
hashMap.put(CONTENT_TYPE_KEY, getContentType());
|
||||
}
|
||||
if (this.mCustomMetadata.isUserProvided()) {
|
||||
hashMap.put(CUSTOM_METADATA_KEY, new JSONObject(this.mCustomMetadata.getValue()));
|
||||
}
|
||||
if (this.mCacheControl.isUserProvided()) {
|
||||
hashMap.put(CACHE_CONTROL, getCacheControl());
|
||||
}
|
||||
if (this.mContentDisposition.isUserProvided()) {
|
||||
hashMap.put(CONTENT_DISPOSITION, getContentDisposition());
|
||||
}
|
||||
if (this.mContentEncoding.isUserProvided()) {
|
||||
hashMap.put(CONTENT_ENCODING, getContentEncoding());
|
||||
}
|
||||
if (this.mContentLanguage.isUserProvided()) {
|
||||
hashMap.put(CONTENT_LANGUAGE, getContentLanguage());
|
||||
}
|
||||
return new JSONObject(hashMap);
|
||||
}
|
||||
|
||||
public String getBucket() {
|
||||
return this.mBucket;
|
||||
}
|
||||
|
||||
public String getCacheControl() {
|
||||
return this.mCacheControl.getValue();
|
||||
}
|
||||
|
||||
public String getContentDisposition() {
|
||||
return this.mContentDisposition.getValue();
|
||||
}
|
||||
|
||||
public String getContentEncoding() {
|
||||
return this.mContentEncoding.getValue();
|
||||
}
|
||||
|
||||
public String getContentLanguage() {
|
||||
return this.mContentLanguage.getValue();
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return this.mContentType.getValue();
|
||||
}
|
||||
|
||||
public long getCreationTimeMillis() {
|
||||
return Util.parseDateTime(this.mCreationTime);
|
||||
}
|
||||
|
||||
public String getCustomMetadata(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
return this.mCustomMetadata.getValue().get(str);
|
||||
}
|
||||
|
||||
public Set<String> getCustomMetadataKeys() {
|
||||
return this.mCustomMetadata.getValue().keySet();
|
||||
}
|
||||
|
||||
public String getGeneration() {
|
||||
return this.mGeneration;
|
||||
}
|
||||
|
||||
public String getMd5Hash() {
|
||||
return this.mMD5Hash;
|
||||
}
|
||||
|
||||
public String getMetadataGeneration() {
|
||||
return this.mMetadataGeneration;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String path = getPath();
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
return null;
|
||||
}
|
||||
int lastIndexOf = path.lastIndexOf(47);
|
||||
return lastIndexOf != -1 ? path.substring(lastIndexOf + 1) : path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
String str = this.mPath;
|
||||
return str != null ? str : "";
|
||||
}
|
||||
|
||||
public StorageReference getReference() {
|
||||
StorageReference storageReference = this.mStorageRef;
|
||||
if (storageReference != null || this.mStorage == null) {
|
||||
return storageReference;
|
||||
}
|
||||
String bucket = getBucket();
|
||||
String path = getPath();
|
||||
if (TextUtils.isEmpty(bucket) || TextUtils.isEmpty(path)) {
|
||||
return null;
|
||||
}
|
||||
return new StorageReference(new Uri.Builder().scheme("gs").authority(bucket).encodedPath(Slashes.preserveSlashEncode(path)).build(), this.mStorage);
|
||||
}
|
||||
|
||||
public long getSizeBytes() {
|
||||
return this.mSize;
|
||||
}
|
||||
|
||||
public long getUpdatedTimeMillis() {
|
||||
return Util.parseDateTime(this.mUpdatedTime);
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class Builder {
|
||||
boolean mFromJSON;
|
||||
StorageMetadata mMetadata;
|
||||
|
||||
public Builder() {
|
||||
this.mMetadata = new StorageMetadata();
|
||||
}
|
||||
|
||||
private String extractString(JSONObject jSONObject, String str) throws JSONException {
|
||||
if (!jSONObject.has(str) || jSONObject.isNull(str)) {
|
||||
return null;
|
||||
}
|
||||
return jSONObject.getString(str);
|
||||
}
|
||||
|
||||
private void parseJSON(JSONObject jSONObject) throws JSONException {
|
||||
this.mMetadata.mGeneration = jSONObject.optString(StorageMetadata.GENERATION_KEY);
|
||||
this.mMetadata.mPath = jSONObject.optString("name");
|
||||
this.mMetadata.mBucket = jSONObject.optString(StorageMetadata.BUCKET_KEY);
|
||||
this.mMetadata.mMetadataGeneration = jSONObject.optString(StorageMetadata.META_GENERATION_KEY);
|
||||
this.mMetadata.mCreationTime = jSONObject.optString(StorageMetadata.TIME_CREATED_KEY);
|
||||
this.mMetadata.mUpdatedTime = jSONObject.optString(StorageMetadata.TIME_UPDATED_KEY);
|
||||
this.mMetadata.mSize = jSONObject.optLong(StorageMetadata.SIZE_KEY);
|
||||
this.mMetadata.mMD5Hash = jSONObject.optString(StorageMetadata.MD5_HASH_KEY);
|
||||
if (jSONObject.has(StorageMetadata.CUSTOM_METADATA_KEY) && !jSONObject.isNull(StorageMetadata.CUSTOM_METADATA_KEY)) {
|
||||
JSONObject jSONObject2 = jSONObject.getJSONObject(StorageMetadata.CUSTOM_METADATA_KEY);
|
||||
Iterator<String> keys = jSONObject2.keys();
|
||||
while (keys.hasNext()) {
|
||||
String next = keys.next();
|
||||
setCustomMetadata(next, jSONObject2.getString(next));
|
||||
}
|
||||
}
|
||||
String extractString = extractString(jSONObject, StorageMetadata.CONTENT_TYPE_KEY);
|
||||
if (extractString != null) {
|
||||
setContentType(extractString);
|
||||
}
|
||||
String extractString2 = extractString(jSONObject, StorageMetadata.CACHE_CONTROL);
|
||||
if (extractString2 != null) {
|
||||
setCacheControl(extractString2);
|
||||
}
|
||||
String extractString3 = extractString(jSONObject, StorageMetadata.CONTENT_DISPOSITION);
|
||||
if (extractString3 != null) {
|
||||
setContentDisposition(extractString3);
|
||||
}
|
||||
String extractString4 = extractString(jSONObject, StorageMetadata.CONTENT_ENCODING);
|
||||
if (extractString4 != null) {
|
||||
setContentEncoding(extractString4);
|
||||
}
|
||||
String extractString5 = extractString(jSONObject, StorageMetadata.CONTENT_LANGUAGE);
|
||||
if (extractString5 != null) {
|
||||
setContentLanguage(extractString5);
|
||||
}
|
||||
}
|
||||
|
||||
public StorageMetadata build() {
|
||||
return new StorageMetadata(this.mFromJSON);
|
||||
}
|
||||
|
||||
public String getCacheControl() {
|
||||
return (String) this.mMetadata.mCacheControl.getValue();
|
||||
}
|
||||
|
||||
public String getContentDisposition() {
|
||||
return (String) this.mMetadata.mContentDisposition.getValue();
|
||||
}
|
||||
|
||||
public String getContentEncoding() {
|
||||
return (String) this.mMetadata.mContentEncoding.getValue();
|
||||
}
|
||||
|
||||
public String getContentLanguage() {
|
||||
return (String) this.mMetadata.mContentLanguage.getValue();
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return (String) this.mMetadata.mContentType.getValue();
|
||||
}
|
||||
|
||||
public Builder setCacheControl(String str) {
|
||||
this.mMetadata.mCacheControl = MetadataValue.withUserValue(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setContentDisposition(String str) {
|
||||
this.mMetadata.mContentDisposition = MetadataValue.withUserValue(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setContentEncoding(String str) {
|
||||
this.mMetadata.mContentEncoding = MetadataValue.withUserValue(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setContentLanguage(String str) {
|
||||
this.mMetadata.mContentLanguage = MetadataValue.withUserValue(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setContentType(String str) {
|
||||
this.mMetadata.mContentType = MetadataValue.withUserValue(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCustomMetadata(String str, String str2) {
|
||||
if (!this.mMetadata.mCustomMetadata.isUserProvided()) {
|
||||
this.mMetadata.mCustomMetadata = MetadataValue.withUserValue(new HashMap());
|
||||
}
|
||||
((Map) this.mMetadata.mCustomMetadata.getValue()).put(str, str2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder(StorageMetadata storageMetadata) {
|
||||
this.mMetadata = new StorageMetadata(false);
|
||||
}
|
||||
|
||||
public Builder(JSONObject jSONObject, StorageReference storageReference) throws JSONException {
|
||||
this(jSONObject);
|
||||
this.mMetadata.mStorageRef = storageReference;
|
||||
}
|
||||
|
||||
public Builder(JSONObject jSONObject) throws JSONException {
|
||||
this.mMetadata = new StorageMetadata();
|
||||
if (jSONObject != null) {
|
||||
parseJSON(jSONObject);
|
||||
this.mFromJSON = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StorageMetadata() {
|
||||
this.mPath = null;
|
||||
this.mStorage = null;
|
||||
this.mStorageRef = null;
|
||||
this.mBucket = null;
|
||||
this.mGeneration = null;
|
||||
this.mContentType = MetadataValue.withDefaultValue("");
|
||||
this.mMetadataGeneration = null;
|
||||
this.mCreationTime = null;
|
||||
this.mUpdatedTime = null;
|
||||
this.mMD5Hash = null;
|
||||
this.mCacheControl = MetadataValue.withDefaultValue("");
|
||||
this.mContentDisposition = MetadataValue.withDefaultValue("");
|
||||
this.mContentEncoding = MetadataValue.withDefaultValue("");
|
||||
this.mContentLanguage = MetadataValue.withDefaultValue("");
|
||||
this.mCustomMetadata = MetadataValue.withDefaultValue(Collections.EMPTY_MAP);
|
||||
}
|
||||
|
||||
private StorageMetadata(StorageMetadata storageMetadata, boolean z3) {
|
||||
this.mPath = null;
|
||||
this.mStorage = null;
|
||||
this.mStorageRef = null;
|
||||
this.mBucket = null;
|
||||
this.mGeneration = null;
|
||||
this.mContentType = MetadataValue.withDefaultValue("");
|
||||
this.mMetadataGeneration = null;
|
||||
this.mCreationTime = null;
|
||||
this.mUpdatedTime = null;
|
||||
this.mMD5Hash = null;
|
||||
this.mCacheControl = MetadataValue.withDefaultValue("");
|
||||
this.mContentDisposition = MetadataValue.withDefaultValue("");
|
||||
this.mContentEncoding = MetadataValue.withDefaultValue("");
|
||||
this.mContentLanguage = MetadataValue.withDefaultValue("");
|
||||
this.mCustomMetadata = MetadataValue.withDefaultValue(Collections.EMPTY_MAP);
|
||||
Preconditions.checkNotNull(storageMetadata);
|
||||
this.mPath = storageMetadata.mPath;
|
||||
this.mStorage = storageMetadata.mStorage;
|
||||
this.mStorageRef = storageMetadata.mStorageRef;
|
||||
this.mBucket = storageMetadata.mBucket;
|
||||
this.mContentType = storageMetadata.mContentType;
|
||||
this.mCacheControl = storageMetadata.mCacheControl;
|
||||
this.mContentDisposition = storageMetadata.mContentDisposition;
|
||||
this.mContentEncoding = storageMetadata.mContentEncoding;
|
||||
this.mContentLanguage = storageMetadata.mContentLanguage;
|
||||
this.mCustomMetadata = storageMetadata.mCustomMetadata;
|
||||
if (z3) {
|
||||
this.mMD5Hash = storageMetadata.mMD5Hash;
|
||||
this.mSize = storageMetadata.mSize;
|
||||
this.mUpdatedTime = storageMetadata.mUpdatedTime;
|
||||
this.mCreationTime = storageMetadata.mCreationTime;
|
||||
this.mMetadataGeneration = storageMetadata.mMetadataGeneration;
|
||||
this.mGeneration = storageMetadata.mGeneration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.Continuation;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.android.gms.tasks.Tasks;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.StreamDownloadTask;
|
||||
import com.google.firebase.storage.internal.Slashes;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageReference implements Comparable<StorageReference> {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
private static final String TAG = "StorageReference";
|
||||
private final FirebaseStorage mFirebaseStorage;
|
||||
private final Uri mStorageUri;
|
||||
|
||||
public StorageReference(Uri uri, FirebaseStorage firebaseStorage) {
|
||||
Preconditions.checkArgument(uri != null, "storageUri cannot be null");
|
||||
Preconditions.checkArgument(firebaseStorage != null, "FirebaseApp cannot be null");
|
||||
this.mStorageUri = uri;
|
||||
this.mFirebaseStorage = firebaseStorage;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public Task<ListResult> listHelper(Integer num, String str) {
|
||||
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new ListTask(this, num, str, taskCompletionSource));
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public StorageReference child(String str) {
|
||||
Preconditions.checkArgument(!TextUtils.isEmpty(str), "childName cannot be null or empty");
|
||||
return new StorageReference(this.mStorageUri.buildUpon().appendEncodedPath(Slashes.preserveSlashEncode(Slashes.normalizeSlashes(str))).build(), this.mFirebaseStorage);
|
||||
}
|
||||
|
||||
public Task<Void> delete() {
|
||||
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new DeleteStorageTask(this, taskCompletionSource));
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof StorageReference) {
|
||||
return ((StorageReference) obj).toString().equals(toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<FileDownloadTask> getActiveDownloadTasks() {
|
||||
return StorageTaskManager.getInstance().getDownloadTasksUnder(this);
|
||||
}
|
||||
|
||||
public List<UploadTask> getActiveUploadTasks() {
|
||||
return StorageTaskManager.getInstance().getUploadTasksUnder(this);
|
||||
}
|
||||
|
||||
public FirebaseApp getApp() {
|
||||
return getStorage().getApp();
|
||||
}
|
||||
|
||||
public String getBucket() {
|
||||
return this.mStorageUri.getAuthority();
|
||||
}
|
||||
|
||||
public Task<byte[]> getBytes(final long j4) {
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StreamDownloadTask streamDownloadTask = new StreamDownloadTask(this);
|
||||
streamDownloadTask.setStreamProcessor(new StreamDownloadTask.StreamProcessor() { // from class: com.google.firebase.storage.StorageReference.3
|
||||
@Override // com.google.firebase.storage.StreamDownloadTask.StreamProcessor
|
||||
public void doInBackground(StreamDownloadTask.TaskSnapshot taskSnapshot, InputStream inputStream) throws IOException {
|
||||
try {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
byte[] bArr = new byte[16384];
|
||||
int i = 0;
|
||||
while (true) {
|
||||
int read = inputStream.read(bArr, 0, 16384);
|
||||
if (read == -1) {
|
||||
byteArrayOutputStream.flush();
|
||||
taskCompletionSource.setResult(byteArrayOutputStream.toByteArray());
|
||||
inputStream.close();
|
||||
return;
|
||||
} else {
|
||||
i += read;
|
||||
if (i > j4) {
|
||||
Log.e(StorageReference.TAG, "the maximum allowed buffer size was exceeded.");
|
||||
throw new IndexOutOfBoundsException("the maximum allowed buffer size was exceeded.");
|
||||
}
|
||||
byteArrayOutputStream.write(bArr, 0, read);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
inputStream.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}).addOnSuccessListener((OnSuccessListener) new OnSuccessListener<StreamDownloadTask.TaskSnapshot>() { // from class: com.google.firebase.storage.StorageReference.2
|
||||
@Override // com.google.android.gms.tasks.OnSuccessListener
|
||||
public void onSuccess(StreamDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
if (taskCompletionSource.getTask().isComplete()) {
|
||||
return;
|
||||
}
|
||||
Log.e(StorageReference.TAG, "getBytes 'succeeded', but failed to set a Result.");
|
||||
taskCompletionSource.setException(StorageException.fromErrorStatus(Status.RESULT_INTERNAL_ERROR));
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() { // from class: com.google.firebase.storage.StorageReference.1
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
|
||||
@Override // com.google.android.gms.tasks.OnFailureListener
|
||||
public void onFailure(Exception exc) {
|
||||
taskCompletionSource.setException(StorageException.fromExceptionAndHttpCode(exc, 0));
|
||||
}
|
||||
});
|
||||
streamDownloadTask.queue();
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public Task<Uri> getDownloadUrl() {
|
||||
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new GetDownloadUrlTask(this, taskCompletionSource));
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public FileDownloadTask getFile(Uri uri) {
|
||||
FileDownloadTask fileDownloadTask = new FileDownloadTask(this, uri);
|
||||
fileDownloadTask.queue();
|
||||
return fileDownloadTask;
|
||||
}
|
||||
|
||||
public Task<StorageMetadata> getMetadata() {
|
||||
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new GetMetadataTask(this, taskCompletionSource));
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String path = this.mStorageUri.getPath();
|
||||
int lastIndexOf = path.lastIndexOf(47);
|
||||
return lastIndexOf != -1 ? path.substring(lastIndexOf + 1) : path;
|
||||
}
|
||||
|
||||
public StorageReference getParent() {
|
||||
String path = this.mStorageUri.getPath();
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
return null;
|
||||
}
|
||||
String str = RemoteSettings.FORWARD_SLASH_STRING;
|
||||
if (path.equals(RemoteSettings.FORWARD_SLASH_STRING)) {
|
||||
return null;
|
||||
}
|
||||
int lastIndexOf = path.lastIndexOf(47);
|
||||
if (lastIndexOf != -1) {
|
||||
str = path.substring(0, lastIndexOf);
|
||||
}
|
||||
return new StorageReference(this.mStorageUri.buildUpon().path(str).build(), this.mFirebaseStorage);
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.mStorageUri.getPath();
|
||||
}
|
||||
|
||||
public StorageReference getRoot() {
|
||||
return new StorageReference(this.mStorageUri.buildUpon().path("").build(), this.mFirebaseStorage);
|
||||
}
|
||||
|
||||
public FirebaseStorage getStorage() {
|
||||
return this.mFirebaseStorage;
|
||||
}
|
||||
|
||||
public StorageReferenceUri getStorageReferenceUri() {
|
||||
return new StorageReferenceUri(this.mStorageUri, this.mFirebaseStorage.getEmulatorSettings());
|
||||
}
|
||||
|
||||
public Uri getStorageUri() {
|
||||
return this.mStorageUri;
|
||||
}
|
||||
|
||||
public StreamDownloadTask getStream() {
|
||||
StreamDownloadTask streamDownloadTask = new StreamDownloadTask(this);
|
||||
streamDownloadTask.queue();
|
||||
return streamDownloadTask;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
public Task<ListResult> list(int i) {
|
||||
Preconditions.checkArgument(i > 0, "maxResults must be greater than zero");
|
||||
Preconditions.checkArgument(i <= 1000, "maxResults must be at most 1000");
|
||||
return listHelper(Integer.valueOf(i), null);
|
||||
}
|
||||
|
||||
public Task<ListResult> listAll() {
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
final ArrayList arrayList = new ArrayList();
|
||||
final ArrayList arrayList2 = new ArrayList();
|
||||
final Executor commandPoolExecutor = StorageTaskScheduler.getInstance().getCommandPoolExecutor();
|
||||
listHelper(null, null).continueWithTask(commandPoolExecutor, new Continuation<ListResult, Task<Void>>() { // from class: com.google.firebase.storage.StorageReference.4
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.google.android.gms.tasks.Continuation
|
||||
public Task<Void> then(Task<ListResult> task) {
|
||||
if (task.isSuccessful()) {
|
||||
ListResult result = task.getResult();
|
||||
arrayList.addAll(result.getPrefixes());
|
||||
arrayList2.addAll(result.getItems());
|
||||
if (result.getPageToken() != null) {
|
||||
StorageReference.this.listHelper(null, result.getPageToken()).continueWithTask(commandPoolExecutor, this);
|
||||
} else {
|
||||
taskCompletionSource.setResult(new ListResult(arrayList, arrayList2, null));
|
||||
}
|
||||
} else {
|
||||
taskCompletionSource.setException(task.getException());
|
||||
}
|
||||
return Tasks.forResult(null);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
public UploadTask putBytes(byte[] bArr) {
|
||||
Preconditions.checkArgument(bArr != null, "bytes cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, (StorageMetadata) null, bArr);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public UploadTask putFile(Uri uri) {
|
||||
Preconditions.checkArgument(uri != null, "uri cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, null, uri, null);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public UploadTask putStream(InputStream inputStream) {
|
||||
Preconditions.checkArgument(inputStream != null, "stream cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, (StorageMetadata) null, inputStream);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "gs://" + this.mStorageUri.getAuthority() + this.mStorageUri.getEncodedPath();
|
||||
}
|
||||
|
||||
public Task<StorageMetadata> updateMetadata(StorageMetadata storageMetadata) {
|
||||
Preconditions.checkNotNull(storageMetadata);
|
||||
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new UpdateMetadataTask(this, taskCompletionSource, storageMetadata));
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(StorageReference storageReference) {
|
||||
return this.mStorageUri.compareTo(storageReference.mStorageUri);
|
||||
}
|
||||
|
||||
public FileDownloadTask getFile(File file) {
|
||||
return getFile(Uri.fromFile(file));
|
||||
}
|
||||
|
||||
public StreamDownloadTask getStream(StreamDownloadTask.StreamProcessor streamProcessor) {
|
||||
StreamDownloadTask streamDownloadTask = new StreamDownloadTask(this);
|
||||
streamDownloadTask.setStreamProcessor(streamProcessor);
|
||||
streamDownloadTask.queue();
|
||||
return streamDownloadTask;
|
||||
}
|
||||
|
||||
public Task<ListResult> list(int i, String str) {
|
||||
Preconditions.checkArgument(i > 0, "maxResults must be greater than zero");
|
||||
Preconditions.checkArgument(i <= 1000, "maxResults must be at most 1000");
|
||||
Preconditions.checkArgument(str != null, "pageToken must be non-null to resume a previous list() operation");
|
||||
return listHelper(Integer.valueOf(i), str);
|
||||
}
|
||||
|
||||
public UploadTask putBytes(byte[] bArr, StorageMetadata storageMetadata) {
|
||||
Preconditions.checkArgument(bArr != null, "bytes cannot be null");
|
||||
Preconditions.checkArgument(storageMetadata != null, "metadata cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, storageMetadata, bArr);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public UploadTask putFile(Uri uri, StorageMetadata storageMetadata) {
|
||||
Preconditions.checkArgument(uri != null, "uri cannot be null");
|
||||
Preconditions.checkArgument(storageMetadata != null, "metadata cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, storageMetadata, uri, null);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public UploadTask putStream(InputStream inputStream, StorageMetadata storageMetadata) {
|
||||
Preconditions.checkArgument(inputStream != null, "stream cannot be null");
|
||||
Preconditions.checkArgument(storageMetadata != null, "metadata cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, storageMetadata, inputStream);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
|
||||
public UploadTask putFile(Uri uri, StorageMetadata storageMetadata, Uri uri2) {
|
||||
Preconditions.checkArgument(uri != null, "uri cannot be null");
|
||||
Preconditions.checkArgument(storageMetadata != null, "metadata cannot be null");
|
||||
UploadTask uploadTask = new UploadTask(this, storageMetadata, uri, uri2);
|
||||
uploadTask.queue();
|
||||
return uploadTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.annotations.concurrent.Blocking;
|
||||
import com.google.firebase.annotations.concurrent.UiThread;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.components.Component;
|
||||
import com.google.firebase.components.ComponentContainer;
|
||||
import com.google.firebase.components.ComponentFactory;
|
||||
import com.google.firebase.components.ComponentRegistrar;
|
||||
import com.google.firebase.components.Dependency;
|
||||
import com.google.firebase.components.Qualified;
|
||||
import com.google.firebase.platforminfo.LibraryVersionComponent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Keep
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageRegistrar implements ComponentRegistrar {
|
||||
private static final String LIBRARY_NAME = "fire-gcs";
|
||||
Qualified<Executor> blockingExecutor = Qualified.qualified(Blocking.class, Executor.class);
|
||||
Qualified<Executor> uiExecutor = Qualified.qualified(UiThread.class, Executor.class);
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ FirebaseStorageComponent lambda$getComponents$0(ComponentContainer componentContainer) {
|
||||
return new FirebaseStorageComponent((FirebaseApp) componentContainer.get(FirebaseApp.class), componentContainer.getProvider(InternalAuthProvider.class), componentContainer.getProvider(InteropAppCheckTokenProvider.class), (Executor) componentContainer.get(this.blockingExecutor), (Executor) componentContainer.get(this.uiExecutor));
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.components.ComponentRegistrar
|
||||
public List<Component<?>> getComponents() {
|
||||
return Arrays.asList(Component.builder(FirebaseStorageComponent.class).name(LIBRARY_NAME).add(Dependency.required((Class<?>) FirebaseApp.class)).add(Dependency.required(this.blockingExecutor)).add(Dependency.required(this.uiExecutor)).add(Dependency.optionalProvider((Class<?>) InternalAuthProvider.class)).add(Dependency.optionalProvider((Class<?>) InteropAppCheckTokenProvider.class)).factory(new ComponentFactory() { // from class: com.google.firebase.storage.a
|
||||
@Override // com.google.firebase.components.ComponentFactory
|
||||
public final Object create(ComponentContainer componentContainer) {
|
||||
FirebaseStorageComponent lambda$getComponents$0;
|
||||
lambda$getComponents$0 = StorageRegistrar.this.lambda$getComponents$0(componentContainer);
|
||||
return lambda$getComponents$0;
|
||||
}
|
||||
}).build(), LibraryVersionComponent.create(LIBRARY_NAME, BuildConfig.VERSION_NAME));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,850 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.CancellationTokenSource;
|
||||
import com.google.android.gms.tasks.Continuation;
|
||||
import com.google.android.gms.tasks.OnCanceledListener;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.RuntimeExecutionException;
|
||||
import com.google.android.gms.tasks.SuccessContinuation;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
import com.google.firebase.storage.StorageTask.ProvideError;
|
||||
import com.google.firebase.storage.TaskListenerImpl;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class StorageTask<ResultT extends ProvideError> extends ControllableTask<ResultT> {
|
||||
static final int INTERNAL_STATE_CANCELED = 256;
|
||||
static final int INTERNAL_STATE_CANCELING = 32;
|
||||
static final int INTERNAL_STATE_FAILURE = 64;
|
||||
static final int INTERNAL_STATE_IN_PROGRESS = 4;
|
||||
static final int INTERNAL_STATE_NOT_STARTED = 1;
|
||||
static final int INTERNAL_STATE_PAUSED = 16;
|
||||
static final int INTERNAL_STATE_PAUSING = 8;
|
||||
static final int INTERNAL_STATE_QUEUED = 2;
|
||||
static final int INTERNAL_STATE_SUCCESS = 128;
|
||||
static final int STATES_CANCELED = 256;
|
||||
static final int STATES_COMPLETE = 448;
|
||||
static final int STATES_FAILURE = 64;
|
||||
static final int STATES_INPROGRESS = -465;
|
||||
static final int STATES_PAUSED = 16;
|
||||
static final int STATES_SUCCESS = 128;
|
||||
private static final String TAG = "StorageTask";
|
||||
private static final HashMap<Integer, HashSet<Integer>> ValidTaskInitiatedStateChanges;
|
||||
private static final HashMap<Integer, HashSet<Integer>> ValidUserInitiatedStateChanges;
|
||||
final TaskListenerImpl<OnCanceledListener, ResultT> cancelManager;
|
||||
final TaskListenerImpl<OnCompleteListener<ResultT>, ResultT> completeListener;
|
||||
final TaskListenerImpl<OnFailureListener, ResultT> failureManager;
|
||||
private ResultT finalResult;
|
||||
final TaskListenerImpl<OnPausedListener<? super ResultT>, ResultT> pausedManager;
|
||||
final TaskListenerImpl<OnProgressListener<? super ResultT>, ResultT> progressManager;
|
||||
final TaskListenerImpl<OnSuccessListener<? super ResultT>, ResultT> successManager;
|
||||
protected final Object syncObject = new Object();
|
||||
private volatile int currentState = 1;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface ProvideError {
|
||||
Exception getError();
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class SnapshotBase implements ProvideError {
|
||||
private final Exception error;
|
||||
|
||||
public SnapshotBase(Exception exc) {
|
||||
if (exc != null) {
|
||||
this.error = exc;
|
||||
return;
|
||||
}
|
||||
if (StorageTask.this.isCanceled()) {
|
||||
this.error = StorageException.fromErrorStatus(Status.RESULT_CANCELED);
|
||||
} else if (StorageTask.this.getInternalState() == 64) {
|
||||
this.error = StorageException.fromErrorStatus(Status.RESULT_INTERNAL_ERROR);
|
||||
} else {
|
||||
this.error = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask.ProvideError
|
||||
public Exception getError() {
|
||||
return this.error;
|
||||
}
|
||||
|
||||
public StorageReference getStorage() {
|
||||
return getTask().getStorage();
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> getTask() {
|
||||
return StorageTask.this;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
HashMap<Integer, HashSet<Integer>> hashMap = new HashMap<>();
|
||||
ValidUserInitiatedStateChanges = hashMap;
|
||||
HashMap<Integer, HashSet<Integer>> hashMap2 = new HashMap<>();
|
||||
ValidTaskInitiatedStateChanges = hashMap2;
|
||||
hashMap.put(1, new HashSet<>(Arrays.asList(16, 256)));
|
||||
hashMap.put(2, new HashSet<>(Arrays.asList(8, 32)));
|
||||
hashMap.put(4, new HashSet<>(Arrays.asList(8, 32)));
|
||||
hashMap.put(16, new HashSet<>(Arrays.asList(2, 256)));
|
||||
hashMap.put(64, new HashSet<>(Arrays.asList(2, 256)));
|
||||
hashMap2.put(1, new HashSet<>(Arrays.asList(2, 64)));
|
||||
hashMap2.put(2, new HashSet<>(Arrays.asList(4, 64, 128)));
|
||||
hashMap2.put(4, new HashSet<>(Arrays.asList(4, 64, 128)));
|
||||
hashMap2.put(8, new HashSet<>(Arrays.asList(16, 64, 128)));
|
||||
hashMap2.put(32, new HashSet<>(Arrays.asList(256, 64, 128)));
|
||||
}
|
||||
|
||||
public StorageTask() {
|
||||
final int i = 0;
|
||||
this.successManager = new TaskListenerImpl<>(this, 128, new TaskListenerImpl.OnRaise(this) { // from class: com.google.firebase.storage.b
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask f6061b;
|
||||
|
||||
{
|
||||
this.f6061b = this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
this.f6061b.lambda$new$0((OnSuccessListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 1:
|
||||
this.f6061b.lambda$new$1((OnFailureListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 2:
|
||||
this.f6061b.lambda$new$2((OnCompleteListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
this.f6061b.lambda$new$3((OnCanceledListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
final int i4 = 1;
|
||||
this.failureManager = new TaskListenerImpl<>(this, 64, new TaskListenerImpl.OnRaise(this) { // from class: com.google.firebase.storage.b
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask f6061b;
|
||||
|
||||
{
|
||||
this.f6061b = this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i4) {
|
||||
case 0:
|
||||
this.f6061b.lambda$new$0((OnSuccessListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 1:
|
||||
this.f6061b.lambda$new$1((OnFailureListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 2:
|
||||
this.f6061b.lambda$new$2((OnCompleteListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
this.f6061b.lambda$new$3((OnCanceledListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
final int i5 = 2;
|
||||
this.completeListener = new TaskListenerImpl<>(this, STATES_COMPLETE, new TaskListenerImpl.OnRaise(this) { // from class: com.google.firebase.storage.b
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask f6061b;
|
||||
|
||||
{
|
||||
this.f6061b = this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i5) {
|
||||
case 0:
|
||||
this.f6061b.lambda$new$0((OnSuccessListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 1:
|
||||
this.f6061b.lambda$new$1((OnFailureListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 2:
|
||||
this.f6061b.lambda$new$2((OnCompleteListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
this.f6061b.lambda$new$3((OnCanceledListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
final int i6 = 3;
|
||||
this.cancelManager = new TaskListenerImpl<>(this, 256, new TaskListenerImpl.OnRaise(this) { // from class: com.google.firebase.storage.b
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask f6061b;
|
||||
|
||||
{
|
||||
this.f6061b = this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i6) {
|
||||
case 0:
|
||||
this.f6061b.lambda$new$0((OnSuccessListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 1:
|
||||
this.f6061b.lambda$new$1((OnFailureListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
case 2:
|
||||
this.f6061b.lambda$new$2((OnCompleteListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
this.f6061b.lambda$new$3((OnCanceledListener) obj, (StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
final int i7 = 0;
|
||||
this.progressManager = new TaskListenerImpl<>(this, STATES_INPROGRESS, new TaskListenerImpl.OnRaise() { // from class: com.google.firebase.storage.f
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i7) {
|
||||
case 0:
|
||||
((OnProgressListener) obj).onProgress((StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
((OnPausedListener) obj).onPaused((StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
final int i8 = 1;
|
||||
this.pausedManager = new TaskListenerImpl<>(this, 16, new TaskListenerImpl.OnRaise() { // from class: com.google.firebase.storage.f
|
||||
@Override // com.google.firebase.storage.TaskListenerImpl.OnRaise
|
||||
public final void raise(Object obj, Object obj2) {
|
||||
switch (i8) {
|
||||
case 0:
|
||||
((OnProgressListener) obj).onProgress((StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
default:
|
||||
((OnPausedListener) obj).onPaused((StorageTask.ProvideError) obj2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private <ContinuationResultT> Task<ContinuationResultT> continueWithImpl(Executor executor, final Continuation<ResultT, ContinuationResultT> continuation) {
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
||||
this.completeListener.addListener(null, executor, new OnCompleteListener() { // from class: com.google.firebase.storage.g
|
||||
@Override // com.google.android.gms.tasks.OnCompleteListener
|
||||
public final void onComplete(Task task) {
|
||||
StorageTask.this.lambda$continueWithImpl$4(continuation, taskCompletionSource, task);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
@SuppressLint({"TaskMainThread"})
|
||||
private <ContinuationResultT> Task<ContinuationResultT> continueWithTaskImpl(Executor executor, final Continuation<ResultT, Task<ContinuationResultT>> continuation) {
|
||||
final CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource(cancellationTokenSource.getToken());
|
||||
this.completeListener.addListener(null, executor, new OnCompleteListener() { // from class: com.google.firebase.storage.d
|
||||
@Override // com.google.android.gms.tasks.OnCompleteListener
|
||||
public final void onComplete(Task task) {
|
||||
StorageTask.this.lambda$continueWithTaskImpl$5(continuation, taskCompletionSource, cancellationTokenSource, task);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
private void ensureFinalState() {
|
||||
if (isComplete() || isPaused() || getInternalState() == 2 || tryChangeState(256, false)) {
|
||||
return;
|
||||
}
|
||||
tryChangeState(64, false);
|
||||
}
|
||||
|
||||
private ResultT getFinalResult() {
|
||||
ResultT resultt = this.finalResult;
|
||||
if (resultt != null) {
|
||||
return resultt;
|
||||
}
|
||||
if (!isComplete()) {
|
||||
return null;
|
||||
}
|
||||
if (this.finalResult == null) {
|
||||
this.finalResult = snapState();
|
||||
}
|
||||
return this.finalResult;
|
||||
}
|
||||
|
||||
private String getStateString(int[] iArr) {
|
||||
if (iArr.length == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i : iArr) {
|
||||
sb.append(getStateString(i));
|
||||
sb.append(", ");
|
||||
}
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$continueWithImpl$4(Continuation continuation, TaskCompletionSource taskCompletionSource, Task task) {
|
||||
try {
|
||||
Object then = continuation.then(this);
|
||||
if (taskCompletionSource.getTask().isComplete()) {
|
||||
return;
|
||||
}
|
||||
taskCompletionSource.setResult(then);
|
||||
} catch (RuntimeExecutionException e4) {
|
||||
if (e4.getCause() instanceof Exception) {
|
||||
taskCompletionSource.setException((Exception) e4.getCause());
|
||||
} else {
|
||||
taskCompletionSource.setException(e4);
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
taskCompletionSource.setException(e5);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$continueWithTaskImpl$5(Continuation continuation, TaskCompletionSource taskCompletionSource, CancellationTokenSource cancellationTokenSource, Task task) {
|
||||
try {
|
||||
Task task2 = (Task) continuation.then(this);
|
||||
if (taskCompletionSource.getTask().isComplete()) {
|
||||
return;
|
||||
}
|
||||
if (task2 == null) {
|
||||
taskCompletionSource.setException(new NullPointerException("Continuation returned null"));
|
||||
return;
|
||||
}
|
||||
task2.addOnSuccessListener(new h(taskCompletionSource));
|
||||
task2.addOnFailureListener(new i(taskCompletionSource));
|
||||
Objects.requireNonNull(cancellationTokenSource);
|
||||
task2.addOnCanceledListener(new j(cancellationTokenSource));
|
||||
} catch (RuntimeExecutionException e4) {
|
||||
if (e4.getCause() instanceof Exception) {
|
||||
taskCompletionSource.setException((Exception) e4.getCause());
|
||||
} else {
|
||||
taskCompletionSource.setException(e4);
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
taskCompletionSource.setException(e5);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$getRunnable$7() {
|
||||
try {
|
||||
run();
|
||||
} finally {
|
||||
ensureFinalState();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$new$0(OnSuccessListener onSuccessListener, ProvideError provideError) {
|
||||
StorageTaskManager.getInstance().unRegister(this);
|
||||
onSuccessListener.onSuccess(provideError);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$new$1(OnFailureListener onFailureListener, ProvideError provideError) {
|
||||
StorageTaskManager.getInstance().unRegister(this);
|
||||
onFailureListener.onFailure(provideError.getError());
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$new$2(OnCompleteListener onCompleteListener, ProvideError provideError) {
|
||||
StorageTaskManager.getInstance().unRegister(this);
|
||||
onCompleteListener.onComplete(this);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$new$3(OnCanceledListener onCanceledListener, ProvideError provideError) {
|
||||
StorageTaskManager.getInstance().unRegister(this);
|
||||
onCanceledListener.onCanceled();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static /* synthetic */ void lambda$successTaskImpl$6(SuccessContinuation successContinuation, TaskCompletionSource taskCompletionSource, CancellationTokenSource cancellationTokenSource, ProvideError provideError) {
|
||||
try {
|
||||
Task then = successContinuation.then(provideError);
|
||||
Objects.requireNonNull(taskCompletionSource);
|
||||
then.addOnSuccessListener(new h(taskCompletionSource));
|
||||
then.addOnFailureListener(new i(taskCompletionSource));
|
||||
Objects.requireNonNull(cancellationTokenSource);
|
||||
then.addOnCanceledListener(new j(cancellationTokenSource));
|
||||
} catch (RuntimeExecutionException e4) {
|
||||
if (e4.getCause() instanceof Exception) {
|
||||
taskCompletionSource.setException((Exception) e4.getCause());
|
||||
} else {
|
||||
taskCompletionSource.setException(e4);
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
taskCompletionSource.setException(e5);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"TaskMainThread"})
|
||||
private <ContinuationResultT> Task<ContinuationResultT> successTaskImpl(Executor executor, final SuccessContinuation<ResultT, ContinuationResultT> successContinuation) {
|
||||
final CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||
final TaskCompletionSource taskCompletionSource = new TaskCompletionSource(cancellationTokenSource.getToken());
|
||||
this.successManager.addListener(null, executor, new OnSuccessListener() { // from class: com.google.firebase.storage.e
|
||||
@Override // com.google.android.gms.tasks.OnSuccessListener
|
||||
public final void onSuccess(Object obj) {
|
||||
TaskCompletionSource taskCompletionSource2 = taskCompletionSource;
|
||||
StorageTask.lambda$successTaskImpl$6(SuccessContinuation.this, taskCompletionSource2, cancellationTokenSource, (StorageTask.ProvideError) obj);
|
||||
}
|
||||
});
|
||||
return taskCompletionSource.getTask();
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask
|
||||
public boolean cancel() {
|
||||
return tryChangeState(new int[]{256, 32}, true);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> continueWith(Continuation<ResultT, ContinuationResultT> continuation) {
|
||||
return continueWithImpl(null, continuation);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> continueWithTask(Continuation<ResultT, Task<ContinuationResultT>> continuation) {
|
||||
return continueWithTaskImpl(null, continuation);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public Exception getException() {
|
||||
if (getFinalResult() == null) {
|
||||
return null;
|
||||
}
|
||||
return getFinalResult().getError();
|
||||
}
|
||||
|
||||
public int getInternalState() {
|
||||
return this.currentState;
|
||||
}
|
||||
|
||||
public Runnable getRunnable() {
|
||||
return new Runnable() { // from class: com.google.firebase.storage.c
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
StorageTask.this.lambda$getRunnable$7();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public ResultT getSnapshot() {
|
||||
return snapState();
|
||||
}
|
||||
|
||||
public abstract StorageReference getStorage();
|
||||
|
||||
public Object getSyncObject() {
|
||||
return this.syncObject;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask, com.google.android.gms.tasks.Task
|
||||
public boolean isCanceled() {
|
||||
return getInternalState() == 256;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public boolean isComplete() {
|
||||
return (getInternalState() & STATES_COMPLETE) != 0;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask
|
||||
public boolean isInProgress() {
|
||||
return (getInternalState() & STATES_INPROGRESS) != 0;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public boolean isPaused() {
|
||||
return (getInternalState() & 16) != 0;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public boolean isSuccessful() {
|
||||
return (getInternalState() & 128) != 0;
|
||||
}
|
||||
|
||||
public void onCanceled() {
|
||||
}
|
||||
|
||||
public void onFailure() {
|
||||
}
|
||||
|
||||
public void onPaused() {
|
||||
}
|
||||
|
||||
public void onProgress() {
|
||||
}
|
||||
|
||||
public void onQueued() {
|
||||
}
|
||||
|
||||
public void onSuccess() {
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> onSuccessTask(SuccessContinuation<ResultT, ContinuationResultT> successContinuation) {
|
||||
return successTaskImpl(null, successContinuation);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public boolean pause() {
|
||||
return tryChangeState(new int[]{16, 8}, true);
|
||||
}
|
||||
|
||||
public boolean queue() {
|
||||
if (!tryChangeState(2, false)) {
|
||||
return false;
|
||||
}
|
||||
schedule();
|
||||
return true;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnCanceledListener(OnCanceledListener onCanceledListener) {
|
||||
Preconditions.checkNotNull(onCanceledListener);
|
||||
this.cancelManager.lambda$addListener$0(onCanceledListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnCompleteListener(OnCompleteListener<ResultT> onCompleteListener) {
|
||||
Preconditions.checkNotNull(onCompleteListener);
|
||||
this.completeListener.lambda$addListener$0(onCompleteListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnFailureListener(OnFailureListener onFailureListener) {
|
||||
Preconditions.checkNotNull(onFailureListener);
|
||||
this.failureManager.lambda$addListener$0(onFailureListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnPausedListener(OnPausedListener<? super ResultT> onPausedListener) {
|
||||
Preconditions.checkNotNull(onPausedListener);
|
||||
this.pausedManager.lambda$addListener$0(onPausedListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnProgressListener(OnProgressListener<? super ResultT> onProgressListener) {
|
||||
Preconditions.checkNotNull(onProgressListener);
|
||||
this.progressManager.lambda$addListener$0(onProgressListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StorageTask<ResultT> removeOnSuccessListener(OnSuccessListener<? super ResultT> onSuccessListener) {
|
||||
Preconditions.checkNotNull(onSuccessListener);
|
||||
this.successManager.lambda$addListener$0(onSuccessListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void resetState() {
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public boolean resume() {
|
||||
if (!tryChangeState(2, true)) {
|
||||
return false;
|
||||
}
|
||||
resetState();
|
||||
schedule();
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void run();
|
||||
|
||||
public abstract void schedule();
|
||||
|
||||
public ResultT snapState() {
|
||||
ResultT snapStateImpl;
|
||||
synchronized (this.syncObject) {
|
||||
snapStateImpl = snapStateImpl();
|
||||
}
|
||||
return snapStateImpl;
|
||||
}
|
||||
|
||||
public abstract ResultT snapStateImpl();
|
||||
|
||||
public boolean tryChangeState(int[] iArr, boolean z3) {
|
||||
HashMap<Integer, HashSet<Integer>> hashMap = z3 ? ValidUserInitiatedStateChanges : ValidTaskInitiatedStateChanges;
|
||||
synchronized (this.syncObject) {
|
||||
try {
|
||||
for (int i : iArr) {
|
||||
HashSet<Integer> hashSet = hashMap.get(Integer.valueOf(getInternalState()));
|
||||
if (hashSet != null && hashSet.contains(Integer.valueOf(i))) {
|
||||
this.currentState = i;
|
||||
int i4 = this.currentState;
|
||||
if (i4 == 2) {
|
||||
StorageTaskManager.getInstance().ensureRegistered(this);
|
||||
onQueued();
|
||||
} else if (i4 == 4) {
|
||||
onProgress();
|
||||
} else if (i4 == 16) {
|
||||
onPaused();
|
||||
} else if (i4 == 64) {
|
||||
onFailure();
|
||||
} else if (i4 == 128) {
|
||||
onSuccess();
|
||||
} else if (i4 == 256) {
|
||||
onCanceled();
|
||||
}
|
||||
this.successManager.onInternalStateChanged();
|
||||
this.failureManager.onInternalStateChanged();
|
||||
this.cancelManager.onInternalStateChanged();
|
||||
this.completeListener.onInternalStateChanged();
|
||||
this.pausedManager.onInternalStateChanged();
|
||||
this.progressManager.onInternalStateChanged();
|
||||
if (Log.isLoggable(TAG, 3)) {
|
||||
Log.d(TAG, "changed internal state to: " + getStateString(i) + " isUser: " + z3 + " from state:" + getStateString(this.currentState));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Log.w(TAG, "unable to change internal state to: " + getStateString(iArr) + " isUser: " + z3 + " from state:" + getStateString(this.currentState));
|
||||
return false;
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> continueWith(Executor executor, Continuation<ResultT, ContinuationResultT> continuation) {
|
||||
return continueWithImpl(executor, continuation);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> continueWithTask(Executor executor, Continuation<ResultT, Task<ContinuationResultT>> continuation) {
|
||||
return continueWithTaskImpl(executor, continuation);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <ContinuationResultT> Task<ContinuationResultT> onSuccessTask(Executor executor, SuccessContinuation<ResultT, ContinuationResultT> successContinuation) {
|
||||
return successTaskImpl(executor, successContinuation);
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public ResultT getResult() {
|
||||
if (getFinalResult() != null) {
|
||||
Exception error = getFinalResult().getError();
|
||||
if (error == null) {
|
||||
return getFinalResult();
|
||||
}
|
||||
throw new RuntimeExecutionException(error);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCanceledListener(OnCanceledListener onCanceledListener) {
|
||||
Preconditions.checkNotNull(onCanceledListener);
|
||||
this.cancelManager.addListener(null, null, onCanceledListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCompleteListener(OnCompleteListener<ResultT> onCompleteListener) {
|
||||
Preconditions.checkNotNull(onCompleteListener);
|
||||
this.completeListener.addListener(null, null, onCompleteListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnFailureListener(OnFailureListener onFailureListener) {
|
||||
Preconditions.checkNotNull(onFailureListener);
|
||||
this.failureManager.addListener(null, null, onFailureListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public StorageTask<ResultT> addOnPausedListener(OnPausedListener<? super ResultT> onPausedListener) {
|
||||
Preconditions.checkNotNull(onPausedListener);
|
||||
this.pausedManager.addListener(null, null, onPausedListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask
|
||||
public StorageTask<ResultT> addOnProgressListener(OnProgressListener<? super ResultT> onProgressListener) {
|
||||
Preconditions.checkNotNull(onProgressListener);
|
||||
this.progressManager.addListener(null, null, onProgressListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnSuccessListener(OnSuccessListener<? super ResultT> onSuccessListener) {
|
||||
Preconditions.checkNotNull(onSuccessListener);
|
||||
this.successManager.addListener(null, null, onSuccessListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCanceledListener(Executor executor, OnCanceledListener onCanceledListener) {
|
||||
Preconditions.checkNotNull(onCanceledListener);
|
||||
Preconditions.checkNotNull(executor);
|
||||
this.cancelManager.addListener(null, executor, onCanceledListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCompleteListener(Executor executor, OnCompleteListener<ResultT> onCompleteListener) {
|
||||
Preconditions.checkNotNull(onCompleteListener);
|
||||
Preconditions.checkNotNull(executor);
|
||||
this.completeListener.addListener(null, executor, onCompleteListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnFailureListener(Executor executor, OnFailureListener onFailureListener) {
|
||||
Preconditions.checkNotNull(onFailureListener);
|
||||
Preconditions.checkNotNull(executor);
|
||||
this.failureManager.addListener(null, executor, onFailureListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public StorageTask<ResultT> addOnPausedListener(Executor executor, OnPausedListener<? super ResultT> onPausedListener) {
|
||||
Preconditions.checkNotNull(onPausedListener);
|
||||
Preconditions.checkNotNull(executor);
|
||||
this.pausedManager.addListener(null, executor, onPausedListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask
|
||||
public StorageTask<ResultT> addOnProgressListener(Executor executor, OnProgressListener<? super ResultT> onProgressListener) {
|
||||
Preconditions.checkNotNull(onProgressListener);
|
||||
Preconditions.checkNotNull(executor);
|
||||
this.progressManager.addListener(null, executor, onProgressListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnSuccessListener(Executor executor, OnSuccessListener<? super ResultT> onSuccessListener) {
|
||||
Preconditions.checkNotNull(executor);
|
||||
Preconditions.checkNotNull(onSuccessListener);
|
||||
this.successManager.addListener(null, executor, onSuccessListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
private String getStateString(int i) {
|
||||
if (i == 1) {
|
||||
return "INTERNAL_STATE_NOT_STARTED";
|
||||
}
|
||||
if (i == 2) {
|
||||
return "INTERNAL_STATE_QUEUED";
|
||||
}
|
||||
if (i == 4) {
|
||||
return "INTERNAL_STATE_IN_PROGRESS";
|
||||
}
|
||||
if (i == 8) {
|
||||
return "INTERNAL_STATE_PAUSING";
|
||||
}
|
||||
if (i == 16) {
|
||||
return "INTERNAL_STATE_PAUSED";
|
||||
}
|
||||
if (i == 32) {
|
||||
return "INTERNAL_STATE_CANCELING";
|
||||
}
|
||||
if (i == 64) {
|
||||
return "INTERNAL_STATE_FAILURE";
|
||||
}
|
||||
if (i == 128) {
|
||||
return "INTERNAL_STATE_SUCCESS";
|
||||
}
|
||||
if (i != 256) {
|
||||
return "Unknown Internal State!";
|
||||
}
|
||||
return "INTERNAL_STATE_CANCELED";
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public <X extends Throwable> ResultT getResult(Class<X> cls) throws Throwable {
|
||||
if (getFinalResult() != null) {
|
||||
if (!cls.isInstance(getFinalResult().getError())) {
|
||||
Exception error = getFinalResult().getError();
|
||||
if (error == null) {
|
||||
return getFinalResult();
|
||||
}
|
||||
throw new RuntimeExecutionException(error);
|
||||
}
|
||||
throw cls.cast(getFinalResult().getError());
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCanceledListener(Activity activity, OnCanceledListener onCanceledListener) {
|
||||
Preconditions.checkNotNull(onCanceledListener);
|
||||
Preconditions.checkNotNull(activity);
|
||||
this.cancelManager.addListener(activity, null, onCanceledListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnCompleteListener(Activity activity, OnCompleteListener<ResultT> onCompleteListener) {
|
||||
Preconditions.checkNotNull(onCompleteListener);
|
||||
Preconditions.checkNotNull(activity);
|
||||
this.completeListener.addListener(activity, null, onCompleteListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnFailureListener(Activity activity, OnFailureListener onFailureListener) {
|
||||
Preconditions.checkNotNull(onFailureListener);
|
||||
Preconditions.checkNotNull(activity);
|
||||
this.failureManager.addListener(activity, null, onFailureListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.ControllableTask
|
||||
public StorageTask<ResultT> addOnPausedListener(Activity activity, OnPausedListener<? super ResultT> onPausedListener) {
|
||||
Preconditions.checkNotNull(onPausedListener);
|
||||
Preconditions.checkNotNull(activity);
|
||||
this.pausedManager.addListener(activity, null, onPausedListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.CancellableTask
|
||||
public StorageTask<ResultT> addOnProgressListener(Activity activity, OnProgressListener<? super ResultT> onProgressListener) {
|
||||
Preconditions.checkNotNull(onProgressListener);
|
||||
Preconditions.checkNotNull(activity);
|
||||
this.progressManager.addListener(activity, null, onProgressListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.tasks.Task
|
||||
public StorageTask<ResultT> addOnSuccessListener(Activity activity, OnSuccessListener<? super ResultT> onSuccessListener) {
|
||||
Preconditions.checkNotNull(activity);
|
||||
Preconditions.checkNotNull(onSuccessListener);
|
||||
this.successManager.addListener(activity, null, onSuccessListener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean tryChangeState(int i, boolean z3) {
|
||||
return tryChangeState(new int[]{i}, z3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class StorageTaskManager {
|
||||
private static final StorageTaskManager _instance = new StorageTaskManager();
|
||||
private final Map<String, WeakReference<StorageTask<?>>> inProgressTasks = new HashMap();
|
||||
private final Object syncObject = new Object();
|
||||
|
||||
public static StorageTaskManager getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public void ensureRegistered(StorageTask<?> storageTask) {
|
||||
synchronized (this.syncObject) {
|
||||
this.inProgressTasks.put(storageTask.getStorage().toString(), new WeakReference<>(storageTask));
|
||||
}
|
||||
}
|
||||
|
||||
public List<FileDownloadTask> getDownloadTasksUnder(StorageReference storageReference) {
|
||||
List<FileDownloadTask> unmodifiableList;
|
||||
synchronized (this.syncObject) {
|
||||
try {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
String storageReference2 = storageReference.toString();
|
||||
for (Map.Entry<String, WeakReference<StorageTask<?>>> entry : this.inProgressTasks.entrySet()) {
|
||||
if (entry.getKey().startsWith(storageReference2)) {
|
||||
StorageTask<?> storageTask = entry.getValue().get();
|
||||
if (storageTask instanceof FileDownloadTask) {
|
||||
arrayList.add((FileDownloadTask) storageTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
unmodifiableList = Collections.unmodifiableList(arrayList);
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
return unmodifiableList;
|
||||
}
|
||||
|
||||
public List<UploadTask> getUploadTasksUnder(StorageReference storageReference) {
|
||||
List<UploadTask> unmodifiableList;
|
||||
synchronized (this.syncObject) {
|
||||
try {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
String storageReference2 = storageReference.toString();
|
||||
for (Map.Entry<String, WeakReference<StorageTask<?>>> entry : this.inProgressTasks.entrySet()) {
|
||||
if (entry.getKey().startsWith(storageReference2)) {
|
||||
StorageTask<?> storageTask = entry.getValue().get();
|
||||
if (storageTask instanceof UploadTask) {
|
||||
arrayList.add((UploadTask) storageTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
unmodifiableList = Collections.unmodifiableList(arrayList);
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
return unmodifiableList;
|
||||
}
|
||||
|
||||
public void unRegister(StorageTask<?> storageTask) {
|
||||
synchronized (this.syncObject) {
|
||||
try {
|
||||
String storageReference = storageTask.getStorage().toString();
|
||||
WeakReference<StorageTask<?>> weakReference = this.inProgressTasks.get(storageReference);
|
||||
StorageTask<?> storageTask2 = weakReference != null ? weakReference.get() : null;
|
||||
if (storageTask2 == null || storageTask2 == storageTask) {
|
||||
this.inProgressTasks.remove(storageReference);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.firebase.concurrent.FirebaseExecutors;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageTaskScheduler {
|
||||
private static Executor CALLBACK_QUEUE_EXECUTOR = null;
|
||||
private static Executor COMMAND_POOL_EXECUTOR = null;
|
||||
private static final int COMMAND_POOL_SIZE = 5;
|
||||
private static final int DOWNLOAD_POOL_SIZE = 3;
|
||||
private static Executor DOWNLOAD_QUEUE_EXECUTOR = null;
|
||||
private static Executor MAIN_THREAD_EXECUTOR = null;
|
||||
private static final int UPLOAD_POOL_SIZE = 2;
|
||||
private static Executor UPLOAD_QUEUE_EXECUTOR;
|
||||
public static StorageTaskScheduler sInstance = new StorageTaskScheduler();
|
||||
|
||||
public static StorageTaskScheduler getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static void initializeExecutors(Executor executor, Executor executor2) {
|
||||
COMMAND_POOL_EXECUTOR = FirebaseExecutors.newLimitedConcurrencyExecutor(executor, 5);
|
||||
DOWNLOAD_QUEUE_EXECUTOR = FirebaseExecutors.newLimitedConcurrencyExecutor(executor, 3);
|
||||
UPLOAD_QUEUE_EXECUTOR = FirebaseExecutors.newLimitedConcurrencyExecutor(executor, 2);
|
||||
CALLBACK_QUEUE_EXECUTOR = FirebaseExecutors.newSequentialExecutor(executor);
|
||||
MAIN_THREAD_EXECUTOR = executor2;
|
||||
}
|
||||
|
||||
public Executor getCommandPoolExecutor() {
|
||||
return COMMAND_POOL_EXECUTOR;
|
||||
}
|
||||
|
||||
public Executor getMainThreadExecutor() {
|
||||
return MAIN_THREAD_EXECUTOR;
|
||||
}
|
||||
|
||||
public void scheduleCallback(Runnable runnable) {
|
||||
CALLBACK_QUEUE_EXECUTOR.execute(runnable);
|
||||
}
|
||||
|
||||
public void scheduleCommand(Runnable runnable) {
|
||||
COMMAND_POOL_EXECUTOR.execute(runnable);
|
||||
}
|
||||
|
||||
public void scheduleDownload(Runnable runnable) {
|
||||
DOWNLOAD_QUEUE_EXECUTOR.execute(runnable);
|
||||
}
|
||||
|
||||
public void scheduleUpload(Runnable runnable) {
|
||||
UPLOAD_QUEUE_EXECUTOR.execute(runnable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.GetNetworkRequest;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StreamDownloadTask extends StorageTask<TaskSnapshot> {
|
||||
static final long PREFERRED_CHUNK_SIZE = 262144;
|
||||
private static final String TAG = "StreamDownloadTask";
|
||||
private long bytesDownloaded;
|
||||
private long bytesDownloadedSnapped;
|
||||
private String eTagVerification;
|
||||
private InputStream inputStream;
|
||||
private StreamProcessor processor;
|
||||
private NetworkRequest request;
|
||||
private ExponentialBackoffSender sender;
|
||||
private StorageReference storageRef;
|
||||
private volatile Exception exception = null;
|
||||
private volatile int resultCode = 0;
|
||||
private long totalBytes = -1;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface StreamProcessor {
|
||||
void doInBackground(TaskSnapshot taskSnapshot, InputStream inputStream) throws IOException;
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class TaskSnapshot extends StorageTask<TaskSnapshot>.SnapshotBase {
|
||||
private final long mBytesDownloaded;
|
||||
|
||||
public TaskSnapshot(Exception exc, long j4) {
|
||||
super(exc);
|
||||
this.mBytesDownloaded = j4;
|
||||
}
|
||||
|
||||
public long getBytesTransferred() {
|
||||
return this.mBytesDownloaded;
|
||||
}
|
||||
|
||||
public InputStream getStream() {
|
||||
return StreamDownloadTask.this.inputStream;
|
||||
}
|
||||
|
||||
public long getTotalByteCount() {
|
||||
return StreamDownloadTask.this.getTotalBytes();
|
||||
}
|
||||
}
|
||||
|
||||
public StreamDownloadTask(StorageReference storageReference) {
|
||||
this.storageRef = storageReference;
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.sender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public InputStream createDownloadStream() throws Exception {
|
||||
String str;
|
||||
this.sender.reset();
|
||||
NetworkRequest networkRequest = this.request;
|
||||
if (networkRequest != null) {
|
||||
networkRequest.performRequestEnd();
|
||||
}
|
||||
GetNetworkRequest getNetworkRequest = new GetNetworkRequest(this.storageRef.getStorageReferenceUri(), this.storageRef.getApp(), this.bytesDownloaded);
|
||||
this.request = getNetworkRequest;
|
||||
this.sender.sendWithExponentialBackoff(getNetworkRequest, false);
|
||||
this.resultCode = this.request.getResultCode();
|
||||
this.exception = this.request.getException() != null ? this.request.getException() : this.exception;
|
||||
if (!isValidHttpResponseCode(this.resultCode) || this.exception != null || getInternalState() != 4) {
|
||||
throw new IOException("Could not open resulting stream.");
|
||||
}
|
||||
String resultString = this.request.getResultString("ETag");
|
||||
if (!TextUtils.isEmpty(resultString) && (str = this.eTagVerification) != null && !str.equals(resultString)) {
|
||||
this.resultCode = 409;
|
||||
throw new IOException("The ETag on the server changed.");
|
||||
}
|
||||
this.eTagVerification = resultString;
|
||||
this.totalBytes = this.request.getResultingContentLength() + this.bytesDownloaded;
|
||||
return this.request.getStream();
|
||||
}
|
||||
|
||||
private boolean isValidHttpResponseCode(int i) {
|
||||
if (i != 308) {
|
||||
return i >= 200 && i < 300;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public StorageReference getStorage() {
|
||||
return this.storageRef;
|
||||
}
|
||||
|
||||
public long getTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void onCanceled() {
|
||||
this.sender.cancel();
|
||||
this.exception = StorageException.fromErrorStatus(Status.RESULT_CANCELED);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void onProgress() {
|
||||
this.bytesDownloadedSnapped = this.bytesDownloaded;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask, com.google.firebase.storage.ControllableTask
|
||||
public boolean pause() {
|
||||
throw new UnsupportedOperationException("this operation is not supported on StreamDownloadTask.");
|
||||
}
|
||||
|
||||
public void recordDownloadedBytes(long j4) {
|
||||
long j5 = this.bytesDownloaded + j4;
|
||||
this.bytesDownloaded = j5;
|
||||
if (this.bytesDownloadedSnapped + PREFERRED_CHUNK_SIZE <= j5) {
|
||||
if (getInternalState() == 4) {
|
||||
tryChangeState(4, false);
|
||||
} else {
|
||||
this.bytesDownloadedSnapped = this.bytesDownloaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask, com.google.firebase.storage.ControllableTask
|
||||
public boolean resume() {
|
||||
throw new UnsupportedOperationException("this operation is not supported on StreamDownloadTask.");
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void run() {
|
||||
if (this.exception != null) {
|
||||
tryChangeState(64, false);
|
||||
return;
|
||||
}
|
||||
if (tryChangeState(4, false)) {
|
||||
StreamProgressWrapper streamProgressWrapper = new StreamProgressWrapper(new Callable<InputStream>() { // from class: com.google.firebase.storage.StreamDownloadTask.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // java.util.concurrent.Callable
|
||||
public InputStream call() throws Exception {
|
||||
return StreamDownloadTask.this.createDownloadStream();
|
||||
}
|
||||
}, this);
|
||||
this.inputStream = new BufferedInputStream(streamProgressWrapper);
|
||||
try {
|
||||
streamProgressWrapper.ensureStream();
|
||||
StreamProcessor streamProcessor = this.processor;
|
||||
if (streamProcessor != null) {
|
||||
try {
|
||||
streamProcessor.doInBackground(snapState(), this.inputStream);
|
||||
} catch (Exception e4) {
|
||||
Log.w(TAG, "Exception occurred calling doInBackground.", e4);
|
||||
this.exception = e4;
|
||||
}
|
||||
}
|
||||
} catch (IOException e5) {
|
||||
Log.d(TAG, "Initial opening of Stream failed", e5);
|
||||
this.exception = e5;
|
||||
}
|
||||
if (this.inputStream == null) {
|
||||
this.request.performRequestEnd();
|
||||
this.request = null;
|
||||
}
|
||||
if (this.exception == null && getInternalState() == 4) {
|
||||
tryChangeState(4, false);
|
||||
tryChangeState(128, false);
|
||||
return;
|
||||
}
|
||||
if (tryChangeState(getInternalState() == 32 ? 256 : 64, false)) {
|
||||
return;
|
||||
}
|
||||
Log.w(TAG, "Unable to change download task to final state from " + getInternalState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void schedule() {
|
||||
StorageTaskScheduler.getInstance().scheduleDownload(getRunnable());
|
||||
}
|
||||
|
||||
public StreamDownloadTask setStreamProcessor(StreamProcessor streamProcessor) {
|
||||
Preconditions.checkNotNull(streamProcessor);
|
||||
Preconditions.checkState(this.processor == null);
|
||||
this.processor = streamProcessor;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public TaskSnapshot snapStateImpl() {
|
||||
return new TaskSnapshot(StorageException.fromExceptionAndHttpCode(this.exception, this.resultCode), this.bytesDownloadedSnapped);
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class StreamProgressWrapper extends InputStream {
|
||||
private long mDownloadedBytes;
|
||||
private Callable<InputStream> mInputStreamCallable;
|
||||
private long mLastExceptionPosition;
|
||||
private StreamDownloadTask mParentTask;
|
||||
private boolean mStreamClosed;
|
||||
private IOException mTemporaryException;
|
||||
private InputStream mWrappedStream;
|
||||
|
||||
public StreamProgressWrapper(Callable<InputStream> callable, StreamDownloadTask streamDownloadTask) {
|
||||
this.mParentTask = streamDownloadTask;
|
||||
this.mInputStreamCallable = callable;
|
||||
}
|
||||
|
||||
private void checkCancel() throws IOException {
|
||||
StreamDownloadTask streamDownloadTask = this.mParentTask;
|
||||
if (streamDownloadTask != null && streamDownloadTask.getInternalState() == 32) {
|
||||
throw new CancelException();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean ensureStream() throws IOException {
|
||||
checkCancel();
|
||||
if (this.mTemporaryException != null) {
|
||||
try {
|
||||
InputStream inputStream = this.mWrappedStream;
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
this.mWrappedStream = null;
|
||||
if (this.mLastExceptionPosition == this.mDownloadedBytes) {
|
||||
Log.i(StreamDownloadTask.TAG, "Encountered exception during stream operation. Aborting.", this.mTemporaryException);
|
||||
return false;
|
||||
}
|
||||
Log.i(StreamDownloadTask.TAG, "Encountered exception during stream operation. Retrying at " + this.mDownloadedBytes, this.mTemporaryException);
|
||||
this.mLastExceptionPosition = this.mDownloadedBytes;
|
||||
this.mTemporaryException = null;
|
||||
}
|
||||
if (this.mStreamClosed) {
|
||||
throw new IOException("Can't perform operation on closed stream");
|
||||
}
|
||||
if (this.mWrappedStream != null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
this.mWrappedStream = this.mInputStreamCallable.call();
|
||||
return true;
|
||||
} catch (Exception e4) {
|
||||
if (e4 instanceof IOException) {
|
||||
throw ((IOException) e4);
|
||||
}
|
||||
throw new IOException("Unable to open stream", e4);
|
||||
}
|
||||
}
|
||||
|
||||
private void recordDownloadedBytes(long j4) {
|
||||
StreamDownloadTask streamDownloadTask = this.mParentTask;
|
||||
if (streamDownloadTask != null) {
|
||||
streamDownloadTask.recordDownloadedBytes(j4);
|
||||
}
|
||||
this.mDownloadedBytes += j4;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public int available() throws IOException {
|
||||
while (this.ensureStream()) {
|
||||
try {
|
||||
return this.mWrappedStream.available();
|
||||
} catch (IOException e4) {
|
||||
this.mTemporaryException = e4;
|
||||
}
|
||||
}
|
||||
throw this.mTemporaryException;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() throws IOException {
|
||||
InputStream inputStream = this.mWrappedStream;
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
this.mStreamClosed = true;
|
||||
StreamDownloadTask streamDownloadTask = this.mParentTask;
|
||||
if (streamDownloadTask != null && streamDownloadTask.request != null) {
|
||||
this.mParentTask.request.performRequestEnd();
|
||||
this.mParentTask.request = null;
|
||||
}
|
||||
checkCancel();
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public void mark(int i) {
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public int read() throws IOException {
|
||||
while (ensureStream()) {
|
||||
try {
|
||||
int read = this.mWrappedStream.read();
|
||||
if (read != -1) {
|
||||
recordDownloadedBytes(1L);
|
||||
}
|
||||
return read;
|
||||
} catch (IOException e4) {
|
||||
this.mTemporaryException = e4;
|
||||
}
|
||||
}
|
||||
throw this.mTemporaryException;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public long skip(long j4) throws IOException {
|
||||
long j5 = 0;
|
||||
while (ensureStream()) {
|
||||
while (j4 > StreamDownloadTask.PREFERRED_CHUNK_SIZE) {
|
||||
try {
|
||||
long skip = this.mWrappedStream.skip(StreamDownloadTask.PREFERRED_CHUNK_SIZE);
|
||||
if (skip < 0) {
|
||||
if (j5 == 0) {
|
||||
return -1L;
|
||||
}
|
||||
return j5;
|
||||
}
|
||||
j5 += skip;
|
||||
j4 -= skip;
|
||||
recordDownloadedBytes(skip);
|
||||
checkCancel();
|
||||
} catch (IOException e4) {
|
||||
this.mTemporaryException = e4;
|
||||
}
|
||||
}
|
||||
if (j4 > 0) {
|
||||
long skip2 = this.mWrappedStream.skip(j4);
|
||||
if (skip2 < 0) {
|
||||
if (j5 == 0) {
|
||||
return -1L;
|
||||
}
|
||||
return j5;
|
||||
}
|
||||
j5 += skip2;
|
||||
j4 -= skip2;
|
||||
recordDownloadedBytes(skip2);
|
||||
}
|
||||
if (j4 == 0) {
|
||||
return j5;
|
||||
}
|
||||
}
|
||||
throw this.mTemporaryException;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public int read(byte[] bArr, int i, int i4) throws IOException {
|
||||
int i5 = 0;
|
||||
while (ensureStream()) {
|
||||
while (i4 > StreamDownloadTask.PREFERRED_CHUNK_SIZE) {
|
||||
try {
|
||||
int read = this.mWrappedStream.read(bArr, i, 262144);
|
||||
if (read == -1) {
|
||||
if (i5 == 0) {
|
||||
return -1;
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
i5 += read;
|
||||
i += read;
|
||||
i4 -= read;
|
||||
recordDownloadedBytes(read);
|
||||
checkCancel();
|
||||
} catch (IOException e4) {
|
||||
this.mTemporaryException = e4;
|
||||
}
|
||||
}
|
||||
if (i4 > 0) {
|
||||
int read2 = this.mWrappedStream.read(bArr, i, i4);
|
||||
if (read2 == -1) {
|
||||
if (i5 == 0) {
|
||||
return -1;
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
i += read2;
|
||||
i5 += read2;
|
||||
i4 -= read2;
|
||||
recordDownloadedBytes(read2);
|
||||
}
|
||||
if (i4 == 0) {
|
||||
return i5;
|
||||
}
|
||||
}
|
||||
throw this.mTemporaryException;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
import com.google.firebase.storage.StorageTask.ProvideError;
|
||||
import com.google.firebase.storage.internal.ActivityLifecycleListener;
|
||||
import com.google.firebase.storage.internal.SmartHandler;
|
||||
import java.util.HashMap;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes3.dex */
|
||||
public class TaskListenerImpl<ListenerTypeT, ResultT extends StorageTask.ProvideError> {
|
||||
private OnRaise<ListenerTypeT, ResultT> onRaise;
|
||||
private int targetStates;
|
||||
private StorageTask<ResultT> task;
|
||||
private final Queue<ListenerTypeT> listenerQueue = new ConcurrentLinkedQueue();
|
||||
private final HashMap<ListenerTypeT, SmartHandler> handlerMap = new HashMap<>();
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface OnRaise<ListenerTypeT, ResultT> {
|
||||
void raise(ListenerTypeT listenertypet, ResultT resultt);
|
||||
}
|
||||
|
||||
public TaskListenerImpl(StorageTask<ResultT> storageTask, int i, OnRaise<ListenerTypeT, ResultT> onRaise) {
|
||||
this.task = storageTask;
|
||||
this.targetStates = i;
|
||||
this.onRaise = onRaise;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$addListener$1(Object obj, StorageTask.ProvideError provideError) {
|
||||
this.onRaise.raise(obj, provideError);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public /* synthetic */ void lambda$onInternalStateChanged$2(Object obj, StorageTask.ProvideError provideError) {
|
||||
this.onRaise.raise(obj, provideError);
|
||||
}
|
||||
|
||||
public void addListener(Activity activity, Executor executor, final ListenerTypeT listenertypet) {
|
||||
boolean z3;
|
||||
SmartHandler smartHandler;
|
||||
Preconditions.checkNotNull(listenertypet);
|
||||
synchronized (this.task.getSyncObject()) {
|
||||
try {
|
||||
z3 = (this.task.getInternalState() & this.targetStates) != 0;
|
||||
this.listenerQueue.add(listenertypet);
|
||||
smartHandler = new SmartHandler(executor);
|
||||
this.handlerMap.put(listenertypet, smartHandler);
|
||||
if (activity != null) {
|
||||
Preconditions.checkArgument(!activity.isDestroyed(), "Activity is already destroyed!");
|
||||
ActivityLifecycleListener.getInstance().runOnActivityStopped(activity, listenertypet, new Runnable() { // from class: com.google.firebase.storage.l
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
TaskListenerImpl.this.lambda$addListener$0(listenertypet);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
smartHandler.callBack(new k(this, listenertypet, this.task.snapState(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
public int getListenerCount() {
|
||||
return Math.max(this.listenerQueue.size(), this.handlerMap.size());
|
||||
}
|
||||
|
||||
public void onInternalStateChanged() {
|
||||
if ((this.task.getInternalState() & this.targetStates) != 0) {
|
||||
ResultT snapState = this.task.snapState();
|
||||
for (ListenerTypeT listenertypet : this.listenerQueue) {
|
||||
SmartHandler smartHandler = this.handlerMap.get(listenertypet);
|
||||
if (smartHandler != null) {
|
||||
smartHandler.callBack(new k(this, listenertypet, snapState, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: removeListener, reason: merged with bridge method [inline-methods] */
|
||||
public void lambda$addListener$0(ListenerTypeT listenertypet) {
|
||||
Preconditions.checkNotNull(listenertypet);
|
||||
synchronized (this.task.getSyncObject()) {
|
||||
this.handlerMap.remove(listenertypet);
|
||||
this.listenerQueue.remove(listenertypet);
|
||||
ActivityLifecycleListener.getInstance().removeCookie(listenertypet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.storage.StorageMetadata;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.network.UpdateMetadataNetworkRequest;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class UpdateMetadataTask implements Runnable {
|
||||
private static final String TAG = "UpdateMetadataTask";
|
||||
private final StorageMetadata mNewMetadata;
|
||||
private final TaskCompletionSource<StorageMetadata> mPendingResult;
|
||||
private StorageMetadata mResultMetadata = null;
|
||||
private ExponentialBackoffSender mSender;
|
||||
private final StorageReference mStorageRef;
|
||||
|
||||
public UpdateMetadataTask(StorageReference storageReference, TaskCompletionSource<StorageMetadata> taskCompletionSource, StorageMetadata storageMetadata) {
|
||||
this.mStorageRef = storageReference;
|
||||
this.mPendingResult = taskCompletionSource;
|
||||
this.mNewMetadata = storageMetadata;
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.mSender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), storage.getAuthProvider(), storage.getAppCheckProvider(), storage.getMaxOperationRetryTimeMillis());
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
UpdateMetadataNetworkRequest updateMetadataNetworkRequest = new UpdateMetadataNetworkRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mNewMetadata.createJSONObject());
|
||||
this.mSender.sendWithExponentialBackoff(updateMetadataNetworkRequest);
|
||||
if (updateMetadataNetworkRequest.isResultSuccess()) {
|
||||
try {
|
||||
this.mResultMetadata = new StorageMetadata.Builder(updateMetadataNetworkRequest.getResultBody(), this.mStorageRef).build();
|
||||
} catch (JSONException e4) {
|
||||
Log.e(TAG, "Unable to parse a valid JSON object from resulting metadata:" + updateMetadataNetworkRequest.getRawResult(), e4);
|
||||
this.mPendingResult.setException(StorageException.fromException(e4));
|
||||
return;
|
||||
}
|
||||
}
|
||||
TaskCompletionSource<StorageMetadata> taskCompletionSource = this.mPendingResult;
|
||||
if (taskCompletionSource != null) {
|
||||
updateMetadataNetworkRequest.completeTask(taskCompletionSource, this.mResultMetadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,442 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.common.util.Clock;
|
||||
import com.google.android.gms.common.util.DefaultClock;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.storage.StorageMetadata;
|
||||
import com.google.firebase.storage.internal.AdaptiveStreamBuffer;
|
||||
import com.google.firebase.storage.internal.ExponentialBackoffSender;
|
||||
import com.google.firebase.storage.internal.Sleeper;
|
||||
import com.google.firebase.storage.internal.SleeperImpl;
|
||||
import com.google.firebase.storage.internal.Util;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
import com.google.firebase.storage.network.ResumableUploadByteRequest;
|
||||
import com.google.firebase.storage.network.ResumableUploadCancelRequest;
|
||||
import com.google.firebase.storage.network.ResumableUploadQueryRequest;
|
||||
import com.google.firebase.storage.network.ResumableUploadStartRequest;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class UploadTask extends StorageTask<TaskSnapshot> {
|
||||
private static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
|
||||
private static final int MAXIMUM_CHUNK_SIZE = 33554432;
|
||||
static final int PREFERRED_CHUNK_SIZE = 262144;
|
||||
private static final String RESUMABLE_FINAL_STATUS = "final";
|
||||
private static final String TAG = "UploadTask";
|
||||
private static final String X_GOOG_UPLOAD_URL = "X-Goog-Upload-URL";
|
||||
private final InteropAppCheckTokenProvider mAppCheckProvider;
|
||||
private final InternalAuthProvider mAuthProvider;
|
||||
private final AtomicLong mBytesUploaded;
|
||||
private int mCurrentChunkSize;
|
||||
private volatile Exception mException;
|
||||
private boolean mIsStreamOwned;
|
||||
private volatile StorageMetadata mMetadata;
|
||||
private volatile int mResultCode;
|
||||
private ExponentialBackoffSender mSender;
|
||||
private volatile Exception mServerException;
|
||||
private volatile String mServerStatus;
|
||||
private final StorageReference mStorageRef;
|
||||
private final AdaptiveStreamBuffer mStreamBuffer;
|
||||
private final long mTotalByteCount;
|
||||
private volatile Uri mUploadUri;
|
||||
private final Uri mUri;
|
||||
private volatile long maxSleepTime;
|
||||
private final int minimumSleepInterval;
|
||||
private int sleepTime;
|
||||
private static final Random random = new Random();
|
||||
static Sleeper sleeper = new SleeperImpl();
|
||||
static Clock clock = DefaultClock.getInstance();
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class TaskSnapshot extends StorageTask<TaskSnapshot>.SnapshotBase {
|
||||
private final long mBytesUploaded;
|
||||
private final StorageMetadata mMetadata;
|
||||
private final Uri mUploadUri;
|
||||
|
||||
public TaskSnapshot(Exception exc, long j4, Uri uri, StorageMetadata storageMetadata) {
|
||||
super(exc);
|
||||
this.mBytesUploaded = j4;
|
||||
this.mUploadUri = uri;
|
||||
this.mMetadata = storageMetadata;
|
||||
}
|
||||
|
||||
public long getBytesTransferred() {
|
||||
return this.mBytesUploaded;
|
||||
}
|
||||
|
||||
public StorageMetadata getMetadata() {
|
||||
return this.mMetadata;
|
||||
}
|
||||
|
||||
public long getTotalByteCount() {
|
||||
return UploadTask.this.getTotalByteCount();
|
||||
}
|
||||
|
||||
public Uri getUploadSessionUri() {
|
||||
return this.mUploadUri;
|
||||
}
|
||||
}
|
||||
|
||||
public UploadTask(StorageReference storageReference, StorageMetadata storageMetadata, byte[] bArr) {
|
||||
this.mBytesUploaded = new AtomicLong(0L);
|
||||
this.mCurrentChunkSize = PREFERRED_CHUNK_SIZE;
|
||||
this.mUploadUri = null;
|
||||
this.mException = null;
|
||||
this.mServerException = null;
|
||||
this.mResultCode = 0;
|
||||
this.sleepTime = 0;
|
||||
this.minimumSleepInterval = 1000;
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(bArr);
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.mTotalByteCount = bArr.length;
|
||||
this.mStorageRef = storageReference;
|
||||
this.mMetadata = storageMetadata;
|
||||
InternalAuthProvider authProvider = storage.getAuthProvider();
|
||||
this.mAuthProvider = authProvider;
|
||||
InteropAppCheckTokenProvider appCheckProvider = storage.getAppCheckProvider();
|
||||
this.mAppCheckProvider = appCheckProvider;
|
||||
this.mUri = null;
|
||||
this.mStreamBuffer = new AdaptiveStreamBuffer(new ByteArrayInputStream(bArr), PREFERRED_CHUNK_SIZE);
|
||||
this.mIsStreamOwned = true;
|
||||
this.maxSleepTime = storage.getMaxChunkUploadRetry();
|
||||
this.mSender = new ExponentialBackoffSender(storage.getApp().getApplicationContext(), authProvider, appCheckProvider, storage.getMaxDownloadRetryTimeMillis());
|
||||
}
|
||||
|
||||
private void beginResumableUpload() {
|
||||
String contentType = this.mMetadata != null ? this.mMetadata.getContentType() : null;
|
||||
if (this.mUri != null && TextUtils.isEmpty(contentType)) {
|
||||
contentType = this.mStorageRef.getStorage().getApp().getApplicationContext().getContentResolver().getType(this.mUri);
|
||||
}
|
||||
if (TextUtils.isEmpty(contentType)) {
|
||||
contentType = APPLICATION_OCTET_STREAM;
|
||||
}
|
||||
ResumableUploadStartRequest resumableUploadStartRequest = new ResumableUploadStartRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mMetadata != null ? this.mMetadata.createJSONObject() : null, contentType);
|
||||
if (sendWithRetry(resumableUploadStartRequest)) {
|
||||
String resultString = resumableUploadStartRequest.getResultString(X_GOOG_UPLOAD_URL);
|
||||
if (TextUtils.isEmpty(resultString)) {
|
||||
return;
|
||||
}
|
||||
this.mUploadUri = Uri.parse(resultString);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean delaySend(NetworkRequest networkRequest) {
|
||||
try {
|
||||
Log.d(TAG, "Waiting " + this.sleepTime + " milliseconds");
|
||||
sleeper.sleep(this.sleepTime + random.nextInt(250));
|
||||
boolean send = send(networkRequest);
|
||||
if (send) {
|
||||
this.sleepTime = 0;
|
||||
}
|
||||
return send;
|
||||
} catch (InterruptedException e4) {
|
||||
Log.w(TAG, "thread interrupted during exponential backoff.");
|
||||
Thread.currentThread().interrupt();
|
||||
this.mServerException = e4;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidHttpResponseCode(int i) {
|
||||
if (i != 308) {
|
||||
return i >= 200 && i < 300;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean processResultValid(NetworkRequest networkRequest) {
|
||||
int resultCode = networkRequest.getResultCode();
|
||||
if (this.mSender.isRetryableError(resultCode)) {
|
||||
resultCode = -2;
|
||||
}
|
||||
this.mResultCode = resultCode;
|
||||
this.mServerException = networkRequest.getException();
|
||||
this.mServerStatus = networkRequest.getResultString("X-Goog-Upload-Status");
|
||||
return isValidHttpResponseCode(this.mResultCode) && this.mServerException == null;
|
||||
}
|
||||
|
||||
private boolean recoverStatus(boolean z3) {
|
||||
ResumableUploadQueryRequest resumableUploadQueryRequest = new ResumableUploadQueryRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mUploadUri);
|
||||
if (RESUMABLE_FINAL_STATUS.equals(this.mServerStatus)) {
|
||||
return false;
|
||||
}
|
||||
if (z3) {
|
||||
if (!sendWithRetry(resumableUploadQueryRequest)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!send(resumableUploadQueryRequest)) {
|
||||
return false;
|
||||
}
|
||||
if (RESUMABLE_FINAL_STATUS.equals(resumableUploadQueryRequest.getResultString("X-Goog-Upload-Status"))) {
|
||||
this.mException = new IOException("The server has terminated the upload session");
|
||||
return false;
|
||||
}
|
||||
String resultString = resumableUploadQueryRequest.getResultString("X-Goog-Upload-Size-Received");
|
||||
long parseLong = !TextUtils.isEmpty(resultString) ? Long.parseLong(resultString) : 0L;
|
||||
long j4 = this.mBytesUploaded.get();
|
||||
if (j4 > parseLong) {
|
||||
this.mException = new IOException("Unexpected error. The server lost a chunk update.");
|
||||
return false;
|
||||
}
|
||||
if (j4 >= parseLong) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (this.mStreamBuffer.advance((int) r7) != parseLong - j4) {
|
||||
this.mException = new IOException("Unexpected end of stream encountered.");
|
||||
return false;
|
||||
}
|
||||
if (this.mBytesUploaded.compareAndSet(j4, parseLong)) {
|
||||
return true;
|
||||
}
|
||||
Log.e(TAG, "Somehow, the uploaded bytes changed during an uploaded. This should nothappen");
|
||||
this.mException = new IllegalStateException("uploaded bytes changed unexpectedly.");
|
||||
return false;
|
||||
} catch (IOException e4) {
|
||||
Log.e(TAG, "Unable to recover position in Stream during resumable upload", e4);
|
||||
this.mException = e4;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean send(NetworkRequest networkRequest) {
|
||||
networkRequest.performRequest(Util.getCurrentAuthToken(this.mAuthProvider), Util.getCurrentAppCheckToken(this.mAppCheckProvider), this.mStorageRef.getApp().getApplicationContext());
|
||||
return processResultValid(networkRequest);
|
||||
}
|
||||
|
||||
private boolean sendWithRetry(NetworkRequest networkRequest) {
|
||||
this.mSender.sendWithExponentialBackoff(networkRequest);
|
||||
return processResultValid(networkRequest);
|
||||
}
|
||||
|
||||
private boolean serverStateValid() {
|
||||
if (!RESUMABLE_FINAL_STATUS.equals(this.mServerStatus)) {
|
||||
return true;
|
||||
}
|
||||
if (this.mException == null) {
|
||||
this.mException = new IOException("The server has terminated the upload session", this.mServerException);
|
||||
}
|
||||
tryChangeState(64, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean shouldContinue() {
|
||||
if (getInternalState() == 128) {
|
||||
return false;
|
||||
}
|
||||
if (Thread.interrupted()) {
|
||||
this.mException = new InterruptedException();
|
||||
tryChangeState(64, false);
|
||||
return false;
|
||||
}
|
||||
if (getInternalState() == 32) {
|
||||
tryChangeState(256, false);
|
||||
return false;
|
||||
}
|
||||
if (getInternalState() == 8) {
|
||||
tryChangeState(16, false);
|
||||
return false;
|
||||
}
|
||||
if (!serverStateValid()) {
|
||||
return false;
|
||||
}
|
||||
if (this.mUploadUri == null) {
|
||||
if (this.mException == null) {
|
||||
this.mException = new IllegalStateException("Unable to obtain an upload URL.");
|
||||
}
|
||||
tryChangeState(64, false);
|
||||
return false;
|
||||
}
|
||||
if (this.mException != null) {
|
||||
tryChangeState(64, false);
|
||||
return false;
|
||||
}
|
||||
boolean z3 = this.mServerException != null || this.mResultCode < 200 || this.mResultCode >= 300;
|
||||
long elapsedRealtime = clock.elapsedRealtime() + this.maxSleepTime;
|
||||
long elapsedRealtime2 = clock.elapsedRealtime() + this.sleepTime;
|
||||
if (z3) {
|
||||
if (elapsedRealtime2 > elapsedRealtime || !recoverStatus(true)) {
|
||||
if (serverStateValid()) {
|
||||
tryChangeState(64, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
this.sleepTime = Math.max(this.sleepTime * 2, 1000);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void uploadChunk() {
|
||||
try {
|
||||
this.mStreamBuffer.fill(this.mCurrentChunkSize);
|
||||
int min = Math.min(this.mCurrentChunkSize, this.mStreamBuffer.available());
|
||||
ResumableUploadByteRequest resumableUploadByteRequest = new ResumableUploadByteRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mUploadUri, this.mStreamBuffer.get(), this.mBytesUploaded.get(), min, this.mStreamBuffer.isFinished());
|
||||
if (!delaySend(resumableUploadByteRequest)) {
|
||||
this.mCurrentChunkSize = PREFERRED_CHUNK_SIZE;
|
||||
Log.d(TAG, "Resetting chunk size to " + this.mCurrentChunkSize);
|
||||
return;
|
||||
}
|
||||
this.mBytesUploaded.getAndAdd(min);
|
||||
if (!this.mStreamBuffer.isFinished()) {
|
||||
this.mStreamBuffer.advance(min);
|
||||
int i = this.mCurrentChunkSize;
|
||||
if (i < MAXIMUM_CHUNK_SIZE) {
|
||||
this.mCurrentChunkSize = i * 2;
|
||||
Log.d(TAG, "Increasing chunk size to " + this.mCurrentChunkSize);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.mMetadata = new StorageMetadata.Builder(resumableUploadByteRequest.getResultBody(), this.mStorageRef).build();
|
||||
tryChangeState(4, false);
|
||||
tryChangeState(128, false);
|
||||
} catch (JSONException e4) {
|
||||
Log.e(TAG, "Unable to parse resulting metadata from upload:" + resumableUploadByteRequest.getRawResult(), e4);
|
||||
this.mException = e4;
|
||||
}
|
||||
} catch (IOException e5) {
|
||||
Log.e(TAG, "Unable to read bytes for uploading", e5);
|
||||
this.mException = e5;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public StorageReference getStorage() {
|
||||
return this.mStorageRef;
|
||||
}
|
||||
|
||||
public long getTotalByteCount() {
|
||||
return this.mTotalByteCount;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void onCanceled() {
|
||||
this.mSender.cancel();
|
||||
final ResumableUploadCancelRequest resumableUploadCancelRequest = this.mUploadUri != null ? new ResumableUploadCancelRequest(this.mStorageRef.getStorageReferenceUri(), this.mStorageRef.getApp(), this.mUploadUri) : null;
|
||||
if (resumableUploadCancelRequest != null) {
|
||||
StorageTaskScheduler.getInstance().scheduleCommand(new Runnable() { // from class: com.google.firebase.storage.UploadTask.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
resumableUploadCancelRequest.performRequest(Util.getCurrentAuthToken(UploadTask.this.mAuthProvider), Util.getCurrentAppCheckToken(UploadTask.this.mAppCheckProvider), UploadTask.this.mStorageRef.getApp().getApplicationContext());
|
||||
}
|
||||
});
|
||||
}
|
||||
this.mException = StorageException.fromErrorStatus(Status.RESULT_CANCELED);
|
||||
super.onCanceled();
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void resetState() {
|
||||
this.mException = null;
|
||||
this.mServerException = null;
|
||||
this.mResultCode = 0;
|
||||
this.mServerStatus = null;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void run() {
|
||||
this.mSender.reset();
|
||||
if (!tryChangeState(4, false)) {
|
||||
Log.d(TAG, "The upload cannot continue as it is not in a valid state.");
|
||||
return;
|
||||
}
|
||||
if (this.mStorageRef.getParent() == null) {
|
||||
this.mException = new IllegalArgumentException("Cannot upload to getRoot. You should upload to a storage location such as .getReference('image.png').putFile...");
|
||||
}
|
||||
if (this.mException != null) {
|
||||
return;
|
||||
}
|
||||
if (this.mUploadUri == null) {
|
||||
beginResumableUpload();
|
||||
} else {
|
||||
recoverStatus(false);
|
||||
}
|
||||
boolean shouldContinue = shouldContinue();
|
||||
while (shouldContinue) {
|
||||
uploadChunk();
|
||||
shouldContinue = shouldContinue();
|
||||
if (shouldContinue) {
|
||||
tryChangeState(4, false);
|
||||
}
|
||||
}
|
||||
if (!this.mIsStreamOwned || getInternalState() == 16) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.mStreamBuffer.close();
|
||||
} catch (IOException e4) {
|
||||
Log.e(TAG, "Unable to close stream.", e4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public void schedule() {
|
||||
StorageTaskScheduler.getInstance().scheduleUpload(getRunnable());
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.StorageTask
|
||||
public TaskSnapshot snapStateImpl() {
|
||||
return new TaskSnapshot(StorageException.fromExceptionAndHttpCode(this.mException != null ? this.mException : this.mServerException, this.mResultCode), this.mBytesUploaded.get(), this.mUploadUri, this.mMetadata);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x00b1 */
|
||||
/* JADX WARN: Type inference failed for: r7v0, types: [com.google.firebase.auth.internal.InternalAuthProvider] */
|
||||
/* JADX WARN: Type inference failed for: r7v1 */
|
||||
/* JADX WARN: Type inference failed for: r7v10 */
|
||||
/* JADX WARN: Type inference failed for: r7v12 */
|
||||
/* JADX WARN: Type inference failed for: r7v13 */
|
||||
/* JADX WARN: Type inference failed for: r7v6 */
|
||||
/* JADX WARN: Type inference failed for: r7v8, types: [long] */
|
||||
/* JADX WARN: Type inference failed for: r7v9, types: [long] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public UploadTask(com.google.firebase.storage.StorageReference r12, com.google.firebase.storage.StorageMetadata r13, android.net.Uri r14, android.net.Uri r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 239
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.storage.UploadTask.<init>(com.google.firebase.storage.StorageReference, com.google.firebase.storage.StorageMetadata, android.net.Uri, android.net.Uri):void");
|
||||
}
|
||||
|
||||
public UploadTask(StorageReference storageReference, StorageMetadata storageMetadata, InputStream inputStream) {
|
||||
this.mBytesUploaded = new AtomicLong(0L);
|
||||
this.mCurrentChunkSize = PREFERRED_CHUNK_SIZE;
|
||||
this.mUploadUri = null;
|
||||
this.mException = null;
|
||||
this.mServerException = null;
|
||||
this.mResultCode = 0;
|
||||
this.sleepTime = 0;
|
||||
this.minimumSleepInterval = 1000;
|
||||
Preconditions.checkNotNull(storageReference);
|
||||
Preconditions.checkNotNull(inputStream);
|
||||
FirebaseStorage storage = storageReference.getStorage();
|
||||
this.mTotalByteCount = -1L;
|
||||
this.mStorageRef = storageReference;
|
||||
this.mMetadata = storageMetadata;
|
||||
InternalAuthProvider authProvider = storage.getAuthProvider();
|
||||
this.mAuthProvider = authProvider;
|
||||
InteropAppCheckTokenProvider appCheckProvider = storage.getAppCheckProvider();
|
||||
this.mAppCheckProvider = appCheckProvider;
|
||||
this.mStreamBuffer = new AdaptiveStreamBuffer(inputStream, PREFERRED_CHUNK_SIZE);
|
||||
this.mIsStreamOwned = false;
|
||||
this.mUri = null;
|
||||
this.maxSleepTime = storage.getMaxChunkUploadRetry();
|
||||
this.mSender = new ExponentialBackoffSender(storageReference.getApp().getApplicationContext(), authProvider, appCheckProvider, storage.getMaxUploadRetryTimeMillis());
|
||||
}
|
||||
}
|
||||
16
apk_decompiled/sources/com/google/firebase/storage/h.java
Normal file
16
apk_decompiled/sources/com/google/firebase/storage/h.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class h implements OnSuccessListener {
|
||||
|
||||
/* renamed from: a, reason: collision with root package name */
|
||||
public final /* synthetic */ TaskCompletionSource f6074a;
|
||||
|
||||
@Override // com.google.android.gms.tasks.OnSuccessListener
|
||||
public final void onSuccess(Object obj) {
|
||||
this.f6074a.setResult(obj);
|
||||
}
|
||||
}
|
||||
16
apk_decompiled/sources/com/google/firebase/storage/i.java
Normal file
16
apk_decompiled/sources/com/google/firebase/storage/i.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class i implements OnFailureListener {
|
||||
|
||||
/* renamed from: a, reason: collision with root package name */
|
||||
public final /* synthetic */ TaskCompletionSource f6075a;
|
||||
|
||||
@Override // com.google.android.gms.tasks.OnFailureListener
|
||||
public final void onFailure(Exception exc) {
|
||||
this.f6075a.setException(exc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.api.internal.LifecycleActivity;
|
||||
import com.google.android.gms.common.api.internal.LifecycleCallback;
|
||||
import com.google.android.gms.common.api.internal.LifecycleFragment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ActivityLifecycleListener {
|
||||
private static final ActivityLifecycleListener instance = new ActivityLifecycleListener();
|
||||
private final Map<Object, LifecycleEntry> cookieMap = new HashMap();
|
||||
private final Object sync = new Object();
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class LifecycleEntry {
|
||||
private final Activity activity;
|
||||
private final Object cookie;
|
||||
private final Runnable runnable;
|
||||
|
||||
public LifecycleEntry(Activity activity, Runnable runnable, Object obj) {
|
||||
this.activity = activity;
|
||||
this.runnable = runnable;
|
||||
this.cookie = obj;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof LifecycleEntry)) {
|
||||
return false;
|
||||
}
|
||||
LifecycleEntry lifecycleEntry = (LifecycleEntry) obj;
|
||||
return lifecycleEntry.cookie.equals(this.cookie) && lifecycleEntry.runnable == this.runnable && lifecycleEntry.activity == this.activity;
|
||||
}
|
||||
|
||||
public Activity getActivity() {
|
||||
return this.activity;
|
||||
}
|
||||
|
||||
public Object getCookie() {
|
||||
return this.cookie;
|
||||
}
|
||||
|
||||
public Runnable getRunnable() {
|
||||
return this.runnable;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.cookie.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static class OnStopCallback extends LifecycleCallback {
|
||||
private static final String TAG = "StorageOnStopCallback";
|
||||
private final List<LifecycleEntry> listeners;
|
||||
|
||||
private OnStopCallback(LifecycleFragment lifecycleFragment) {
|
||||
super(lifecycleFragment);
|
||||
this.listeners = new ArrayList();
|
||||
this.mLifecycleFragment.addCallback(TAG, this);
|
||||
}
|
||||
|
||||
public static OnStopCallback getInstance(Activity activity) {
|
||||
LifecycleFragment fragment = LifecycleCallback.getFragment(new LifecycleActivity(activity));
|
||||
OnStopCallback onStopCallback = (OnStopCallback) fragment.getCallbackOrNull(TAG, OnStopCallback.class);
|
||||
return onStopCallback == null ? new OnStopCallback(fragment) : onStopCallback;
|
||||
}
|
||||
|
||||
public void addEntry(LifecycleEntry lifecycleEntry) {
|
||||
synchronized (this.listeners) {
|
||||
this.listeners.add(lifecycleEntry);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
|
||||
public void onStop() {
|
||||
ArrayList arrayList;
|
||||
synchronized (this.listeners) {
|
||||
arrayList = new ArrayList(this.listeners);
|
||||
this.listeners.clear();
|
||||
}
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
LifecycleEntry lifecycleEntry = (LifecycleEntry) it.next();
|
||||
if (lifecycleEntry != null) {
|
||||
Log.d(TAG, "removing subscription from activity.");
|
||||
lifecycleEntry.getRunnable().run();
|
||||
ActivityLifecycleListener.getInstance().removeCookie(lifecycleEntry.getCookie());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEntry(LifecycleEntry lifecycleEntry) {
|
||||
synchronized (this.listeners) {
|
||||
this.listeners.remove(lifecycleEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ActivityLifecycleListener() {
|
||||
}
|
||||
|
||||
public static ActivityLifecycleListener getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void removeCookie(Object obj) {
|
||||
synchronized (this.sync) {
|
||||
try {
|
||||
LifecycleEntry lifecycleEntry = this.cookieMap.get(obj);
|
||||
if (lifecycleEntry != null) {
|
||||
OnStopCallback.getInstance(lifecycleEntry.getActivity()).removeEntry(lifecycleEntry);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void runOnActivityStopped(Activity activity, Object obj, Runnable runnable) {
|
||||
synchronized (this.sync) {
|
||||
LifecycleEntry lifecycleEntry = new LifecycleEntry(activity, runnable, obj);
|
||||
OnStopCallback.getInstance(activity).addEntry(lifecycleEntry);
|
||||
this.cookieMap.put(obj, lifecycleEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.util.Log;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class AdaptiveStreamBuffer {
|
||||
private static final String TAG = "AdaptiveStreamBuffer";
|
||||
private static final Runtime runtime = Runtime.getRuntime();
|
||||
private byte[] buffer;
|
||||
private final InputStream source;
|
||||
private int availableBytes = 0;
|
||||
private boolean adaptiveMode = true;
|
||||
private boolean reachedEnd = false;
|
||||
|
||||
public AdaptiveStreamBuffer(InputStream inputStream, int i) {
|
||||
this.source = inputStream;
|
||||
this.buffer = new byte[i];
|
||||
}
|
||||
|
||||
private int resize(int i) {
|
||||
int max = Math.max(this.buffer.length * 2, i);
|
||||
Runtime runtime2 = runtime;
|
||||
long maxMemory = runtime2.maxMemory() - (runtime2.totalMemory() - runtime2.freeMemory());
|
||||
if (!this.adaptiveMode || max >= maxMemory) {
|
||||
Log.w(TAG, "Turning off adaptive buffer resizing to conserve memory.");
|
||||
} else {
|
||||
try {
|
||||
byte[] bArr = new byte[max];
|
||||
System.arraycopy(this.buffer, 0, bArr, 0, this.availableBytes);
|
||||
this.buffer = bArr;
|
||||
} catch (OutOfMemoryError unused) {
|
||||
Log.w(TAG, "Turning off adaptive buffer resizing due to low memory.");
|
||||
this.adaptiveMode = false;
|
||||
}
|
||||
}
|
||||
return this.buffer.length;
|
||||
}
|
||||
|
||||
public int advance(int i) throws IOException {
|
||||
int i4 = this.availableBytes;
|
||||
int i5 = 0;
|
||||
if (i <= i4) {
|
||||
int i6 = i4 - i;
|
||||
this.availableBytes = i6;
|
||||
byte[] bArr = this.buffer;
|
||||
System.arraycopy(bArr, i, bArr, 0, i6);
|
||||
return i;
|
||||
}
|
||||
this.availableBytes = 0;
|
||||
while (i5 < i) {
|
||||
int skip = (int) this.source.skip(i - i5);
|
||||
if (skip > 0) {
|
||||
i5 += skip;
|
||||
} else if (skip != 0) {
|
||||
continue;
|
||||
} else {
|
||||
if (this.source.read() == -1) {
|
||||
break;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
|
||||
public int available() {
|
||||
return this.availableBytes;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
this.source.close();
|
||||
}
|
||||
|
||||
public int fill(int i) throws IOException {
|
||||
if (i > this.buffer.length) {
|
||||
i = Math.min(i, resize(i));
|
||||
}
|
||||
while (true) {
|
||||
int i4 = this.availableBytes;
|
||||
if (i4 >= i) {
|
||||
break;
|
||||
}
|
||||
int read = this.source.read(this.buffer, i4, i - i4);
|
||||
if (read == -1) {
|
||||
this.reachedEnd = true;
|
||||
break;
|
||||
}
|
||||
this.availableBytes += read;
|
||||
}
|
||||
return this.availableBytes;
|
||||
}
|
||||
|
||||
public byte[] get() {
|
||||
return this.buffer;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return this.reachedEnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.common.util.Clock;
|
||||
import com.google.android.gms.common.util.DefaultClock;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
import java.util.Random;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ExponentialBackoffSender {
|
||||
private static final int MAXIMUM_WAIT_TIME_MILLI = 30000;
|
||||
private static final int NETWORK_STATUS_POLL_INTERVAL = 1000;
|
||||
public static final int RND_MAX = 250;
|
||||
private static final String TAG = "ExponenentialBackoff";
|
||||
private final InteropAppCheckTokenProvider appCheckProvider;
|
||||
private final InternalAuthProvider authProvider;
|
||||
private volatile boolean canceled;
|
||||
private final Context context;
|
||||
private long retryTime;
|
||||
private static final Random random = new Random();
|
||||
static Sleeper sleeper = new SleeperImpl();
|
||||
static Clock clock = DefaultClock.getInstance();
|
||||
|
||||
public ExponentialBackoffSender(Context context, InternalAuthProvider internalAuthProvider, InteropAppCheckTokenProvider interopAppCheckTokenProvider, long j4) {
|
||||
this.context = context;
|
||||
this.authProvider = internalAuthProvider;
|
||||
this.appCheckProvider = interopAppCheckTokenProvider;
|
||||
this.retryTime = j4;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
this.canceled = true;
|
||||
}
|
||||
|
||||
public boolean isRetryableError(int i) {
|
||||
return (i >= 500 && i < 600) || i == -2 || i == 429 || i == 408;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.canceled = false;
|
||||
}
|
||||
|
||||
public void sendWithExponentialBackoff(NetworkRequest networkRequest) {
|
||||
sendWithExponentialBackoff(networkRequest, true);
|
||||
}
|
||||
|
||||
public void sendWithExponentialBackoff(NetworkRequest networkRequest, boolean z3) {
|
||||
Preconditions.checkNotNull(networkRequest);
|
||||
long elapsedRealtime = clock.elapsedRealtime() + this.retryTime;
|
||||
if (z3) {
|
||||
networkRequest.performRequest(Util.getCurrentAuthToken(this.authProvider), Util.getCurrentAppCheckToken(this.appCheckProvider), this.context);
|
||||
} else {
|
||||
networkRequest.performRequestStart(Util.getCurrentAuthToken(this.authProvider), Util.getCurrentAppCheckToken(this.appCheckProvider));
|
||||
}
|
||||
int i = 1000;
|
||||
while (clock.elapsedRealtime() + i <= elapsedRealtime && !networkRequest.isResultSuccess() && isRetryableError(networkRequest.getResultCode())) {
|
||||
try {
|
||||
sleeper.sleep(random.nextInt(250) + i);
|
||||
if (i < MAXIMUM_WAIT_TIME_MILLI) {
|
||||
if (networkRequest.getResultCode() != -2) {
|
||||
i *= 2;
|
||||
Log.w(TAG, "network error occurred, backing off/sleeping.");
|
||||
} else {
|
||||
Log.w(TAG, "network unavailable, sleeping.");
|
||||
i = 1000;
|
||||
}
|
||||
}
|
||||
if (this.canceled) {
|
||||
return;
|
||||
}
|
||||
networkRequest.reset();
|
||||
if (z3) {
|
||||
networkRequest.performRequest(Util.getCurrentAuthToken(this.authProvider), Util.getCurrentAppCheckToken(this.appCheckProvider), this.context);
|
||||
} else {
|
||||
networkRequest.performRequestStart(Util.getCurrentAuthToken(this.authProvider), Util.getCurrentAppCheckToken(this.appCheckProvider));
|
||||
}
|
||||
} catch (InterruptedException unused) {
|
||||
Log.w(TAG, "thread interrupted during exponential backoff.");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class Slashes {
|
||||
public static String normalizeSlashes(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return "";
|
||||
}
|
||||
if (!str.startsWith(RemoteSettings.FORWARD_SLASH_STRING) && !str.endsWith(RemoteSettings.FORWARD_SLASH_STRING) && !str.contains("//")) {
|
||||
return str;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String str2 : str.split(RemoteSettings.FORWARD_SLASH_STRING, -1)) {
|
||||
if (!TextUtils.isEmpty(str2)) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(RemoteSettings.FORWARD_SLASH_STRING);
|
||||
sb.append(str2);
|
||||
} else {
|
||||
sb.append(str2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String preserveSlashEncode(String str) {
|
||||
return TextUtils.isEmpty(str) ? "" : slashize(Uri.encode(str));
|
||||
}
|
||||
|
||||
public static String slashize(String str) {
|
||||
Preconditions.checkNotNull(str);
|
||||
return str.replace("%2F", RemoteSettings.FORWARD_SLASH_STRING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface Sleeper {
|
||||
void sleep(int i) throws InterruptedException;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class SleeperImpl implements Sleeper {
|
||||
@Override // com.google.firebase.storage.internal.Sleeper
|
||||
public void sleep(int i) throws InterruptedException {
|
||||
Thread.sleep(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.firebase.storage.StorageTaskScheduler;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class SmartHandler {
|
||||
static boolean testMode = false;
|
||||
private final Executor executor;
|
||||
|
||||
@SuppressLint({"ThreadPoolCreation"})
|
||||
public SmartHandler(Executor executor) {
|
||||
if (executor != null) {
|
||||
this.executor = executor;
|
||||
} else if (testMode) {
|
||||
this.executor = null;
|
||||
} else {
|
||||
this.executor = StorageTaskScheduler.getInstance().getMainThreadExecutor();
|
||||
}
|
||||
}
|
||||
|
||||
public void callBack(Runnable runnable) {
|
||||
Preconditions.checkNotNull(runnable);
|
||||
Executor executor = this.executor;
|
||||
if (executor != null) {
|
||||
executor.execute(runnable);
|
||||
} else {
|
||||
StorageTaskScheduler.getInstance().scheduleCallback(runnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.firebase.emulators.EmulatedServiceSettings;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class StorageReferenceUri {
|
||||
private final Uri gsUri;
|
||||
private final Uri httpBaseUri;
|
||||
private final Uri httpUri;
|
||||
|
||||
public StorageReferenceUri(Uri uri) {
|
||||
this(uri, null);
|
||||
}
|
||||
|
||||
public Uri getGsUri() {
|
||||
return this.gsUri;
|
||||
}
|
||||
|
||||
public Uri getHttpBaseUri() {
|
||||
return this.httpBaseUri;
|
||||
}
|
||||
|
||||
public Uri getHttpUri() {
|
||||
return this.httpUri;
|
||||
}
|
||||
|
||||
public StorageReferenceUri(Uri uri, EmulatedServiceSettings emulatedServiceSettings) {
|
||||
Uri parse;
|
||||
this.gsUri = uri;
|
||||
if (emulatedServiceSettings == null) {
|
||||
parse = NetworkRequest.PROD_BASE_URL;
|
||||
} else {
|
||||
parse = Uri.parse("http://" + emulatedServiceSettings.getHost() + ":" + emulatedServiceSettings.getPort() + "/v0");
|
||||
}
|
||||
this.httpBaseUri = parse;
|
||||
Uri.Builder appendEncodedPath = parse.buildUpon().appendPath("b").appendEncodedPath(uri.getAuthority());
|
||||
String normalizeSlashes = Slashes.normalizeSlashes(uri.getPath());
|
||||
if (normalizeSlashes.length() > 0 && !RemoteSettings.FORWARD_SLASH_STRING.equals(normalizeSlashes)) {
|
||||
appendEncodedPath = appendEncodedPath.appendPath("o").appendPath(normalizeSlashes);
|
||||
}
|
||||
this.httpUri = appendEncodedPath.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Objects;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.Tasks;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.appcheck.AppCheckTokenResult;
|
||||
import com.google.firebase.appcheck.interop.InteropAppCheckTokenProvider;
|
||||
import com.google.firebase.auth.GetTokenResult;
|
||||
import com.google.firebase.auth.internal.InternalAuthProvider;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.network.NetworkRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class Util {
|
||||
public static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||
private static final int MAXIMUM_TOKEN_WAIT_TIME_MS = 30000;
|
||||
public static final int NETWORK_UNAVAILABLE = -2;
|
||||
private static final String TAG = "StorageUtil";
|
||||
|
||||
public static boolean equals(Object obj, Object obj2) {
|
||||
return Objects.equal(obj, obj2);
|
||||
}
|
||||
|
||||
public static String getCurrentAppCheckToken(InteropAppCheckTokenProvider interopAppCheckTokenProvider) {
|
||||
if (interopAppCheckTokenProvider == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
AppCheckTokenResult appCheckTokenResult = (AppCheckTokenResult) Tasks.await(interopAppCheckTokenProvider.getToken(false), 30000L, TimeUnit.MILLISECONDS);
|
||||
if (appCheckTokenResult.getError() != null) {
|
||||
Log.w(TAG, "Error getting App Check token; using placeholder token instead. Error: " + appCheckTokenResult.getError());
|
||||
}
|
||||
return appCheckTokenResult.getToken();
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e4) {
|
||||
Log.e(TAG, "Unexpected error getting App Check token: " + e4);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentAuthToken(InternalAuthProvider internalAuthProvider) {
|
||||
String str;
|
||||
if (internalAuthProvider != null) {
|
||||
try {
|
||||
str = ((GetTokenResult) Tasks.await(internalAuthProvider.getAccessToken(false), 30000L, TimeUnit.MILLISECONDS)).getToken();
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e4) {
|
||||
Log.e(TAG, "error getting token " + e4);
|
||||
}
|
||||
} else {
|
||||
str = null;
|
||||
}
|
||||
if (!TextUtils.isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
Log.w(TAG, "no auth token for request");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Uri normalize(FirebaseApp firebaseApp, String str) throws UnsupportedEncodingException {
|
||||
String substring;
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
Uri uri = NetworkRequest.PROD_BASE_URL;
|
||||
if (str.toLowerCase().startsWith("gs://")) {
|
||||
return Uri.parse("gs://" + Slashes.preserveSlashEncode(Slashes.normalizeSlashes(str.substring(5))));
|
||||
}
|
||||
Uri parse = Uri.parse(str);
|
||||
String scheme = parse.getScheme();
|
||||
if (scheme == null || !(equals(scheme.toLowerCase(), "http") || equals(scheme.toLowerCase(), "https"))) {
|
||||
Log.w(TAG, "FirebaseStorage is unable to support the scheme:" + scheme);
|
||||
throw new IllegalArgumentException("Uri scheme");
|
||||
}
|
||||
int indexOf = parse.getAuthority().toLowerCase().indexOf(uri.getAuthority());
|
||||
String slashize = Slashes.slashize(parse.getEncodedPath());
|
||||
if (indexOf == 0 && slashize.startsWith(RemoteSettings.FORWARD_SLASH_STRING)) {
|
||||
int indexOf2 = slashize.indexOf("/b/", 0);
|
||||
int i = indexOf2 + 3;
|
||||
int indexOf3 = slashize.indexOf(RemoteSettings.FORWARD_SLASH_STRING, i);
|
||||
int indexOf4 = slashize.indexOf("/o/", 0);
|
||||
if (indexOf2 == -1 || indexOf3 == -1) {
|
||||
Log.w(TAG, "Firebase Storage URLs must point to an object in your Storage Bucket. Please obtain a URL using the Firebase Console or getDownloadUrl().");
|
||||
throw new IllegalArgumentException("Firebase Storage URLs must point to an object in your Storage Bucket. Please obtain a URL using the Firebase Console or getDownloadUrl().");
|
||||
}
|
||||
substring = slashize.substring(i, indexOf3);
|
||||
slashize = indexOf4 != -1 ? slashize.substring(indexOf4 + 3) : "";
|
||||
} else {
|
||||
if (indexOf <= 1) {
|
||||
Log.w(TAG, "Firebase Storage URLs must point to an object in your Storage Bucket. Please obtain a URL using the Firebase Console or getDownloadUrl().");
|
||||
throw new IllegalArgumentException("Firebase Storage URLs must point to an object in your Storage Bucket. Please obtain a URL using the Firebase Console or getDownloadUrl().");
|
||||
}
|
||||
substring = parse.getAuthority().substring(0, indexOf - 1);
|
||||
}
|
||||
Preconditions.checkNotEmpty(substring, "No bucket specified");
|
||||
return new Uri.Builder().scheme("gs").authority(substring).encodedPath(slashize).build();
|
||||
}
|
||||
|
||||
public static long parseDateTime(String str) {
|
||||
if (str == null) {
|
||||
return 0L;
|
||||
}
|
||||
String replaceAll = str.replaceAll("Z$", "-0000");
|
||||
try {
|
||||
return new SimpleDateFormat(ISO_8601_FORMAT, Locale.getDefault()).parse(replaceAll).getTime();
|
||||
} catch (ParseException e4) {
|
||||
Log.w(TAG, "unable to parse datetime:" + replaceAll, e4);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.firebase.storage.internal;
|
||||
|
||||
16
apk_decompiled/sources/com/google/firebase/storage/j.java
Normal file
16
apk_decompiled/sources/com/google/firebase/storage/j.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.android.gms.tasks.CancellationTokenSource;
|
||||
import com.google.android.gms.tasks.OnCanceledListener;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class j implements OnCanceledListener {
|
||||
|
||||
/* renamed from: a, reason: collision with root package name */
|
||||
public final /* synthetic */ CancellationTokenSource f6076a;
|
||||
|
||||
@Override // com.google.android.gms.tasks.OnCanceledListener
|
||||
public final void onCanceled() {
|
||||
this.f6076a.cancel();
|
||||
}
|
||||
}
|
||||
38
apk_decompiled/sources/com/google/firebase/storage/k.java
Normal file
38
apk_decompiled/sources/com/google/firebase/storage/k.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.google.firebase.storage;
|
||||
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class k implements Runnable {
|
||||
|
||||
/* renamed from: a, reason: collision with root package name */
|
||||
public final /* synthetic */ int f6077a;
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ TaskListenerImpl f6078b;
|
||||
|
||||
/* renamed from: c, reason: collision with root package name */
|
||||
public final /* synthetic */ Object f6079c;
|
||||
|
||||
/* renamed from: d, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask.ProvideError f6080d;
|
||||
|
||||
public /* synthetic */ k(TaskListenerImpl taskListenerImpl, Object obj, StorageTask.ProvideError provideError, int i) {
|
||||
this.f6077a = i;
|
||||
this.f6078b = taskListenerImpl;
|
||||
this.f6079c = obj;
|
||||
this.f6080d = provideError;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
switch (this.f6077a) {
|
||||
case 0:
|
||||
this.f6078b.lambda$onInternalStateChanged$2(this.f6079c, this.f6080d);
|
||||
return;
|
||||
default:
|
||||
this.f6078b.lambda$addListener$1(this.f6079c, this.f6080d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class BuildConfig {
|
||||
public static final String BUILD_TYPE = "release";
|
||||
public static final boolean DEBUG = false;
|
||||
public static final String LIBRARY_PACKAGE_NAME = "com.google.firebase.storage.ktx";
|
||||
public static final String VERSION_NAME = "unspecified";
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import com.google.firebase.components.Component;
|
||||
import com.google.firebase.components.ComponentRegistrar;
|
||||
import com.google.firebase.platforminfo.LibraryVersionComponent;
|
||||
import java.util.List;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
|
||||
@Keep
|
||||
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\b\u0007\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0003\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u00050\u0004H\u0016¨\u0006\u0006"}, d2 = {"Lcom/google/firebase/storage/ktx/FirebaseStorageKtxRegistrar;", "Lcom/google/firebase/components/ComponentRegistrar;", "()V", "getComponents", "", "Lcom/google/firebase/components/Component;", "com.google.firebase-firebase-storage-ktx"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class FirebaseStorageKtxRegistrar implements ComponentRegistrar {
|
||||
@Override // com.google.firebase.components.ComponentRegistrar
|
||||
public List<Component<?>> getComponents() {
|
||||
return CollectionsKt.listOf(LibraryVersionComponent.create(StorageKt.LIBRARY_NAME, "unspecified"));
|
||||
}
|
||||
}
|
||||
361
apk_decompiled/sources/com/google/firebase/storage/ktx/R.java
Normal file
361
apk_decompiled/sources/com/google/firebase/storage/ktx/R.java
Normal file
@@ -0,0 +1,361 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class R {
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class attr {
|
||||
public static final int alpha = 0x7f030031;
|
||||
public static final int buttonSize = 0x7f0300a5;
|
||||
public static final int circleCrop = 0x7f0300e9;
|
||||
public static final int colorScheme = 0x7f030135;
|
||||
public static final int coordinatorLayoutStyle = 0x7f03016c;
|
||||
public static final int font = 0x7f03022d;
|
||||
public static final int fontProviderAuthority = 0x7f03022f;
|
||||
public static final int fontProviderCerts = 0x7f030230;
|
||||
public static final int fontProviderFetchStrategy = 0x7f030231;
|
||||
public static final int fontProviderFetchTimeout = 0x7f030232;
|
||||
public static final int fontProviderPackage = 0x7f030233;
|
||||
public static final int fontProviderQuery = 0x7f030234;
|
||||
public static final int fontStyle = 0x7f030236;
|
||||
public static final int fontVariationSettings = 0x7f030237;
|
||||
public static final int fontWeight = 0x7f030238;
|
||||
public static final int imageAspectRatio = 0x7f030271;
|
||||
public static final int imageAspectRatioAdjust = 0x7f030272;
|
||||
public static final int keylines = 0x7f0302b5;
|
||||
public static final int layout_anchor = 0x7f0302c6;
|
||||
public static final int layout_anchorGravity = 0x7f0302c7;
|
||||
public static final int layout_behavior = 0x7f0302c9;
|
||||
public static final int layout_dodgeInsetEdges = 0x7f0302fa;
|
||||
public static final int layout_insetEdge = 0x7f030305;
|
||||
public static final int layout_keyline = 0x7f030306;
|
||||
public static final int scopeUris = 0x7f03041a;
|
||||
public static final int statusBarBackground = 0x7f030488;
|
||||
public static final int ttcIndex = 0x7f030559;
|
||||
|
||||
private attr() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class color {
|
||||
public static final int common_google_signin_btn_text_dark = 0x7f050045;
|
||||
public static final int common_google_signin_btn_text_dark_default = 0x7f050046;
|
||||
public static final int common_google_signin_btn_text_dark_disabled = 0x7f050047;
|
||||
public static final int common_google_signin_btn_text_dark_focused = 0x7f050048;
|
||||
public static final int common_google_signin_btn_text_dark_pressed = 0x7f050049;
|
||||
public static final int common_google_signin_btn_text_light = 0x7f05004a;
|
||||
public static final int common_google_signin_btn_text_light_default = 0x7f05004b;
|
||||
public static final int common_google_signin_btn_text_light_disabled = 0x7f05004c;
|
||||
public static final int common_google_signin_btn_text_light_focused = 0x7f05004d;
|
||||
public static final int common_google_signin_btn_text_light_pressed = 0x7f05004e;
|
||||
public static final int common_google_signin_btn_tint = 0x7f05004f;
|
||||
public static final int notification_action_color_filter = 0x7f050315;
|
||||
public static final int notification_icon_bg_color = 0x7f050316;
|
||||
public static final int ripple_material_light = 0x7f050322;
|
||||
public static final int secondary_text_default_material_light = 0x7f050324;
|
||||
|
||||
private color() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class dimen {
|
||||
public static final int compat_button_inset_horizontal_material = 0x7f06006d;
|
||||
public static final int compat_button_inset_vertical_material = 0x7f06006e;
|
||||
public static final int compat_button_padding_horizontal_material = 0x7f06006f;
|
||||
public static final int compat_button_padding_vertical_material = 0x7f060070;
|
||||
public static final int compat_control_corner_material = 0x7f060071;
|
||||
public static final int compat_notification_large_icon_max_height = 0x7f060072;
|
||||
public static final int compat_notification_large_icon_max_width = 0x7f060073;
|
||||
public static final int notification_action_icon_size = 0x7f060385;
|
||||
public static final int notification_action_text_size = 0x7f060386;
|
||||
public static final int notification_big_circle_margin = 0x7f060387;
|
||||
public static final int notification_content_margin_start = 0x7f060388;
|
||||
public static final int notification_large_icon_height = 0x7f06038d;
|
||||
public static final int notification_large_icon_width = 0x7f06038e;
|
||||
public static final int notification_main_column_padding_top = 0x7f06038f;
|
||||
public static final int notification_media_narrow_margin = 0x7f060391;
|
||||
public static final int notification_right_icon_size = 0x7f060393;
|
||||
public static final int notification_right_side_padding_top = 0x7f060394;
|
||||
public static final int notification_small_icon_background_padding = 0x7f060395;
|
||||
public static final int notification_small_icon_size_as_large = 0x7f060396;
|
||||
public static final int notification_subtext_size = 0x7f060397;
|
||||
public static final int notification_top_pad = 0x7f06039b;
|
||||
public static final int notification_top_pad_large_text = 0x7f06039c;
|
||||
|
||||
private dimen() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class drawable {
|
||||
public static final int common_full_open_on_phone = 0x7f07008b;
|
||||
public static final int common_google_signin_btn_icon_dark = 0x7f07008c;
|
||||
public static final int common_google_signin_btn_icon_dark_focused = 0x7f07008d;
|
||||
public static final int common_google_signin_btn_icon_dark_normal = 0x7f07008e;
|
||||
public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f07008f;
|
||||
public static final int common_google_signin_btn_icon_disabled = 0x7f070090;
|
||||
public static final int common_google_signin_btn_icon_light = 0x7f070091;
|
||||
public static final int common_google_signin_btn_icon_light_focused = 0x7f070092;
|
||||
public static final int common_google_signin_btn_icon_light_normal = 0x7f070093;
|
||||
public static final int common_google_signin_btn_icon_light_normal_background = 0x7f070094;
|
||||
public static final int common_google_signin_btn_text_dark = 0x7f070095;
|
||||
public static final int common_google_signin_btn_text_dark_focused = 0x7f070096;
|
||||
public static final int common_google_signin_btn_text_dark_normal = 0x7f070097;
|
||||
public static final int common_google_signin_btn_text_dark_normal_background = 0x7f070098;
|
||||
public static final int common_google_signin_btn_text_disabled = 0x7f070099;
|
||||
public static final int common_google_signin_btn_text_light = 0x7f07009a;
|
||||
public static final int common_google_signin_btn_text_light_focused = 0x7f07009b;
|
||||
public static final int common_google_signin_btn_text_light_normal = 0x7f07009c;
|
||||
public static final int common_google_signin_btn_text_light_normal_background = 0x7f07009d;
|
||||
public static final int googleg_disabled_color_18 = 0x7f0700ac;
|
||||
public static final int googleg_standard_color_18 = 0x7f0700ad;
|
||||
public static final int notification_action_background = 0x7f070181;
|
||||
public static final int notification_bg = 0x7f070182;
|
||||
public static final int notification_bg_low = 0x7f070183;
|
||||
public static final int notification_bg_low_normal = 0x7f070184;
|
||||
public static final int notification_bg_low_pressed = 0x7f070185;
|
||||
public static final int notification_bg_normal = 0x7f070186;
|
||||
public static final int notification_bg_normal_pressed = 0x7f070187;
|
||||
public static final int notification_icon_background = 0x7f070188;
|
||||
public static final int notification_template_icon_bg = 0x7f07018a;
|
||||
public static final int notification_template_icon_low_bg = 0x7f07018b;
|
||||
public static final int notification_tile_bg = 0x7f07018c;
|
||||
public static final int notify_panel_notification_icon_bg = 0x7f07018d;
|
||||
|
||||
private drawable() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class id {
|
||||
public static final int accessibility_action_clickable_span = 0x7f090013;
|
||||
public static final int accessibility_custom_action_0 = 0x7f090014;
|
||||
public static final int accessibility_custom_action_1 = 0x7f090015;
|
||||
public static final int accessibility_custom_action_10 = 0x7f090016;
|
||||
public static final int accessibility_custom_action_11 = 0x7f090017;
|
||||
public static final int accessibility_custom_action_12 = 0x7f090018;
|
||||
public static final int accessibility_custom_action_13 = 0x7f090019;
|
||||
public static final int accessibility_custom_action_14 = 0x7f09001a;
|
||||
public static final int accessibility_custom_action_15 = 0x7f09001b;
|
||||
public static final int accessibility_custom_action_16 = 0x7f09001c;
|
||||
public static final int accessibility_custom_action_17 = 0x7f09001d;
|
||||
public static final int accessibility_custom_action_18 = 0x7f09001e;
|
||||
public static final int accessibility_custom_action_19 = 0x7f09001f;
|
||||
public static final int accessibility_custom_action_2 = 0x7f090020;
|
||||
public static final int accessibility_custom_action_20 = 0x7f090021;
|
||||
public static final int accessibility_custom_action_21 = 0x7f090022;
|
||||
public static final int accessibility_custom_action_22 = 0x7f090023;
|
||||
public static final int accessibility_custom_action_23 = 0x7f090024;
|
||||
public static final int accessibility_custom_action_24 = 0x7f090025;
|
||||
public static final int accessibility_custom_action_25 = 0x7f090026;
|
||||
public static final int accessibility_custom_action_26 = 0x7f090027;
|
||||
public static final int accessibility_custom_action_27 = 0x7f090028;
|
||||
public static final int accessibility_custom_action_28 = 0x7f090029;
|
||||
public static final int accessibility_custom_action_29 = 0x7f09002a;
|
||||
public static final int accessibility_custom_action_3 = 0x7f09002b;
|
||||
public static final int accessibility_custom_action_30 = 0x7f09002c;
|
||||
public static final int accessibility_custom_action_31 = 0x7f09002d;
|
||||
public static final int accessibility_custom_action_4 = 0x7f09002e;
|
||||
public static final int accessibility_custom_action_5 = 0x7f09002f;
|
||||
public static final int accessibility_custom_action_6 = 0x7f090030;
|
||||
public static final int accessibility_custom_action_7 = 0x7f090031;
|
||||
public static final int accessibility_custom_action_8 = 0x7f090032;
|
||||
public static final int accessibility_custom_action_9 = 0x7f090033;
|
||||
public static final int action_container = 0x7f090045;
|
||||
public static final int action_divider = 0x7f090048;
|
||||
public static final int action_image = 0x7f09004a;
|
||||
public static final int action_text = 0x7f090051;
|
||||
public static final int actions = 0x7f090052;
|
||||
public static final int adjust_height = 0x7f090058;
|
||||
public static final int adjust_width = 0x7f090059;
|
||||
public static final int async = 0x7f090071;
|
||||
public static final int auto = 0x7f090072;
|
||||
public static final int blocking = 0x7f090082;
|
||||
public static final int bottom = 0x7f090083;
|
||||
public static final int chronometer = 0x7f0900a9;
|
||||
public static final int dark = 0x7f0900ea;
|
||||
public static final int dialog_button = 0x7f09010b;
|
||||
public static final int end = 0x7f090133;
|
||||
public static final int forever = 0x7f090152;
|
||||
public static final int icon = 0x7f090195;
|
||||
public static final int icon_group = 0x7f090196;
|
||||
public static final int icon_only = 0x7f090198;
|
||||
public static final int info = 0x7f0901a9;
|
||||
public static final int italic = 0x7f0901be;
|
||||
public static final int left = 0x7f0901e2;
|
||||
public static final int light = 0x7f0901e7;
|
||||
public static final int line1 = 0x7f0901e9;
|
||||
public static final int line3 = 0x7f0901ea;
|
||||
public static final int none = 0x7f090264;
|
||||
public static final int normal = 0x7f090265;
|
||||
public static final int notification_background = 0x7f090269;
|
||||
public static final int notification_main_column = 0x7f09026a;
|
||||
public static final int notification_main_column_container = 0x7f09026b;
|
||||
public static final int right = 0x7f0902cd;
|
||||
public static final int right_icon = 0x7f0902cf;
|
||||
public static final int right_side = 0x7f0902d0;
|
||||
public static final int standard = 0x7f090321;
|
||||
public static final int start = 0x7f090322;
|
||||
public static final int tag_accessibility_actions = 0x7f09035c;
|
||||
public static final int tag_accessibility_clickable_spans = 0x7f09035d;
|
||||
public static final int tag_accessibility_heading = 0x7f09035e;
|
||||
public static final int tag_accessibility_pane_title = 0x7f09035f;
|
||||
public static final int tag_screen_reader_focusable = 0x7f090363;
|
||||
public static final int tag_transition_group = 0x7f090365;
|
||||
public static final int tag_unhandled_key_event_manager = 0x7f090366;
|
||||
public static final int tag_unhandled_key_listeners = 0x7f090367;
|
||||
public static final int text = 0x7f09036d;
|
||||
public static final int text2 = 0x7f09036e;
|
||||
public static final int time = 0x7f09038e;
|
||||
public static final int title = 0x7f090393;
|
||||
public static final int top = 0x7f0903ac;
|
||||
public static final int wide = 0x7f090401;
|
||||
|
||||
private id() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class integer {
|
||||
public static final int google_play_services_version = 0x7f0a0009;
|
||||
public static final int status_bar_notification_info_maxnum = 0x7f0a0045;
|
||||
|
||||
private integer() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class layout {
|
||||
public static final int custom_dialog = 0x7f0c0026;
|
||||
public static final int notification_action = 0x7f0c00a8;
|
||||
public static final int notification_action_tombstone = 0x7f0c00a9;
|
||||
public static final int notification_template_custom_big = 0x7f0c00aa;
|
||||
public static final int notification_template_icon_group = 0x7f0c00ab;
|
||||
public static final int notification_template_part_chronometer = 0x7f0c00ac;
|
||||
public static final int notification_template_part_time = 0x7f0c00ad;
|
||||
|
||||
private layout() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class raw {
|
||||
public static final int firebase_common_keep = 0x7f120000;
|
||||
|
||||
private raw() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class string {
|
||||
public static final int common_google_play_services_enable_button = 0x7f1300b4;
|
||||
public static final int common_google_play_services_enable_text = 0x7f1300b5;
|
||||
public static final int common_google_play_services_enable_title = 0x7f1300b6;
|
||||
public static final int common_google_play_services_install_button = 0x7f1300b7;
|
||||
public static final int common_google_play_services_install_text = 0x7f1300b8;
|
||||
public static final int common_google_play_services_install_title = 0x7f1300b9;
|
||||
public static final int common_google_play_services_notification_channel_name = 0x7f1300ba;
|
||||
public static final int common_google_play_services_notification_ticker = 0x7f1300bb;
|
||||
public static final int common_google_play_services_unknown_issue = 0x7f1300bc;
|
||||
public static final int common_google_play_services_unsupported_text = 0x7f1300bd;
|
||||
public static final int common_google_play_services_update_button = 0x7f1300be;
|
||||
public static final int common_google_play_services_update_text = 0x7f1300bf;
|
||||
public static final int common_google_play_services_update_title = 0x7f1300c0;
|
||||
public static final int common_google_play_services_updating_text = 0x7f1300c1;
|
||||
public static final int common_google_play_services_wear_update_text = 0x7f1300c2;
|
||||
public static final int common_open_on_phone = 0x7f1300c4;
|
||||
public static final int common_signin_button_text = 0x7f1300c5;
|
||||
public static final int common_signin_button_text_long = 0x7f1300c6;
|
||||
public static final int status_bar_notification_info_overflow = 0x7f13023b;
|
||||
|
||||
private string() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class style {
|
||||
public static final int TextAppearance_Compat_Notification = 0x7f1401fb;
|
||||
public static final int TextAppearance_Compat_Notification_Info = 0x7f1401fc;
|
||||
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1401fd;
|
||||
public static final int TextAppearance_Compat_Notification_Time = 0x7f1401fe;
|
||||
public static final int TextAppearance_Compat_Notification_Title = 0x7f1401ff;
|
||||
public static final int Widget_Compat_NotificationActionContainer = 0x7f1403a1;
|
||||
public static final int Widget_Compat_NotificationActionText = 0x7f1403a2;
|
||||
public static final int Widget_Support_CoordinatorLayout = 0x7f1404d7;
|
||||
|
||||
private style() {
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class styleable {
|
||||
public static final int ColorStateListItem_alpha = 0x00000003;
|
||||
public static final int ColorStateListItem_android_alpha = 0x00000001;
|
||||
public static final int ColorStateListItem_android_color = 0x00000000;
|
||||
public static final int ColorStateListItem_android_lStar = 0x00000002;
|
||||
public static final int ColorStateListItem_lStar = 0x00000004;
|
||||
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0x00000000;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchor = 0x00000001;
|
||||
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 0x00000002;
|
||||
public static final int CoordinatorLayout_Layout_layout_behavior = 0x00000003;
|
||||
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 0x00000004;
|
||||
public static final int CoordinatorLayout_Layout_layout_insetEdge = 0x00000005;
|
||||
public static final int CoordinatorLayout_Layout_layout_keyline = 0x00000006;
|
||||
public static final int CoordinatorLayout_keylines = 0x00000000;
|
||||
public static final int CoordinatorLayout_statusBarBackground = 0x00000001;
|
||||
public static final int FontFamilyFont_android_font = 0x00000000;
|
||||
public static final int FontFamilyFont_android_fontStyle = 0x00000002;
|
||||
public static final int FontFamilyFont_android_fontVariationSettings = 0x00000004;
|
||||
public static final int FontFamilyFont_android_fontWeight = 0x00000001;
|
||||
public static final int FontFamilyFont_android_ttcIndex = 0x00000003;
|
||||
public static final int FontFamilyFont_font = 0x00000005;
|
||||
public static final int FontFamilyFont_fontStyle = 0x00000006;
|
||||
public static final int FontFamilyFont_fontVariationSettings = 0x00000007;
|
||||
public static final int FontFamilyFont_fontWeight = 0x00000008;
|
||||
public static final int FontFamilyFont_ttcIndex = 0x00000009;
|
||||
public static final int FontFamily_fontProviderAuthority = 0x00000000;
|
||||
public static final int FontFamily_fontProviderCerts = 0x00000001;
|
||||
public static final int FontFamily_fontProviderFetchStrategy = 0x00000002;
|
||||
public static final int FontFamily_fontProviderFetchTimeout = 0x00000003;
|
||||
public static final int FontFamily_fontProviderPackage = 0x00000004;
|
||||
public static final int FontFamily_fontProviderQuery = 0x00000005;
|
||||
public static final int FontFamily_fontProviderSystemFontFamily = 0x00000006;
|
||||
public static final int GradientColorItem_android_color = 0x00000000;
|
||||
public static final int GradientColorItem_android_offset = 0x00000001;
|
||||
public static final int GradientColor_android_centerColor = 0x00000007;
|
||||
public static final int GradientColor_android_centerX = 0x00000003;
|
||||
public static final int GradientColor_android_centerY = 0x00000004;
|
||||
public static final int GradientColor_android_endColor = 0x00000001;
|
||||
public static final int GradientColor_android_endX = 0x0000000a;
|
||||
public static final int GradientColor_android_endY = 0x0000000b;
|
||||
public static final int GradientColor_android_gradientRadius = 0x00000005;
|
||||
public static final int GradientColor_android_startColor = 0x00000000;
|
||||
public static final int GradientColor_android_startX = 0x00000008;
|
||||
public static final int GradientColor_android_startY = 0x00000009;
|
||||
public static final int GradientColor_android_tileMode = 0x00000006;
|
||||
public static final int GradientColor_android_type = 0x00000002;
|
||||
public static final int LoadingImageView_circleCrop = 0x00000000;
|
||||
public static final int LoadingImageView_imageAspectRatio = 0x00000001;
|
||||
public static final int LoadingImageView_imageAspectRatioAdjust = 0x00000002;
|
||||
public static final int SignInButton_buttonSize = 0x00000000;
|
||||
public static final int SignInButton_colorScheme = 0x00000001;
|
||||
public static final int SignInButton_scopeUris = 0x00000002;
|
||||
public static final int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, 16844359, com.adif.elcanomovil.R.attr.alpha, com.adif.elcanomovil.R.attr.lStar};
|
||||
public static final int[] CoordinatorLayout = {com.adif.elcanomovil.R.attr.keylines, com.adif.elcanomovil.R.attr.statusBarBackground};
|
||||
public static final int[] CoordinatorLayout_Layout = {android.R.attr.layout_gravity, com.adif.elcanomovil.R.attr.layout_anchor, com.adif.elcanomovil.R.attr.layout_anchorGravity, com.adif.elcanomovil.R.attr.layout_behavior, com.adif.elcanomovil.R.attr.layout_dodgeInsetEdges, com.adif.elcanomovil.R.attr.layout_insetEdge, com.adif.elcanomovil.R.attr.layout_keyline};
|
||||
public static final int[] FontFamily = {com.adif.elcanomovil.R.attr.fontProviderAuthority, com.adif.elcanomovil.R.attr.fontProviderCerts, com.adif.elcanomovil.R.attr.fontProviderFetchStrategy, com.adif.elcanomovil.R.attr.fontProviderFetchTimeout, com.adif.elcanomovil.R.attr.fontProviderPackage, com.adif.elcanomovil.R.attr.fontProviderQuery, com.adif.elcanomovil.R.attr.fontProviderSystemFontFamily};
|
||||
public static final int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, com.adif.elcanomovil.R.attr.font, com.adif.elcanomovil.R.attr.fontStyle, com.adif.elcanomovil.R.attr.fontVariationSettings, com.adif.elcanomovil.R.attr.fontWeight, com.adif.elcanomovil.R.attr.ttcIndex};
|
||||
public static final int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
|
||||
public static final int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
|
||||
public static final int[] LoadingImageView = {com.adif.elcanomovil.R.attr.circleCrop, com.adif.elcanomovil.R.attr.imageAspectRatio, com.adif.elcanomovil.R.attr.imageAspectRatioAdjust};
|
||||
public static final int[] SignInButton = {com.adif.elcanomovil.R.attr.buttonSize, com.adif.elcanomovil.R.attr.colorScheme, com.adif.elcanomovil.R.attr.scopeUris};
|
||||
|
||||
private styleable() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.storage.OnPausedListener;
|
||||
import com.google.firebase.storage.OnProgressListener;
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
import com.google.firebase.storage.StorageTaskScheduler;
|
||||
import com.google.firebase.storage.ktx.TaskState;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.ResultKt;
|
||||
import kotlin.Unit;
|
||||
import kotlin.coroutines.Continuation;
|
||||
import kotlin.coroutines.intrinsics.IntrinsicsKt;
|
||||
import kotlin.coroutines.jvm.internal.DebugMetadata;
|
||||
import kotlin.coroutines.jvm.internal.SuspendLambda;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlin.jvm.internal.Lambda;
|
||||
import kotlinx.coroutines.CoroutineScopeKt;
|
||||
import kotlinx.coroutines.channels.ChannelsKt;
|
||||
import kotlinx.coroutines.channels.ProduceKt;
|
||||
import kotlinx.coroutines.channels.ProducerScope;
|
||||
import kotlinx.coroutines.channels.SendChannel;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00028\u00000\u00030\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/channels/ProducerScope;", "Lcom/google/firebase/storage/ktx/TaskState;"}, k = 3, mv = {1, 7, 1}, xi = 48)
|
||||
@DebugMetadata(c = "com.google.firebase.storage.ktx.StorageKt$taskState$1", f = "Storage.kt", i = {}, l = {183}, m = "invokeSuspend", n = {}, s = {})
|
||||
/* loaded from: classes3.dex */
|
||||
public final class StorageKt$taskState$1<T> extends SuspendLambda implements Function2<ProducerScope<? super TaskState<T>>, Continuation<? super Unit>, Object> {
|
||||
final /* synthetic */ StorageTask<T> $this_taskState;
|
||||
private /* synthetic */ Object L$0;
|
||||
int label;
|
||||
|
||||
@Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 7, 1}, xi = 48)
|
||||
/* renamed from: com.google.firebase.storage.ktx.StorageKt$taskState$1$1 */
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class AnonymousClass1 extends Lambda implements Function0<Unit> {
|
||||
final /* synthetic */ OnCompleteListener<T> $completionListener;
|
||||
final /* synthetic */ OnPausedListener<T> $pauseListener;
|
||||
final /* synthetic */ OnProgressListener<T> $progressListener;
|
||||
final /* synthetic */ StorageTask<T> $this_taskState;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public AnonymousClass1(StorageTask<T> storageTask, OnProgressListener<T> onProgressListener, OnPausedListener<T> onPausedListener, OnCompleteListener<T> onCompleteListener) {
|
||||
super(0);
|
||||
r1 = storageTask;
|
||||
r2 = onProgressListener;
|
||||
r3 = onPausedListener;
|
||||
r4 = onCompleteListener;
|
||||
}
|
||||
|
||||
@Override // kotlin.jvm.functions.Function0
|
||||
public /* bridge */ /* synthetic */ Unit invoke() {
|
||||
invoke2();
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
|
||||
/* renamed from: invoke */
|
||||
public final void invoke2() {
|
||||
r1.removeOnProgressListener(r2);
|
||||
r1.removeOnPausedListener(r3);
|
||||
r1.removeOnCompleteListener(r4);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public StorageKt$taskState$1(StorageTask<T> storageTask, Continuation<? super StorageKt$taskState$1> continuation) {
|
||||
super(2, continuation);
|
||||
this.$this_taskState = storageTask;
|
||||
}
|
||||
|
||||
/* renamed from: invokeSuspend$lambda-1 */
|
||||
public static final void m107invokeSuspend$lambda1(ProducerScope producerScope, StorageTask.SnapshotBase snapshotBase) {
|
||||
StorageTaskScheduler.getInstance().scheduleCallback(new d(producerScope, snapshotBase, 0));
|
||||
}
|
||||
|
||||
/* renamed from: invokeSuspend$lambda-1$lambda-0 */
|
||||
public static final void m108invokeSuspend$lambda1$lambda0(ProducerScope producerScope, StorageTask.SnapshotBase snapshot) {
|
||||
Intrinsics.checkNotNullExpressionValue(snapshot, "snapshot");
|
||||
ChannelsKt.trySendBlocking(producerScope, new TaskState.InProgress(snapshot));
|
||||
}
|
||||
|
||||
/* renamed from: invokeSuspend$lambda-3 */
|
||||
public static final void m109invokeSuspend$lambda3(ProducerScope producerScope, StorageTask.SnapshotBase snapshotBase) {
|
||||
StorageTaskScheduler.getInstance().scheduleCallback(new d(producerScope, snapshotBase, 1));
|
||||
}
|
||||
|
||||
/* renamed from: invokeSuspend$lambda-3$lambda-2 */
|
||||
public static final void m110invokeSuspend$lambda3$lambda2(ProducerScope producerScope, StorageTask.SnapshotBase snapshot) {
|
||||
Intrinsics.checkNotNullExpressionValue(snapshot, "snapshot");
|
||||
ChannelsKt.trySendBlocking(producerScope, new TaskState.Paused(snapshot));
|
||||
}
|
||||
|
||||
/* renamed from: invokeSuspend$lambda-4 */
|
||||
public static final void m111invokeSuspend$lambda4(ProducerScope producerScope, Task task) {
|
||||
if (task.isSuccessful()) {
|
||||
SendChannel.DefaultImpls.close$default(producerScope, null, 1, null);
|
||||
} else {
|
||||
CoroutineScopeKt.cancel(producerScope, "Error getting the TaskState", task.getException());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
||||
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
|
||||
StorageKt$taskState$1 storageKt$taskState$1 = new StorageKt$taskState$1(this.$this_taskState, continuation);
|
||||
storageKt$taskState$1.L$0 = obj;
|
||||
return storageKt$taskState$1;
|
||||
}
|
||||
|
||||
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
|
||||
public final Object invokeSuspend(Object obj) {
|
||||
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
|
||||
int i = this.label;
|
||||
if (i == 0) {
|
||||
ResultKt.throwOnFailure(obj);
|
||||
final ProducerScope producerScope = (ProducerScope) this.L$0;
|
||||
OnProgressListener<? super T> onProgressListener = new OnProgressListener() { // from class: com.google.firebase.storage.ktx.a
|
||||
@Override // com.google.firebase.storage.OnProgressListener
|
||||
public final void onProgress(Object obj2) {
|
||||
StorageKt$taskState$1.m107invokeSuspend$lambda1(ProducerScope.this, (StorageTask.SnapshotBase) obj2);
|
||||
}
|
||||
};
|
||||
OnPausedListener<? super T> onPausedListener = new OnPausedListener() { // from class: com.google.firebase.storage.ktx.b
|
||||
@Override // com.google.firebase.storage.OnPausedListener
|
||||
public final void onPaused(Object obj2) {
|
||||
StorageKt$taskState$1.m109invokeSuspend$lambda3(ProducerScope.this, (StorageTask.SnapshotBase) obj2);
|
||||
}
|
||||
};
|
||||
OnCompleteListener<T> onCompleteListener = new OnCompleteListener() { // from class: com.google.firebase.storage.ktx.c
|
||||
@Override // com.google.android.gms.tasks.OnCompleteListener
|
||||
public final void onComplete(Task task) {
|
||||
StorageKt$taskState$1.m111invokeSuspend$lambda4(ProducerScope.this, task);
|
||||
}
|
||||
};
|
||||
this.$this_taskState.addOnProgressListener(onProgressListener);
|
||||
this.$this_taskState.addOnPausedListener(onPausedListener);
|
||||
this.$this_taskState.addOnCompleteListener(onCompleteListener);
|
||||
AnonymousClass1 anonymousClass1 = new Function0<Unit>() { // from class: com.google.firebase.storage.ktx.StorageKt$taskState$1.1
|
||||
final /* synthetic */ OnCompleteListener<T> $completionListener;
|
||||
final /* synthetic */ OnPausedListener<T> $pauseListener;
|
||||
final /* synthetic */ OnProgressListener<T> $progressListener;
|
||||
final /* synthetic */ StorageTask<T> $this_taskState;
|
||||
|
||||
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||||
public AnonymousClass1(StorageTask<T> storageTask, OnProgressListener<T> onProgressListener2, OnPausedListener<T> onPausedListener2, OnCompleteListener<T> onCompleteListener2) {
|
||||
super(0);
|
||||
r1 = storageTask;
|
||||
r2 = onProgressListener2;
|
||||
r3 = onPausedListener2;
|
||||
r4 = onCompleteListener2;
|
||||
}
|
||||
|
||||
@Override // kotlin.jvm.functions.Function0
|
||||
public /* bridge */ /* synthetic */ Unit invoke() {
|
||||
invoke2();
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
|
||||
/* renamed from: invoke */
|
||||
public final void invoke2() {
|
||||
r1.removeOnProgressListener(r2);
|
||||
r1.removeOnPausedListener(r3);
|
||||
r1.removeOnCompleteListener(r4);
|
||||
}
|
||||
};
|
||||
this.label = 1;
|
||||
if (ProduceKt.awaitClose(producerScope, anonymousClass1, this) == coroutine_suspended) {
|
||||
return coroutine_suspended;
|
||||
}
|
||||
} else {
|
||||
if (i != 1) {
|
||||
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
|
||||
}
|
||||
ResultKt.throwOnFailure(obj);
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
|
||||
@Override // kotlin.jvm.functions.Function2
|
||||
public final Object invoke(ProducerScope<? super TaskState<T>> producerScope, Continuation<? super Unit> continuation) {
|
||||
return ((StorageKt$taskState$1) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.android.gms.common.internal.ImagesContract;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.ktx.Firebase;
|
||||
import com.google.firebase.storage.FileDownloadTask;
|
||||
import com.google.firebase.storage.FirebaseStorage;
|
||||
import com.google.firebase.storage.ListResult;
|
||||
import com.google.firebase.storage.StorageMetadata;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
import com.google.firebase.storage.StreamDownloadTask;
|
||||
import com.google.firebase.storage.UploadTask;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlinx.coroutines.flow.FlowKt;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u0082\u0001\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u001f\u0010\u000f\u001a\u00020\u00102\u0017\u0010\u0011\u001a\u0013\u0012\u0004\u0012\u00020\u0013\u0012\u0004\u0012\u00020\u00140\u0012¢\u0006\u0002\b\u0015\u001a\u0011\u0010\u0016\u001a\u00020\u0017*\u00060\u0018R\u00020\u0019H\u0086\u0002\u001a\u0013\u0010\u0016\u001a\b\u0012\u0004\u0012\u00020\u001b0\u001a*\u00020\u001cH\u0086\u0002\u001a\u0011\u0010\u0016\u001a\u00020\u0017*\u00060\u001dR\u00020\u001eH\u0086\u0002\u001a\u0011\u0010\u0016\u001a\u00020\u0017*\u00060\u001fR\u00020 H\u0086\u0002\u001a\u0011\u0010!\u001a\u00020\u0017*\u00060\u0018R\u00020\u0019H\u0086\u0002\u001a\u0013\u0010!\u001a\b\u0012\u0004\u0012\u00020\u001b0\u001a*\u00020\u001cH\u0086\u0002\u001a\u0011\u0010!\u001a\u00020\u0017*\u00060\u001dR\u00020\u001eH\u0086\u0002\u001a\u0011\u0010!\u001a\u00020\u0017*\u00060\u001fR\u00020 H\u0086\u0002\u001a\u000f\u0010\"\u001a\u0004\u0018\u00010\u0001*\u00020\u001cH\u0086\u0002\u001a\u0011\u0010\"\u001a\u00020#*\u00060\u001dR\u00020\u001eH\u0086\u0002\u001a\u0013\u0010\"\u001a\u0004\u0018\u00010\u0010*\u00060\u001fR\u00020 H\u0086\u0002\u001a\u0013\u0010$\u001a\u0004\u0018\u00010%*\u00060\u001fR\u00020 H\u0086\u0002\u001a\u0012\u0010\u0002\u001a\u00020\u0003*\u00020\u00042\u0006\u0010&\u001a\u00020'\u001a\u001a\u0010\u0002\u001a\u00020\u0003*\u00020\u00042\u0006\u0010&\u001a\u00020'2\u0006\u0010(\u001a\u00020\u0001\u001a\u0012\u0010\u0002\u001a\u00020\u0003*\u00020\u00042\u0006\u0010(\u001a\u00020\u0001\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0080T¢\u0006\u0002\n\u0000\"\u0015\u0010\u0002\u001a\u00020\u0003*\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006\";\u0010\u0007\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\n0\t0\b\"\u0012\b\u0000\u0010\n*\f0\u000bR\b\u0012\u0004\u0012\u0002H\n0\f*\b\u0012\u0004\u0012\u0002H\n0\f8F¢\u0006\u0006\u001a\u0004\b\r\u0010\u000e¨\u0006)"}, d2 = {"LIBRARY_NAME", "", "storage", "Lcom/google/firebase/storage/FirebaseStorage;", "Lcom/google/firebase/ktx/Firebase;", "getStorage", "(Lcom/google/firebase/ktx/Firebase;)Lcom/google/firebase/storage/FirebaseStorage;", "taskState", "Lkotlinx/coroutines/flow/Flow;", "Lcom/google/firebase/storage/ktx/TaskState;", "T", "Lcom/google/firebase/storage/StorageTask$SnapshotBase;", "Lcom/google/firebase/storage/StorageTask;", "getTaskState", "(Lcom/google/firebase/storage/StorageTask;)Lkotlinx/coroutines/flow/Flow;", "storageMetadata", "Lcom/google/firebase/storage/StorageMetadata;", "init", "Lkotlin/Function1;", "Lcom/google/firebase/storage/StorageMetadata$Builder;", "", "Lkotlin/ExtensionFunctionType;", "component1", "", "Lcom/google/firebase/storage/FileDownloadTask$TaskSnapshot;", "Lcom/google/firebase/storage/FileDownloadTask;", "", "Lcom/google/firebase/storage/StorageReference;", "Lcom/google/firebase/storage/ListResult;", "Lcom/google/firebase/storage/StreamDownloadTask$TaskSnapshot;", "Lcom/google/firebase/storage/StreamDownloadTask;", "Lcom/google/firebase/storage/UploadTask$TaskSnapshot;", "Lcom/google/firebase/storage/UploadTask;", "component2", "component3", "Ljava/io/InputStream;", "component4", "Landroid/net/Uri;", "app", "Lcom/google/firebase/FirebaseApp;", ImagesContract.URL, "com.google.firebase-firebase-storage-ktx"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public final class StorageKt {
|
||||
public static final String LIBRARY_NAME = "fire-stg-ktx";
|
||||
|
||||
public static final long component1(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getBytesTransferred();
|
||||
}
|
||||
|
||||
public static final long component2(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getTotalByteCount();
|
||||
}
|
||||
|
||||
public static final StorageMetadata component3(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getMetadata();
|
||||
}
|
||||
|
||||
public static final Uri component4(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getUploadSessionUri();
|
||||
}
|
||||
|
||||
public static final FirebaseStorage getStorage(Firebase firebase) {
|
||||
Intrinsics.checkNotNullParameter(firebase, "<this>");
|
||||
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance();
|
||||
Intrinsics.checkNotNullExpressionValue(firebaseStorage, "getInstance()");
|
||||
return firebaseStorage;
|
||||
}
|
||||
|
||||
public static final <T extends StorageTask<T>.SnapshotBase> Flow<TaskState<T>> getTaskState(StorageTask<T> storageTask) {
|
||||
Intrinsics.checkNotNullParameter(storageTask, "<this>");
|
||||
return FlowKt.callbackFlow(new StorageKt$taskState$1(storageTask, null));
|
||||
}
|
||||
|
||||
public static final FirebaseStorage storage(Firebase firebase, String url) {
|
||||
Intrinsics.checkNotNullParameter(firebase, "<this>");
|
||||
Intrinsics.checkNotNullParameter(url, "url");
|
||||
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance(url);
|
||||
Intrinsics.checkNotNullExpressionValue(firebaseStorage, "getInstance(url)");
|
||||
return firebaseStorage;
|
||||
}
|
||||
|
||||
public static final StorageMetadata storageMetadata(Function1<? super StorageMetadata.Builder, Unit> init) {
|
||||
Intrinsics.checkNotNullParameter(init, "init");
|
||||
StorageMetadata.Builder builder = new StorageMetadata.Builder();
|
||||
init.invoke(builder);
|
||||
StorageMetadata build = builder.build();
|
||||
Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
|
||||
return build;
|
||||
}
|
||||
|
||||
public static final long component1(StreamDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getBytesTransferred();
|
||||
}
|
||||
|
||||
public static final long component2(StreamDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getTotalByteCount();
|
||||
}
|
||||
|
||||
public static final InputStream component3(StreamDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
InputStream stream = taskSnapshot.getStream();
|
||||
Intrinsics.checkNotNullExpressionValue(stream, "stream");
|
||||
return stream;
|
||||
}
|
||||
|
||||
public static final FirebaseStorage storage(Firebase firebase, FirebaseApp app) {
|
||||
Intrinsics.checkNotNullParameter(firebase, "<this>");
|
||||
Intrinsics.checkNotNullParameter(app, "app");
|
||||
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance(app);
|
||||
Intrinsics.checkNotNullExpressionValue(firebaseStorage, "getInstance(app)");
|
||||
return firebaseStorage;
|
||||
}
|
||||
|
||||
public static final long component1(FileDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getBytesTransferred();
|
||||
}
|
||||
|
||||
public static final long component2(FileDownloadTask.TaskSnapshot taskSnapshot) {
|
||||
Intrinsics.checkNotNullParameter(taskSnapshot, "<this>");
|
||||
return taskSnapshot.getTotalByteCount();
|
||||
}
|
||||
|
||||
public static final String component3(ListResult listResult) {
|
||||
Intrinsics.checkNotNullParameter(listResult, "<this>");
|
||||
return listResult.getPageToken();
|
||||
}
|
||||
|
||||
public static final FirebaseStorage storage(Firebase firebase, FirebaseApp app, String url) {
|
||||
Intrinsics.checkNotNullParameter(firebase, "<this>");
|
||||
Intrinsics.checkNotNullParameter(app, "app");
|
||||
Intrinsics.checkNotNullParameter(url, "url");
|
||||
FirebaseStorage firebaseStorage = FirebaseStorage.getInstance(app, url);
|
||||
Intrinsics.checkNotNullExpressionValue(firebaseStorage, "getInstance(app, url)");
|
||||
return firebaseStorage;
|
||||
}
|
||||
|
||||
public static final List<StorageReference> component1(ListResult listResult) {
|
||||
Intrinsics.checkNotNullParameter(listResult, "<this>");
|
||||
List<StorageReference> items = listResult.getItems();
|
||||
Intrinsics.checkNotNullExpressionValue(items, "items");
|
||||
return items;
|
||||
}
|
||||
|
||||
public static final List<StorageReference> component2(ListResult listResult) {
|
||||
Intrinsics.checkNotNullParameter(listResult, "<this>");
|
||||
List<StorageReference> prefixes = listResult.getPrefixes();
|
||||
Intrinsics.checkNotNullExpressionValue(prefixes, "prefixes");
|
||||
return prefixes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||||
|
||||
@Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0004\b&\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002:\u0002\u0004\u0005B\u0007\b\u0002¢\u0006\u0002\u0010\u0003¨\u0006\u0006"}, d2 = {"Lcom/google/firebase/storage/ktx/TaskState;", "T", "", "()V", "InProgress", "Paused", "com.google.firebase-firebase-storage-ktx"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class TaskState<T> {
|
||||
|
||||
@Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u0000*\u0004\b\u0001\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00028\u0001¢\u0006\u0002\u0010\u0004R\u0013\u0010\u0003\u001a\u00028\u0001¢\u0006\n\n\u0002\u0010\u0007\u001a\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"Lcom/google/firebase/storage/ktx/TaskState$InProgress;", "T", "Lcom/google/firebase/storage/ktx/TaskState;", "snapshot", "(Ljava/lang/Object;)V", "getSnapshot", "()Ljava/lang/Object;", "Ljava/lang/Object;", "com.google.firebase-firebase-storage-ktx"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class InProgress<T> extends TaskState<T> {
|
||||
private final T snapshot;
|
||||
|
||||
public InProgress(T t2) {
|
||||
super(null);
|
||||
this.snapshot = t2;
|
||||
}
|
||||
|
||||
public final T getSnapshot() {
|
||||
return this.snapshot;
|
||||
}
|
||||
}
|
||||
|
||||
@Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u0000*\u0004\b\u0001\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00028\u0001¢\u0006\u0002\u0010\u0004R\u0013\u0010\u0003\u001a\u00028\u0001¢\u0006\n\n\u0002\u0010\u0007\u001a\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"Lcom/google/firebase/storage/ktx/TaskState$Paused;", "T", "Lcom/google/firebase/storage/ktx/TaskState;", "snapshot", "(Ljava/lang/Object;)V", "getSnapshot", "()Ljava/lang/Object;", "Ljava/lang/Object;", "com.google.firebase-firebase-storage-ktx"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class Paused<T> extends TaskState<T> {
|
||||
private final T snapshot;
|
||||
|
||||
public Paused(T t2) {
|
||||
super(null);
|
||||
this.snapshot = t2;
|
||||
}
|
||||
|
||||
public final T getSnapshot() {
|
||||
return this.snapshot;
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ TaskState(DefaultConstructorMarker defaultConstructorMarker) {
|
||||
this();
|
||||
}
|
||||
|
||||
private TaskState() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.google.firebase.storage.ktx;
|
||||
|
||||
import com.google.firebase.storage.StorageTask;
|
||||
import kotlinx.coroutines.channels.ProducerScope;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final /* synthetic */ class d implements Runnable {
|
||||
|
||||
/* renamed from: a, reason: collision with root package name */
|
||||
public final /* synthetic */ int f6084a;
|
||||
|
||||
/* renamed from: b, reason: collision with root package name */
|
||||
public final /* synthetic */ ProducerScope f6085b;
|
||||
|
||||
/* renamed from: c, reason: collision with root package name */
|
||||
public final /* synthetic */ StorageTask.SnapshotBase f6086c;
|
||||
|
||||
public /* synthetic */ d(ProducerScope producerScope, StorageTask.SnapshotBase snapshotBase, int i) {
|
||||
this.f6084a = i;
|
||||
this.f6085b = producerScope;
|
||||
this.f6086c = snapshotBase;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
switch (this.f6084a) {
|
||||
case 0:
|
||||
StorageKt$taskState$1.c(this.f6085b, this.f6086c);
|
||||
return;
|
||||
default:
|
||||
StorageKt$taskState$1.d(this.f6085b, this.f6086c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class DeleteNetworkRequest extends NetworkRequest {
|
||||
public DeleteNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "DELETE";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class GetMetadataNetworkRequest extends NetworkRequest {
|
||||
public GetMetadataNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "GET";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class GetNetworkRequest extends NetworkRequest {
|
||||
private static final String TAG = "GetNetworkRequest";
|
||||
|
||||
public GetNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, long j4) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
if (j4 != 0) {
|
||||
super.setCustomHeader("Range", "bytes=" + j4 + "-");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "GET";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Map<String, String> getQueryParameters() {
|
||||
return Collections.singletonMap("alt", "media");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ListNetworkRequest extends NetworkRequest {
|
||||
private final Integer maxPageSize;
|
||||
private final String nextPageToken;
|
||||
|
||||
public ListNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, Integer num, String str) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
this.maxPageSize = num;
|
||||
this.nextPageToken = str;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "GET";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Map<String, String> getQueryParameters() {
|
||||
HashMap hashMap = new HashMap();
|
||||
String pathWithoutBucket = getPathWithoutBucket();
|
||||
if (!pathWithoutBucket.isEmpty()) {
|
||||
hashMap.put("prefix", pathWithoutBucket.concat(RemoteSettings.FORWARD_SLASH_STRING));
|
||||
}
|
||||
hashMap.put("delimiter", RemoteSettings.FORWARD_SLASH_STRING);
|
||||
Integer num = this.maxPageSize;
|
||||
if (num != null) {
|
||||
hashMap.put("maxResults", Integer.toString(num.intValue()));
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.nextPageToken)) {
|
||||
hashMap.put("pageToken", this.nextPageToken);
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Uri getURL() {
|
||||
return Uri.parse(getStorageReferenceUri().getHttpBaseUri() + "/b/" + getStorageReferenceUri().getGsUri().getAuthority() + "/o");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import com.google.android.gms.tasks.TaskCompletionSource;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.emulators.EmulatedServiceSettings;
|
||||
import com.google.firebase.sessions.settings.RemoteSettings;
|
||||
import com.google.firebase.storage.StorageException;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import com.google.firebase.storage.network.connection.HttpURLConnectionFactory;
|
||||
import com.google.firebase.storage.network.connection.HttpURLConnectionFactoryImpl;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.SocketException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public abstract class NetworkRequest {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
private static final String APPLICATION_JSON = "application/json";
|
||||
private static final String CONTENT_LENGTH = "Content-Length";
|
||||
private static final String CONTENT_TYPE = "Content-Type";
|
||||
static final String DELETE = "DELETE";
|
||||
static final String GET = "GET";
|
||||
public static final int INITIALIZATION_EXCEPTION = -1;
|
||||
private static final int MAXIMUM_TOKEN_WAIT_TIME_MS = 30000;
|
||||
public static final int NETWORK_UNAVAILABLE = -2;
|
||||
static final String PATCH = "PATCH";
|
||||
static final String POST = "POST";
|
||||
static final String PUT = "PUT";
|
||||
private static final String TAG = "NetworkRequest";
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
private static final String X_FIREBASE_APPCHECK = "x-firebase-appcheck";
|
||||
private static final String X_FIREBASE_GMPID = "x-firebase-gmpid";
|
||||
private static String gmsCoreVersion;
|
||||
private HttpURLConnection connection;
|
||||
private Context context;
|
||||
protected Exception mException;
|
||||
private String rawStringResponse;
|
||||
private Map<String, String> requestHeaders = new HashMap();
|
||||
private int resultCode;
|
||||
private Map<String, List<String>> resultHeaders;
|
||||
private InputStream resultInputStream;
|
||||
private int resultingContentLength;
|
||||
private StorageReferenceUri storageReferenceUri;
|
||||
public static final Uri PROD_BASE_URL = Uri.parse("https://firebasestorage.googleapis.com/v0");
|
||||
static HttpURLConnectionFactory connectionFactory = new HttpURLConnectionFactoryImpl();
|
||||
|
||||
public NetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp) {
|
||||
Preconditions.checkNotNull(storageReferenceUri);
|
||||
Preconditions.checkNotNull(firebaseApp);
|
||||
this.storageReferenceUri = storageReferenceUri;
|
||||
this.context = firebaseApp.getApplicationContext();
|
||||
setCustomHeader(X_FIREBASE_GMPID, firebaseApp.getOptions().getApplicationId());
|
||||
}
|
||||
|
||||
private void constructMessage(HttpURLConnection httpURLConnection, String str, String str2) throws IOException {
|
||||
int i;
|
||||
byte[] bArr;
|
||||
Preconditions.checkNotNull(httpURLConnection);
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
Log.w(TAG, "no auth token for request");
|
||||
} else {
|
||||
httpURLConnection.setRequestProperty("Authorization", "Firebase " + str);
|
||||
}
|
||||
if (TextUtils.isEmpty(str2)) {
|
||||
Log.w(TAG, "No App Check token for request.");
|
||||
} else {
|
||||
httpURLConnection.setRequestProperty(X_FIREBASE_APPCHECK, str2);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("Android/");
|
||||
String gmsCoreVersion2 = getGmsCoreVersion(this.context);
|
||||
if (!TextUtils.isEmpty(gmsCoreVersion2)) {
|
||||
sb.append(gmsCoreVersion2);
|
||||
}
|
||||
httpURLConnection.setRequestProperty("X-Firebase-Storage-Version", sb.toString());
|
||||
for (Map.Entry<String, String> entry : this.requestHeaders.entrySet()) {
|
||||
httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
JSONObject outputJSON = getOutputJSON();
|
||||
if (outputJSON != null) {
|
||||
bArr = outputJSON.toString().getBytes(UTF_8);
|
||||
i = bArr.length;
|
||||
} else {
|
||||
byte[] outputRaw = getOutputRaw();
|
||||
int outputRawSize = getOutputRawSize();
|
||||
if (outputRawSize == 0 && outputRaw != null) {
|
||||
outputRawSize = outputRaw.length;
|
||||
}
|
||||
i = outputRawSize;
|
||||
bArr = outputRaw;
|
||||
}
|
||||
if (bArr == null || bArr.length <= 0) {
|
||||
httpURLConnection.setRequestProperty(CONTENT_LENGTH, "0");
|
||||
} else {
|
||||
if (outputJSON != null) {
|
||||
httpURLConnection.setRequestProperty(CONTENT_TYPE, APPLICATION_JSON);
|
||||
}
|
||||
httpURLConnection.setDoOutput(true);
|
||||
httpURLConnection.setRequestProperty(CONTENT_LENGTH, Integer.toString(i));
|
||||
}
|
||||
httpURLConnection.setUseCaches(false);
|
||||
httpURLConnection.setDoInput(true);
|
||||
if (bArr == null || bArr.length <= 0) {
|
||||
return;
|
||||
}
|
||||
OutputStream outputStream = httpURLConnection.getOutputStream();
|
||||
if (outputStream == null) {
|
||||
Log.e(TAG, "Unable to write to the http request!");
|
||||
return;
|
||||
}
|
||||
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
|
||||
try {
|
||||
bufferedOutputStream.write(bArr, 0, i);
|
||||
} finally {
|
||||
bufferedOutputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
private HttpURLConnection createConnection() throws IOException {
|
||||
Uri url = getURL();
|
||||
Map<String, String> queryParameters = getQueryParameters();
|
||||
if (queryParameters != null) {
|
||||
Uri.Builder buildUpon = url.buildUpon();
|
||||
for (Map.Entry<String, String> entry : queryParameters.entrySet()) {
|
||||
buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
|
||||
}
|
||||
url = buildUpon.build();
|
||||
}
|
||||
return connectionFactory.createInstance(new URL(url.toString()));
|
||||
}
|
||||
|
||||
private boolean ensureNetworkAvailable(Context context) {
|
||||
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
|
||||
if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
|
||||
return true;
|
||||
}
|
||||
this.mException = new SocketException("Network subsystem is unavailable");
|
||||
this.resultCode = -2;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Uri getBaseUrl(EmulatedServiceSettings emulatedServiceSettings) {
|
||||
if (emulatedServiceSettings == null) {
|
||||
return PROD_BASE_URL;
|
||||
}
|
||||
return Uri.parse("http://" + emulatedServiceSettings.getHost() + ":" + emulatedServiceSettings.getPort() + "/v0");
|
||||
}
|
||||
|
||||
private static String getGmsCoreVersion(Context context) {
|
||||
if (gmsCoreVersion == null) {
|
||||
try {
|
||||
gmsCoreVersion = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e4) {
|
||||
Log.e(TAG, "Unable to find gmscore in package manager", e4);
|
||||
}
|
||||
if (gmsCoreVersion == null) {
|
||||
gmsCoreVersion = "[No Gmscore]";
|
||||
}
|
||||
}
|
||||
return gmsCoreVersion;
|
||||
}
|
||||
|
||||
private static String getPathWithoutBucket(Uri uri) {
|
||||
String path = uri.getPath();
|
||||
if (path == null) {
|
||||
return "";
|
||||
}
|
||||
return path.startsWith(RemoteSettings.FORWARD_SLASH_STRING) ? path.substring(1) : path;
|
||||
}
|
||||
|
||||
private void parseResponse(HttpURLConnection httpURLConnection) throws IOException {
|
||||
Preconditions.checkNotNull(httpURLConnection);
|
||||
this.resultCode = httpURLConnection.getResponseCode();
|
||||
this.resultHeaders = httpURLConnection.getHeaderFields();
|
||||
this.resultingContentLength = httpURLConnection.getContentLength();
|
||||
if (isResultSuccess()) {
|
||||
this.resultInputStream = httpURLConnection.getInputStream();
|
||||
} else {
|
||||
this.resultInputStream = httpURLConnection.getErrorStream();
|
||||
}
|
||||
}
|
||||
|
||||
private final void performRequest(String str, String str2) {
|
||||
performRequestStart(str, str2);
|
||||
try {
|
||||
processResponseStream();
|
||||
} catch (IOException e4) {
|
||||
Log.w(TAG, "error sending network request " + getAction() + " " + getURL(), e4);
|
||||
this.mException = e4;
|
||||
this.resultCode = -2;
|
||||
}
|
||||
performRequestEnd();
|
||||
}
|
||||
|
||||
private void processResponseStream() throws IOException {
|
||||
if (isResultSuccess()) {
|
||||
parseSuccessulResponse(this.resultInputStream);
|
||||
} else {
|
||||
parseErrorResponse(this.resultInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
public <TResult> void completeTask(TaskCompletionSource<TResult> taskCompletionSource, TResult tresult) {
|
||||
Exception exception = getException();
|
||||
if (isResultSuccess() && exception == null) {
|
||||
taskCompletionSource.setResult(tresult);
|
||||
} else {
|
||||
taskCompletionSource.setException(StorageException.fromExceptionAndHttpCode(exception, getResultCode()));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String getAction();
|
||||
|
||||
public Exception getException() {
|
||||
return this.mException;
|
||||
}
|
||||
|
||||
public JSONObject getOutputJSON() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] getOutputRaw() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getOutputRawSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Map<String, String> getQueryParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getRawResult() {
|
||||
return this.rawStringResponse;
|
||||
}
|
||||
|
||||
public JSONObject getResultBody() {
|
||||
if (TextUtils.isEmpty(this.rawStringResponse)) {
|
||||
return new JSONObject();
|
||||
}
|
||||
try {
|
||||
return new JSONObject(this.rawStringResponse);
|
||||
} catch (JSONException e4) {
|
||||
Log.e(TAG, "error parsing result into JSON:" + this.rawStringResponse, e4);
|
||||
return new JSONObject();
|
||||
}
|
||||
}
|
||||
|
||||
public int getResultCode() {
|
||||
return this.resultCode;
|
||||
}
|
||||
|
||||
public Map<String, String> getResultHeaders() {
|
||||
return this.requestHeaders;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getResultHeadersImpl() {
|
||||
return this.resultHeaders;
|
||||
}
|
||||
|
||||
public String getResultString(String str) {
|
||||
List<String> list;
|
||||
Map<String, List<String>> resultHeadersImpl = getResultHeadersImpl();
|
||||
if (resultHeadersImpl == null || (list = resultHeadersImpl.get(str)) == null || list.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
public int getResultingContentLength() {
|
||||
return this.resultingContentLength;
|
||||
}
|
||||
|
||||
public StorageReferenceUri getStorageReferenceUri() {
|
||||
return this.storageReferenceUri;
|
||||
}
|
||||
|
||||
public InputStream getStream() {
|
||||
return this.resultInputStream;
|
||||
}
|
||||
|
||||
public Uri getURL() {
|
||||
return this.storageReferenceUri.getHttpUri();
|
||||
}
|
||||
|
||||
public boolean isResultSuccess() {
|
||||
int i = this.resultCode;
|
||||
return i >= 200 && i < 300;
|
||||
}
|
||||
|
||||
public void parseErrorResponse(InputStream inputStream) throws IOException {
|
||||
parseResponse(inputStream);
|
||||
}
|
||||
|
||||
public void parseSuccessulResponse(InputStream inputStream) throws IOException {
|
||||
parseResponse(inputStream);
|
||||
}
|
||||
|
||||
public void performRequestEnd() {
|
||||
HttpURLConnection httpURLConnection = this.connection;
|
||||
if (httpURLConnection != null) {
|
||||
httpURLConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public void performRequestStart(String str, String str2) {
|
||||
if (this.mException != null) {
|
||||
this.resultCode = -1;
|
||||
return;
|
||||
}
|
||||
if (Log.isLoggable(TAG, 3)) {
|
||||
Log.d(TAG, "sending network request " + getAction() + " " + getURL());
|
||||
}
|
||||
NetworkInfo activeNetworkInfo = ((ConnectivityManager) this.context.getSystemService("connectivity")).getActiveNetworkInfo();
|
||||
if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) {
|
||||
this.resultCode = -2;
|
||||
this.mException = new SocketException("Network subsystem is unavailable");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
HttpURLConnection createConnection = createConnection();
|
||||
this.connection = createConnection;
|
||||
createConnection.setRequestMethod(getAction());
|
||||
constructMessage(this.connection, str, str2);
|
||||
parseResponse(this.connection);
|
||||
if (Log.isLoggable(TAG, 3)) {
|
||||
Log.d(TAG, "network request result " + this.resultCode);
|
||||
}
|
||||
} catch (IOException e4) {
|
||||
Log.w(TAG, "error sending network request " + getAction() + " " + getURL(), e4);
|
||||
this.mException = e4;
|
||||
this.resultCode = -2;
|
||||
}
|
||||
}
|
||||
|
||||
public final void reset() {
|
||||
this.mException = null;
|
||||
this.resultCode = 0;
|
||||
}
|
||||
|
||||
public void setCustomHeader(String str, String str2) {
|
||||
this.requestHeaders.put(str, str2);
|
||||
}
|
||||
|
||||
public String getPathWithoutBucket() {
|
||||
return getPathWithoutBucket(this.storageReferenceUri.getGsUri());
|
||||
}
|
||||
|
||||
public void performRequest(String str, String str2, Context context) {
|
||||
if (ensureNetworkAvailable(context)) {
|
||||
performRequest(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseResponse(InputStream inputStream) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (inputStream != null) {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, UTF_8));
|
||||
while (true) {
|
||||
try {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null) {
|
||||
break;
|
||||
} else {
|
||||
sb.append(readLine);
|
||||
}
|
||||
} finally {
|
||||
bufferedReader.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawStringResponse = sb.toString();
|
||||
if (isResultSuccess()) {
|
||||
return;
|
||||
}
|
||||
this.mException = new IOException(this.rawStringResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
abstract class ResumableNetworkRequest extends NetworkRequest {
|
||||
static final String COMMAND = "X-Goog-Upload-Command";
|
||||
static final String CONTENT_TYPE = "X-Goog-Upload-Header-Content-Type";
|
||||
static final String OFFSET = "X-Goog-Upload-Offset";
|
||||
static final String PROTOCOL = "X-Goog-Upload-Protocol";
|
||||
|
||||
public ResumableNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ResumableUploadByteRequest extends ResumableNetworkRequest {
|
||||
private final int bytesToWrite;
|
||||
private final byte[] chunk;
|
||||
private final boolean isFinal;
|
||||
private final long offset;
|
||||
private final Uri uploadURL;
|
||||
|
||||
public ResumableUploadByteRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, Uri uri, byte[] bArr, long j4, int i, boolean z3) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
if (bArr == null && i != -1) {
|
||||
this.mException = new IllegalArgumentException("contentType is null or empty");
|
||||
}
|
||||
if (j4 < 0) {
|
||||
this.mException = new IllegalArgumentException("offset cannot be negative");
|
||||
}
|
||||
this.bytesToWrite = i;
|
||||
this.uploadURL = uri;
|
||||
this.chunk = i <= 0 ? null : bArr;
|
||||
this.offset = j4;
|
||||
this.isFinal = z3;
|
||||
super.setCustomHeader("X-Goog-Upload-Protocol", "resumable");
|
||||
if (z3 && i > 0) {
|
||||
super.setCustomHeader("X-Goog-Upload-Command", "upload, finalize");
|
||||
} else if (z3) {
|
||||
super.setCustomHeader("X-Goog-Upload-Command", "finalize");
|
||||
} else {
|
||||
super.setCustomHeader("X-Goog-Upload-Command", "upload");
|
||||
}
|
||||
super.setCustomHeader("X-Goog-Upload-Offset", Long.toString(j4));
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "POST";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public byte[] getOutputRaw() {
|
||||
return this.chunk;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public int getOutputRawSize() {
|
||||
int i = this.bytesToWrite;
|
||||
if (i > 0) {
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Uri getURL() {
|
||||
return this.uploadURL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ResumableUploadCancelRequest extends ResumableNetworkRequest {
|
||||
public static boolean cancelCalled = false;
|
||||
private final Uri uploadURL;
|
||||
|
||||
public ResumableUploadCancelRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, Uri uri) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
cancelCalled = true;
|
||||
this.uploadURL = uri;
|
||||
super.setCustomHeader("X-Goog-Upload-Protocol", "resumable");
|
||||
super.setCustomHeader("X-Goog-Upload-Command", "cancel");
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "POST";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Uri getURL() {
|
||||
return this.uploadURL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.android.gms.actions.SearchIntents;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ResumableUploadQueryRequest extends ResumableNetworkRequest {
|
||||
private final Uri uploadURL;
|
||||
|
||||
public ResumableUploadQueryRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, Uri uri) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
this.uploadURL = uri;
|
||||
super.setCustomHeader("X-Goog-Upload-Protocol", "resumable");
|
||||
super.setCustomHeader("X-Goog-Upload-Command", SearchIntents.EXTRA_QUERY);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "POST";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Uri getURL() {
|
||||
return this.uploadURL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class ResumableUploadStartRequest extends ResumableNetworkRequest {
|
||||
private final String contentType;
|
||||
private final JSONObject metadata;
|
||||
|
||||
public ResumableUploadStartRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, JSONObject jSONObject, String str) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
this.metadata = jSONObject;
|
||||
this.contentType = str;
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
this.mException = new IllegalArgumentException("mContentType is null or empty");
|
||||
}
|
||||
super.setCustomHeader("X-Goog-Upload-Protocol", "resumable");
|
||||
super.setCustomHeader("X-Goog-Upload-Command", "start");
|
||||
super.setCustomHeader("X-Goog-Upload-Header-Content-Type", str);
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "POST";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public JSONObject getOutputJSON() {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Map<String, String> getQueryParameters() {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put(AppMeasurementSdk.ConditionalUserProperty.NAME, getPathWithoutBucket());
|
||||
hashMap.put("uploadType", "resumable");
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public Uri getURL() {
|
||||
String authority = getStorageReferenceUri().getGsUri().getAuthority();
|
||||
Uri.Builder buildUpon = getStorageReferenceUri().getHttpBaseUri().buildUpon();
|
||||
buildUpon.appendPath("b");
|
||||
buildUpon.appendPath(authority);
|
||||
buildUpon.appendPath("o");
|
||||
return buildUpon.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.storage.internal.StorageReferenceUri;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class UpdateMetadataNetworkRequest extends NetworkRequest {
|
||||
private final JSONObject metadata;
|
||||
|
||||
public UpdateMetadataNetworkRequest(StorageReferenceUri storageReferenceUri, FirebaseApp firebaseApp, JSONObject jSONObject) {
|
||||
super(storageReferenceUri, firebaseApp);
|
||||
this.metadata = jSONObject;
|
||||
setCustomHeader("X-HTTP-Method-Override", "PATCH");
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public String getAction() {
|
||||
return "PUT";
|
||||
}
|
||||
|
||||
@Override // com.google.firebase.storage.network.NetworkRequest
|
||||
public JSONObject getOutputJSON() {
|
||||
return this.metadata;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.google.firebase.storage.network.connection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public interface HttpURLConnectionFactory {
|
||||
HttpURLConnection createInstance(URL url) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.google.firebase.storage.network.connection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public class HttpURLConnectionFactoryImpl implements HttpURLConnectionFactory {
|
||||
@Override // com.google.firebase.storage.network.connection.HttpURLConnectionFactory
|
||||
public HttpURLConnection createInstance(URL url) throws IOException {
|
||||
return (HttpURLConnection) url.openConnection();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.firebase.storage.network.connection;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.firebase.storage.network;
|
||||
|
||||
Reference in New Issue
Block a user