Add iOS lifecycle hardening hooks
This commit is contained in:
@@ -9,6 +9,7 @@ struct TeleTuiIOSSmokeTests {
|
||||
try await chatDetailLoadsAndSendsMessage()
|
||||
try await messageActionsCoverEditReplyForwardReactDeleteSearchAndCopy()
|
||||
try await platformServicesCoverNotificationsMediaVoiceClipboardAndAccounts()
|
||||
lifecycleCoordinatorDropsStaleAccountEvents()
|
||||
try await profileLoadsFromSelectedChat()
|
||||
appStorageUsesApplicationSupportStyleAccountPaths()
|
||||
print("TeleTuiIOS smoke tests passed")
|
||||
@@ -141,6 +142,35 @@ struct TeleTuiIOSSmokeTests {
|
||||
precondition(switcher.activeAccount.databasePath.path.hasSuffix("/Accounts/work/tdlib"))
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func lifecycleCoordinatorDropsStaleAccountEvents() {
|
||||
let coordinator = SessionLifecycleCoordinator(activeAccountId: "personal")
|
||||
precondition(coordinator.shouldPollEvents)
|
||||
|
||||
coordinator.enterBackground()
|
||||
precondition(!coordinator.shouldPollEvents)
|
||||
|
||||
coordinator.enterForeground()
|
||||
precondition(coordinator.shouldPollEvents)
|
||||
|
||||
let oldGenerationEvent = ScopedSessionEvent(
|
||||
accountId: "personal",
|
||||
generation: coordinator.generation,
|
||||
event: .authChanged(.ready)
|
||||
)
|
||||
precondition(coordinator.accepts(oldGenerationEvent))
|
||||
|
||||
coordinator.switchAccount(to: "work")
|
||||
precondition(!coordinator.accepts(oldGenerationEvent))
|
||||
|
||||
let newGenerationEvent = ScopedSessionEvent(
|
||||
accountId: "work",
|
||||
generation: coordinator.generation,
|
||||
event: .authChanged(.ready)
|
||||
)
|
||||
precondition(coordinator.accepts(newGenerationEvent))
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func profileLoadsFromSelectedChat() async throws {
|
||||
let bridge = FakeSessionBridge(auth: .ready)
|
||||
|
||||
Reference in New Issue
Block a user