WIP: refactor: Introduce a Store trait and move the placeholder data there #9

Draft
warren wants to merge 14 commits from data-store into main
Collaborator

Depends on: #6

Purpose:

  • Replace the Slint types with Rust-specific types, which are then converted into Slint types at the last possible moment
Depends on: https://kitsunes.dev/nemalixi/chat-app/pulls/6 Purpose: - Replace the Slint types with Rust-specific types, which are then converted into Slint types at the last possible moment
ChatView will need to accept data externally. Putting mock data straight into the slint file makes not much sense - we'll feed that from rust-land if need be.
Introduced `ChatData` struct to encapsulate both messages and chat title, and updated ChatData to use this struct, making the data better-encapsulated for feeding in through a larger data model.
Replaced hardcoded `ChatView` instances with dynamic rendering using `views` and `chat-data` properties, enabling better integration with Rust-land.
Added placeholder_data.rs which contains two sets of example chat messages with which to fill out the UI.
the `chat-data` and `views` properties were populated with placeholder data from Rust, demonstrating how information flows from Rust to Slint components.
Slint's types want an Image value, which underneath the hood uses a reference-counted value, but it was awkward to keep track of those references.

The cache makes it easier by just letting you get images from there by cache.
Slint types are annoyingly opinionated in terms of all the mechanics that are in there for observing and tracking data, none of which should end up in the networking code.

This commit introduces far more Vanilla Rust plain-old-data types that mirror the generated Slint types.
Replaced `SharedString` and `Image` with vanilla Rust `String` and `PathBuf`. Updated `ChatData` and `MessageData` to depend on plain data types.
Added the `Store` trait to handle long-term storage of user data, including methods for fetching all chat UUIDs and retrieving chat data by UUID.
Introduced a placeholder implementation of the `Store` trait with predefined chat data for testing and demonstration. Updated `store` module to include `placeholder_store`.
Replaced static chat data and views initialization with dynamic data retrieved using the new `PlaceholderStore` implementation.
warren changed title from refactor: Introduce a Store trait and move the placeholder data there to WIP: refactor: Introduce a Store trait and move the placeholder data there 2025-11-27 11:52:46 +00:00
Replaced raw `Uuid` usage with `ChatUuid` newtype across `Store` implementations to prevent mixing up identifiers.
Refactored `create_simple_sample_messages` and `create_complex_sample_messages` to return `ChatData` instead of `Vec<MessageData>`.
ChatData now has a uuid field rather than this being implicit in the store hashmap
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin data-store:data-store
git switch data-store
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
nemalixi/chat-app!9
No description provided.