Keep onboarding story message ids on unlink
This commit is contained in:
@@ -11,37 +11,19 @@ import { IMAGE_JPEG } from '../types/MIME';
|
||||
import { ReadStatus } from '../messages/MessageReadStatus';
|
||||
import { SeenStatus } from '../MessageSeenStatus';
|
||||
import { findAndDeleteOnboardingStoryIfExists } from './findAndDeleteOnboardingStoryIfExists';
|
||||
import { runStorageServiceSyncJob } from '../services/storage';
|
||||
import { saveNewMessageBatcher } from './messageBatcher';
|
||||
import { strictAssert } from './assert';
|
||||
import { incrementMessageCounter } from './incrementMessageCounter';
|
||||
|
||||
// * Check if we've viewed onboarding story. Short circuit.
|
||||
// * Run storage service sync (just in case) and check again.
|
||||
// * If it has been viewed and it's downloaded on this device, delete & return.
|
||||
// First, this function is meant to be run after a storage service sync
|
||||
|
||||
// * If onboarding story has been viewed and it's downloaded on this device,
|
||||
// delete & return.
|
||||
// * Check if we've already downloaded the onboarding story.
|
||||
// * Download onboarding story, create db entry, mark as downloaded.
|
||||
// * If story has been viewed mark as viewed on AccountRecord.
|
||||
// * If we viewed it >24 hours ago, delete.
|
||||
export async function downloadOnboardingStory(): Promise<void> {
|
||||
const hasViewedOnboardingStory = window.storage.get(
|
||||
'hasViewedOnboardingStory'
|
||||
);
|
||||
|
||||
if (hasViewedOnboardingStory) {
|
||||
await findAndDeleteOnboardingStoryIfExists();
|
||||
return;
|
||||
}
|
||||
|
||||
runStorageServiceSyncJob();
|
||||
|
||||
window.Whisper.events.once(
|
||||
'storageService:syncComplete',
|
||||
continueDownloadingOnboardingStory
|
||||
);
|
||||
}
|
||||
|
||||
async function continueDownloadingOnboardingStory(): Promise<void> {
|
||||
const { server } = window.textsecure;
|
||||
|
||||
strictAssert(server, 'server not initialized');
|
||||
|
Reference in New Issue
Block a user