mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +00:00
added missing return types to sync service
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
export interface SyncService {
|
export interface SyncService {
|
||||||
syncInProgress: boolean;
|
syncInProgress: boolean;
|
||||||
|
|
||||||
getLastSync();
|
getLastSync(): Promise<Date>;
|
||||||
setLastSync(date: Date);
|
setLastSync(date: Date): Promise<any>;
|
||||||
syncStarted();
|
syncStarted(): void;
|
||||||
syncCompleted(successfully: boolean);
|
syncCompleted(successfully: boolean): void;
|
||||||
fullSync(forceSync: boolean);
|
fullSync(forceSync: boolean): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class SyncService implements SyncServiceInterface {
|
|||||||
private messagingService: MessagingService, private logoutCallback: Function) {
|
private messagingService: MessagingService, private logoutCallback: Function) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLastSync() {
|
async getLastSync(): Promise<Date> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
const lastSync = await this.storageService.get<any>(Keys.lastSyncPrefix + userId);
|
const lastSync = await this.storageService.get<any>(Keys.lastSyncPrefix + userId);
|
||||||
if (lastSync) {
|
if (lastSync) {
|
||||||
@@ -43,7 +43,7 @@ export class SyncService implements SyncServiceInterface {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async setLastSync(date: Date) {
|
async setLastSync(date: Date): Promise<any> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
|
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ export class SyncService implements SyncServiceInterface {
|
|||||||
this.messagingService.send('syncCompleted', { successfully: successfully });
|
this.messagingService.send('syncCompleted', { successfully: successfully });
|
||||||
}
|
}
|
||||||
|
|
||||||
async fullSync(forceSync: boolean) {
|
async fullSync(forceSync: boolean): Promise<boolean> {
|
||||||
this.syncStarted();
|
this.syncStarted();
|
||||||
const isAuthenticated = await this.userService.isAuthenticated();
|
const isAuthenticated = await this.userService.isAuthenticated();
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
|
|||||||
Reference in New Issue
Block a user