mammoth-wolf-34989
04/28/2024, 4:28 PMrefreshHandler
call back in the GrowthBookBuilder initialiser to listen on changes, whenever it is called i use the isOn
function on all my feature keys that i want, but after some minutes in a session, it stops sending call backs in refreshHandler, why is that and is there a way to implement what i need?mammoth-wolf-34989
04/28/2024, 7:06 PMimport Foundation
import GrowthBook
class FeatureToggleManager {
static let shared = FeatureToggleManager()
private var sdkInstance: GrowthBookSDK?
@Published var isYourpartsOn = true
@Published var isMaydayOn = true
private init() {}
func initFeatureToggle() {
sdkInstance = GrowthBookBuilder(
apiHost: "https://" + (getPlistString(key: Constants.InfoKeys.growthbookApiHost) ?? ""),
clientKey: getPlistString(key: Constants.InfoKeys.growthbookClientKey),
attributes: [:],
trackingCallback: { experiment, experimentResult in },
refreshHandler: { isRefreshed in
debugPrint(isRefreshed)
self.isYourpartsOn = self.isFeatureEnabled("yourparts-ios")
self.isMaydayOn = self.isFeatureEnabled("mayday-ios")
},
backgroundSync: true).initializer()
}
func isFeatureEnabled(_ featureKey: String) -> Bool {
return sdkInstance?.isOn(feature: featureKey) ?? true
}
}
calm-dog-24239
04/29/2024, 8:25 AMmammoth-wolf-34989
05/02/2024, 7:14 AMcalm-dog-24239
05/02/2024, 7:44 AMcalm-dog-24239
05/02/2024, 2:26 PMmammoth-wolf-34989
05/26/2024, 6:40 AMcalm-dog-24239
05/28/2024, 7:23 AMmammoth-wolf-34989
05/28/2024, 7:29 AM