mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Avoid race conditions between the home screen's crash alert and Sentry's onLastRunStatusDetermined
By converting the `lastCrashEventID` to a publisher that the VM can just listen to instead of relying on start to match a pre-set event
This commit is contained in:
@@ -21,7 +21,7 @@ final class BugReportServiceTests {
|
||||
appSettings.bugReportRageshakeURL.reset()
|
||||
|
||||
let bugReportServiceMock = BugReportServiceMock()
|
||||
bugReportServiceMock.crashedLastRun = false
|
||||
bugReportServiceMock.lastCrashEventIDSubject = .init(nil)
|
||||
bugReportServiceMock.submitBugReportProgressListenerReturnValue = .success(SubmitBugReportResponse(reportURL: "https://www.example.com/123"))
|
||||
bugReportService = bugReportServiceMock
|
||||
}
|
||||
@@ -32,7 +32,7 @@ final class BugReportServiceTests {
|
||||
|
||||
@Test
|
||||
func initialStateWithMockService() {
|
||||
#expect(!bugReportService.crashedLastRun)
|
||||
#expect(bugReportService.lastCrashEventIDSubject.value == nil)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -62,7 +62,7 @@ final class BugReportServiceTests {
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
#expect(service.isEnabled)
|
||||
#expect(!service.crashedLastRun)
|
||||
#expect(bugReportService.lastCrashEventIDSubject.value == nil)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -74,7 +74,7 @@ final class BugReportServiceTests {
|
||||
session: .mock,
|
||||
appHooks: AppHooks())
|
||||
#expect(!service.isEnabled)
|
||||
#expect(!service.crashedLastRun)
|
||||
#expect(bugReportService.lastCrashEventIDSubject.value == nil)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -432,6 +432,7 @@ final class HomeScreenViewModelTests {
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: appSettings,
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
bugReportService: BugReportServiceMock(.init()),
|
||||
notificationManager: notificationManager,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user