Patch local chat realtime and align Caddy
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user