1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

Move lastSync State (#10272)

This commit is contained in:
Justin Baur
2024-08-06 15:01:42 -04:00
committed by GitHub
parent 887b98988a
commit dcb21c2685
22 changed files with 198 additions and 110 deletions

View File

@@ -1,8 +1,11 @@
import { Observable } from "rxjs";
import {
SyncCipherNotification,
SyncFolderNotification,
SyncSendNotification,
} from "../../models/response/notification.response";
import { UserId } from "../../types/guid";
/**
* A class encapsulating sync operations and data.
@@ -20,15 +23,16 @@ export abstract class SyncService {
* Gets the date of the last sync for the currently active user.
*
* @returns The date of the last sync or null if there is no active user or the active user has not synced before.
*
* @deprecated Use {@link lastSync$} to get an observable stream of a given users last sync date instead.
*/
abstract getLastSync(): Promise<Date>;
abstract getLastSync(): Promise<Date | null>;
/**
* Updates a users last sync date.
* @param date The date to be set as the users last sync date.
* @param userId The userId of the user to update the last sync date for.
* Retrieves a stream of the given users last sync date. Or null if the user has not synced before.
* @param userId The user id of the user to get the stream for.
*/
abstract setLastSync(date: Date, userId?: string): Promise<void>;
abstract lastSync$(userId: UserId): Observable<Date | null>;
/**
* Optionally does a full sync operation including going to the server to gather the source