-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathMockRemoteConfigClient.swift
46 lines (33 loc) · 1.1 KB
/
MockRemoteConfigClient.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import FirebaseRemoteConfig
import Foundation
private class MockRemoteConfigValue: RemoteConfigValue {
var bool = false
override var boolValue: Bool { self.bool }
}
public class MockRemoteConfigClient: RemoteConfigClientType {
public func fetchAndActivate(completionHandler _: (
(RemoteConfigFetchAndActivateStatus, Error?)
-> Void
)?) {}
public var features: [String: Bool]
public init() {
self.features = [:]
}
public func activate(completion _: ((Bool, Error?) -> Void)?) {}
public func configValue(forKey key: String?) -> RemoteConfigValue {
let value = MockRemoteConfigValue()
guard let keyValue = key else {
return value
}
value.bool = self.features[keyValue] == true
return value
}
public func fetch(completionHandler _: ((RemoteConfigFetchStatus, Error?) -> Void)?) {}
public func setDefaults(_: [String: NSObject]?) {}
public func addOnConfigUpdateListener(remoteConfigUpdateCompletion _: @escaping (
RemoteConfigUpdate?,
Error?
) -> Void) -> ConfigUpdateListenerRegistration {
return ConfigUpdateListenerRegistration()
}
}