diff --git a/jslib b/jslib index c395293e64..78d40d9f18 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit c395293e64d5e8e276ede7ed84649fadde60dcb0 +Subproject commit 78d40d9f18c23a185465d5fca238b258b2848193 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 628a8342e5..dd027cc5d9 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -126,7 +126,7 @@ export default class MainBackground { analytics: Analytics; popupUtilsService: PopupUtilsService; sendService: SendServiceAbstraction; - fileUploadService: FileUploadServiceAbstraction + fileUploadService: FileUploadServiceAbstraction; onUpdatedRan: boolean; onReplacedRan: boolean; @@ -190,7 +190,7 @@ export default class MainBackground { this.storageService, this.i18nService, this.cipherService); this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService, this.i18nService); - this.searchService = new SearchService(this.cipherService, this.consoleLogService); + this.searchService = new SearchService(this.cipherService, this.consoleLogService, this.i18nService); this.sendService = new SendService(this.cryptoService, this.userService, this.apiService, this.fileUploadService, this.storageService, this.i18nService, this.cryptoFunctionService); this.stateService = new StateService(); diff --git a/src/popup/services/popup-search.service.ts b/src/popup/services/popup-search.service.ts index 2bab18acee..a866a060a6 100644 --- a/src/popup/services/popup-search.service.ts +++ b/src/popup/services/popup-search.service.ts @@ -1,12 +1,13 @@ import { CipherService } from 'jslib/abstractions/cipher.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; import { ConsoleLogService } from 'jslib/services/consoleLog.service'; import { SearchService } from 'jslib/services/search.service'; export class PopupSearchService extends SearchService { constructor(private mainSearchService: SearchService, cipherService: CipherService, - consoleLogService: ConsoleLogService) { - super(cipherService, consoleLogService); + consoleLogService: ConsoleLogService, i18nService: I18nService) { + super(cipherService, consoleLogService, i18nService); } clearIndex() { diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index 44cad897f1..1c7a5cd413 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -68,7 +68,8 @@ function getBgService(service: string) { export const stateService = new StateService(); export const messagingService = new BrowserMessagingService(); export const searchService = new PopupSearchService(getBgService('searchService')(), - getBgService('cipherService')(), getBgService('consoleLogService')()); + getBgService('cipherService')(), getBgService('consoleLogService')(), + getBgService('i18nService')()); export function initFactory(platformUtilsService: PlatformUtilsService, i18nService: I18nService, storageService: StorageService, popupUtilsService: PopupUtilsService): Function { @@ -90,7 +91,7 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ let theme = await storageService.get(ConstantsService.themeKey); if (theme == null) { - theme = platformUtilsService.getDefaultSystemTheme(); + theme = await platformUtilsService.getDefaultSystemTheme(); platformUtilsService.onDefaultSystemThemeChange(sysTheme => { window.document.documentElement.classList.remove('theme_light', 'theme_dark'); diff --git a/src/services/browserPlatformUtils.service.ts b/src/services/browserPlatformUtils.service.ts index e93e50fc1e..b770f91147 100644 --- a/src/services/browserPlatformUtils.service.ts +++ b/src/services/browserPlatformUtils.service.ts @@ -122,8 +122,8 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService BrowserApi.downloadFile(win, blobData, blobOptions, fileName); } - getApplicationVersion(): string { - return BrowserApi.getApplicationVersion(); + getApplicationVersion(): Promise { + return Promise.resolve(BrowserApi.getApplicationVersion()); } supportsWebAuthn(win: Window): boolean { @@ -314,8 +314,8 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService return false; } - getDefaultSystemTheme() { - return this.prefersColorSchemeDark.matches ? 'dark' : 'light'; + getDefaultSystemTheme(): Promise<'light' | 'dark'> { + return Promise.resolve(this.prefersColorSchemeDark.matches ? 'dark' : 'light'); } onDefaultSystemThemeChange(callback: ((theme: 'light' | 'dark') => unknown)) {