File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed
Sources/Remote Logging/Crash Logging Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ _None._
3838
3939### New Features
4040
41- _ None. _
41+ - Exposed Sentry's ` onCrashedLastRun ` to ` CrashLoggingDataProvider ` .
4242
4343### Bug Fixes
4444
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ public class CrashLogging {
8383 options. enableUserInteractionTracing = self . dataProvider. enableUserInteractionTracing
8484 options. enableUIViewControllerTracing = self . dataProvider. enableUIViewControllerTracking
8585 #endif
86+
87+ options. onCrashedLastRun = self . dataProvider. onCrashedLastRun
8688 }
8789
8890 Internals . crashLogging = self
Original file line number Diff line number Diff line change 11import Foundation
2+ import Sentry
23
34#if SWIFT_PACKAGE
45import AutomatticTracksModel
@@ -17,6 +18,9 @@ public protocol CrashLoggingDataProvider {
1718 var enableAppHangTracking : Bool { get }
1819 /// Whether HTTP client errors are captured.
1920 var enableCaptureFailedRequests : Bool { get }
21+
22+ /// A closure that will run shortly after the crash logging is initialized in case a crash was detected during the previous run.
23+ var onCrashedLastRun : ( ( Event ) -> Void ) ? { get }
2024}
2125
2226/// Default implementations of common protocol properties
@@ -94,4 +98,8 @@ public extension CrashLoggingDataProvider {
9498 var errorEventsSamplingRate : Double {
9599 return 1.0
96100 }
101+
102+ var onCrashedLastRun : ( ( Event ) -> Void ) ? {
103+ return nil
104+ }
97105}
Original file line number Diff line number Diff line change @@ -196,6 +196,12 @@ class CrashLoggingTests: XCTestCase {
196196 XCTAssertTrue ( dataProvider. enableUserInteractionTracing)
197197 #endif
198198 }
199+
200+ func testOnCrashedLastRunDisabledByDefault( ) {
201+ let dataProvider = MockCrashLoggingDataProvider ( )
202+
203+ XCTAssertNil ( dataProvider. onCrashedLastRun)
204+ }
199205}
200206
201207/// Allow throwing Strings as error
You can’t perform that action at this time.
0 commit comments