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

Commit

Permalink
Fixing LiveQuery Parse Server error for empty where property.
Browse files Browse the repository at this point in the history
  • Loading branch information
noobs2ninjas committed Jul 27, 2019
1 parent b6888eb commit 547fa20
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sources/ParseLiveQuery/Internal/QueryEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ extension Dictionary where Key: ExpressibleByStringLiteral, Value: AnyObject {
}
if let conditions: [String:AnyObject] = queryState?.value(forKey: "conditions") as? [String:AnyObject] {
self["where"] = conditions.encodedQueryDictionary as? Value
}
} else { self["where"] = [:] as? Value }
}
}

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 +39,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 547fa20

Please sign in to comment.