|
25 | 25 | #include "storage/src/android/controller_android.h" |
26 | 26 | #include "storage/src/android/metadata_android.h" |
27 | 27 | #include "storage/src/android/storage_android.h" |
| 28 | +#include "storage/src/common/list_result_internal.h" |
28 | 29 | #include "storage/src/include/firebase/storage.h" |
29 | 30 | #include "storage/src/include/firebase/storage/common.h" |
30 | 31 | #include "storage/storage_resources.h" |
@@ -129,12 +130,14 @@ enum StorageReferenceFn { |
129 | 130 | bool StorageReferenceInternal::Initialize(App* app) { |
130 | 131 | JNIEnv* env = app->GetJNIEnv(); |
131 | 132 | jobject activity = app->activity(); |
132 | | - return storage_reference::CacheMethodIds(env, activity); |
| 133 | + return storage_reference::CacheMethodIds(env, activity) && |
| 134 | + list_result::CacheMethodIds(env, activity); |
133 | 135 | } |
134 | 136 |
|
135 | 137 | void StorageReferenceInternal::Terminate(App* app) { |
136 | 138 | JNIEnv* env = app->GetJNIEnv(); |
137 | 139 | storage_reference::ReleaseClass(env); |
| 140 | + list_result::ReleaseClass(env); |
138 | 141 | util::CheckAndClearJniExceptions(env); |
139 | 142 | } |
140 | 143 |
|
@@ -631,13 +634,12 @@ Future<StorageListResult> StorageReferenceInternal::List( |
631 | 634 | future_impl->Complete(handle, kErrorUnknown, "Call to list() failed."); |
632 | 635 | } else { |
633 | 636 | util::RegisterCallbackOnTask( |
634 | | - env, task, |
635 | | - reinterpret_cast<util::TaskFinishedCallback>( |
636 | | - StorageReferenceInternal::FutureCallback), |
637 | | - new FutureCallbackData(handle, future_impl, storage_, |
638 | | - kStorageReferenceFnList), |
639 | | - storage_resources::GetClass(storage_resources::kApiExecutor)); |
| 637 | + env, task, FutureCallback, |
| 638 | + reinterpret_cast<void*>(new FutureCallbackData( |
| 639 | + handle, future_impl, storage_, kStorageReferenceFnList)), |
| 640 | + storage_->jni_task_id()); |
640 | 641 | } |
| 642 | + util::CheckAndClearJniExceptions(env); |
641 | 643 | env->DeleteLocalRef(task); |
642 | 644 |
|
643 | 645 | return ListLastResult(); |
|
0 commit comments