diff --git a/Sources/ParseSwift/Types/ParseConfigCodable+combine.swift b/Sources/ParseSwift/Types/ParseConfigCodable+combine.swift index c0f054c3d..d04fe304c 100644 --- a/Sources/ParseSwift/Types/ParseConfigCodable+combine.swift +++ b/Sources/ParseSwift/Types/ParseConfigCodable+combine.swift @@ -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) @@ -36,12 +37,14 @@ public extension ParseConfigCodable { */ static func savePublisher(_ config: [String: V], options: API.Options = []) -> Future { + Future { promise in Self.save(config, options: options, completion: promise) } } + } #endif diff --git a/Sources/ParseSwift/Types/ParseConfigCodable.swift b/Sources/ParseSwift/Types/ParseConfigCodable.swift index d8b7812d0..18a078e7a 100644 --- a/Sources/ParseSwift/Types/ParseConfigCodable.swift +++ b/Sources/ParseSwift/Types/ParseConfigCodable.swift @@ -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)) @@ -72,6 +73,7 @@ extension ParseConfigCodable { options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result) -> Void) { + Task { var options = options options.insert(.usePrimaryKey) @@ -85,6 +87,7 @@ extension ParseConfigCodable { // swiftlint:disable:next line_length internal static func updateCommand(_ config: [String: V]) async -> API.NonParseBodyCommand, Bool> { + let body = ConfigCodableUpdateBody(params: config) return API.NonParseBodyCommand(method: .PUT, // MARK: Should be switched to ".PATCH" when server supports PATCH. path: .config, @@ -160,6 +163,7 @@ extension ParseConfigCodable { currentContainer?.currentConfig = current await Self.setCurrentContainer(currentContainer) } + } struct CurrentConfigDictionaryContainer: Codable { diff --git a/Tests/ParseSwiftTests/ParseConfigCodableTests.swift b/Tests/ParseSwiftTests/ParseConfigCodableTests.swift index 473ce5a40..f12219aa6 100644 --- a/Tests/ParseSwiftTests/ParseConfigCodableTests.swift +++ b/Tests/ParseSwiftTests/ParseConfigCodableTests.swift @@ -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()