Commit graph

29 commits

Author SHA1 Message Date
bunnie
0770d5437f bring chat lib up to date with new ux-api layer 2025-02-21 17:46:11 +08:00
bunnie
c699e06c5a port rkyv ser/de usage in mtxchat 2024-09-23 17:00:16 +08:00
bunnie
34e6f46d63 formatting changes that resulted from the regex search
a bunch of lines are shorter or different length now which
triggers a mandatory reformat. this patch cleans that up,
so that going forward the manual rework patches are clearer and
not tied up with formatting patches.
2024-09-22 15:31:14 +08:00
bunnie
52ffd88b40 regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:17:03 +08:00
bunnie
660c3b06f9 format libs/chat 2024-01-14 19:12:20 +08:00
bunnie
157f0031e6 refactor layout to take advantage of pre-computed height bubbles
mostly works, so checkpointing it here. need to debug why going down
after going up (in terms of selection) is not working.
2023-12-01 02:23:47 +08:00
bunnie
7222fb0de9 add an optional bounding rectangle field to posts
this is computed when the post is added to the list of posts.

Also split out the visual properties of a UI into a separate
struct so that we can pass it as a single argument to routines
that could handle layout-related tasks.
2023-11-30 23:05:41 +08:00
nworbnhoj
ffa3d56af4 fix ChatOp::PostAdd to default correctly to dialogue_key set by ChatOp::DialogueSet 2023-11-30 07:24:58 +11:00
bunnie
5aefcac8ec add forced redraw function, fix misdirected message
- rapid redraws are normally aborted by this routine. offer a forced
redraw in the case that a "final state" has to be rendered without
fail.

- fix a misdirected message (sending it to app instead of to ui by
accident)
2023-10-29 23:03:46 +08:00
bunnie
d4a934785b re-introduce a default text to display when going out of busy state
this simplifies the problem of tracking concurrency if multiple threads
are requesting a busy-state to be presented. In this case, when the
final thread leaves its busy state, the idle-state will be shown.
2023-10-29 20:07:22 +08:00
bunnie
4e027b676c remove logic from status primitive and make the interface simpler
- status bar text is just status bar text now
- idle animation runs/stops based on an explicit run/stop message

Note that at the moment if one starts the busy bar and a modal pops
up, you might overflow the queue of the ui drawing thread with animation
requests, because the thread blocks when the modal is summoned.

Modals "take the screen" anyways, so maybe the solution to this is
to add an additional interlock around any modal calls within the UI
main thread. Need to think about it a bit more.
2023-10-29 01:08:38 +08:00
bunnie
b456bfaf3b add busy-wait animation server and hooks for managing the same
Busy-wait animaitions are handled by a helper server that is normally
blocked. A single shared `bool` indicates whether the animation should
run or not.

When woken up, the busy-wait animator will check if the shared `bool`
is set, and if so, send a message to the main loop to update
the animation, then send wait an appropriate timeout and send itself
a message to re-check the animation status.

This particular format of server is fairly compact but can be vulnerable
to a "message storm" if busy state updates happen in rapid
succession without allowing the server to unblock and handle messages.
Thus, all messages to this server use a `try_send` method, with a silent
failure if the message can't be sent. In other words, if the animator
is already super busy and its queue is full, don't send it more messages,
just drop the existing updates so we can fail without a panic or deadlock.
The typical consequence of this is some UX inconsistency, which is
not a critical error.
2023-10-20 00:43:09 +08:00
nworbnhoj
7803efec7f pass room_alias aka dialogue_id aka dialogue.pddb_key to mtxchat.listen()
this ensures that new Matrix Events received from the server are added to the correct chat::Dialogue
2023-09-18 18:49:59 +10:00
nworbnhoj
c50cc73610 mtxchat add navigation help on first login
chat add help navigation modal
2023-09-09 10:24:52 +10:00
nworbnhoj
3542103510 mtxchat tidy-up 2023-09-08 13:46:52 +10:00
nworbnhoj
ff68567140 chat UI rawkeys toggle menu_mode & raise app/msg menus 2023-09-07 11:38:21 +10:00
nworbnhoj
c7c0041922 Chat readme & comments 2023-09-01 05:41:40 +10:00
nworbnhoj
2f157d5957 implement ChatOp::Dialogue::Save 2023-08-30 04:46:44 +10:00
nworbnhoj
7b7a7003f1 implement chat Dialogue navigation with up/down keys 2023-08-28 09:58:57 +10:00
nworbnhoj
77f25bc416 implement chat icontray 2023-08-23 09:04:42 +10:00
nworbnhoj
197ed63058 chat tidy-up 2023-08-22 16:59:26 +10:00
nworbnhoj
4f03a27e79 implement chat app_menu 2023-08-15 04:27:15 +10:00
nworbnhoj
b095462f29 implement mtxchat post() 2023-08-15 04:11:13 +10:00
nworbnhoj
62a3bae502 extend chat::Dialogue to accept Option<pddb_key>
extend ui.dialogue_set() to select existing Dialogue when operating offline
2023-08-10 20:22:15 +10:00
nworbnhoj
50f06e2f78 implement mtxchat::MtxChat::listen() 2023-08-07 06:20:15 +10:00
nworbnhoj
9db7a3c2c5 refactor chat timestamp to u64 2023-08-04 09:17:43 +10:00
nworbnhoj
e9f362907d configure Chat_UI to register Chat_App Name with gam 2023-07-27 06:01:39 +10:00
nworbnhoj
34334cb80a rename ChatOp::Rawkeys 2023-07-27 04:39:30 +10:00
nworbnhoj
aab92c2b37 sketch chat UI library
A Chat object provides a generic UI to read a series of Posts in a Dialogue stored in the pddb - and to Author a new Post.

The idea is to provide a solid common Xous Chat interface, so that Chat Apps can specialize in the unique aspects of a chat Platform protocol (Matrix, Signal etc).

A Chat App will typically call `Chat::new()` and then `Chat::dialogue_set()` with a pddb dict and key holding a Dialogue of Posts. The Chat object will fire-up the UI and retrieve the Dialogue from the pddb. The user will be able to peruse the stored Posts in the Dialogue - and potentially Author a new Post. A new User Post will be sent to the Chat App in a `MemoryMessage` via the (optional) `CID` and `Opcode` provided by the Chat App. Conversely, when the Chat App receives a new Post from the Platform, it will call Chat::post_add() to have it saved in the pddb.

The Chat UI will also accept (optional) opcodes to forward raw-keystrokes and UI-Events to the Chat App. This allows the Chat App to respond to key UI Events. For example if the User navigates to the `top` of the list of stored Posts, then the Chat App might retrieve older Posts from the Platform to be stored Dialogue with calls to Chat::post_add().
2023-07-12 17:23:41 +10:00