Skip to content

Commit f99a509

Browse files
committed
version 2.9.7
2 parents 09ac705 + 28e6cd7 commit f99a509

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/ios/RNAParamMap.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@ public class ParamMap {
2727
dict[key.rawValue] as? T
2828
}
2929

30-
func getDecodedValue<T: Decodable>(for key: ParamKey, jsonDecoder: JSONDecoder) throws -> T {
30+
public func getDecodedValue<T: Decodable>(for key: ParamKey, jsonDecoder: JSONDecoder) throws -> T {
3131
let jsonString: String = try getRequiredValue(for: key)
3232

33-
return try getDecodedValue<T>(for: key, jsonString: jsonString, jsonDecoder: jsonDecoder)
33+
guard let jsonData = jsonString.data(using: .utf8),
34+
let decodedValue = try? jsonDecoder.decode(T.self, from: jsonData) else {
35+
throw BridgeError.typeMismatch(name: key, type: "JSON-encoded \(T.self)")
36+
}
37+
38+
return decodedValue
3439
}
3540

3641
public func getDecodedOptionalValue<T: Decodable>(for key: ParamKey, jsonDecoder: JSONDecoder) throws -> T? {
3742
guard let jsonString: String = getOptionalValue(for: key) else { return nil }
3843

39-
return try getDecodedValue<T>(for: key, jsonString: jsonString, jsonDecoder: jsonDecoder)
40-
}
41-
42-
func getDecodedValue<T: Decodable>(for key: ParamKey, jsonString: String, jsonDecoder: JSONDecoder) throws -> T {
4344
guard let jsonData = jsonString.data(using: .utf8),
4445
let decodedValue = try? jsonDecoder.decode(T.self, from: jsonData) else {
4546
throw BridgeError.typeMismatch(name: key, type: "JSON-encoded \(T.self)")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package",
33
"name": "react-native-adapty",
4-
"version": "2.9.6",
4+
"version": "2.9.7",
55
"description": "Adapty React Native SDK",
66
"license": "MIT",
77
"author": "Vanya Dorofeyev <[email protected]> (https://github.com/divanc)",

0 commit comments

Comments
 (0)