diff --git a/CHANGELOG.md b/CHANGELOG.md index f01c3103..f669e89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ [Full Changelog](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/compare/2.5.0...2.6.0) -- Added `@objc` to compile with objective-c. Thanks to [Junya Yamaguchi](https://github.com/junya100) [(#184)](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/184) -- Encode Date object with `__type: Date`. Thanks to [anafang](https://github.com/ananfang) [#186](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/186) +- Fixed issue where no "where" property sent when no constraints where added to a query. This is required by the LiveQuery protocol. +- Support for .or queries. Fixes #156, #47, and #85. Allows orQuery to be encoded without throwing. Thanks to [dblythy](https://github.com/dblythy) +- Added @objc to compile with objective-c . Thanks to [Junya Yamaguchi](https://github.com/junya100) [(#184)](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/184) +- Encode Date object with __type: Date. Thanks to [anafang](https://github.com/ananfang) [#186](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/186) ### 2.5.0 diff --git a/Sources/ParseLiveQuery/Internal/QueryEncoder.swift b/Sources/ParseLiveQuery/Internal/QueryEncoder.swift index 885eb8fd..a59c7b14 100644 --- a/Sources/ParseLiveQuery/Internal/QueryEncoder.swift +++ b/Sources/ParseLiveQuery/Internal/QueryEncoder.swift @@ -20,8 +20,10 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject { if let className = queryState?.value(forKey: "parseClassName") { self["className"] = className as? Value } - if let conditions: [String:AnyObject] = queryState?.value(forKey: "conditions") as? [String:AnyObject] { + if let conditions = queryState?.value(forKey: "conditions") as? [String:AnyObject] { self["where"] = conditions.encodedQueryDictionary as? Value + } else { + self["where"] = [:] as? Value } } } @@ -30,7 +32,7 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject { var encodedQueryDictionary: Dictionary { var encodedQueryDictionary = Dictionary() for (key, val) in self { - if let array = val as? [PFQuery] { + if let array = val as? [PFQuery] { var queries:[Value] = [] for query in array { let queryState = query.value(forKey: "state") as AnyObject? @@ -39,8 +41,7 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject { } } encodedQueryDictionary[key] = queries as? Value - } - else if let dict = val as? [String:AnyObject] { + } else if let dict = val as? [String:AnyObject] { encodedQueryDictionary[key] = dict.encodedQueryDictionary as? Value } else if let geoPoint = val as? PFGeoPoint { encodedQueryDictionary[key] = geoPoint.encodedDictionary as? Value