File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Sources/ParseLiveQuery/Internal Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,18 @@ private func parseObject<T: PFObject>(objectDictionary: [String:AnyObject]) thro
2222
2323 let parseObject = T ( withoutDataWithClassName: parseClassName, objectId: objectId)
2424
25+ // Map of strings to closures to determine if the key is valid. Allows for more advanced checking of
26+ // classnames and such.
27+ let invalidKeys : [ String : Void -> Bool ] = [
28+ " objectId " : { true } ,
29+ " parseClassName " : { true } ,
30+ " sessionToken " : { parseClassName == " _User " }
31+ ]
32+
2533 objectDictionary. filter { key, _ in
26- key != " parseClassName " && key != " objectId "
27- } . forEach { key, value in
28- parseObject [ key] = value
34+ return ! ( invalidKeys [ key ] . map { $0 ( ) } ?? false )
35+ } . forEach { key, value in
36+ parseObject [ key] = value
2937 }
3038 return parseObject
3139}
You can’t perform that action at this time.
0 commit comments