Implement sync for chat folders

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Jamie Kyle 2025-08-25 18:02:05 -07:00 committed by GitHub
commit 1df2dc6151
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 2364 additions and 327 deletions

View file

@ -54,6 +54,7 @@ import type { GifType } from '../components/fun/panels/FunPanelGifs';
import type { NotificationProfileType } from '../types/NotificationProfile';
import type { DonationReceipt } from '../types/Donations';
import type { InsertOrUpdateCallLinkFromSyncResult } from './server/callLinks';
import type { ChatFolderId, ChatFolder } from '../types/ChatFolder';
export type ReadableDB = Database & { __readable_db: never };
export type WritableDB = ReadableDB & { __writable_db: never };
@ -346,8 +347,8 @@ export const StickerPackStatuses = [
export type StickerPackStatusType = (typeof StickerPackStatuses)[number];
export type StorageServiceFieldsType = Readonly<{
storageID?: string;
storageVersion?: number;
storageID?: string | null;
storageVersion?: number | null;
storageUnknownFields?: Uint8Array | null;
storageNeedsSync: boolean;
}>;
@ -872,6 +873,11 @@ type ReadableInterface = {
getAllDonationReceipts(): Array<DonationReceipt>;
getDonationReceiptById(id: string): DonationReceipt | undefined;
getAllChatFolders: () => ReadonlyArray<ChatFolder>;
getCurrentChatFolders: () => ReadonlyArray<ChatFolder>;
getChatFolder: (id: ChatFolderId) => ChatFolder | null;
getOldestDeletedChatFolder: () => ChatFolder | null;
getMessagesNeedingUpgrade: (
limit: number,
options: { maxVersion: number }
@ -1200,6 +1206,22 @@ type WritableInterface = {
deleteDonationReceiptById(id: string): void;
createDonationReceipt(profile: DonationReceipt): void;
createChatFolder: (chatFolder: ChatFolder) => void;
updateChatFolder: (chatFolder: ChatFolder) => void;
updateChatFolderPositions: (chatFolders: ReadonlyArray<ChatFolder>) => void;
updateChatFolderDeletedAtTimestampMsFromSync: (
chatFolderId: ChatFolderId,
deletedAtTimestampMs: number
) => void;
markChatFolderDeleted: (
chatFolderId: ChatFolderId,
deletedAtTimestampMs: number,
storageNeedsSync: boolean
) => void;
deleteExpiredChatFolders: (
messageQueueTime: number
) => ReadonlyArray<ChatFolderId>;
removeAll: () => void;
removeAllConfiguration: () => void;
eraseStorageServiceState: () => void;