Skip to content

Commit b781991

Browse files
authored
Update config & method parser in iOS implementation (#145)
1 parent f184762 commit b781991

File tree

14 files changed

+129
-46
lines changed

14 files changed

+129
-46
lines changed

splitio/example/ios/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ target 'Runner' do
3232
use_modular_headers!
3333

3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
36+
pod 'Split', :git => 'https://github.com/splitio/ios-client.git', :branch => 'SDKS-9073_baseline' # TODO: remove; development only
3537
end
3638

3739
post_install do |installer|

splitio/example/ios/Podfile.lock

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- Split (3.0.0)
3+
- Split (3.1.0)
44
- splitio_ios (0.7.0):
55
- Flutter
6-
- Split (~> 3.0.0)
6+
- Split
77

88
DEPENDENCIES:
99
- Flutter (from `Flutter`)
10+
- Split (from `https://github.com/splitio/ios-client.git`, branch `SDKS-9073_baseline`)
1011
- splitio_ios (from `.symlinks/plugins/splitio_ios/ios`)
1112

12-
SPEC REPOS:
13-
trunk:
14-
- Split
15-
1613
EXTERNAL SOURCES:
1714
Flutter:
1815
:path: Flutter
16+
Split:
17+
:branch: SDKS-9073_baseline
18+
:git: https://github.com/splitio/ios-client.git
1919
splitio_ios:
2020
:path: ".symlinks/plugins/splitio_ios/ios"
2121

22+
CHECKOUT OPTIONS:
23+
Split:
24+
:commit: 708427ff99d24e2f2ae6e5a672ee23efebafba06
25+
:git: https://github.com/splitio/ios-client.git
26+
2227
SPEC CHECKSUMS:
2328
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
24-
Split: 66424040ad573d052f58269f841e71b34578a916
25-
splitio_ios: e4e3becbe89cae0a2fa9ca03a575c21f23af0d90
29+
Split: 17f15abcc74b39c3a8d670f59e787163626ad6b5
30+
splitio_ios: 00bf48283a9e3f9497a973d9b5cafc5d414dd427
2631

27-
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
32+
PODFILE CHECKSUM: a52d9df387b5aca8aed91ec989839c51add619b2
2833

2934
COCOAPODS: 1.15.0

splitio/example/pubspec.lock

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,16 @@ packages:
177177
splitio_ios:
178178
dependency: transitive
179179
description:
180-
name: splitio_ios
181-
sha256: "7c7a2a60711b8e6267cde7e2754d30931dafc76b20b28e1356624963628cb166"
182-
url: "https://pub.dev"
183-
source: hosted
180+
path: "../../splitio_ios"
181+
relative: true
182+
source: path
184183
version: "0.2.0"
185184
splitio_platform_interface:
186185
dependency: transitive
187186
description:
188-
name: splitio_platform_interface
189-
sha256: "2f0457991d18d654486264a66dacf54c7cf23cd88bbb73ed299d69dbbc2fd49b"
190-
url: "https://pub.dev"
191-
source: hosted
187+
path: "../../splitio_platform_interface"
188+
relative: true
189+
source: path
192190
version: "1.5.0"
193191
stack_trace:
194192
dependency: transitive

splitio/pubspec.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ flutter:
2020
dependencies:
2121
flutter:
2222
sdk: flutter
23-
splitio_android:
23+
splitio_android: # ^0.2.0
2424
path: ../splitio_android
25-
splitio_ios: ^0.2.0
26-
splitio_platform_interface: ^1.5.0
27-
25+
splitio_ios: # ^0.2.0
26+
path: ../splitio_ios
27+
splitio_platform_interface: # ^1.5.0
28+
path: ../splitio_platform_interface
2829
dev_dependencies:
2930
flutter_test:
3031
sdk: flutter

splitio_android/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ flutter:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
splitio_platform_interface: ^1.5.0
22+
splitio_platform_interface: # ^1.5.0
23+
path: ../splitio_platform_interface
2324

2425
dev_dependencies:
2526
flutter_test:

splitio_ios/example/ios/Podfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ target 'Runner' do
3232
use_modular_headers!
3333

3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
36+
pod 'Split', :git => 'https://github.com/splitio/ios-client.git', :branch => 'SDKS-9073_baseline' # TODO: remove; development only
3537
end
3638

3739
target 'SplitTests' do
3840
use_frameworks!
3941
use_modular_headers!
4042

4143
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
44+
45+
pod 'Split', :git => 'https://github.com/splitio/ios-client.git', :branch => 'SDKS-9073_baseline' # TODO: remove; development only
4246
end
4347

4448
post_install do |installer|
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- Split (3.0.0)
3+
- Split (3.1.0)
44
- splitio_ios (0.7.0):
55
- Flutter
6-
- Split (~> 3.0.0)
6+
- Split
77

88
DEPENDENCIES:
99
- Flutter (from `Flutter`)
10+
- Split (from `https://github.com/splitio/ios-client.git`, branch `SDKS-9073_baseline`)
1011
- splitio_ios (from `.symlinks/plugins/splitio_ios/ios`)
1112

12-
SPEC REPOS:
13-
trunk:
14-
- Split
15-
1613
EXTERNAL SOURCES:
1714
Flutter:
1815
:path: Flutter
16+
Split:
17+
:branch: SDKS-9073_baseline
18+
:git: https://github.com/splitio/ios-client.git
1919
splitio_ios:
2020
:path: ".symlinks/plugins/splitio_ios/ios"
2121

22+
CHECKOUT OPTIONS:
23+
Split:
24+
:commit: 708427ff99d24e2f2ae6e5a672ee23efebafba06
25+
:git: https://github.com/splitio/ios-client.git
26+
2227
SPEC CHECKSUMS:
2328
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
24-
Split: 66424040ad573d052f58269f841e71b34578a916
25-
splitio_ios: e4e3becbe89cae0a2fa9ca03a575c21f23af0d90
29+
Split: 17f15abcc74b39c3a8d670f59e787163626ad6b5
30+
splitio_ios: 00bf48283a9e3f9497a973d9b5cafc5d414dd427
2631

27-
PODFILE CHECKSUM: aed42fc5c94ade572556b7ed357c5c57f1bd83a2
32+
PODFILE CHECKSUM: 3e7633332e3580ada5ac333ff9c0b05e8c0b7972
2833

2934
COCOAPODS: 1.15.0

splitio_ios/example/ios/SplitTests/ExtensionsTests.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import XCTest
22
import Split
3+
@testable import splitio_ios
34

45
class ExtensionsTests: XCTestCase {
56

@@ -26,4 +27,30 @@ class ExtensionsTests: XCTestCase {
2627
"split": "my-split",
2728
"time": 16161616]))
2829
}
30+
31+
func testSplitViewMapping() throws {
32+
var splitView = SplitView()
33+
splitView.name = "my-split"
34+
splitView.trafficType = "account"
35+
splitView.killed = true
36+
splitView.treatments = ["on", "off"]
37+
splitView.changeNumber = 121212
38+
splitView.configs = ["key": "value"]
39+
splitView.defaultTreatment = "off"
40+
splitView.sets = ["set1", "set2"]
41+
splitView.impressionsDisabled = true
42+
43+
let splitViewMap = SplitView.asMap(splitView: splitView)
44+
XCTAssert(splitViewMap.count == 9)
45+
XCTAssert(NSDictionary(dictionary: splitViewMap).isEqual(to: [
46+
"name": "my-split",
47+
"trafficType": "account",
48+
"killed": true,
49+
"treatments": ["on", "off"],
50+
"changeNumber": 121212,
51+
"configs": ["key": "value"],
52+
"defaultTreatment": "off",
53+
"sets": ["set1", "set2"],
54+
"impressionsDisabled": true]))
55+
}
2956
}

splitio_ios/example/ios/SplitTests/SplitClientConfigHelperTests.swift

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,31 @@ class SplitClientConfigHelperTests: XCTestCase {
127127
]
128128

129129
let splitClientConfig: SplitClientConfig = SplitClientConfigHelper.fromMap(configurationMap: configValues, impressionListener: nil)
130-
let actualConfig = splitClientConfig.certificatePinningConfig?.pins
130+
let actualConfig = splitClientConfig.certificatePinningConfig!.pins
131131

132-
let containsPins = actualConfig?.contains { pin in
133-
(pin.host == "host1" && pin.algo == KeyHashAlgo.sha256) &&
134-
(pin.host == "host1" && pin.algo == KeyHashAlgo.sha1) &&
132+
let containsPins = actualConfig.contains { pin in
133+
(pin.host == "host1" && pin.algo == KeyHashAlgo.sha256) } &&
134+
actualConfig.contains { pin in
135+
(pin.host == "host1" && pin.algo == KeyHashAlgo.sha1) } &&
136+
actualConfig.contains { pin in
135137
(pin.host == "host2" && pin.algo == KeyHashAlgo.sha256 )
136138
}
139+
140+
XCTAssertTrue(containsPins)
141+
}
142+
143+
func testRolloutCacheConfigurationValuesAreMappedCorrectly() {
144+
let configValues = [
145+
"rolloutCacheConfiguration": [
146+
"expirationDays": 5,
147+
"clearOnInit": true
148+
]
149+
]
150+
151+
let splitClientConfig: SplitClientConfig = SplitClientConfigHelper.fromMap(configurationMap: configValues, impressionListener: nil)
152+
let actualConfig = splitClientConfig.rolloutCacheConfiguration!
153+
154+
XCTAssertEqual(5, actualConfig.expirationDays)
155+
XCTAssertTrue(actualConfig.clearOnInit)
137156
}
138157
}

splitio_ios/example/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ packages:
166166
path: ".."
167167
relative: true
168168
source: path
169-
version: "0.1.9"
169+
version: "0.2.0"
170170
splitio_platform_interface:
171171
dependency: transitive
172172
description:
173173
path: "../../splitio_platform_interface"
174174
relative: true
175175
source: path
176-
version: "1.4.0"
176+
version: "1.5.0"
177177
stack_trace:
178178
dependency: transitive
179179
description:

0 commit comments

Comments
 (0)