iris_chat_core/
updates.rs1use crate::actions::AppAction;
2use crate::state::AppState;
3use flume::Sender;
4use nostr_sdk::prelude::{Event, RelayStatus};
5
6#[derive(uniffi::Enum, Clone, Debug)]
7#[allow(clippy::large_enum_variant)]
8pub enum AppUpdate {
9 FullState(AppState),
10 PersistAccountBundle {
11 rev: u64,
12 owner_nsec: Option<String>,
13 owner_pubkey_hex: String,
14 device_nsec: String,
15 },
16 NearbyPublishedEvent {
17 event_id: String,
18 kind: u32,
19 created_at_secs: u64,
20 event_json: String,
21 },
22}
23
24#[derive(Debug)]
25pub(crate) enum CoreMsg {
26 Action(AppAction),
27 Internal(Box<InternalEvent>),
28 BuildNearbyPresenceEvent {
29 peer_id: String,
30 my_nonce: String,
31 their_nonce: String,
32 profile_event_id: String,
33 reply_tx: Sender<String>,
34 },
35 ExportSupportBundle(Sender<String>),
36 Shutdown(Option<Sender<()>>),
37}
38
39#[derive(Debug)]
40pub(crate) enum InternalEvent {
41 RelayEvent(Event),
42 NearbyEvent {
43 event: Event,
44 transport: String,
45 },
46 FetchTrackedPeerCatchUp,
47 ProtocolSubscriptionLivenessCheck {
48 token: u64,
49 },
50 PollPendingDeviceInvites {
51 token: u64,
52 },
53 PruneExpiredMessages {
54 token: u64,
55 },
56 FetchCatchUpEvents(Vec<Event>),
57 RelayStatusChanged {
58 relay_url: String,
59 status: RelayStatus,
60 },
61 RelayConnectionChecked {
62 reason: String,
63 },
64 DebugLog {
65 category: String,
66 detail: String,
67 },
68 TypingIndicatorExpired {
69 chat_id: String,
70 author: String,
71 },
72 RelayPublishFinished {
73 event_id: String,
74 message_id: Option<String>,
75 chat_id: Option<String>,
76 success: bool,
77 relay_urls: Vec<String>,
78 detail: String,
79 },
80 AttachmentUploadFinished {
81 chat_id: String,
82 result: Result<String, String>,
83 },
84 ProfilePictureUploadFinished {
85 result: Result<String, String>,
86 },
87 SyncComplete,
88}