Skip to content

Commit

Permalink
Merge 74bc2e1 into 9754750
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers authored Nov 14, 2022
2 parents 9754750 + 74bc2e1 commit bba6cd3
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Fixes

- Too long flush duration (#2370)
- Do not delete the app state when OOM tracking is disabled (#2382)

## 7.30.2

Expand Down
8 changes: 0 additions & 8 deletions Sources/Sentry/SentryAppStateManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ - (void)stop
removeObserver:self
name:SentryNSNotificationCenterWrapper.willTerminateNotificationName
object:nil];

[self deleteAppState];
}
}

Expand All @@ -124,7 +122,6 @@ - (void)dealloc
// In dealloc it's safe to unsubscribe for all, see
// https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver
[NSNotificationCenter.defaultCenter removeObserver:self];
[self deleteAppState];
}

/**
Expand Down Expand Up @@ -199,11 +196,6 @@ - (void)storeCurrentAppState
[self.fileManager storeAppState:[self buildCurrentAppState]];
}

- (void)deleteAppState
{
[self.fileManager deleteAppState];
}

#endif

@end
2 changes: 0 additions & 2 deletions Sources/Sentry/include/SentryAppStateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ SENTRY_NO_INIT

- (void)storeCurrentAppState;

- (void)deleteAppState;

- (void)updateAppState:(void (^)(SentryAppState *))block;

#endif
Expand Down
27 changes: 1 addition & 26 deletions Tests/SentryTests/Helper/SentryAppStateManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,39 +65,14 @@ class SentryAppStateManagerTests: XCTestCase {
XCTAssertNil(fixture.fileManager.readAppState())
}

func testStopDeletesAppState() {
func testStopDoesNotDeleteAppState() {
XCTAssertNil(fixture.fileManager.readAppState())

sut.start()
XCTAssertNotNil(fixture.fileManager.readAppState())

sut.stop()
XCTAssertNil(fixture.fileManager.readAppState())
}

func testStopOnlyRunsLogicWhenStartCountBecomesZero() {
XCTAssertNil(fixture.fileManager.readAppState())

sut.start()
XCTAssertNotNil(fixture.fileManager.readAppState())

sut.start()

sut.stop()
XCTAssertNotNil(fixture.fileManager.readAppState())

sut.stop()
XCTAssertNil(fixture.fileManager.readAppState())
}

func testStoreAndDeleteAppState() {
XCTAssertNil(fixture.fileManager.readAppState())

sut.storeCurrentAppState()
XCTAssertNotNil(fixture.fileManager.readAppState())

sut.deleteAppState()
XCTAssertNil(fixture.fileManager.readAppState())
}

func testUpdateAppState() {
Expand Down

0 comments on commit bba6cd3

Please sign in to comment.