File tree Expand file tree Collapse file tree 6 files changed +10
-8
lines changed Expand file tree Collapse file tree 6 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 22
33Pod ::Spec . new do |s |
44 s . name = 'Automattic-Tracks-iOS'
5- s . version = '1.0.0 '
5+ s . version = '1.1.0-beta '
66
77 s . summary = 'Simple way to track events in an iOS app with Automattic Tracks internal service'
88 s . description = <<-DESC
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ _None._
3636
3737- ` logErrorImmediately ` and ` logErrorsImmediately ` no longer have a ` Result ` parameter in their callback [ #232 ]
3838- ` logErrorImmediately ` and ` logErrorsImmediately ` no longer ` throws ` [ #236 ]
39+ - ` ExPlat ` returns optional instead of assuming ` control ` as variant. This lets the client know that there is no variant for an experiment. [ #247 ]
3940
4041### New Features
4142
@@ -49,3 +50,4 @@ _None._
4950
5051- Add this changelog file [ #234 ]
5152- Log a message if events won't be collected because the user opted out [ #239 ]
53+ - Make ` Variation ` confirm to cobable. [ #247 ]
Original file line number Diff line number Diff line change 11import Foundation
22
3- public enum Variation : Equatable {
3+ public enum Variation : Equatable , Codable {
44 case control
55 case treatment
66 case customTreatment( name: String )
@@ -13,5 +13,5 @@ public protocol ABTesting {
1313 func refresh( completion: ( ( ) -> Void ) ? )
1414
1515 /// Return an experiment variation
16- func experiment( _ name: String ) -> Variation
16+ func experiment( _ name: String ) -> Variation ?
1717}
Original file line number Diff line number Diff line change @@ -95,10 +95,10 @@ import Cocoa
9595 }
9696 }
9797
98- public func experiment( _ name: String ) -> Variation {
98+ public func experiment( _ name: String ) -> Variation ? {
9999 guard let assignments = UserDefaults . standard. object ( forKey: assignmentsKey) as? [ String : String ? ] ,
100100 case let variation? ? = assignments [ name] else {
101- return . control
101+ return nil
102102 }
103103
104104 switch variation {
Original file line number Diff line number Diff line change 11#import " TracksConstants.h"
22
33NSString *const TracksErrorDomain = @" TracksErrorDomain" ;
4- NSString *const TracksLibraryVersion = @" 1.0.0 " ;
4+ NSString *const TracksLibraryVersion = @" 1.1.0-beta " ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class ExPlatTests: XCTestCase {
2121 let abTesting = ExPlat ( configuration: exPlatTestConfiguration, service: ExPlatServiceMock ( ) )
2222
2323 abTesting. refresh {
24- XCTAssertEqual ( abTesting. experiment ( " experiment " ) , . control )
24+ XCTAssertNil ( abTesting. experiment ( " experiment " ) )
2525 XCTAssertEqual ( abTesting. experiment ( " another_experiment " ) , . treatment)
2626 XCTAssertEqual ( abTesting. experiment ( " experiment_multiple_variation " ) , . customTreatment( name: " another_treatment " ) )
2727 expectation. fulfill ( )
@@ -70,7 +70,7 @@ class ExPlatTests: XCTestCase {
7070
7171 serviceMock. returnAssignments = false
7272 abTesting. refresh {
73- XCTAssertEqual ( abTesting. experiment ( " experiment " ) , . control )
73+ XCTAssertNil ( abTesting. experiment ( " experiment " ) )
7474 XCTAssertEqual ( abTesting. experiment ( " another_experiment " ) , . treatment)
7575 XCTAssertEqual ( abTesting. experiment ( " experiment_multiple_variation " ) , . customTreatment( name: " another_treatment " ) )
7676 expectation. fulfill ( )
You can’t perform that action at this time.
0 commit comments