@@ -1252,8 +1252,11 @@ fileprivate class __JSONDecoder : Decoder {
1252
1252
debugDescription: " Cannot get keyed decoding container -- found null value instead. " ) )
1253
1253
}
1254
1254
var topContainer : [ String : Any ]
1255
- if let rcValue = self . storage. topContainer as? FirebaseRemoteConfigValueDecoding ,
1256
- let top = rcValue. jsonValue ( ) {
1255
+ if let rcValue = self . storage. topContainer as? FirebaseRemoteConfigValueDecoding {
1256
+ guard let top = rcValue. dictionaryValue ( ) else {
1257
+ throw DecodingError . _typeMismatch ( at: self . codingPath, expectation: [ String : Any ] . self,
1258
+ reality: rcValue)
1259
+ }
1257
1260
topContainer = top
1258
1261
} else {
1259
1262
guard let top = self . storage. topContainer as? [ String : Any ] else {
@@ -1273,6 +1276,13 @@ fileprivate class __JSONDecoder : Decoder {
1273
1276
debugDescription: " Cannot get unkeyed decoding container -- found null value instead. " ) )
1274
1277
}
1275
1278
1279
+ if let rcValue = self . storage. topContainer as? FirebaseRemoteConfigValueDecoding {
1280
+ guard let arrayValue = rcValue. arrayValue ( ) else {
1281
+ throw DecodingError . _typeMismatch ( at: self . codingPath, expectation: [ Any ] . self, reality: rcValue)
1282
+ }
1283
+ return _JSONUnkeyedDecodingContainer ( referencing: self , wrapping: arrayValue )
1284
+ }
1285
+
1276
1286
guard let topContainer = self . storage. topContainer as? [ Any ] else {
1277
1287
throw DecodingError . _typeMismatch ( at: self . codingPath, expectation: [ Any ] . self, reality: self . storage. topContainer)
1278
1288
}
@@ -2468,6 +2478,13 @@ extension __JSONDecoder {
2468
2478
fileprivate func unbox< T> ( _ value: Any , as type: _JSONStringDictionaryDecodableMarker . Type ) throws -> T ? {
2469
2479
guard !( value is NSNull ) else { return nil }
2470
2480
2481
+ if let rcValue = value as? FirebaseRemoteConfigValueDecoding {
2482
+ guard let dictionaryValue = rcValue. dictionaryValue ( ) else {
2483
+ throw DecodingError . _typeMismatch ( at: self . codingPath, expectation: type, reality: rcValue)
2484
+ }
2485
+ return dictionaryValue as? T
2486
+ }
2487
+
2471
2488
var result = [ String : Any] ( )
2472
2489
guard let dict = value as? NSDictionary else {
2473
2490
throw DecodingError . _typeMismatch ( at: self . codingPath, expectation: type, reality: value)
0 commit comments