Skip to content

Commit

Permalink
Merge pull request #36 from ringpublishing/bugfix/iz-parameter
Browse files Browse the repository at this point in the history
IZ is set only for O!Konto sso system name
  • Loading branch information
bbijoch authored Oct 7, 2024
2 parents 93758ed + 414ec72 commit f4b873d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Changelogs/1.5.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1.5.3 Release notes (2024-10-03)
================================

### Changes

* IZ parameter set only when SSO system name equals 'O!Konto'
4 changes: 2 additions & 2 deletions Example/RingPublishingTracking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.3;
MARKETING_VERSION = 1.5.4;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.RingPublishingTracking-Example.RingPublishingTracking";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1373,7 +1373,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.5.3;
MARKETING_VERSION = 1.5.4;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.RingPublishingTracking-Example.RingPublishingTracking";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion Example/RingPublishingTracking/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.5.3</string>
<string>1.5.4</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion RingPublishingTracking.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "RingPublishingTracking"
s.version = "1.5.3"
s.version = "1.5.4"

s.summary = "SDK used to report events from mobile application"
s.license = { :type => 'Copyright. Ringier Axel Springer Polska', :file => 'LICENSE' }
Expand Down
4 changes: 4 additions & 0 deletions Sources/RingPublishingTracking/Private/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ struct Constants {
// MARK: Video event

static let videoEventParametersPrefix = "video"

// MARK: SSO system name

static let raspSsoSystemName = "O!Konto"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class UserDataDecorator: Decorator {
}

// IZ
if let userId = data.userId {
if let userId = data.sso?.logged.id, data.ssoSystemName == Constants.raspSsoSystemName {
userDataParams["IZ"] = userId
}

Expand Down
21 changes: 20 additions & 1 deletion Tests/RingPublishingTrackingTests/DecoratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class DecoratorTests: XCTestCase {
XCTAssertNil(params["IZ"], "IZ should be empty")
}

func testParameters_userDataDecoratorCreated_returnedParametersAreCorrect() {
func testParameters_userDataDecoratorCreatedForNonOKontoSSO_returnedParametersAreCorrect() {
// Given
let userId = "12345"
let email = "[email protected]"
Expand All @@ -202,6 +202,25 @@ class DecoratorTests: XCTestCase {
eyJzc28iOnsibG9nZ2VkIjp7ImlkIjoiMTIzNDUiLCJtZDUiOiI5Mzk0MmU5NmY1YWNkODNlMmUwNDdhZDhmZTAzMTE0ZCJ9LCJuYW1lIjoiVGVzdCJ9fQ==
"""

XCTAssertEqual(params["RDLU"], expectedBase64, "RDLU should match")
XCTAssertTrue(params["IZ"] == nil, "IZ should be empty for SSO system name not equal to O!Konto")
}

func testParameters_userDataDecoratorCreatedForOKontoSSO_returnedParametersAreCorrect() {
// Given
let userId = "12345"
let email = "[email protected]"
let decorator = UserDataDecorator()

// Then
decorator.updateUserData(userId: userId, email: email)
decorator.updateSSO(ssoSystemName: "O!Konto")
let params = decorator.parameters

let expectedBase64 = """
eyJzc28iOnsibG9nZ2VkIjp7ImlkIjoiMTIzNDUiLCJtZDUiOiI5Mzk0MmU5NmY1YWNkODNlMmUwNDdhZDhmZTAzMTE0ZCJ9LCJuYW1lIjoiTyFLb250byJ9fQ==
"""

XCTAssertEqual(params["RDLU"], expectedBase64, "RDLU should match")
XCTAssertEqual(params["IZ"], userId, "IZ should match")
}
Expand Down

0 comments on commit f4b873d

Please sign in to comment.