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

Commit

Permalink
Merge pull request #197 from noobs2ninjas/master
Browse files Browse the repository at this point in the history
Fixing LiveQuery Parse Server error for empty "where" property.
  • Loading branch information
noobs2ninjas authored Jul 27, 2019
2 parents b6888eb + ea5bf7e commit 71b2a69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit 71b2a69

Please sign in to comment.