FIRStorageTask_Private.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FirebaseStorageInternal/Sources/Public/FirebaseStorageInternal/FIRStorageReference.h"
  17. #import "FirebaseStorageInternal/Sources/Public/FirebaseStorageInternal/FIRStorageTaskSnapshot.h"
  18. #import "FirebaseStorageInternal/Sources/FIRStorageConstants_Private.h"
  19. #import "FirebaseStorageInternal/Sources/FIRStorageErrors.h"
  20. #import "FirebaseStorageInternal/Sources/FIRStorageReference_Private.h"
  21. #import "FirebaseStorageInternal/Sources/FIRStorageTaskSnapshot_Private.h"
  22. #import "FirebaseStorageInternal/Sources/FIRStorageUtils.h"
  23. #if SWIFT_PACKAGE
  24. @import GTMSessionFetcherCore;
  25. #else
  26. #import <GTMSessionFetcher/GTMSessionFetcher.h>
  27. #import <GTMSessionFetcher/GTMSessionFetcherService.h>
  28. #endif
  29. NS_ASSUME_NONNULL_BEGIN
  30. @interface FIRIMPLStorageTask ()
  31. /**
  32. * State for the current task in progress.
  33. */
  34. @property(atomic) FIRIMPLStorageTaskState state;
  35. /**
  36. * FIRIMPLStorageMetadata for the task in progress, or nil if none present.
  37. */
  38. @property(strong, nonatomic, nullable) FIRIMPLStorageMetadata *metadata;
  39. /**
  40. * Error which occurred during task execution, or nil if no error occurred.
  41. */
  42. @property(strong, nonatomic, nullable) NSError *error;
  43. /**
  44. * NSProgress object which tracks the progress of an observable task.
  45. */
  46. @property(strong, nonatomic) NSProgress *progress;
  47. /**
  48. * Reference pointing to the location the task is being performed against.
  49. */
  50. @property(strong, nonatomic) FIRIMPLStorageReference *reference;
  51. /**
  52. * A serial queue for all storage operations.
  53. */
  54. @property(nonatomic, readonly) dispatch_queue_t dispatchQueue;
  55. @property(strong, readwrite, nonatomic, nonnull) FIRIMPLStorageTaskSnapshot *snapshot;
  56. @property(readonly, copy, nonatomic) NSURLRequest *baseRequest;
  57. @property(strong, atomic) GTMSessionFetcher *fetcher;
  58. @property(readonly, nonatomic) GTMSessionFetcherService *fetcherService;
  59. @property(readonly, copy) GTMSessionFetcherCompletionHandler fetcherCompletion;
  60. - (instancetype)init NS_UNAVAILABLE;
  61. /**
  62. * Creates a new FIRIMPLStorageTask initialized with a FIRIMPLStorageReference and
  63. * GTMSessionFetcherService.
  64. * @param reference A FIRIMPLStorageReference the task will be performed on.
  65. * @param service A GTMSessionFetcherService which provides the fetchers and configuration for
  66. * requests.
  67. * @param queue The shared queue to use for all Storage operations.
  68. * @return A new FIRIMPLStorageTask representing the current task.
  69. */
  70. - (instancetype)initWithReference:(FIRIMPLStorageReference *)reference
  71. fetcherService:(GTMSessionFetcherService *)service
  72. dispatchQueue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;
  73. /** Dispatches a block on the shared Storage queue. */
  74. - (void)dispatchAsync:(void (^)(void))block;
  75. @end
  76. NS_ASSUME_NONNULL_END