Skip to content

Commit

Permalink
Merge 1634638 into 3d3a411
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann committed Jan 2, 2024
2 parents 3d3a411 + 1634638 commit 122ae54
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,7 @@

- TTFD waits for next drawn frame (#3505)
- Fix TTID/TTFD for app start transactions (#3512): TTID/TTFD spans and measurements for app start transaction now include the app start duration.
- Crash when adding a crumb for a timezone change (#3524)
- Fix a race condition in SentryTracer (#3523)

## 8.17.2
Expand Down
14 changes: 9 additions & 5 deletions Sources/Sentry/SentrySystemEventBreadcrumbs.m
Expand Up @@ -240,11 +240,15 @@ - (void)timezoneEventTriggered:(NSNumber *)storedTimezoneOffset
NSInteger offset = SentryDependencyContainer.sharedInstance.dateProvider.timezoneOffset;

crumb.type = @"system";
crumb.data = @{
@"action" : @"TIMEZONE_CHANGE",
@"previous_seconds_from_gmt" : storedTimezoneOffset,
@"current_seconds_from_gmt" : @(offset)
};

NSMutableDictionary *dataDict =
[@{ @"action" : @"TIMEZONE_CHANGE", @"current_seconds_from_gmt" : @(offset) } mutableCopy];

if (storedTimezoneOffset != nil) {
dataDict[@"previous_seconds_from_gmt"] = storedTimezoneOffset;
}

crumb.data = dataDict;
[_delegate addBreadcrumb:crumb];

[self updateStoredTimezone];
Expand Down
@@ -1,3 +1,4 @@
import Nimble
@testable import Sentry
import SentryTestUtils
import XCTest
Expand Down Expand Up @@ -251,6 +252,20 @@ class SentrySystemEventBreadcrumbsTest: XCTestCase {
XCTAssertEqual(data["current_seconds_from_gmt"] as? Int64, 7_200)
}
}

func testTimezoneChangeNotificationBreadcrumb_NoStoredTimezoneOffset() {
sut = fixture.getSut(currentDevice: nil)

fixture.currentDateProvider.timezoneOffsetValue = 7_200
fixture.fileManager.deleteTimezoneOffset()

sut.timezoneEventTriggered()

assertBreadcrumbAction(action: "TIMEZONE_CHANGE") { data in
expect(data["previous_seconds_from_gmt"]) == nil
expect(data["current_seconds_from_gmt"] as? Int64) == 7_200
}
}

func testStopCallsSpecificRemoveObserverMethods() {
sut = fixture.getSut(currentDevice: nil)
Expand Down

0 comments on commit 122ae54

Please sign in to comment.