Skip to content

Commit

Permalink
Merge pull request #1200 from DroidKaigi/ios-realtime-remote-config
Browse files Browse the repository at this point in the history
[iOS] enable realtime updates for remote config
  • Loading branch information
ry-itto authored Sep 13, 2023
2 parents 00b6d8a + 834dd6f commit 7345638
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app-ios/Modules/Sources/RemoteConfig/RemoteConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ import FirebaseRemoteConfig
import shared

public class RemoteConfigApiImpl: RemoteConfigApi {
public init() {}
private let remoteConfig = RemoteConfig.remoteConfig()

public init() {
remoteConfig.addOnConfigUpdateListener { [weak remoteConfig] configUpdate, error in
guard error == nil else {
return
}

remoteConfig?.activate()
}
}

public func getBoolean(key: String) async throws -> KotlinBoolean {
.init(
bool: RemoteConfig.remoteConfig().configValue(forKey: key).boolValue
bool: remoteConfig.configValue(forKey: key).boolValue
)
}
public func getString(key: String) async throws -> String {
return RemoteConfig.remoteConfig().configValue(forKey: key).stringValue ?? ""
return remoteConfig.configValue(forKey: key).stringValue ?? ""
}
}

0 comments on commit 7345638

Please sign in to comment.