Skip to content

Commit c4a7608

Browse files
authored
[MOBILE-12406] Release 0.7.2, filtering empty events (#166)
1 parent 79bac91 commit c4a7608

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
1414
## [Unreleased]
1515

16+
## [0.7.2]
17+
18+
### Fixed
19+
20+
- Zero length events (`Heap.shared.track("")`) are no longer uploaded to the server, where they were
21+
being rejected.
22+
1623
## [0.7.1]
1724

1825
### Added
@@ -198,7 +205,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
198205
- Support for manual capture within WKWebView.
199206
- Support for platforms targeting Swift: macOS, watchOS, iOS, iPadOS, tvOS.
200207

201-
[Unreleased]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.1...main
208+
[Unreleased]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.2...main
209+
[0.7.2]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.1...0.7.2
202210
[0.7.1]: https://github.com/heap/heap-swift-core-sdk/compare/0.7.0...0.7.1
203211
[0.7.0]: https://github.com/heap/heap-swift-core-sdk/compare/0.6.1...0.7.0
204212
[0.6.1]: https://github.com/heap/heap-swift-core-sdk/compare/0.6.0...0.6.1

Development/Sources/HeapSwiftCore/Implementations/EventConsumer/EventConsumer.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,13 @@ extension EventConsumer {
186186

187187
func track(_ event: String, properties: [String: HeapPropertyValue] = [:], timestamp: Date = Date(), sourceInfo: SourceInfo? = nil, pageview: Pageview? = nil) {
188188

189+
if event.utf16.count == 0 {
190+
HeapLogger.shared.warn("Event without a name will not be logged.")
191+
return
192+
}
193+
189194
if event.utf16.count > 512 {
190-
HeapLogger.shared.warn("Event \(event) was not logged because its name exceeds 512 UTF-16 code units")
195+
HeapLogger.shared.warn("Event \(event) was not logged because its name exceeds 512 UTF-16 code units.")
191196
return
192197
}
193198

Development/Sources/HeapSwiftCore/Version.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct Version {
88
static let minor = 7
99

1010
/// Revision number.
11-
static let revision = 1
11+
static let revision = 2
1212

1313
/// Optional pre-release version
1414
static let prerelease: String? = nil

Development/Tests/HeapSwiftCoreTests/EventConsumer/TrackSpec.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,18 @@ final class EventConsumer_TrackSpec: HeapSpec {
201201
try dataStore.assertExactPendingMessagesCountInOnlySession(for: user, count: 4)
202202
}
203203

204-
it("does not send event where the event name is above the maximum length") {
204+
it("does not send an event where the event name is above the maximum length") {
205205
let name = String(repeating: "", count: 513)
206206
consumer.track(name)
207207
let user = try dataStore.assertOnlyOneUserToUpload()
208208
expect(user.sessionIds).to(beEmpty(), description: "The event should have been suppressed, so the first session should not have started.")
209209
}
210+
211+
it("does not send an event where the event name is empty") {
212+
consumer.track("")
213+
let user = try dataStore.assertOnlyOneUserToUpload()
214+
expect(user.sessionIds).to(beEmpty(), description: "The event should have been suppressed, so the first session should not have started.")
215+
}
210216

211217
it("records events sequentially on the main thread") {
212218

HeapSwiftCore.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'HeapSwiftCore'
3-
s.version = '0.7.1'
3+
s.version = '0.7.2'
44
s.license = { :type => 'MIT' }
55
s.summary = 'The core Heap library used for apps on Apple platforms.'
66
s.homepage = 'https://heap.io'

0 commit comments

Comments
 (0)