Remove ts/services/timers.ts
This commit is contained in:
parent
26eabf16a8
commit
a537204fc0
10 changed files with 38 additions and 144 deletions
|
@ -54,7 +54,10 @@ export function start(): void {
|
|||
this.on('add remove change:unreadCount', debouncedUpdateUnreadCount);
|
||||
window.Whisper.events.on('updateUnreadCount', debouncedUpdateUnreadCount);
|
||||
this.on('add', (model: ConversationModel): void => {
|
||||
this.initMuteExpirationTimer(model);
|
||||
// If the conversation is muted we set a timeout so when the mute expires
|
||||
// we can reset the mute state on the model. If the mute has already expired
|
||||
// then we reset the state right away.
|
||||
model.startMuteTimer();
|
||||
});
|
||||
},
|
||||
addActive(model: ConversationModel) {
|
||||
|
@ -64,25 +67,6 @@ export function start(): void {
|
|||
this.remove(model);
|
||||
}
|
||||
},
|
||||
// If the conversation is muted we set a timeout so when the mute expires
|
||||
// we can reset the mute state on the model. If the mute has already expired
|
||||
// then we reset the state right away.
|
||||
initMuteExpirationTimer(model: ConversationModel): void {
|
||||
const muteExpiresAt = model.get('muteExpiresAt');
|
||||
// This check for `muteExpiresAt` is likely redundant, but is needed to appease
|
||||
// TypeScript.
|
||||
if (model.isMuted() && muteExpiresAt) {
|
||||
window.Signal.Services.onTimeout(
|
||||
muteExpiresAt,
|
||||
() => {
|
||||
model.set({ muteExpiresAt: undefined });
|
||||
},
|
||||
model.getMuteTimeoutId()
|
||||
);
|
||||
} else if (muteExpiresAt) {
|
||||
model.set({ muteExpiresAt: undefined });
|
||||
}
|
||||
},
|
||||
updateUnreadCount() {
|
||||
const canCountMutedConversations = window.storage.get(
|
||||
'badge-count-muted-conversations'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue