File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
FirebaseFunctions/Sources Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -541,10 +541,8 @@ enum FunctionsConstants {
541541 private func callableResult( fromResponseData data: Data ) throws -> HTTPSCallableResult {
542542 let processedData = try processedData ( fromResponseData: data)
543543 let json = try responseDataJSON ( from: processedData)
544- // TODO: Refactor `decode(_:)` so it either returns a non-optional object or throws
545544 let payload = try serializer. decode ( json)
546- // TODO: Remove `as Any` once `decode(_:)` is refactored
547- return HTTPSCallableResult ( data: payload as Any )
545+ return HTTPSCallableResult ( data: payload)
548546 }
549547
550548 private func processedData( fromResponseData data: Data ) throws -> Data {
Original file line number Diff line number Diff line change @@ -58,16 +58,17 @@ final class FunctionsSerializer {
5858 }
5959 }
6060
61- func decode( _ object: Any ) throws -> AnyObject ? {
61+ func decode( _ object: Any ) throws -> Any {
6262 // Return these types as is. PORTING NOTE: Moved from the bottom of the func for readability.
6363 if let dict = object as? NSDictionary {
6464 if let requestedType = dict [ " @type " ] as? String {
6565 guard let value = dict [ " value " ] as? String else {
6666 // Seems like we should throw here - but this maintains compatibility.
6767 return dict
6868 }
69- let result = try decodeWrappedType ( requestedType, value)
70- if result != nil { return result }
69+ if let result = try decodeWrappedType ( requestedType, value) {
70+ return result
71+ }
7172
7273 // Treat unknown types as dictionaries, so we don't crash old clients when we add types.
7374 }
You can’t perform that action at this time.
0 commit comments