From 79bac91c825bb71a0f229a32bef140f214837c9d Mon Sep 17 00:00:00 2001 From: Brian Nickel Date: Wed, 28 Aug 2024 16:11:21 -0700 Subject: [PATCH] [MOBILE-11948] Release 0.7.1 with Live data feed identity (#165) --- CHANGELOG.md | 11 +++++++++-- .../NotificationInteractionSource.swift | 1 + .../HeapSwiftCore/Protobufs/Extensions/Message.swift | 4 ++++ Development/Sources/HeapSwiftCore/Version.swift | 2 +- .../EventConsumer/IdentifySpec.swift | 11 +++++++++++ .../EventConsumer/ResetIdentitySpec.swift | 12 +++++++++++- HeapSwiftCore.podspec | 2 +- 7 files changed, 38 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffd6358..b71cec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.7.1] + +### Added + +- The SDK now sends identity to the Live data feed. + ## [0.7.0] ### Added @@ -192,7 +198,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for manual capture within WKWebView. - Support for platforms targeting Swift: macOS, watchOS, iOS, iPadOS, tvOS. -[Unreleased]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.0...main +[Unreleased]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.1...main +[0.7.1]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.0...0.7.1 [0.7.0]: https://github.com/heap/heap-swift-core-sdk/compare/0.6.1...0.7.0 [0.6.1]: https://github.com/heap/heap-swift-core-sdk/compare/0.6.0...0.6.1 [0.6.0]: https://github.com/heap/heap-swift-core-sdk/compare/0.5.3...0.6.0 @@ -208,4 +215,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [0.1.2]: https://github.com/heap/heap-swift-core-sdk/compare/0.1.1...0.1.2 [0.1.1]: https://github.com/heap/heap-swift-core-sdk/compare/0.1.0...0.1.1 [0.1.0]: https://github.com/heap/heap-swift-core-sdk/releases/tag/0.1.0 -[user privacy and data use]: https://developer.apple.com/app-store/user-privacy-and-data-use/ \ No newline at end of file +[user privacy and data use]: https://developer.apple.com/app-store/user-privacy-and-data-use/ diff --git a/Development/Sources/HeapSwiftCore/Implementations/EventConsumer/NotificationInteractionSource.swift b/Development/Sources/HeapSwiftCore/Implementations/EventConsumer/NotificationInteractionSource.swift index dc123f4..7035b74 100644 --- a/Development/Sources/HeapSwiftCore/Implementations/EventConsumer/NotificationInteractionSource.swift +++ b/Development/Sources/HeapSwiftCore/Implementations/EventConsumer/NotificationInteractionSource.swift @@ -8,6 +8,7 @@ extension NotificationInteractionSource { case .geofence: return .sourceGeofence case .interval: return .sourceTimeInterval case .calendar: return .sourceCalendar + @unknown default: return .sourceUnknown } } } diff --git a/Development/Sources/HeapSwiftCore/Protobufs/Extensions/Message.swift b/Development/Sources/HeapSwiftCore/Protobufs/Extensions/Message.swift index f596a7c..a279eb4 100644 --- a/Development/Sources/HeapSwiftCore/Protobufs/Extensions/Message.swift +++ b/Development/Sources/HeapSwiftCore/Protobufs/Extensions/Message.swift @@ -8,6 +8,10 @@ extension Message { envID = state.environment.envID userID = state.environment.userID + if state.environment.hasIdentity { + identity = state.environment.identity + } + baseLibrary = state.sdkInfo.libraryInfo application = state.sdkInfo.applicationInfo device = state.sdkInfo.deviceInfo diff --git a/Development/Sources/HeapSwiftCore/Version.swift b/Development/Sources/HeapSwiftCore/Version.swift index a3365e2..051bcb7 100644 --- a/Development/Sources/HeapSwiftCore/Version.swift +++ b/Development/Sources/HeapSwiftCore/Version.swift @@ -8,7 +8,7 @@ struct Version { static let minor = 7 /// Revision number. - static let revision = 0 + static let revision = 1 /// Optional pre-release version static let prerelease: String? = nil diff --git a/Development/Tests/HeapSwiftCoreTests/EventConsumer/IdentifySpec.swift b/Development/Tests/HeapSwiftCoreTests/EventConsumer/IdentifySpec.swift index ad2cd64..49484e1 100644 --- a/Development/Tests/HeapSwiftCoreTests/EventConsumer/IdentifySpec.swift +++ b/Development/Tests/HeapSwiftCoreTests/EventConsumer/IdentifySpec.swift @@ -104,6 +104,17 @@ final class EventConsumer_IdentifySpec: HeapSpec { let state = dataStore.loadState(for: "11") expect(state.properties).to(equal(originalState.properties)) } + + it("causes identity to be sent in subsequent messages") { + consumer.track("event") + let user = try dataStore.assertUserToUploadExists(with: consumer.userId!) + let messages = try dataStore.getPendingMessages(for: user, sessionId: consumer.activeOrExpiredSessionId) + + expect(messages).toNot(beEmpty()) + for message in messages { + expect(message.identity).to(equal("user1")) + } + } } context("called with a valid identity, before the session expires") { diff --git a/Development/Tests/HeapSwiftCoreTests/EventConsumer/ResetIdentitySpec.swift b/Development/Tests/HeapSwiftCoreTests/EventConsumer/ResetIdentitySpec.swift index a6b66a9..761d218 100644 --- a/Development/Tests/HeapSwiftCoreTests/EventConsumer/ResetIdentitySpec.swift +++ b/Development/Tests/HeapSwiftCoreTests/EventConsumer/ResetIdentitySpec.swift @@ -174,7 +174,17 @@ final class EventConsumer_ResetIdentitySpec: HeapSpec { it("extends the session") { try consumer.assertSessionWasExtended(from: resetTimestamp) - } + } + + it("causes identity to not be sent in subsequent messages") { + let user = try dataStore.assertUserToUploadExists(with: consumer.userId!) + let messages = try dataStore.getPendingMessages(for: user, sessionId: consumer.activeOrExpiredSessionId) + + expect(messages).toNot(beEmpty()) + for message in messages { + expect(message.identity).to(beEmpty()) + } + } } context("Heap is recording with clearEventPropertiesOnNewUser set as true") { diff --git a/HeapSwiftCore.podspec b/HeapSwiftCore.podspec index 0f9542f..1d0ef9a 100644 --- a/HeapSwiftCore.podspec +++ b/HeapSwiftCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'HeapSwiftCore' - s.version = '0.7.0' + s.version = '0.7.1' s.license = { :type => 'MIT' } s.summary = 'The core Heap library used for apps on Apple platforms.' s.homepage = 'https://heap.io'