Skip to content

Commit 833890f

Browse files
committed
Add dataValue
1 parent aacac80 commit 833890f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

FirebaseRemoteConfig/Tests/SwiftAPI/Value.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ private enum Constants {
7676
XCTAssertEqual(config[Constants.floatKey].numberValue.doubleValue, Constants.doubleValue)
7777
XCTAssertEqual(config[Constants.trueKey].boolValue, true)
7878
XCTAssertEqual(config[Constants.falseKey].boolValue, false)
79+
XCTAssertEqual(
80+
config[Constants.stringKey].dataValue,
81+
Constants.stringValue.data(using: .utf8)
82+
)
7983
XCTAssertEqual(
8084
config[Constants.jsonKey].jsonValue as! [String: AnyHashable],
8185
Constants.jsonValue
@@ -101,6 +105,10 @@ private enum Constants {
101105
XCTAssertEqual(config[doubleValue: Constants.floatKey], Constants.doubleValue)
102106
XCTAssertEqual(config[boolValue: Constants.trueKey], true)
103107
XCTAssertEqual(config[boolValue: Constants.falseKey], false)
108+
XCTAssertEqual(
109+
config[dataValue: Constants.stringKey],
110+
Constants.stringValue.data(using: .utf8)
111+
)
104112
XCTAssertEqual(try XCTUnwrap(config[jsonValue: Constants.jsonKey]), Constants.jsonValue)
105113
}
106114

FirebaseRemoteConfigSwift/Sources/Value.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public extension RemoteConfig {
8686
return configValue(forKey: key).boolValue
8787
}
8888

89+
subscript(dataValue key: String) -> Data {
90+
return configValue(forKey: key).dataValue
91+
}
92+
8993
subscript(jsonValue key: String) -> [String: AnyHashable]? {
9094
guard let value = configValue(forKey: key).jsonValue as? [String: AnyHashable] else {
9195
// nil is the historical behavior for failing to extract JSON.

0 commit comments

Comments
 (0)