FIRStorageTask_Private.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 "FirebaseStorage/Sources/Public/FirebaseStorage/FIRStorageReference.h"
  17. #import "FirebaseStorage/Sources/Public/FirebaseStorage/FIRStorageTaskSnapshot.h"
  18. #import "FirebaseStorage/Sources/FIRStorageConstants_Private.h"
  19. #import "FirebaseStorage/Sources/FIRStorageErrors.h"
  20. #import "FirebaseStorage/Sources/FIRStorageReference_Private.h"
  21. #import "FirebaseStorage/Sources/FIRStorageTaskSnapshot_Private.h"
  22. #import "FirebaseStorage/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 FIRStorageTask ()
  31. /**
  32. * State for the current task in progress.
  33. */
  34. @property(atomic) FIRStorageTaskState state;
  35. /**
  36. * FIRStorageMetadata for the task in progress, or nil if none present.
  37. */
  38. @property(strong, nonatomic, nullable) FIRStorageMetadata *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 progess 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) FIRStorageReference *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) FIRStorageTaskSnapshot *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 FIRStorageTask initialized with a FIRStorageReference and GTMSessionFetcherService.
  63. * @param reference A FIRStorageReference the task will be performed on.
  64. * @param service A GTMSessionFetcherService which provides the fetchers and configuration for
  65. * requests.
  66. * @param queue The shared queue to use for all Storage operations.
  67. * @return A new FIRStorageTask representing the current task.
  68. */
  69. - (instancetype)initWithReference:(FIRStorageReference *)reference
  70. fetcherService:(GTMSessionFetcherService *)service
  71. dispatchQueue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;
  72. /** Dispatches a block on the shared Storage queue. */
  73. - (void)dispatchAsync:(void (^)(void))block;
  74. @end
  75. NS_ASSUME_NONNULL_END