Skip to content

Commit

Permalink
Add sending to async Storage APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
morganchen12 committed Jan 8, 2025
1 parent 0d885d2 commit 12c52b9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions FirebaseStorage/Sources/AsyncAwait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public extension StorageReference {
/// the task will be cancelled and an error will be thrown.
/// - Throws: An error if the operation failed, for example if the data exceeded `maxSize`.
/// - Returns: Data object.
func data(maxSize: Int64) async throws -> Data {
func data(maxSize: Int64) async throws -> sending Data {

Check failure on line 29 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 29 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
return try await withCheckedThrowingContinuation { continuation in
_ = self.getData(maxSize: maxSize) { result in
continuation.resume(with: result)
Expand All @@ -48,7 +48,7 @@ public extension StorageReference {
/// - Returns: StorageMetadata with additional information about the object being uploaded.
func putDataAsync(_ uploadData: Data,
metadata: StorageMetadata? = nil,
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending StorageMetadata {

Check failure on line 51 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 51 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
self.putData(uploadData, metadata: metadata) { result in
Expand Down Expand Up @@ -86,7 +86,7 @@ public extension StorageReference {
/// - Returns: `StorageMetadata` with additional information about the object being uploaded.
func putFileAsync(from url: URL,
metadata: StorageMetadata? = nil,
onProgress: ((Progress?) -> Void)? = nil) async throws -> StorageMetadata {
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending StorageMetadata {

Check failure on line 89 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 89 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
self.putFile(from: url, metadata: metadata) { result in
Expand Down Expand Up @@ -121,7 +121,7 @@ public extension StorageReference {
/// or `fileURL` did not reference a valid path on disk.
/// - Returns: A `URL` pointing to the file path of the downloaded file.
func writeAsync(toFile fileURL: URL,
onProgress: ((Progress?) -> Void)? = nil) async throws -> URL {
onProgress: ((Progress?) -> Void)? = nil) async throws -> sending URL {

Check failure on line 124 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 124 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
guard let onProgress = onProgress else {
return try await withCheckedThrowingContinuation { continuation in
_ = self.write(toFile: fileURL) { result in
Expand Down Expand Up @@ -160,7 +160,7 @@ public extension StorageReference {
/// - Throws: An error if the operation failed, for example if Storage was unreachable
/// or the storage reference referenced an invalid path.
/// - Returns: A `StorageListResult` containing the contents of the storage reference.
func list(maxResults: Int64) async throws -> StorageListResult {
func list(maxResults: Int64) async throws -> sending StorageListResult {

Check failure on line 163 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

consecutive declarations on a line must be separated by ';'

Check failure on line 163 in FirebaseStorage/Sources/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / spm (macos-14, Xcode_15.4, iOS)

expected declaration
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
self.list(maxResults: maxResults) { result in
Expand All @@ -186,7 +186,7 @@ public extension StorageReference {
/// or the storage reference referenced an invalid path.
/// - Returns:
/// - completion A `Result` enum with either the list or an `Error`.
func list(maxResults: Int64, pageToken: String) async throws -> StorageListResult {
func list(maxResults: Int64, pageToken: String) async throws -> sending StorageListResult {
typealias ListContinuation = CheckedContinuation<StorageListResult, Error>
return try await withCheckedThrowingContinuation { (continuation: ListContinuation) in
self.list(maxResults: maxResults, pageToken: pageToken) { result in
Expand Down

0 comments on commit 12c52b9

Please sign in to comment.