App Completed

Basic Prototype App Completed. Proposal, Literature Review and Final
Report to Follow.
This commit is contained in:
Alexander Davis
2017-04-13 18:18:38 +01:00
parent 933a4acff6
commit 0018e82ee5
510 changed files with 86109 additions and 1315 deletions

View File

@@ -0,0 +1,121 @@
// clang-format off
/** @file FIRStorage.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorageConstants.h"
@class FIRApp;
@class FIRStorageReference;
NS_ASSUME_NONNULL_BEGIN
/** Project version string for FirebaseStorage. */
FOUNDATION_EXPORT const unsigned char *const FirebaseStorageVersionString;
/**
* FirebaseStorage is a service that supports uploading and downloading binary objects,
* such as images, videos, and other files to Google Cloud Storage.
*
* If you call [FIRStorage storage], the instance will initialize with the default FIRApp,
* [FIRApp defaultApp], and the storage location will come from the provided
* GoogleService-Info.plist.
*
* If you call [FIRStorage storageForApp:] and provide a custom instance of FIRApp,
* the storage location will be specified via the FIROptions#storageBucket property.
*/
@interface FIRStorage : NSObject
/**
* Creates an instance of FIRStorage, configured with the default FIRApp.
* @return the FIRStorage instance, initialized with the default FIRApp.
*/
+ (instancetype)storage NS_SWIFT_NAME(storage());
/**
* Creates an instance of FIRStorage, configured with the custom FIRApp @a app.
* @param app The custom FIRApp used for initialization.
* @return the FIRStorage instance, initialized with the custom FIRApp.
*/
+ (instancetype)storageForApp:(FIRApp *)app NS_SWIFT_NAME(storage(app:));
/**
* Creates an instance of FIRStorage, configured with a custom storage bucket @a url.
* @param url The gs:// url to your Firebase Storage Bucket.
* @return the FIRStorage instance, initialized with the custom FIRApp.
*/
+ (instancetype)storageWithURL:(NSString *)url NS_SWIFT_NAME(storage(url:));
/**
* Creates an instance of FIRStorage, configured with a custom FIRApp @a app and a custom storage
* bucket @a url.
* @param app The custom FIRApp used for initialization.
* @param url The gs:// url to your Firebase Storage Bucket.
* @return the FIRStorage instance, initialized with the custom FIRApp.
*/
+ (instancetype)storageForApp:(FIRApp *)app
URL:(NSString *)url NS_SWIFT_NAME(storage(app:url:));
/**
* The Firebase App associated with this Firebase Storage instance.
*/
@property(strong, nonatomic, readonly) FIRApp *app;
/**
* Maximum time in seconds to retry an upload if a failure occurs.
* Defaults to 10 minutes (600 seconds).
*/
@property NSTimeInterval maxUploadRetryTime;
/**
* Maximum time in seconds to retry a download if a failure occurs.
* Defaults to 10 minutes (600 seconds).
*/
@property NSTimeInterval maxDownloadRetryTime;
/**
* Maximum time in seconds to retry operations other than upload and download if a failure occurs.
* Defaults to 2 minutes (120 seconds).
*/
@property NSTimeInterval maxOperationRetryTime;
/**
* Queue that all developer callbacks are fired on. Defaults to the main queue.
*/
@property(strong, nonatomic) dispatch_queue_t callbackQueue;
/**
* Creates a FIRStorageReference initialized at the root Firebase Storage location.
* @return An instance of FIRStorageReference initialized at the root.
*/
- (FIRStorageReference *)reference;
/**
* Creates a FIRStorageReference given a gs:// or https:// URL pointing to a Firebase Storage
* location. For example, you can pass in an https:// download URL retrieved from
* [FIRStorageReference downloadURLWithCompletion] or the gs:// URI from
* [FIRStorageReference description].
* @param string A gs:// or https:// URL to initialize the reference with.
* @return An instance of FIRStorageReference at the given child path.
* @throws Throws an exception if passed in URL is not associated with the FIRApp used to initialize
* this FIRStorage.
*/
- (FIRStorageReference *)referenceForURL:(NSString *)string;
/**
* Creates a FIRStorageReference initialized at a child Firebase Storage location.
* @param string A relative path from the root to initialize the reference with,
* for instance @"path/to/object".
* @return An instance of FIRStorageReference at the given child path.
*/
- (FIRStorageReference *)referenceWithPath:(NSString *)string;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,159 @@
// clang-format off
/** @file FIRStorageConstants.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
@class FIRStorageDownloadTask;
@class FIRStorageMetadata;
@class FIRStorageTaskSnapshot;
@class FIRStorageUploadTask;
NS_ASSUME_NONNULL_BEGIN
/**
* NSString typedef representing a task listener handle.
*/
typedef NSString *FIRStorageHandle;
/**
* Block typedef typically used when downloading data.
* @param data The data returned by the download, or nil if no data available or download failed.
* @param error The error describing failure, if one occurred.
*/
typedef void (^FIRStorageVoidDataError)(NSData *_Nullable data, NSError *_Nullable error);
/**
* Block typedef typically used when performing "binary" async operations such as delete,
* where the operation either succeeds without an error or fails with an error.
* @param error The error describing failure, if one occurred.
*/
typedef void (^FIRStorageVoidError)(NSError *_Nullable error);
/**
* Block typedef typically used when retrieving metadata.
* @param metadata The metadata returned by the operation, if metadata exists.
*/
typedef void (^FIRStorageVoidMetadata)(FIRStorageMetadata *_Nullable metadata);
/**
* Block typedef typically used when retrieving metadata with the possibility of an error.
* @param metadata The metadata returned by the operation, if metadata exists.
* @param error The error describing failure, if one occurred.
*/
typedef void (^FIRStorageVoidMetadataError)(FIRStorageMetadata *_Nullable metadata,
NSError *_Nullable error);
/**
* Block typedef typically used to asynchronously return a storage task snapshot.
* @param snapshot The returned task snapshot.
*/
typedef void (^FIRStorageVoidSnapshot)(FIRStorageTaskSnapshot *snapshot);
/**
* Block typedef typically used when retrieving a download URL.
* @param URL The download URL associated with the operation.
* @param error The error describing failure, if one occurred.
*/
typedef void (^FIRStorageVoidURLError)(NSURL *_Nullable URL, NSError *_Nullable error);
/**
* Enum representing the upload and download task status.
*/
typedef NS_ENUM(NSInteger, FIRStorageTaskStatus) {
/**
* Unknown task status.
*/
FIRStorageTaskStatusUnknown,
/**
* Task is being resumed.
*/
FIRStorageTaskStatusResume,
/**
* Task reported a progress event.
*/
FIRStorageTaskStatusProgress,
/**
* Task is paused.
*/
FIRStorageTaskStatusPause,
/**
* Task has completed successfully.
*/
FIRStorageTaskStatusSuccess,
/**
* Task has failed and is unrecoverable.
*/
FIRStorageTaskStatusFailure
};
/**
* Firebase Storage error domain.
*/
FOUNDATION_EXPORT NSString *const FIRStorageErrorDomain;
/**
* Enum representing the errors raised by Firebase Storage.
*/
typedef NS_ENUM(NSInteger, FIRStorageErrorCode) {
/** An unknown error occurred. */
FIRStorageErrorCodeUnknown = -13000,
/** No object exists at the desired reference. */
FIRStorageErrorCodeObjectNotFound = -13010,
/** No bucket is configured for Firebase Storage. */
FIRStorageErrorCodeBucketNotFound = -13011,
/** No project is configured for Firebase Storage. */
FIRStorageErrorCodeProjectNotFound = -13012,
/**
* Quota on your Firebase Storage bucket has been exceeded.
* If you're on the free tier, upgrade to a paid plan.
* If you're on a paid plan, reach out to Firebase support.
*/
FIRStorageErrorCodeQuotaExceeded = -13013,
/** User is unauthenticated. Authenticate and try again. */
FIRStorageErrorCodeUnauthenticated = -13020,
/**
* User is not authorized to perform the desired action.
* Check your rules to ensure they are correct.
*/
FIRStorageErrorCodeUnauthorized = -13021,
/**
* The maximum time limit on an operation (upload, download, delete, etc.) has been exceeded.
* Try uploading again.
*/
FIRStorageErrorCodeRetryLimitExceeded = -13030,
/**
* File on the client does not match the checksum of the file received by the server.
* Try uploading again.
*/
FIRStorageErrorCodeNonMatchingChecksum = -13031,
/**
* Size of the downloaded file exceeds the amount of memory allocated for the download.
* Increase memory cap and try downloading again.
*/
FIRStorageErrorCodeDownloadSizeExceeded = -13032,
/** User cancelled the operation. */
FIRStorageErrorCodeCancelled = -13040
};
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,30 @@
// clang-format off
/** @file FIRStorageDownloadTask.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorageObservableTask.h"
NS_ASSUME_NONNULL_BEGIN
/**
* FIRStorageDownloadTask implements resumable downloads from an object in Firebase Storage.
* Downloads can be returned on completion with a completion handler, and can be monitored
* by attaching observers, or controlled by calling FIRStorageTask#pause, FIRStorageTask#resume,
* or FIRStorageTask#cancel.
* Downloads can currently be returned as NSData in memory, or as an NSURL to a file on disk.
* Downloads are performed on a background queue, and callbacks are raised on the developer
* specified callbackQueue in FIRStorage, or the main queue if left unspecified.
* Currently all uploads must be initiated and managed on the main queue.
*/
@interface FIRStorageDownloadTask : FIRStorageObservableTask<FIRStorageTaskManagement>
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,138 @@
// clang-format off
/** @file FIRStorageMetadata.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
@class FIRStorageReference;
NS_ASSUME_NONNULL_BEGIN
/**
* Class which represents the metadata on an object in Firebase Storage. This metadata is
* returned on successful operations, and can be used to retrieve download URLs, content types,
* and a FIRStorage reference to the object in question. Full documentation can be found at the GCS
* Objects#resource docs.
* @see https://cloud.google.com/storage/docs/json_api/v1/objects#resource
*/
@interface FIRStorageMetadata : NSObject<NSCopying>
/**
* The name of the bucket containing this object.
*/
@property(copy, nonatomic, readonly) NSString *bucket;
/**
* Cache-Control directive for the object data.
*/
@property(copy, nonatomic, nullable) NSString *cacheControl;
/**
* Content-Disposition of the object data.
*/
@property(copy, nonatomic, nullable) NSString *contentDisposition;
/**
* Content-Encoding of the object data.
*/
@property(copy, nonatomic, nullable) NSString *contentEncoding;
/**
* Content-Language of the object data.
*/
@property(copy, nonatomic, nullable) NSString *contentLanguage;
/**
* Content-Type of the object data.
*/
@property(copy, nonatomic, nullable) NSString *contentType;
/**
* The content generation of this object. Used for object versioning.
*/
@property(readonly) int64_t generation;
/**
* User-provided metadata, in key/value pairs.
*/
@property(copy, nonatomic, nullable) NSDictionary<NSString *, NSString *> *customMetadata;
/**
* The version of the metadata for this object at this generation. Used
* for preconditions and for detecting changes in metadata. A metageneration number is only
* meaningful in the context of a particular generation of a particular object.
*/
@property(readonly) int64_t metageneration;
/**
* The name of this object, in gs://bucket/path/to/object.txt, this is object.txt.
*/
@property(copy, nonatomic, readonly, nullable) NSString *name;
/**
* The full path of this object, in gs://bucket/path/to/object.txt, this is path/to/object.txt.
*/
@property(copy, nonatomic, readonly, nullable) NSString *path;
/**
* Content-Length of the data in bytes.
*/
@property(readonly) int64_t size;
/**
* The creation time of the object in RFC 3339 format.
*/
@property(copy, nonatomic, readonly, nullable) NSDate *timeCreated;
/**
* The modification time of the object metadata in RFC 3339 format.
*/
@property(copy, nonatomic, readonly, nullable) NSDate *updated;
/**
* A reference to the object in Firebase Storage.
*/
@property(strong, nonatomic, readonly, nullable) FIRStorageReference *storageReference;
/**
* An array containing all download URLs available for the object.
*/
@property(strong, nonatomic, readonly, nullable) NSArray<NSURL *> *downloadURLs;
/**
* Creates an instanece of FIRStorageMetadata from the contents of a dictionary.
* @return An instance of FIRStorageMetadata that represents the contents of a dictionary.
*/
- (nullable instancetype)initWithDictionary:(NSDictionary *)dictionary NS_DESIGNATED_INITIALIZER;
/**
* Creates an NSDictionary from the contents of the metadata.
* @return An NSDictionary that represents the contents of the metadata.
*/
- (NSDictionary *)dictionaryRepresentation;
/**
* Determines if the current metadata represents a "file".
*/
@property(readonly, getter=isFile) BOOL file;
/**
* Determines if the current metadata represents a "folder".
*/
@property(readonly, getter=isFolder) BOOL folder;
/**
* Retrieves a download URL for the given object, or nil if none exist.
* Note that if there are many valid download tokens, this will always return the first
* valid token created.
*/
- (nullable NSURL *)downloadURL;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,54 @@
// clang-format off
/** @file FIRStorageObservableTask.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import "FIRStorageTask.h"
NS_ASSUME_NONNULL_BEGIN
@class FIRStorageReference;
@class FIRStorageTaskSnapshot;
/**
* Extends FIRStorageTask to provide observable semantics such as adding and removing observers.
* Observers produce a FIRStorageHandle, which is used to keep track of and remove specific
* observers at a later date.
* This class is currently not thread safe and can only be called on the main thread.
*/
@interface FIRStorageObservableTask : FIRStorageTask
/**
* Observes changes in the upload status: Resume, Pause, Progress, Success, and Failure.
* @param status The FIRStorageTaskStatus change to observe.
* @param handler A callback that fires every time the status event occurs,
* returns a FIRStorageTaskSnapshot containing the state of the task.
* @return A task handle that can be used to remove the observer at a later date.
*/
- (FIRStorageHandle)observeStatus:(FIRStorageTaskStatus)status
handler:(void (^)(FIRStorageTaskSnapshot *snapshot))handler;
/**
* Removes the single observer with the provided handle.
* @param handle The handle of the task to remove.
*/
- (void)removeObserverWithHandle:(FIRStorageHandle)handle;
/**
* Removes all observers for a single status.
* @param status A FIRStorageTaskStatus to remove listeners for.
*/
- (void)removeAllObserversForStatus:(FIRStorageTaskStatus)status;
/**
* Removes all observers.
*/
- (void)removeAllObservers;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,228 @@
// clang-format off
/** @file FIRStorageReference.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorage.h"
#import "FIRStorageConstants.h"
#import "FIRStorageDownloadTask.h"
#import "FIRStorageMetadata.h"
#import "FIRStorageTask.h"
#import "FIRStorageUploadTask.h"
NS_ASSUME_NONNULL_BEGIN
/**
* FIRStorageReference represents a reference to a Google Cloud Storage object. Developers can
* upload and download objects, as well as get/set object metadata, and delete an object at the
* path.
* @see https://cloud.google.com/storage/
*/
@interface FIRStorageReference : NSObject
/**
* The FIRStorage service object which created this reference.
*/
@property(nonatomic, readonly) FIRStorage *storage;
/**
* The name of the Google Cloud Storage bucket associated with this reference,
* in gs://bucket/path/to/object.txt, the bucket would be: 'bucket'
*/
@property(nonatomic, readonly) NSString *bucket;
/**
* The full path to this object, not including the Google Cloud Storage bucket.
* In gs://bucket/path/to/object.txt, the full path would be: 'path/to/object.txt'
*/
@property(nonatomic, readonly) NSString *fullPath;
/**
* The short name of the object associated with this reference,
* in gs://bucket/path/to/object.txt, the name of the object would be: 'object.txt'
*/
@property(nonatomic, readonly) NSString *name;
#pragma mark - Path Operations
/**
* Creates a new FIRStorageReference pointing to the root object.
* @return A new FIRStorageReference pointing to the root object.
*/
- (FIRStorageReference *)root;
/**
* Creates a new FIRStorageReference pointing to the parent of the current reference
* or nil if this instance references the root location.
* For example:
* path = foo/bar/baz parent = foo/bar
* path = foo parent = (root)
* path = (root) parent = nil
* @return A new FIRStorageReference pointing to the parent of the current reference.
*/
- (nullable FIRStorageReference *)parent;
/**
* Creates a new FIRStorageReference pointing to a child object of the current reference.
* path = foo child = bar newPath = foo/bar
* path = foo/bar child = baz newPath = foo/bar/baz
* All leading and trailing slashes will be removed, and consecutive slashes will be
* compressed to single slashes. For example:
* child = /foo/bar newPath = foo/bar
* child = foo/bar/ newPath = foo/bar
* child = foo///bar newPath = foo/bar
* @param path Path to append to the current path.
* @return A new FIRStorageReference pointing to a child location of the current reference.
*/
- (FIRStorageReference *)child:(NSString *)path;
#pragma mark - Uploads
/**
* Asynchronously uploads data to the currently specified FIRStorageReference,
* without additional metadata.
* This is not recommended for large files, and one should instead upload a file from disk.
* @param uploadData The NSData to upload.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putData:(NSData *)uploadData;
/**
* Asynchronously uploads data to the currently specified FIRStorageReference.
* This is not recommended for large files, and one should instead upload a file from disk.
* @param uploadData The NSData to upload.
* @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
* about the object being uploaded.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putData:(NSData *)uploadData
metadata:(nullable FIRStorageMetadata *)metadata;
/**
* Asynchronously uploads data to the currently specified FIRStorageReference.
* This is not recommended for large files, and one should instead upload a file from disk.
* @param uploadData The NSData to upload.
* @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
* about the object being uploaded.
* @param completion A completion block that either returns the object metadata on success,
* or an error on failure.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putData:(NSData *)uploadData
metadata:(nullable FIRStorageMetadata *)metadata
completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
NSError *_Nullable error))completion;
/**
* Asynchronously uploads a file to the currently specified FIRStorageReference,
* without additional metadata.
* @param fileURL A URL representing the system file path of the object to be uploaded.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL;
/**
* Asynchronously uploads a file to the currently specified FIRStorageReference.
* @param fileURL A URL representing the system file path of the object to be uploaded.
* @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
* about the object being uploaded.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL metadata:(nullable FIRStorageMetadata *)metadata;
/**
* Asynchronously uploads a file to the currently specified FIRStorageReference.
* @param fileURL A URL representing the system file path of the object to be uploaded.
* @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
* about the object being uploaded.
* @param completion A completion block that either returns the object metadata on success,
* or an error on failure.
* @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
*/
- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL
metadata:(nullable FIRStorageMetadata *)metadata
completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
NSError *_Nullable error))completion;
#pragma mark - Downloads
/**
* Asynchronously downloads the object at the FIRStorageReference to an NSData object in memory.
* An NSData of the provided max size will be allocated, so ensure that the device has enough free
* memory to complete the download. For downloading large files, writeToFile may be a better option.
* @param size The maximum size in bytes to download. If the download exceeds this size
* the task will be cancelled and an error will be returned.
* @param completion A completion block that either returns the object data on success,
* or an error on failure.
* @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
*/
- (FIRStorageDownloadTask *)dataWithMaxSize:(int64_t)size
completion:(void (^)(NSData *_Nullable data,
NSError *_Nullable error))completion;
/**
* Asynchronously retrieves a long lived download URL with a revokable token.
* This can be used to share the file with others, but can be revoked by a developer
* in the Firebase Console if desired.
* @param completion A completion block that either returns the URL on success,
* or an error on failure.
*/
- (void)downloadURLWithCompletion:(void (^)(NSURL *_Nullable URL,
NSError *_Nullable error))completion;
/**
* Asynchronously downloads the object at the current path to a specified system filepath.
* @param fileURL A file system URL representing the path the object should be downloaded to.
* @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
*/
- (FIRStorageDownloadTask *)writeToFile:(NSURL *)fileURL;
/**
* Asynchronously downloads the object at the current path to a specified system filepath.
* @param fileURL A file system URL representing the path the object should be downloaded to.
* @param completion A completion block that fires when the file download completes.
* Returns an NSURL pointing to the file path of the downloaded file on success,
* or an error on failure.
* @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
*/
- (FIRStorageDownloadTask *)writeToFile:(NSURL *)fileURL
completion:(nullable void (^)(NSURL *_Nullable URL,
NSError *_Nullable error))completion;
#pragma mark - Metadata Operations
/**
* Retrieves metadata associated with an object at the current path.
* @param completion A completion block which returns the object metadata on success,
* or an error on failure.
*/
- (void)metadataWithCompletion:(void (^)(FIRStorageMetadata *_Nullable metadata,
NSError *_Nullable error))completion;
/**
* Updates the metadata associated with an object at the current path.
* @param metadata An FIRStorageMetadata object with the metadata to update.
* @param completion A completion block which returns the FIRStorageMetadata on success,
* or an error on failure.
*/
- (void)updateMetadata:(FIRStorageMetadata *)metadata
completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
NSError *_Nullable error))completion;
#pragma mark - Delete
/**
* Deletes the object at the current path.
* @param completion A completion block which returns nil on success, or an error on failure.
*/
- (void)deleteWithCompletion:(nullable void (^)(NSError *_Nullable error))completion;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,66 @@
// clang-format off
/** @file FIRStorageTask.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorageConstants.h"
#import "FIRStorageMetadata.h"
NS_ASSUME_NONNULL_BEGIN
/**
* A superclass to all FIRStorage*Tasks, including FIRStorageUploadTask
* and FIRStorageDownloadTask, to provide state transitions, event raising, and common storage
* or metadata and errors.
* Callbacks are always fired on the developer specified callback queue.
* If no queue is specified by the developer, it defaults to the main queue.
* Currently not thread safe, so only call methods on the main thread.
*/
@interface FIRStorageTask : NSObject
/**
* An immutable view of the task and associated metadata, progress, error, etc.
*/
@property(strong, readonly, nonatomic, nonnull) FIRStorageTaskSnapshot *snapshot;
@end
/**
* Defines task operations such as pause, resume, cancel, and enqueue for all tasks.
* All tasks are required to implement enqueue, which begins the task, and may optionally
* implement pause, resume, and cancel, which operate on the task to pause, resume, and cancel
* operations.
*/
@protocol FIRStorageTaskManagement<NSObject>
@required
/**
* Prepares a task and begins execution.
*/
- (void)enqueue;
@optional
/**
* Pauses a task currently in progress.
*/
- (void)pause;
/**
* Cancels a task currently in progress.
*/
- (void)cancel;
/**
* Resumes a task that is paused.
*/
- (void)resume;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,59 @@
// clang-format off
/** @file FIRStorageTaskSnapshot.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorageConstants.h"
NS_ASSUME_NONNULL_BEGIN
@class FIRStorageMetadata;
@class FIRStorageReference;
@class FIRStorageTask;
/**
* FIRStorageTaskSnapshot represents an immutable view of a task.
* A Snapshot contains a task, storage reference, metadata (if it exists),
* progress, and an error (if one occurred).
*/
@interface FIRStorageTaskSnapshot : NSObject
/**
* Subclass of FIRStorageTask this snapshot represents.
*/
@property(readonly, copy, nonatomic) __kindof FIRStorageTask *task;
/**
* Metadata returned by the task, or nil if no metadata returned.
*/
@property(readonly, copy, nonatomic, nullable) FIRStorageMetadata *metadata;
/**
* FIRStorageReference this task is operates on.
*/
@property(readonly, copy, nonatomic) FIRStorageReference *reference;
/**
* NSProgress object which tracks the progess of an upload or download.
*/
@property(readonly, strong, nonatomic, nullable) NSProgress *progress;
/**
* Error during task execution, or nil if no error occurred.
*/
@property(readonly, copy, nonatomic, nullable) NSError *error;
/**
* Status of the task.
*/
@property(readonly, nonatomic) FIRStorageTaskStatus status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,30 @@
// clang-format off
/** @file FIRStorageUploadTask.h
@brief Firebase SDK
@copyright Copyright 2016 Google Inc.
@remarks Use of this SDK is subject to the Google APIs Terms of Service:
https://developers.google.com/terms/
*/
// clang-format on
#import <Foundation/Foundation.h>
#import "FIRStorageObservableTask.h"
NS_ASSUME_NONNULL_BEGIN
/**
* FIRStorageUploadTask implements resumable uploads to a file in Firebase Storage.
* Uploads can be returned on completion with a completion callback, and can be monitored
* by attaching observers, or controlled by calling FIRStorageTask#pause, FIRStorageTask#resume,
* or FIRStorageTask#cancel.
* Uploads can take NSData in memory, or an NSURL to a file on disk.
* Uploads are performed on a background queue, and callbacks are raised on the developer
* specified callbackQueue in FIRStorage, or the main queue if left unspecified.
* Currently all uploads must be initiated and managed on the main queue.
*/
@interface FIRStorageUploadTask : FIRStorageObservableTask<FIRStorageTaskManagement>
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,9 @@
#import "FIRStorage.h"
#import "FIRStorageConstants.h"
#import "FIRStorageDownloadTask.h"
#import "FIRStorageMetadata.h"
#import "FIRStorageObservableTask.h"
#import "FIRStorageReference.h"
#import "FIRStorageTask.h"
#import "FIRStorageTaskSnapshot.h"
#import "FIRStorageUploadTask.h"

View File

@@ -0,0 +1,12 @@
framework module FirebaseStorage {
umbrella header "FirebaseStorage.h"
export *
module * { export *}
link "c++"
link "z"
link framework "CoreGraphics"
link framework "Foundation"
link framework "MobileCoreServices"
link framework "Security"
link framework "UIKit"
}