Patch local chat realtime and align Caddy

This commit is contained in:
kris
2026-04-10 22:12:58 +08:00
parent a084688e35
commit 1b0f126d4f
8 changed files with 144 additions and 17 deletions

View File

@@ -356,9 +356,32 @@ public class ProjectDetailActivity extends BossScreenActivity {
if (isDuplicateRealtimeEvent(eventFingerprint, now)) {
return;
}
if (tryApplyRealtimeMessagesPatch(event)) {
return;
}
runOnUiThread(() -> scheduleRealtimeReload(!"project.messages.updated".equals(event.eventName)));
}
private boolean tryApplyRealtimeMessagesPatch(BossRealtimeEvent event) {
if (event == null || !"project.messages.updated".equals(event.eventName)) {
return false;
}
JSONObject projectMessagesPayload = event.payload.optJSONObject("projectMessagesPayload");
if (projectMessagesPayload == null) {
return false;
}
runOnUiThread(() -> {
if (reloadInFlight) {
scheduleRealtimeReload(false);
return;
}
renderNearBottom = isChatNearBottom();
renderForcedScrollToBottom = false;
renderLoadedProjectSnapshot(new ProjectSnapshot(projectMessagesPayload, null, null));
});
return true;
}
private boolean isDuplicateRealtimeEvent(String eventFingerprint, long now) {
pruneRecentRealtimeEvents(now);
Long previousEventAt = recentRealtimeEventTimestamps.get(eventFingerprint);