signal-desktop/ts/util/postLinkExperience.ts

33 lines
668 B
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2021-10-06 21:59:34 +00:00
import { MINUTE } from './durations';
class PostLinkExperience {
private hasNotFinishedSync: boolean;
constructor() {
this.hasNotFinishedSync = false;
}
start() {
this.hasNotFinishedSync = true;
// timeout "post link" after 10 minutes in case the syncs don't complete
// in time or are never called.
2021-10-06 21:59:34 +00:00
setTimeout(() => {
this.stop();
2021-10-06 21:59:34 +00:00
}, 10 * MINUTE);
}
stop() {
this.hasNotFinishedSync = false;
}
isActive(): boolean {
return this.hasNotFinishedSync === true;
}
}
export const postLinkExperience = new PostLinkExperience();