Skip to content

Commit bc5f14f

Browse files
committed
Stop stale ghost notification on reconnect + show changelog in update prompt (v1.0.3)
- An old message the server replays on reconnect was treated as new because isNew only checked the ~30-message in-memory window, not stored history. It re-fired its notification on every launch. isNew now also checks the DB (new MessageStore.exists(id:)), so already-stored messages stay silent. - Added CHANGELOG.md and taught release.sh to embed the current version's section as inline <description> release notes in the appcast — Sparkle shows it in the 'A new version is available' prompt — and to emit RELEASE_NOTES.md for the GitHub release.
1 parent ef3c97f commit bc5f14f

5 files changed

Lines changed: 93 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Relay — Changelog
2+
3+
All notable changes to Relay, newest first. The current version's bullet list is
4+
shown right inside the in-app update prompt ("A new version is available — would
5+
you like to install it?"), so you can see what's new before updating.
6+
7+
## 1.0.3
8+
- Fixed a stale "ghost" notification that replayed an old message every time the app reconnected.
9+
- Update prompts now show this changelog, so you can see what changed before you install.
10+
11+
## 1.0.2
12+
- Reaction bar no longer runs off the side of the window — it now opens toward the centre of the screen.
13+
- Reaction picker stays put while you choose an emoji instead of flickering shut.
14+
- Fixed the double "send" animation that made one message look like it was sent twice.
15+
16+
## 1.0.1
17+
- Hardened Return-to-send on macOS Ventura so Enter reliably sends a message.
18+
- Hid translation menu items on macOS versions that don't support them, so there are no dead buttons.
19+
20+
## 1.0
21+
- First public release: a native macOS Messenger client over a Go backend that speaks Meta's real protocol.
22+
- Messaging with reactions, replies, edit, unsend, forward, and multi-image media.
23+
- Voice notes, emoji, drag-and-drop, scheduled send, snooze, pin, mute, and saved messages.
24+
- Full-text search across all local history; per-chat accent colours, wallpapers, and nicknames.
25+
- On-device translation (macOS 15+), Touch ID lock, menu-bar companion, and one-click in-app updates.
26+
- Universal binary — runs on both Apple Silicon and Intel, macOS 13 Ventura or later.

‎RelayNative/Backend.swift‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,11 @@ final class RelayStore: ObservableObject {
13701370
return
13711371
}
13721372
var arr = messagesByThread[thread] ?? []
1373-
let isNew = !arr.contains(msg)
1373+
// "New" means we've never stored this message — NOT merely that it's outside the
1374+
// short in-memory window (which only holds ~30 messages). Without the DB check, an
1375+
// old message the server replays on reconnect looks new on every launch and
1376+
// re-fires its notification — the stale "ghost" notification.
1377+
let isNew = !arr.contains(msg) && !db.exists(id: id)
13741378
if isNew {
13751379
db.upsert(msg) // always persist
13761380
// Only grow the in-memory window if it's showing the latest messages. If the

‎RelayNative/MessageStore.swift‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ final class MessageStore {
188188
}
189189
}
190190

191+
/// True if a message with this id is already in our local history (any thread). Used to
192+
/// tell a genuinely-new live message from one the server replays on reconnect — the
193+
/// in-memory window only holds ~30 messages, so a containment check there is not enough.
194+
func exists(id: String) -> Bool {
195+
guard let st = prepare("SELECT 1 FROM messages WHERE id=? LIMIT 1;") else { return false }
196+
defer { sqlite3_finalize(st) }
197+
sqlite3_bind_text(st, 1, id, -1, SQLITE_TRANSIENT)
198+
return sqlite3_step(st) == SQLITE_ROW
199+
}
200+
191201
/// Fetch specific messages by id (used by Saved messages, which may not be in any window).
192202
func byIDs(_ ids: [String]) -> [Message] {
193203
guard !ids.isEmpty else { return [] }

‎project.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ packages:
1717

1818
settings:
1919
base:
20-
MARKETING_VERSION: "1.0.2"
21-
CURRENT_PROJECT_VERSION: "3"
20+
MARKETING_VERSION: "1.0.3"
21+
CURRENT_PROJECT_VERSION: "4"
2222
SWIFT_VERSION: "5.0"
2323
# No Apple Developer account required: builds are ad-hoc signed (CODE_SIGN_IDENTITY "-").
2424
# scripts/release.sh re-signs the bundle ad-hoc and ships it on GitHub Releases; users

‎scripts/release.sh‎

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,52 @@ if [ -n "${GENAPPCAST:-}" ] && [ -x "$GENAPPCAST" ]; then
7373
"$GENAPPCAST" --download-url-prefix "https://github.com/hatimhtm/Relay/releases/download/v$VERSION/" "$APPCAST_SRC"
7474
mv "$APPCAST_SRC/appcast.xml" "$APPCAST"
7575
rm -rf "$APPCAST_SRC"
76+
77+
# --- Embed this version's changelog as inline release notes ----------------
78+
# Sparkle renders an item's <description> HTML in the update prompt. Pull the
79+
# "## <VERSION>" section out of CHANGELOG.md, turn its bullets into an HTML
80+
# list, and inject it — so users see exactly what's new before they install.
81+
CHANGELOG="$ROOT/CHANGELOG.md"
82+
if [ -f "$CHANGELOG" ]; then
83+
# The raw bullets for this version (markdown), for the GitHub release notes.
84+
NOTES_MD="$DIST/RELEASE_NOTES.md"
85+
awk -v ver="$VERSION" '
86+
$0 ~ ("^## +" ver "([ \t]|$)") { grab=1; next }
87+
grab && /^## / { grab=0 }
88+
grab { print }
89+
' "$CHANGELOG" | sed '/^[[:space:]]*$/d' > "$NOTES_MD"
90+
91+
if [ -s "$NOTES_MD" ]; then
92+
# Build the HTML list (escape &, <, > so the CDATA stays valid).
93+
NOTES_HTML="$DIST/relnotes.html"
94+
{
95+
echo "<h3 style=\"margin:0 0 8px;font:600 14px -apple-system\">What&rsquo;s new in Relay $VERSION</h3>"
96+
echo "<ul style=\"margin:0;padding-left:20px;font:13px -apple-system;line-height:1.5\">"
97+
sed -E 's/^[[:space:]]*[-*][[:space:]]+//' "$NOTES_MD" \
98+
| sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' \
99+
| while IFS= read -r line; do [ -n "$line" ] && echo " <li>$line</li>"; done
100+
echo "</ul>"
101+
} > "$NOTES_HTML"
102+
103+
# Inject right after the item's opening <item> tag (the channel has none).
104+
TMP="$APPCAST.tmp"
105+
awk -v notesfile="$NOTES_HTML" '
106+
/<item>/ && !done {
107+
print
108+
print " <description><![CDATA["
109+
while ((getline l < notesfile) > 0) print l
110+
print " ]]></description>"
111+
done=1
112+
next
113+
}
114+
{ print }
115+
' "$APPCAST" > "$TMP" && mv "$TMP" "$APPCAST"
116+
rm -f "$NOTES_HTML"
117+
echo "→ Embedded the v$VERSION changelog into the appcast (shown in the update prompt)."
118+
else
119+
echo "⚠ No '## $VERSION' section in CHANGELOG.md — update prompt will have no notes." >&2
120+
fi
121+
fi
76122
else
77123
echo "⚠ generate_appcast not found — skipping appcast (auto-update won't update without it)." >&2
78124
echo " Download the Sparkle tools into .sparkle-tools/ or set GENAPPCAST — see RELEASE.md." >&2
@@ -86,9 +132,11 @@ echo " Zip (Sparkle update): $ZIP"
86132
[ -n "$APPCAST" ] && echo " Appcast (auto-update): $APPCAST"
87133
echo
88134
echo "Publish the release with the GitHub CLI (tag MUST be v$VERSION to match the appcast URLs):"
135+
NOTES_ARG="--notes \"…\""
136+
[ -f "$DIST/RELEASE_NOTES.md" ] && NOTES_ARG="--notes-file \"$DIST/RELEASE_NOTES.md\""
89137
if [ -n "$APPCAST" ]; then
90-
echo " gh release create v$VERSION \"$DMG\" \"$ZIP\" \"$APPCAST\" --title \"Relay v$VERSION\" --notes \"…\""
138+
echo " gh release create v$VERSION \"$DMG\" \"$ZIP\" \"$APPCAST\" --title \"Relay v$VERSION\" $NOTES_ARG"
91139
else
92-
echo " gh release create v$VERSION \"$DMG\" \"$ZIP\" --title \"Relay v$VERSION\" --notes \"…\""
140+
echo " gh release create v$VERSION \"$DMG\" \"$ZIP\" --title \"Relay v$VERSION\" $NOTES_ARG"
93141
fi
94142
echo "Bump MARKETING_VERSION + CURRENT_PROJECT_VERSION in project.yml before each release."

0 commit comments

Comments
 (0)