-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Add ProviderState #46
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Fabrizio Demaria <[email protected]>
Signed-off-by: Fabrizio Demaria <[email protected]>
Signed-off-by: Fabrizio Demaria <[email protected]>
8ae1b86
to
5b69522
Compare
let stateObserver = provider.observe().sink { | ||
if $0 == .ready || $0 == .error { | ||
continuation.resume() | ||
holder.removeAll() | ||
} | ||
} | ||
stateObserver.store(in: &holder) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a very good change
Signed-off-by: Fabrizio Demaria <[email protected]>
fix: setProvider sends Ready Event on success Signed-off-by: Fabrizio Demaria <[email protected]>
Signed-off-by: Fabrizio Demaria <[email protected]>
Signed-off-by: Fabrizio Demaria <[email protected]>
private let eventState: CurrentValueSubject<ProviderEvent, Never> | ||
private let lastSentEvent = PassthroughSubject<ProviderEvent?, Never>() | ||
|
||
convenience init() { | ||
self.init(.notReady) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EventHandler doesn't keep a "state" anymore, that is now responsibility of OpenFeatureAPI
Signed-off-by: Fabrizio Demaria <[email protected]>
dee8973
to
203e8da
Compare
Signed-off-by: Fabrizio Demaria <[email protected]>
203e8da
to
40d0812
Compare
/// It is expected that the implementer is slow and blocking (e.g. network), the caller must deal with wrapping this into a background Task if necessary | ||
func initialize(initialContext: EvaluationContext?) throws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need docs like this for user-facing setContext
and setContextAndWait
, as well, so it's clear that the former can take time and should be called from the UI thread.
Signed-off-by: Fabrizio Demaria <[email protected]>
Signed-off-by: Fabrizio Demaria <[email protected]>
cabfae2
to
533f1ab
Compare
This PR
Breaking Changes
initialize()
implementation needs to throw in case of errors, rather than emitting theERROR
event. The latter is now responsibility of the SDK. This might apply to other parts of the integration as well (e.g. onContextChange)ERROR
emission from the Provider side)Improvements