import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore'; import { ConversationProps, EncryptionFunctions, EncryptionOptions, EncryptionStatus, MediaFile, type IUserInfo, type MessageProps, type SendMessageProps } from '../../interfaces'; import type { StorageProvider } from '../../interfaces/storage'; type PropsWithEncryption = { enableEncrypt?: true; encryptionOptions: EncryptionOptions; encryptKey?: string; }; type PropsWithoutEncryption = { enableEncrypt: false; encryptionOptions?: never; encryptKey?: never; }; type FirestoreEncryptionProps = PropsWithEncryption | PropsWithoutEncryption; type FirestoreBaseProps = { userInfo?: IUserInfo; memberIds?: string[]; blackListWords?: string[]; encryptionFuncProps?: EncryptionFunctions; prefix?: string; storageProvider?: StorageProvider; }; export type FirestoreProps = FirestoreBaseProps & FirestoreEncryptionProps; export declare class FirestoreServices { private static instance; /** User configuration */ userInfo?: IUserInfo; enableEncrypt: boolean; encryptKey: string; regexBlacklist: RegExp | undefined; prefix: string; /** Encryption function */ generateKeyFunctionProp: ((key: string) => Promise) | undefined; encryptFunctionProp: ((text: string) => Promise) | undefined; decryptFunctionProp: ((text: string) => Promise) | undefined; /** Storage provider */ private storageProvider; /** Decryption cache: ciphertext → plaintext, cleared when encryptKey changes */ private decryptCache; /** Conversation info */ conversationId: string | null; memberIds: string[]; partners: Record | null; /** Message info */ messageCursor: FirebaseFirestoreTypes.QueryDocumentSnapshot | undefined; /** * The constructor should always be private to prevent direct * construction calls with the `new` operator. */ constructor(); get userId(): string; static getInstance: () => FirestoreServices; setStorageProvider: (provider: StorageProvider) => void; private getStorageProviderOrThrow; createEncryptionsFunction: (functions: EncryptionFunctions) => void; configuration: ({ userInfo, blackListWords, prefix, }: FirestoreBaseProps) => Promise; configurationEncryption: ({ encryptKey, encryptionOptions, }: PropsWithEncryption) => Promise; getRegexBlacklist: () => RegExp | undefined; getUrlWithPrefix: (url: string) => string; /** Cached decrypt — avoids re-decrypting the same ciphertext multiple times */ private cachedDecrypt; getConfiguration: >(key: K) => any; /** * Validates if encryption is properly configured */ isEncryptionReady: () => boolean; /** * Test encryption/decryption flow */ testEncryption: (testText?: string) => Promise; /** * Get comprehensive encryption status */ getEncryptionStatus: () => Promise; setConversationInfo: (conversationId: string, memberIds: string[], partners: IUserInfo[]) => void; clearConversationInfo: () => void; /** * * @param conversationId pre-defined ID for the conversation * @param memberIds list member id in the conversation * @param name conversation's name * @param image conversation's image */ createConversation: (conversationId: string, memberIds: string[], name?: string, image?: string) => Promise; sendMessageWithFile: (message: SendMessageProps) => Promise; /** * send message to collection conversation and update latest message to users * @param text is message */ sendMessage: (message: MessageProps) => Promise; changeReadMessage: (_messageId: string, userId?: string) => Promise; getMessageHistory: (maxPageSize: number) => Promise; getMoreMessage: (maxPageSize: number) => Promise; receiveMessageListener: (callBack: (message: MessageProps) => void) => (() => void); userConversationListener: (callBack?: (data: FirebaseFirestoreTypes.DocumentData | undefined) => void) => (() => void) | undefined; countAllMessages: () => Promise; setUserConversationTyping: (isTyping: boolean) => Promise | undefined; getListConversation: () => Promise; /** * Search conversations by name or latest message text. * Fetches all conversations for the current user and filters client-side. * This approach is used because Firebase doesn't support case-insensitive * or full-text search natively. * * @param searchText The text to search for in conversation names or messages * @returns Promise resolving to filtered conversations */ searchConversations: (searchText: string) => Promise; listenConversationUpdate: (callback: (_: ConversationProps) => void) => (() => void); getMediaFilesByConversationId: () => Promise; } export {}; //# sourceMappingURL=firestore.d.ts.map