Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SKAdN sourceIdentifier availability check #890

Merged
merged 1 commit into from
Aug 1, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class SkadnParametersManager: NSObject {
}

// For SKAdNetwork 4.0 add sourceidentifier that replaces campaign
if #available(iOS 16.0, *) {
if #available(iOS 16.1, *) {
if let sourceidentifier = skadnInfo.sourceidentifier, let sourceidentifierInteger = Int(sourceidentifier) {
imp.sourceIdentifier = NSNumber(value: sourceidentifierInteger)
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public class SkadnParametersManager: NSObject {
productParams[SKStoreProductParameterAdNetworkCampaignIdentifier] = campaign
}

if #available(iOS 16.0, *) {
if #available(iOS 16.1, *) {
if let sourceIdentifier = skadnInfo.sourceidentifier, let sourceidentifierInteger = Int(sourceIdentifier) {
productParams[SKStoreProductParameterAdNetworkSourceIdentifier] = NSNumber(value: sourceidentifierInteger)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SkadnParametersManagerTest: XCTestCase {
PBMAssertEq(type: String.self, actual: actual[SKStoreProductParameterAdNetworkAttributionSignature]!, expected: expected[SKStoreProductParameterAdNetworkAttributionSignature]!)
}

@available(iOS 16.0, *)
@available(iOS 16.1, *)
func testGetSkadnImpression_version_4_0() {
let skadn = SkadnUtilities.createSkadnExtWithFidelities_version_4_0()
let nonceForFidelity0 = skadn.fidelities!.filter({ $0.fidelity == 0 }).first!.nonce!
Expand All @@ -64,7 +64,7 @@ class SkadnParametersManagerTest: XCTestCase {
PBMAssertEq(type: String.self, actual: actual.signature, expected: expected.signature)
}

@available(iOS 16.0, *)
@available(iOS 16.1, *)
func testGetProductParameters_version_4_0() {
let skadn = SkadnUtilities.createSkadnExtWithFidelities_version_4_0()
let actual = SkadnParametersManager.getSkadnProductParameters(for: skadn)!
Expand Down Expand Up @@ -143,7 +143,7 @@ class SkadnUtilities {

}

@available(iOS 16.0, *)
@available(iOS 16.1, *)
class func createSkadnProductParameters_version_4_0(from skadn: PBMORTBBidExtSkadn) -> [String: Any] {
let fidelity1 = skadn.fidelities!.filter({ $0.fidelity == 1 }).first!
return [
Expand Down Expand Up @@ -172,7 +172,7 @@ class SkadnUtilities {
return imp
}

@available(iOS 16.0, *)
@available(iOS 16.1, *)
class func createSkadImpression_version_4_0(with nonce: UUID) -> SKAdImpression {
let imp = SKAdImpression()
imp.sourceAppStoreItemIdentifier = 880047117
Expand Down