From 835083e870b20a7a999b49e5ed3f57c0dc442e89 Mon Sep 17 00:00:00 2001 From: Corey Date: Thu, 22 Jun 2023 15:13:24 -0400 Subject: [PATCH] fix: hydrateUser() should not replace the options passed in (#121) --- CHANGELOG.md | 8 +++++++- Sources/ParseSwift/ParseConstants.swift | 2 +- .../ParseSwift/Protocols/ParseHookRequestable.swift | 11 +++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 935040ca2..9d634f158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,15 @@ # Parse-Swift Changelog ### main -[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.7.3...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift) +[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.7.4...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift) * _Contributing to this repo? Add info about your change here to be included in the next release_ +### 5.7.4 +[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.7.3...5.7.4), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.7.4/documentation/parseswift) + +__Fixes__ +* hydrateUser() should not replace the options passed in ([#121](https://github.com/netreconlab/Parse-Swift/pull/121)), thanks to [Corey Baker](https://github.com/cbaker6). + ### 5.7.3 [Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.7.2...5.7.3), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.7.3/documentation/parseswift) diff --git a/Sources/ParseSwift/ParseConstants.swift b/Sources/ParseSwift/ParseConstants.swift index 25bf3dcba..197af44f8 100644 --- a/Sources/ParseSwift/ParseConstants.swift +++ b/Sources/ParseSwift/ParseConstants.swift @@ -10,7 +10,7 @@ import Foundation enum ParseConstants { static let sdk = "swift" - static let version = "5.7.3" + static let version = "5.7.4" static let fileManagementDirectory = "parse/" static let fileManagementPrivateDocumentsDirectory = "Private Documents/" static let fileManagementLibraryDirectory = "Library/" diff --git a/Sources/ParseSwift/Protocols/ParseHookRequestable.swift b/Sources/ParseSwift/Protocols/ParseHookRequestable.swift index 7037e2da9..fc3d60d32 100644 --- a/Sources/ParseSwift/Protocols/ParseHookRequestable.swift +++ b/Sources/ParseSwift/Protocols/ParseHookRequestable.swift @@ -52,13 +52,13 @@ extension ParseHookRequestable { if let primaryKey = primaryKey, primaryKey { options.insert(.usePrimaryKey) - } else if let sessionToken = user?.sessionToken { - options.insert(.sessionToken(sessionToken)) + } else { + if let sessionToken = user?.sessionToken { + options.insert(.sessionToken(sessionToken)) + } if let installationId = installationId { options.insert(.installationId(installationId)) } - } else if let installationId = installationId { - options.insert(.installationId(installationId)) } return options } @@ -83,8 +83,7 @@ extension ParseHookRequestable { } let request = self var updatedOptions = self.options() - updatedOptions.insert(.cachePolicy(.reloadIgnoringLocalCacheData)) - options.forEach { updatedOptions.insert($0) } + updatedOptions = options.union(updatedOptions) user.fetch(options: updatedOptions, callbackQueue: callbackQueue) { result in switch result {