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

Fixed compile issue w/ Analytics-Swift 1.6 #2

Merged
merged 5 commits into from
Sep 13, 2024
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 .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- run: xcodebuild -scheme SegmentConsent test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13'
- run: xcodebuild -scheme SegmentConsent test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15'

build_and_test_tvos:
needs: cancel_previous
Expand Down
17 changes: 13 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/segmentio/analytics-swift.git",
"state" : {
"revision" : "efc111b5fccaebd1063ef0db6d206c252da387ec",
"version" : "1.4.8"
"revision" : "338be8f55c83309f10d2cfd0193505117b4ab2d5",
"version" : "1.6.0"
}
},
{
"identity" : "jsonsafeencoding-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/segmentio/jsonsafeencoding-swift.git",
"state" : {
"revision" : "af6a8b360984085e36c6341b21ecb35c12f47ebd",
"version" : "2.0.0"
}
},
{
"identity" : "sovran-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/segmentio/Sovran-Swift.git",
"state" : {
"revision" : "64f3b5150c282a34af4578188dce2fd597e600e3",
"version" : "1.1.0"
"revision" : "24867f3e4ac62027db9827112135e6531b6f4051",
"version" : "1.1.2"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
platforms: [
.macOS("10.15"),
.iOS("13.0"),
.tvOS("11.0")
.tvOS("13.0")
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand All @@ -19,7 +19,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.4.8")
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.6.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
8 changes: 4 additions & 4 deletions Sources/SegmentConsent-Tests/ConsentBlockerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ConsentBlockerTests: XCTestCase {
}

func testBlockWhenPartialConsentAvailable() {
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockWhenPartialConsentAvailable").trackApplicationLifecycleEvents(false))

// Artificially give segment.io destination some consent settings
let segmentSettings = [
Expand Down Expand Up @@ -51,7 +51,7 @@ final class ConsentBlockerTests: XCTestCase {
}

func testBlockBecauseNoConsentSettings() {
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoConsentSettings").trackApplicationLifecycleEvents(false))
let output = OutputReaderPlugin()
let consentManager = ConsentManager(provider: NoConsentProvider())

Expand All @@ -72,7 +72,7 @@ final class ConsentBlockerTests: XCTestCase {
}

func testBlockBecauseNoStamp() {
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoStamp").trackApplicationLifecycleEvents(false))
let output = OutputReaderPlugin()
let consentManager = ConsentManager(provider: AllConsentProvider())

Expand Down Expand Up @@ -106,7 +106,7 @@ final class ConsentBlockerTests: XCTestCase {
}

func testBlockBecauseNoConsent() {
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoConsent").trackApplicationLifecycleEvents(false))
let output = OutputReaderPlugin()
let consentManager = ConsentManager(provider: NoConsentProvider())

Expand Down
12 changes: 6 additions & 6 deletions Sources/SegmentConsent-Tests/ConsentNotEnabledAtSegment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
}

func testNoToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "testNoToAll")

let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "testNoToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -82,10 +82,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
}

func testYesToSome() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "testYesToSome")

let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "testYesToSome")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -144,10 +144,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
}

func testYesToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "testYesToAll")

let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "testYesToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
}

func testNoToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "dmc.testNoToAll")

let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testNoToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -67,10 +67,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
}

func testYesTo1() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "dmc.testYesTo1")

let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesTo1")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -114,10 +114,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
}

func testYesTo2() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "dmc.testYesTo2")

let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesTo2")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -161,10 +161,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
}

func testYesToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "dmc.testYesToAll")

let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ final class NoUnmappedDestinationsTests: XCTestCase {
}

func testNoToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "nud.testNoToAll")

let settings = Settings.load(resource: "NoUnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "nud.testNoToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down
28 changes: 14 additions & 14 deletions Sources/SegmentConsent-Tests/UnmappedDestinationsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testNoToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testNoToAll")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testNoToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -82,10 +82,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesTo1() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesTo1")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo1")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -144,10 +144,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesTo2() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesTo2")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo2")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -206,10 +206,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesTo3() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesTo3")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo3")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -268,10 +268,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesTo4() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesTo4")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo4")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -330,10 +330,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesTo1and2() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesTo1and2")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo1and2")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down Expand Up @@ -392,10 +392,10 @@ final class UnmappedDestinationsTests: XCTestCase {
}

func testYesToAll() {
removeUserDefaults(forWriteKey: "test")
removeUserDefaults(forWriteKey: "ud.testYesToAll")

let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
let analytics = Analytics(configuration: Configuration(writeKey: "test")
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesToAll")
.trackApplicationLifecycleEvents(false)
.defaultSettings(settings)
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/SegmentConsent/Manager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extension ConsentManager {
}

public func start() {
started = true
_started.set(true)
// replay events. they'll be sent back through the system and get stamped above.
for event in queuedEvents {
analytics?.process(event: event)
Expand Down
Loading