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

Commit 71b2a69

Browse files
authored
Merge pull request #197 from noobs2ninjas/master
Fixing LiveQuery Parse Server error for empty "where" property.
2 parents b6888eb + ea5bf7e commit 71b2a69

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88

99
[Full Changelog](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/compare/2.5.0...2.6.0)
1010

11-
- 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)
12-
- Encode Date object with `__type: Date`. Thanks to [anafang](https://github.com/ananfang) [#186](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/186)
11+
- Fixed issue where no "where" property sent when no constraints where added to a query. This is required by the LiveQuery protocol.
12+
- Support for .or queries. Fixes #156, #47, and #85. Allows orQuery to be encoded without throwing. Thanks to [dblythy](https://github.com/dblythy)
13+
- 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)
14+
- Encode Date object with __type: Date. Thanks to [anafang](https://github.com/ananfang) [#186](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/186)
1315

1416
### 2.5.0
1517

Sources/ParseLiveQuery/Internal/QueryEncoder.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
2020
if let className = queryState?.value(forKey: "parseClassName") {
2121
self["className"] = className as? Value
2222
}
23-
if let conditions: [String:AnyObject] = queryState?.value(forKey: "conditions") as? [String:AnyObject] {
23+
if let conditions = queryState?.value(forKey: "conditions") as? [String:AnyObject] {
2424
self["where"] = conditions.encodedQueryDictionary as? Value
25+
} else {
26+
self["where"] = [:] as? Value
2527
}
2628
}
2729
}
@@ -30,7 +32,7 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
3032
var encodedQueryDictionary: Dictionary {
3133
var encodedQueryDictionary = Dictionary()
3234
for (key, val) in self {
33-
if let array = val as? [PFQuery] {
35+
if let array = val as? [PFQuery] {
3436
var queries:[Value] = []
3537
for query in array {
3638
let queryState = query.value(forKey: "state") as AnyObject?
@@ -39,8 +41,7 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
3941
}
4042
}
4143
encodedQueryDictionary[key] = queries as? Value
42-
}
43-
else if let dict = val as? [String:AnyObject] {
44+
} else if let dict = val as? [String:AnyObject] {
4445
encodedQueryDictionary[key] = dict.encodedQueryDictionary as? Value
4546
} else if let geoPoint = val as? PFGeoPoint {
4647
encodedQueryDictionary[key] = geoPoint.encodedDictionary as? Value

0 commit comments

Comments
 (0)