From bddf7ef4ab047d4f42b447aa68f0e900eca8b570 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Mon, 11 Nov 2024 16:00:37 +0100 Subject: [PATCH 1/4] docs: Spec the behaviour of putContext --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cc2a58b2..3ebaf90f 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ It is also appended to the tracked events, making it a great way to create dimen confidence.putContext(context: ["key": ConfidenceValue(string: "value")]) ``` -Note that a `ConfidenceValue` is accepted a map values, which has a constructor for all the value types -supported by Confidence. +Upon the returning of this function call, the updated context is appended to tracking events. +However, to relfect the new context in flags resolves, a new call to `fetchAndActivate()` is required. ### Resolving feature flags Once the Confidence instance is **activated**, you can access the flag values using the From 3bc935d1e66ebfbaab870f860bee9a94c4e900a7 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Mon, 11 Nov 2024 16:04:19 +0100 Subject: [PATCH 2/4] fix: typo Co-authored-by: Nicklas Lundin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ebaf90f..650d2c66 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ confidence.putContext(context: ["key": ConfidenceValue(string: "value")]) ``` Upon the returning of this function call, the updated context is appended to tracking events. -However, to relfect the new context in flags resolves, a new call to `fetchAndActivate()` is required. +However, to reflect the new context in flags resolves, a new call to `fetchAndActivate()` is required. ### Resolving feature flags Once the Confidence instance is **activated**, you can access the flag values using the From 90f06f185d757593262b088f50ee99fbb87a66c1 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Tue, 12 Nov 2024 13:50:21 +0100 Subject: [PATCH 3/4] docs: Update Context behaviour specs --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 650d2c66..fa8277f3 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,18 @@ It is also appended to the tracked events, making it a great way to create dimen confidence.putContext(context: ["key": ConfidenceValue(string: "value")]) ``` -Upon the returning of this function call, the updated context is appended to tracking events. -However, to reflect the new context in flags resolves, a new call to `fetchAndActivate()` is required. +Another way to configure the context involves using the `track` API: +```swift +confidence.track(producer: contextProducerImplementation) +``` + +The "producer" conforms to `ConfidenceContextProducer`, which allows to dynamically push context changes +to the Confidence object. + +In both cases above, any context change triggers a new `fetchAndActivate` asynchronously and the flags in the +local cache are re-evaluated remotely according to the new context: until that background operation is complete, +flag values are returned to the application according to the old context's evaluation, and marked as "stale". + ### Resolving feature flags Once the Confidence instance is **activated**, you can access the flag values using the From d06a82575522ea3d3c3908c67c495a0f0b270b61 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Tue, 12 Nov 2024 14:00:35 +0100 Subject: [PATCH 4/4] docs: Re-wording --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa8277f3..4b6c479a 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ To avoid waiting on backend calls when the Application starts, the suggested app `confidence.activate()` and then trigger a background refresh via `confidence.asyncFetch()` for future sessions. ### Setting the context -The context is a key-value map used for sampling and for targeting, when flag are evaluated by the Confidence backend. +The context is a key-value map used for sampling and for targeting, when flags are evaluated by the Confidence backend. It is also appended to the tracked events, making it a great way to create dimensions for metrics in Confidence. ```swift @@ -86,9 +86,9 @@ confidence.track(producer: contextProducerImplementation) The "producer" conforms to `ConfidenceContextProducer`, which allows to dynamically push context changes to the Confidence object. -In both cases above, any context change triggers a new `fetchAndActivate` asynchronously and the flags in the -local cache are re-evaluated remotely according to the new context: until that background operation is complete, -flag values are returned to the application according to the old context's evaluation, and marked as "stale". +In both cases above, any context change triggers a new asynchronous `fetchAndActivate` and the flags in the +local cache are re-evaluated remotely according to the new context: until this background operation is complete, +flag values are returned to the application according to the old context's evaluation, and with `resolveReason = .stale`. ### Resolving feature flags