Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Fixing LiveQuery Parse Server error for empty "where" property. #197

Merged
merged 3 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions Sources/ParseLiveQuery/Internal/QueryEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand All @@ -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?
Expand All @@ -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
Expand Down