commit 4ee38a5eab8d562e239cdb30d1939c17e61389d2
parent ce46e14884c49bdd5df58fd972b2199db2371ec8
Author: Michael Camilleri <[email protected]>
Date: Sun, 7 Jun 2026 19:23:20 +0900
Tweak announcement wording
Diffstat:
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/Crossmate/Services/AppServices.swift b/Crossmate/Services/AppServices.swift
@@ -2888,7 +2888,7 @@ final class AppServices {
let name = summary.playerName.isEmpty ? "A player" : summary.playerName
if summary.isFirstObservation {
let count = summary.added
- return "\(name) has added \(count) \(count == 1 ? "letter" : "letters") so far"
+ return "\(name) added \(count) \(count == 1 ? "letter" : "letters") while you were away"
}
var parts: [String] = []
if summary.added > 0 {
diff --git a/Crossmate/Sync/SessionMonitor.swift b/Crossmate/Sync/SessionMonitor.swift
@@ -27,9 +27,9 @@ final class SessionMonitor {
/// player and puzzle names so the caller can format a body string
/// without a second Core Data round-trip.
///
- /// `isFirstObservation` flips the formatter from delta wording ("Alice
- /// added 5 letters") to cumulative wording ("Alice has added 50 letters
- /// so far"). Set on the first ever observation of `(gameID, authorID)` —
+ /// `isFirstObservation` flips the formatter from regular delta wording
+ /// ("Alice added 5 letters") to away wording ("Alice added 50 letters
+ /// while you were away"). Set on the first ever observation of `(gameID, authorID)` —
/// e.g. just-joined shared game or fresh install — when there is no
/// "since you last looked" period to describe and `added` is the peer's
/// current total filled cells, not a per-session delta.
@@ -86,8 +86,8 @@ final class SessionMonitor {
} else {
// First observation of this peer — there's no "since you
// last looked" period to describe. Surface the peer's
- // current contribution as cumulative context ("Alice has
- // added 50 letters so far") so a freshly joined user knows
+ // current contribution as away context ("Alice added 50
+ // letters while you were away") so a freshly joined user knows
// there's progress already in the grid.
added = current.filled.count
cleared = 0
diff --git a/Tests/Unit/Sync/AppServicesAnnouncementTests.swift b/Tests/Unit/Sync/AppServicesAnnouncementTests.swift
@@ -14,7 +14,8 @@ struct AppServicesAnnouncementTests {
playerName: String,
added: Int = 0,
cleared: Int = 0,
- puzzleTitle: String = "Tuesday Mini"
+ puzzleTitle: String = "Tuesday Mini",
+ isFirstObservation: Bool = false
) -> SessionMonitor.SessionSummary {
SessionMonitor.SessionSummary(
gameID: gameID,
@@ -22,7 +23,8 @@ struct AppServicesAnnouncementTests {
playerName: playerName,
puzzleTitle: puzzleTitle,
added: added,
- cleared: cleared
+ cleared: cleared,
+ isFirstObservation: isFirstObservation
)
}
@@ -50,6 +52,14 @@ struct AppServicesAnnouncementTests {
])
#expect(body == "A player added 3 letters.")
}
+
+ @Test("First-observation summary uses away wording")
+ func firstObservation() {
+ let body = AppServices.formatSummaryBanner([
+ summary(author: "a", playerName: "Alice", added: 4, isFirstObservation: true),
+ ])
+ #expect(body == "Alice added 4 letters while you were away.")
+ }
}
@Suite("AppServices peer presence", .serialized)