Further improvements for backup import/export

This commit is contained in:
Fedor Indutny
2024-09-18 22:26:52 -07:00
committed by GitHub
parent b9cd858ec7
commit d5f44c1b8f
24 changed files with 539 additions and 201 deletions
+8 -1
View File
@@ -117,10 +117,12 @@ export type CallDetails = Readonly<{
callId: string;
peerId: AciString | string;
ringerId: AciString | string | null;
startedById: AciString | string | null;
mode: CallMode;
type: CallType;
direction: CallDirection;
timestamp: number;
endedTimestamp: number | null;
}>;
export type CallLogEventTarget = Readonly<{
@@ -147,7 +149,10 @@ export type CallHistoryDetails = CallDetails &
status: CallStatus;
}>;
export type CallHistoryGroup = Omit<CallHistoryDetails, 'callId' | 'ringerId'> &
export type CallHistoryGroup = Omit<
CallHistoryDetails,
'callId' | 'ringerId' | 'startedById' | 'endedTimestamp'
> &
Readonly<{
children: ReadonlyArray<{
callId: string;
@@ -200,10 +205,12 @@ export const callDetailsSchema = z.object({
callId: z.string(),
peerId: z.string(),
ringerId: ringerIdSchema,
startedById: aciSchema.or(z.null()),
mode: callModeSchema,
type: callTypeSchema,
direction: callDirectionSchema,
timestamp: z.number(),
endedTimestamp: z.number().or(z.null()),
}) satisfies z.ZodType<CallDetails>;
export const callEventDetailsSchema = callDetailsSchema.extend({
+6 -2
View File
@@ -169,7 +169,7 @@ export async function createPacksFromBackup(
id,
key,
status: 'known' as const,
status: 'installed' as const,
})
);
@@ -187,11 +187,15 @@ export async function getStickerPacksForBackup(): Promise<
const uninstalled = new Set(
(await DataReader.getUninstalledStickerPacks()).map(({ id }) => id)
);
for (const { id, key } of stickerPacks) {
for (const { id, key, status } of stickerPacks) {
if (uninstalled.has(id)) {
continue;
}
if (status === 'known' || status === 'ephemeral') {
continue;
}
result.push({ id, key });
}
return result;