将文件上传到 firebase 存储的代码中的两个任务是什么?

What are the two tasks in the code to upload file to firebase storage?

根据文档 Upload Files on Android,这是将文件上传到 Firebase 存储并检索下载 uri 的代码:

    Task<Uri> urlTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
    @Override
    public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
        if (!task.isSuccessful()) {
            throw task.getException();
        }

        // Continue with the task to get the download URL
        return ref.getDownloadUrl();
    }
    }).addOnCompleteListener(new OnCompleteListener<Uri>() {
        @Override
        public void onComplete(@NonNull Task<Uri> task) {
            if (task.isSuccessful()) {
                Uri downloadUri = task.getResult();
            } else {
                 // Handle failures
                 // ...
            }
        }
    });

从代码中可以看出,代码中有两个任务,Task<UploadTask.TaskSnapshot>任务在continueWithTask方法上,Task<Uri>任务在addOnCompleteListener方法上。我想知道我必须检查哪个任务是否成功以确保文件上传成功?

Task<Uri> urlTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
    @Override
    public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
        if (!task.isSuccessful()) {
            throw task.getException();
        }

        // Continue with the task to get the download URL
        return ref.getDownloadUrl();
    }
    }).addOnCompleteListener(new OnCompleteListener<Uri>() {
        @Override
        public void onComplete(@NonNull Task<Uri> task) {
            if (task.isSuccessful()) {
                -> **This is the Success Case for you**
                Uri downloadUri = task.getResult();
            } else {
                 -> **In this case File Uploaded Successfully But You failed to get its URL,
                   Again send this call again with storage reference. No need to send other 
                   call to upload the file again because its uploaded already on FireStore.**
                }
            }
        });