fix: Sync DM read status after modal close and add Android PWA viewport fix

Two critical fixes:

1. DM Badge Sync Issue:
   - After closing DM modal, badge showed correct count for 10 seconds
   - Then auto-refresh (running every 10s) used stale dmLastSeenTimestamps
   - Solution: Call loadDmLastSeenTimestampsFromServer() before updating badge
   - This ensures app.js auto-refresh uses current server state

2. Android PWA Viewport Corruption:
   - Viewport corrupted on F5 refresh in Android PWA mode
   - Status bar content hidden under system UI
   - Solution: Force viewport recalculation on page load
   - Scrolls to top and forces reflow after 100ms delay

Testing needed on Android PWA to verify both fixes work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-01-02 06:45:10 +01:00
parent 843ec94bf6
commit 35d9d89563
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -262,6 +262,20 @@
<!-- Custom JS -->
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
<!-- PWA Viewport Fix for Android -->
<script>
// Fix viewport corruption on Android PWA after page reload
window.addEventListener('load', function() {
// Force viewport recalculation
setTimeout(() => {
window.scrollTo(0, 0);
// Force reflow
document.body.style.height = '100%';
void(document.body.offsetHeight);
}, 100);
});
</script>
{% block extra_scripts %}{% endblock %}
</body>
</html>
+6
View File
@@ -196,6 +196,12 @@
// Update DM badges when modal is closed (without full page reload)
dmModal.addEventListener('hidden.bs.modal', async function () {
try {
// Reload DM read status from server to sync with app.js automatic updates
// This ensures dmLastSeenTimestamps in app.js is current
if (typeof loadDmLastSeenTimestampsFromServer === 'function') {
await loadDmLastSeenTimestampsFromServer();
}
// Fetch latest DM conversations with unread counts
const response = await fetch('/api/dm/conversations');
if (response.ok) {