Import/export sticker packs

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-06-12 17:57:27 -05:00 committed by GitHub
parent d426109734
commit a0fb131294
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 62 additions and 15 deletions

View file

@ -214,7 +214,11 @@ function downloadStickerPack(
function installStickerPack(
packId: string,
packKey: string,
options: { fromSync?: boolean; fromStorageService?: boolean } = {}
options: {
fromSync?: boolean;
fromStorageService?: boolean;
fromBackup?: boolean;
} = {}
): InstallStickerPackAction {
return {
type: 'stickers/INSTALL_STICKER_PACK',
@ -224,19 +228,27 @@ function installStickerPack(
async function doInstallStickerPack(
packId: string,
packKey: string,
options: { fromSync?: boolean; fromStorageService?: boolean } = {}
options: {
fromSync?: boolean;
fromStorageService?: boolean;
fromBackup?: boolean;
} = {}
): Promise<InstallStickerPackPayloadType> {
const { fromSync = false, fromStorageService = false } = options;
const {
fromSync = false,
fromStorageService = false,
fromBackup = false,
} = options;
const timestamp = Date.now();
await dataInterface.installStickerPack(packId, timestamp);
if (!fromSync && !fromStorageService) {
if (!fromSync && !fromStorageService && !fromBackup) {
// Kick this off, but don't wait for it
void sendStickerPackSync(packId, packKey, true);
}
if (!fromStorageService) {
if (!fromStorageService && !fromBackup) {
storageServiceUploadJob();
}