Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Automattic-Tracks-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pod::Spec.new do |s|
s.name = 'Automattic-Tracks-iOS'
s.version = '1.0.0'
s.version = '1.1.0-beta'

s.summary = 'Simple way to track events in an iOS app with Automattic Tracks internal service'
s.description = <<-DESC
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ _None._

- `logErrorImmediately` and `logErrorsImmediately` no longer have a `Result` parameter in their callback [#232]
- `logErrorImmediately` and `logErrorsImmediately` no longer `throws` [#236]
- `ExPlat` returns optional instead of assuming `control` as variant. This lets the client know that there is no variant for an experiment. [#247]

### New Features

Expand All @@ -49,3 +50,4 @@ _None._

- Add this changelog file [#234]
- Log a message if events won't be collected because the user opted out [#239]
- Make `Variation` confirm to cobable. [#247]
4 changes: 2 additions & 2 deletions Sources/Experiments/ABTesting.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public enum Variation: Equatable {
public enum Variation: Equatable, Codable {
case control
case treatment
case customTreatment(name: String)
Expand All @@ -13,5 +13,5 @@ public protocol ABTesting {
func refresh(completion: (() -> Void)?)

/// Return an experiment variation
func experiment(_ name: String) -> Variation
func experiment(_ name: String) -> Variation?
}
4 changes: 2 additions & 2 deletions Sources/Experiments/ExPlat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ import Cocoa
}
}

public func experiment(_ name: String) -> Variation {
public func experiment(_ name: String) -> Variation? {
guard let assignments = UserDefaults.standard.object(forKey: assignmentsKey) as? [String: String?],
case let variation?? = assignments[name] else {
return .control
return nil
}

switch variation {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Model/ObjC/Constants/TracksConstants.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "TracksConstants.h"

NSString *const TracksErrorDomain = @"TracksErrorDomain";
NSString *const TracksLibraryVersion = @"1.0.0";
NSString *const TracksLibraryVersion = @"1.1.0-beta";
4 changes: 2 additions & 2 deletions Tests/Tests/ABTesting/ExPlatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExPlatTests: XCTestCase {
let abTesting = ExPlat(configuration: exPlatTestConfiguration, service: ExPlatServiceMock())

abTesting.refresh {
XCTAssertEqual(abTesting.experiment("experiment"), .control)
XCTAssertNil(abTesting.experiment("experiment"))
XCTAssertEqual(abTesting.experiment("another_experiment"), .treatment)
XCTAssertEqual(abTesting.experiment("experiment_multiple_variation"), .customTreatment(name: "another_treatment"))
expectation.fulfill()
Expand Down Expand Up @@ -70,7 +70,7 @@ class ExPlatTests: XCTestCase {

serviceMock.returnAssignments = false
abTesting.refresh {
XCTAssertEqual(abTesting.experiment("experiment"), .control)
XCTAssertNil(abTesting.experiment("experiment"))
XCTAssertEqual(abTesting.experiment("another_experiment"), .treatment)
XCTAssertEqual(abTesting.experiment("experiment_multiple_variation"), .customTreatment(name: "another_treatment"))
expectation.fulfill()
Expand Down