forked from maluQxzh/QChatDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
68 lines (60 loc) · 1.42 KB
/
Copy pathtypes.ts
File metadata and controls
68 lines (60 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
export enum MessageStatus {
PENDING = "PENDING",
SENT = "SENT",
DELIVERED = "DELIVERED",
FAILED = "FAILED",
}
export enum MessageType {
TEXT = "TEXT",
IMAGE = "IMAGE",
}
export interface User {
id: string;
username: string;
avatarUrl?: string;
status: "online" | "offline" | "busy";
lastSeen?: number;
publicKey?: string; // JWK string for ECDH
}
export interface FriendRequest {
fromUser: User;
timestamp: number;
}
export interface Message {
id: string;
conversationId: string;
senderId: string;
content: string; // Text content or Base64 image string
type: MessageType;
status: MessageStatus;
timestamp: number;
}
export interface Conversation {
id: string;
participantId: string; // The other person
unreadCount: number;
lastMessage?: Message;
updatedAt: number;
}
export interface AppSettings {
theme: "light" | "dark";
notificationsEnabled: boolean;
logLevel: "info" | "warn" | "error";
// Optional server configuration for signaling
serverHost?: string;
serverPort?: number;
}
// Event types for our mock socket
export interface SocketEvent {
type: "MESSAGE_RECEIVED" | "STATUS_UPDATE" | "CONNECT" | "DISCONNECT";
payload?: any;
}
// Global Window Extension for Electron
declare global {
interface Window {
electronAPI?: {
invoke: (channel: string, data?: any) => Promise<any>;
on: (channel: string, func: (...args: any[]) => void) => void;
};
}
}