-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: async save/create/update/replace use async/await deep save (#418)
* decode bad encoded errors from server * ParseObject uses async/await deep save * fix: async save/create/update/replace use async/await deep save * refactor batchCommand * add deep save async/await tests
- Loading branch information
Showing
15 changed files
with
1,707 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// API+Command+async.swift | ||
// ParseSwift | ||
// | ||
// Created by Corey Baker on 9/17/22. | ||
// Copyright © 2022 Parse Community. All rights reserved. | ||
// | ||
|
||
#if compiler(>=5.5.2) && canImport(_Concurrency) | ||
import Foundation | ||
#if canImport(FoundationNetworking) | ||
import FoundationNetworking | ||
#endif | ||
|
||
internal extension API.Command { | ||
// MARK: Asynchronous Execution | ||
func executeAsync(options: API.Options, | ||
callbackQueue: DispatchQueue, | ||
notificationQueue: DispatchQueue? = nil, | ||
childObjects: [String: PointerType]? = nil, | ||
childFiles: [UUID: ParseFile]? = nil, | ||
uploadProgress: ((URLSessionTask, Int64, Int64, Int64) -> Void)? = nil, | ||
// swiftlint:disable:next line_length | ||
downloadProgress: ((URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? = nil) async throws -> U { | ||
try await withCheckedThrowingContinuation { continuation in | ||
self.executeAsync(options: options, | ||
callbackQueue: callbackQueue, | ||
notificationQueue: notificationQueue, | ||
childObjects: childObjects, | ||
childFiles: childFiles, | ||
uploadProgress: uploadProgress, | ||
downloadProgress: downloadProgress, | ||
completion: continuation.resume) | ||
} | ||
} | ||
} | ||
#endif |
26 changes: 26 additions & 0 deletions
26
Sources/ParseSwift/API/API+NonParseBodyCommand+async.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// API+NonParseBodyCommand+async.swift | ||
// ParseSwift | ||
// | ||
// Created by Corey Baker on 9/17/22. | ||
// Copyright © 2022 Parse Community. All rights reserved. | ||
// | ||
|
||
#if compiler(>=5.5.2) && canImport(_Concurrency) | ||
import Foundation | ||
#if canImport(FoundationNetworking) | ||
import FoundationNetworking | ||
#endif | ||
|
||
extension API.NonParseBodyCommand { | ||
// MARK: Asynchronous Execution | ||
func executeAsync(options: API.Options, | ||
callbackQueue: DispatchQueue) async throws -> U { | ||
try await withCheckedThrowingContinuation { continuation in | ||
self.executeAsync(options: options, | ||
callbackQueue: callbackQueue, | ||
completion: continuation.resume) | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.