Skip to content

Commit 2b8cef7

Browse files
committed
WIP ios changes
1 parent 6a7f32f commit 2b8cef7

File tree

13 files changed

+165
-129
lines changed

13 files changed

+165
-129
lines changed

splitio/example/ios/Podfile.lock

Lines changed: 0 additions & 34 deletions
This file was deleted.

splitio/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -53,11 +54,13 @@
5354
buildConfiguration = "Debug"
5455
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5556
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5658
launchStyle = "0"
5759
useCustomWorkingDirectory = "NO"
5860
ignoresPersistentStateOnLaunch = "NO"
5961
debugDocumentVersioning = "YES"
6062
debugServiceExtension = "internal"
63+
enableGPUValidationMode = "1"
6164
allowLocationSimulation = "YES">
6265
<BuildableProductRunnable
6366
runnableDebuggingMode = "0">

splitio/example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

splitio/example/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ packages:
173173
path: "../../splitio_android"
174174
relative: true
175175
source: path
176-
version: "0.3.0-rc.1"
176+
version: "1.0.0-rc.1"
177177
splitio_ios:
178178
dependency: transitive
179179
description:
180180
path: "../../splitio_ios"
181181
relative: true
182182
source: path
183-
version: "0.2.0"
183+
version: "1.0.0-rc.1"
184184
splitio_platform_interface:
185185
dependency: transitive
186186
description:

splitio_ios/example/ios/Podfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ 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
3735
end
3836

3937
target 'SplitTests' do
4038
use_frameworks!
4139
use_modular_headers!
4240

4341
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
4642
end
4743

4844
post_install do |installer|

splitio_ios/example/ios/Podfile.lock

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

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

12+
SPEC REPOS:
13+
trunk:
14+
- Split
15+
1316
EXTERNAL SOURCES:
1417
Flutter:
1518
: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-
2722
SPEC CHECKSUMS:
2823
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
29-
Split: 17f15abcc74b39c3a8d670f59e787163626ad6b5
30-
splitio_ios: 00bf48283a9e3f9497a973d9b5cafc5d414dd427
24+
Split: 0d4962a6c15180e1857c1a3753e1ae9c91a6150b
25+
splitio_ios: 438ad21d0dfe467670f8b9508773b77b16a71d6b
3126

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

34-
COCOAPODS: 1.15.0
29+
COCOAPODS: 1.16.2

splitio_ios/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -53,11 +54,13 @@
5354
buildConfiguration = "Debug"
5455
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5556
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5658
launchStyle = "0"
5759
useCustomWorkingDirectory = "NO"
5860
ignoresPersistentStateOnLaunch = "NO"
5961
debugDocumentVersioning = "YES"
6062
debugServiceExtension = "internal"
63+
enableGPUValidationMode = "1"
6164
allowLocationSimulation = "YES">
6265
<BuildableProductRunnable
6366
runnableDebuggingMode = "0">

splitio_ios/example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

splitio_ios/example/ios/SplitTests/ExtensionsTests.swift

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ExtensionsTests: XCTestCase {
1616
impression.time = 16161616
1717

1818
let impressionMap = impression.toMap()
19-
XCTAssert(impressionMap.count == 8)
19+
XCTAssert(impressionMap.count == 9)
2020
XCTAssert(NSDictionary(dictionary: impressionMap).isEqual(to: [
2121
"key": "matching-key",
2222
"bucketingKey": "bucketing-key",
@@ -25,7 +25,8 @@ class ExtensionsTests: XCTestCase {
2525
"appliedRule": "label",
2626
"treatment": "on",
2727
"split": "my-split",
28-
"time": 16161616]))
28+
"time": 16161616,
29+
"properties": "{}"]))
2930
}
3031

3132
func testSplitViewMapping() throws {
@@ -41,7 +42,12 @@ class ExtensionsTests: XCTestCase {
4142
splitView.impressionsDisabled = true
4243

4344
let splitViewMap = SplitView.asMap(splitView: splitView)
44-
XCTAssert(splitViewMap.count == 9)
45+
46+
// Debug: Print actual values
47+
print("DEBUG - SplitView map count: \(splitViewMap.count)")
48+
print("DEBUG - SplitView map: \(splitViewMap)")
49+
50+
XCTAssert(splitViewMap.count == 10)
4551
XCTAssert(NSDictionary(dictionary: splitViewMap).isEqual(to: [
4652
"name": "my-split",
4753
"trafficType": "account",
@@ -51,6 +57,25 @@ class ExtensionsTests: XCTestCase {
5157
"configs": ["key": "value"],
5258
"defaultTreatment": "off",
5359
"sets": ["set1", "set2"],
54-
"impressionsDisabled": true]))
60+
"impressionsDisabled": true,
61+
"prerequisites": []]))
62+
}
63+
64+
func testImpressionMappingDebug() throws {
65+
var impression = Impression()
66+
impression.keyName = "matching-key"
67+
impression.feature = "my-split"
68+
impression.changeNumber = 121212
69+
impression.bucketingKey = "bucketing-key"
70+
impression.attributes = ["age": 25, "name": "John"]
71+
impression.label = "label"
72+
impression.treatment = "on"
73+
impression.time = 16161616
74+
75+
let impressionMap = impression.toMap()
76+
77+
// Debug: Print actual values
78+
print("DEBUG - Impression map count: \(impressionMap.count)")
79+
print("DEBUG - Impression map: \(impressionMap)")
5580
}
5681
}

splitio_ios/example/ios/SplitTests/SplitTests.swift

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class SplitClientStub: SplitClient {
356356
var clearAttributesCalled: Bool = false
357357
var sdkReadyEventAction: SplitAction?
358358

359+
// MARK: Evaluation feature
359360
func getTreatment(_ split: String, attributes: [String: Any]?) -> String {
360361
methodCalls["getTreatment"] = true
361362
return SplitConstants.control
@@ -365,7 +366,7 @@ class SplitClientStub: SplitClient {
365366
methodCalls["getTreatment"] = true
366367
return SplitConstants.control
367368
}
368-
369+
369370
func getTreatments(splits: [String], attributes: [String: Any]?) -> [String: String] {
370371
methodCalls["getTreatments"] = true
371372
return ["feature": SplitConstants.control]
@@ -385,45 +386,48 @@ class SplitClientStub: SplitClient {
385386
methodCalls["getTreatmentsWithConfig"] = true
386387
return ["feature": SplitResult(treatment: SplitConstants.control)]
387388
}
388-
389-
func getTreatmentsByFlagSet(_ flagSet: String, attributes: [String : Any]?) -> [String : String] {
390-
methodCalls["getTreatmentsByFlagSet"] = true
391-
return [:]
389+
390+
// MARK: Evaluation with Properties (EvaluationOptions)
391+
func getTreatment(_ split: String, attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> String {
392+
methodCalls["getTreatment"] = true
393+
return SplitConstants.control
392394
}
393-
394-
func getTreatmentsByFlagSets(_ flagSets: [String], attributes: [String : Any]?) -> [String : String] {
395-
methodCalls["getTreatmentsByFlagSets"] = true
396-
return [:]
395+
396+
func getTreatments(splits: [String], attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: String] {
397+
methodCalls["getTreatments"] = true
398+
return ["feature": SplitConstants.control]
397399
}
398-
399-
func getTreatmentsWithConfigByFlagSet(_ flagSet: String, attributes: [String : Any]?) -> [String : SplitResult] {
400-
methodCalls["getTreatmentsWithConfigByFlagSet"] = true
401-
return [:]
400+
401+
func getTreatmentWithConfig(_ split: String, attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> SplitResult {
402+
methodCalls["getTreatmentWithConfig"] = true
403+
return SplitResult(treatment: SplitConstants.control)
402404
}
403-
404-
func getTreatmentsWithConfigByFlagSets(_ flagSets: [String], attributes: [String : Any]?) -> [String : SplitResult] {
405-
methodCalls["getTreatmentsWithConfigByFlagSets"] = true
406-
return [:]
405+
406+
func getTreatmentsWithConfig(splits: [String], attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: SplitResult] {
407+
methodCalls["getTreatmentsWithConfig"] = true
408+
return ["feature": SplitResult(treatment: SplitConstants.control)]
407409
}
408410

409-
func on(event: SplitEvent, runInBackground: Bool, execute action: @escaping SplitAction) {
411+
// MARK: Event handling
412+
func on(event: SplitEvent, execute action: @escaping SplitAction) {
410413
if event == .sdkReady {
411414
sdkReadyEventAction = action
412415
}
413416
}
414-
415-
func on(event: SplitEvent, queue: DispatchQueue, execute action: @escaping SplitAction) {
417+
418+
func on(event: SplitEvent, runInBackground: Bool, execute action: @escaping SplitAction) {
416419
if event == .sdkReady {
417420
sdkReadyEventAction = action
418421
}
419422
}
420-
421-
func on(event: SplitEvent, execute action: @escaping SplitAction) {
423+
424+
func on(event: SplitEvent, queue: DispatchQueue, execute action: @escaping SplitAction) {
422425
if event == .sdkReady {
423426
sdkReadyEventAction = action
424427
}
425428
}
426429

430+
// MARK: Track feature
427431
func track(trafficType: String, eventType: String) -> Bool {
428432
return true
429433
}
@@ -470,6 +474,7 @@ class SplitClientStub: SplitClient {
470474
return true
471475
}
472476

477+
// MARK: Persistent attributes feature
473478
func setAttribute(name: String, value: Any) -> Bool {
474479
attributeNameValue = name
475480
attributeValue = value
@@ -499,6 +504,7 @@ class SplitClientStub: SplitClient {
499504
return true
500505
}
501506

507+
// MARK: Client lifecycle
502508
func flush() {
503509
methodCalls["flush"] = true
504510
}
@@ -510,6 +516,48 @@ class SplitClientStub: SplitClient {
510516
func destroy(completion: (() -> Void)?) {
511517
destroyCalled = true
512518
}
519+
520+
// MARK: Evaluation with flagsets
521+
func getTreatmentsByFlagSet(_ flagSet: String, attributes: [String: Any]?) -> [String: String] {
522+
methodCalls["getTreatmentsByFlagSet"] = true
523+
return [:]
524+
}
525+
526+
func getTreatmentsByFlagSets(_ flagSets: [String], attributes: [String: Any]?) -> [String: String] {
527+
methodCalls["getTreatmentsByFlagSets"] = true
528+
return [:]
529+
}
530+
531+
func getTreatmentsWithConfigByFlagSet(_ flagSet: String, attributes: [String: Any]?) -> [String: SplitResult] {
532+
methodCalls["getTreatmentsWithConfigByFlagSet"] = true
533+
return [:]
534+
}
535+
536+
func getTreatmentsWithConfigByFlagSets(_ flagSets: [String], attributes: [String: Any]?) -> [String: SplitResult] {
537+
methodCalls["getTreatmentsWithConfigByFlagSets"] = true
538+
return [:]
539+
}
540+
541+
// MARK: Evaluation with flagsets and properties (EvaluationOptions)
542+
func getTreatmentsByFlagSet(_ flagSet: String, attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: String] {
543+
methodCalls["getTreatmentsByFlagSet"] = true
544+
return [:]
545+
}
546+
547+
func getTreatmentsByFlagSets(_ flagSets: [String], attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: String] {
548+
methodCalls["getTreatmentsByFlagSets"] = true
549+
return [:]
550+
}
551+
552+
func getTreatmentsWithConfigByFlagSet(_ flagSet: String, attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: SplitResult] {
553+
methodCalls["getTreatmentsWithConfigByFlagSet"] = true
554+
return [:]
555+
}
556+
557+
func getTreatmentsWithConfigByFlagSets(_ flagSets: [String], attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: SplitResult] {
558+
methodCalls["getTreatmentsWithConfigByFlagSets"] = true
559+
return [:]
560+
}
513561
}
514562

515563
class SplitManagerStub: SplitManager, Destroyable {

0 commit comments

Comments
 (0)