chore: comprehensive refactor — async DB, dependency bumps, chat sync events, and code quality #10

Open
alisson wants to merge 17 commits from refactor/updates into master
Owner

Summary

This PR contains a broad set of maintenance and feature improvements across the codebase, primarily focused on async safety, dependency updates, internationalization completeness, and preparing for live chat property updates from the WhatsApp sync stream.

Changes

Async & Threading

  • Offloaded all database operations to relm4::spawn to prevent blocking the GTK main thread (application.rs, store/database.rs).
  • Moved QR code generation into relm4::spawn_blocking (utils.rs).
  • Added spawn_blocking wrapper for libsql database connection setup.

Dependencies

  • Bumped libadwaita to 0.9 and relm4 to 0.11.
  • Switched whatsapp-rust from a git dependency to the crates.io registry.
  • Updated Cargo.lock accordingly.

WhatsApp Session & Sync

  • Added handling for SelfPushNameUpdated during initial sync (session/client.rs, application.rs).
  • Added infrastructure to handle chat property updates and sync events (session/client.rs, application.rs, components/chat_list.rs).

Code Quality & Refactors

  • Reordered struct fields across ChatRow, ChatRowWidgets, Login, Message, and Application to follow the "length-then-alphabetical" convention.
  • Boxed large enum variants in session/client.rs and components/chat_view.rs to reduce stack size.
  • Added i18n! translations to previously hardcoded error strings and the about dialog.
  • Fixed i18n_f! macro to use replacen for correct placeholder substitution.
  • Cleaned up import ordering and removed redundant fully-qualified names.

Documentation

  • Added AGENTS.md with comprehensive AI agent guidelines for project development.

Chores

  • Added a FIXME note for the currently unused PKGDATADIR constant in config.rs.in.
### Summary This PR contains a broad set of maintenance and feature improvements across the codebase, primarily focused on async safety, dependency updates, internationalization completeness, and preparing for live chat property updates from the WhatsApp sync stream. ### Changes **Async & Threading** - Offloaded all database operations to `relm4::spawn` to prevent blocking the GTK main thread (`application.rs`, `store/database.rs`). - Moved QR code generation into `relm4::spawn_blocking` (`utils.rs`). - Added `spawn_blocking` wrapper for libsql database connection setup. **Dependencies** - Bumped `libadwaita` to `0.9` and `relm4` to `0.11`. - Switched `whatsapp-rust` from a git dependency to the crates.io registry. - Updated `Cargo.lock` accordingly. **WhatsApp Session & Sync** - Added handling for `SelfPushNameUpdated` during initial sync (`session/client.rs`, `application.rs`). - Added infrastructure to handle chat property updates and sync events (`session/client.rs`, `application.rs`, `components/chat_list.rs`). **Code Quality & Refactors** - Reordered struct fields across `ChatRow`, `ChatRowWidgets`, `Login`, `Message`, and `Application` to follow the "length-then-alphabetical" convention. - Boxed large enum variants in `session/client.rs` and `components/chat_view.rs` to reduce stack size. - Added `i18n!` translations to previously hardcoded error strings and the about dialog. - Fixed `i18n_f!` macro to use `replacen` for correct placeholder substitution. - Cleaned up import ordering and removed redundant fully-qualified names. **Documentation** - Added `AGENTS.md` with comprehensive AI agent guidelines for project development. **Chores** - Added a `FIXME` note for the currently unused `PKGDATADIR` constant in `config.rs.in`.
- Add ChatPropertyUpdate messages for pin, mute, and archive events
- Process HistorySync events to extract conversations and messages
- Handle OfflineSyncCompleted to transition app state from syncing to ready
- Add HistorySyncCompleted and OfflineSyncCompleted signals
- Add RemoveChat input to ChatList for archived chats
- Fallback to extended_text_message text when conversation is empty
- Add ProcessHistorySync command for blocking protobuf parsing
alisson force-pushed refactor/updates from 2bb65731a7 to 59acd71526 2026-04-23 23:01:24 -03:00 Compare
- Switch libadwaita feature from v1_9 to v1_8 in Cargo.toml
- Switch relm4 feature from gnome_50 to gnome_49 in Cargo.toml
- Update AGENTS.md to reflect Relm4 0.11 and GNOME 49
andrielfr approved these changes 2026-04-23 23:43:49 -03:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin refactor/updates:refactor/updates
git switch refactor/updates

Merge

Merge the changes and update on Forgejo.
git switch master
git merge --no-ff refactor/updates
git switch refactor/updates
git rebase master
git switch master
git merge --ff-only refactor/updates
git switch refactor/updates
git rebase master
git switch master
git merge --no-ff refactor/updates
git switch master
git merge --squash refactor/updates
git switch master
git merge --ff-only refactor/updates
git switch master
git merge refactor/updates
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AmanoTeam/Papo!10
No description provided.