Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaker6 committed Mar 10, 2023
1 parent 9b9fea1 commit a25261b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/ParseSwift/Types/ParseConfigCodable+combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public extension ParseConfigCodable {
desires a different policy, it should be inserted in `options`.
*/
static func fetchPublisher(options: API.Options = []) -> Future<[String: V], ParseError> {

Future { promise in
Self.fetch(options: options,
completion: promise)
Expand All @@ -36,12 +37,14 @@ public extension ParseConfigCodable {
*/
static func savePublisher(_ config: [String: V],
options: API.Options = []) -> Future<Bool, ParseError> {

Future { promise in
Self.save(config,
options: options,
completion: promise)
}
}

}

#endif
4 changes: 4 additions & 0 deletions Sources/ParseSwift/Types/ParseConfigCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extension ParseConfigCodable {
public static func fetch(options: API.Options = [],
callbackQueue: DispatchQueue = .main,
completion: @escaping (Result<[String: V], ParseError>) -> Void) {

Task {
var options = options
options.insert(.cachePolicy(.reloadIgnoringLocalCacheData))
Expand Down Expand Up @@ -72,6 +73,7 @@ extension ParseConfigCodable {
options: API.Options = [],
callbackQueue: DispatchQueue = .main,
completion: @escaping (Result<Bool, ParseError>) -> Void) {

Task {
var options = options
options.insert(.usePrimaryKey)
Expand All @@ -85,6 +87,7 @@ extension ParseConfigCodable {

// swiftlint:disable:next line_length
internal static func updateCommand(_ config: [String: V]) async -> API.NonParseBodyCommand<ConfigCodableUpdateBody<[String: V]>, Bool> {

let body = ConfigCodableUpdateBody(params: config)
return API.NonParseBodyCommand(method: .PUT, // MARK: Should be switched to ".PATCH" when server supports PATCH.
path: .config,
Expand Down Expand Up @@ -160,6 +163,7 @@ extension ParseConfigCodable {
currentContainer?.currentConfig = current
await Self.setCurrentContainer(currentContainer)
}

}

struct CurrentConfigDictionaryContainer<T: Codable>: Codable {
Expand Down
1 change: 1 addition & 0 deletions Tests/ParseSwiftTests/ParseConfigCodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class ParseConfigCodableTests: XCTestCase { // swiftlint:disable:this type_body_
return nil
}
}

try await User.logout()
do {
_ = try await ParseConfigCodable<[String: AnyCodable]>.current()
Expand Down

0 comments on commit a25261b

Please sign in to comment.