Skip to content

Commit fcfc4ca

Browse files
authored
Adopt changes from new version of OpenFeature SDK (#2)
* Replace MutableContext with ImmutableContext * Update ci.yml * Bump OF provider dependency version * Setup scheduled GH action run
1 parent 2927bff commit fcfc4ca

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: CI
22

33
on:
4+
schedule:
5+
- cron: '0 1 * * 1'
46
pull_request:
57
branches: [ main ]
68
paths-ignore:
79
- '**.md'
810
push:
9-
branches: [ main ]
11+
branches: [ '*' ]
1012
paths-ignore:
1113
- '**.md'
1214

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
dependencies: [
1818
.package(
1919
url: "https://github.com/open-feature/swift-sdk",
20-
from: "0.3.0"
20+
from: "0.4.0"
2121
),
2222
.package(
2323
url: "https://github.com/configcat/configcat-swift-sdk",

Tests/ConfigCatOpenFeatureTests/ProviderTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ProviderTests: XCTestCase {
5555

5656
func testUser() {
5757
let date = parseDate(val: "2025-05-30T10:15:30.00Z")
58-
let context = MutableContext(targetingKey: "[email protected]", structure: MutableStructure(attributes: [
58+
let context = ImmutableContext(targetingKey: "[email protected]", structure: ImmutableStructure(attributes: [
5959
"custom1": Value.string("something"),
6060
"custom2": Value.boolean(true),
6161
"custom3": Value.integer(5),
@@ -79,14 +79,14 @@ class ProviderTests: XCTestCase {
7979
opts.flagOverrides = try! BundleResourceDataSource(path: "test_json_complex.json", behaviour: .localOnly)
8080
}
8181

82-
let ctx = MutableContext(targetingKey: "[email protected]")
82+
let ctx = ImmutableContext(targetingKey: "[email protected]")
8383

8484
let boolVal = provider.getBooleanEvaluation(key: "disabledFeature", defaultValue: false, context: ctx)
8585
XCTAssertTrue(boolVal.value)
8686
XCTAssertEqual("v-disabled-t", boolVal.variant)
8787
XCTAssertEqual(Reason.targetingMatch.rawValue, boolVal.reason)
8888

89-
let ctxCustom = MutableContext(targetingKey: "[email protected]", structure: MutableStructure(attributes: [
89+
let ctxCustom = ImmutableContext(targetingKey: "[email protected]", structure: ImmutableStructure(attributes: [
9090
"custom-anything": Value.string("something")
9191
]))
9292

@@ -102,7 +102,7 @@ class ProviderTests: XCTestCase {
102102
opts.logLevel = .debug
103103
}
104104

105-
let ctx = MutableContext(targetingKey: "[email protected]", structure: MutableStructure(attributes: [
105+
let ctx = ImmutableContext(targetingKey: "[email protected]", structure: ImmutableStructure(attributes: [
106106
"Date": Value.date(parseDate(val: "2025-05-30T10:15:30.00Z"))
107107
]))
108108

samples/ios/configcat-provider-sample/ContentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct ContentView: View {
2121
// Info level logging helps to inspect the feature flag evaluation process.
2222
// Use the default Warning level to avoid too detailed logging in your application.
2323
opts.logLevel = .info
24-
}, initialContext: MutableContext(targetingKey: "[email protected]", structure: MutableStructure(attributes: [
24+
}, initialContext: ImmutableContext(targetingKey: "[email protected]", structure: ImmutableStructure(attributes: [
2525
"Email": Value.string("[email protected]"),
2626
])))
2727

0 commit comments

Comments
 (0)