Fix onboarding crash

This commit fixes a crash that occurred when clicking "follow all"
during onboarding.

This fix works by making `Contacts` and `PostBox` isolated into a
specific Swift Actor, and updating direct and indirect usages
accordingly.

Changelog-Fixed: Fixed a crash that occurred when clicking "follow all" during onboarding.
Closes: https://github.com/damus-io/damus/issues/3422
Co-authored-by: alltheseas <64376233+alltheseas@users.noreply.github.com>
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2026-01-05 15:57:20 -08:00
parent 368f94a209
commit 71c36052e2
31 changed files with 96 additions and 39 deletions

View File

@@ -23,6 +23,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertFalse(result)
}
@MainActor
func testIsFavorite_WhenPubkeyExists_ReturnsTrue() {
// Given: A pubkey added to favorites
let sut = ContactCardManager()
@@ -36,6 +37,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertTrue(result)
}
@MainActor
func testIsFavorite_WhenPubkeyDoesNotExist_ReturnsFalse() {
// Given: A different pubkey added to favorites
let sut = ContactCardManager()
@@ -50,6 +52,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertFalse(result)
}
@MainActor
func testToggleFavorite_WhenNotFavorite_AddsToFavorites() {
// Given: A pubkey not in favorites
let sut = ContactCardManager()
@@ -64,6 +67,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertEqual(sut.favorites.count, 1)
}
@MainActor
func testToggleFavorite_WhenAlreadyFavorite_RemovesFromFavorites() {
// Given: A pubkey already in favorites
let sut = ContactCardManager()
@@ -105,6 +109,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertTrue(sut.isFavorite(targetPubkey))
}
@MainActor
func testloadEvent_WithContactCard_RemovesFromFavorites() {
// Given: A contact card event without favorite tag (unfavorite)
let sut = ContactCardManager()
@@ -219,6 +224,7 @@ final class ContactCardManagerTests: XCTestCase {
XCTAssertTrue(sut.isFavorite(targetPubkey))
}
@MainActor
func testFilter_WithFavoritePubkey_ReturnsTrue() {
// Given: A pubkey in favorites
let sut = ContactCardManager()