Skip to content

Commit 4c2bc89

Browse files
committed
Add support for deleting key
1 parent 4a25d7b commit 4c2bc89

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

FirebaseRemoteConfig/Swift/CustomSignals.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public extension RemoteConfig {
7070
/// Sets custom signals for this Remote Config instance.
7171
/// - Parameter customSignals: A dictionary mapping string keys to custom
7272
/// signals to be set for the app instance.
73-
func setCustomSignals(_ customSignals: [String: CustomSignalValue]) async throws {
73+
func setCustomSignals(_ customSignals: [String: CustomSignalValue?]) async throws {
7474
return try await withCheckedThrowingContinuation { continuation in
75-
let customSignals = customSignals.mapValues { $0.toNSObject() }
75+
let customSignals = customSignals.mapValues { $0?.toNSObject() ?? NSNull() }
7676
self.__setCustomSignals(customSignals) { error in
7777
if let error {
7878
continuation.resume(throwing: error)

FirebaseRemoteConfig/Tests/Swift/SwiftAPI/FirebaseRemoteConfigSwift_APIBuildTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ final class FirebaseRemoteConfig_APIBuildTests: XCTestCase {
225225
let _: Void = try config.setDefaults(from: MyEncodableValue())
226226

227227
Task {
228-
let signals: [String: CustomSignalValue] = [
228+
let signals: [String: CustomSignalValue?] = [
229229
"signal_1": .integer(5),
230230
"signal_2": .string("enable_feature"),
231231
"signal_3": 5,
232232
"signal_4": "enable_feature",
233233
"signal_5": "enable_feature_\("secret")",
234+
"signal_6": nil, // Used to delete the custom signal for a given key.
234235
]
235236
try await config.setCustomSignals(signals)
236237
}

0 commit comments

Comments
 (0)