mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-29 12:55:21 +01:00
delay i18n load on edge for constants
This commit is contained in:
parent
873cb6aba6
commit
61fb18ec4b
@ -98,7 +98,7 @@ var bg_isBackground = true,
|
||||
// init services
|
||||
window.bg_utilsService = bg_utilsService = new UtilsService();
|
||||
window.bg_i18nService = bg_i18nService = new i18nService(bg_utilsService);
|
||||
window.bg_constantsService = bg_constantsService = new ConstantsService(bg_i18nService);
|
||||
window.bg_constantsService = bg_constantsService = new ConstantsService(bg_i18nService, bg_utilsService);
|
||||
window.bg_cryptoService = bg_cryptoService = new CryptoService();
|
||||
window.bg_tokenService = bg_tokenService = new TokenService();
|
||||
window.bg_appIdService = bg_appIdService = new AppIdService();
|
||||
@ -108,7 +108,7 @@ var bg_isBackground = true,
|
||||
window.bg_settingsService = bg_settingsService = new SettingsService(bg_userService);
|
||||
window.bg_cipherService = bg_cipherService = new CipherService(bg_cryptoService, bg_userService, bg_settingsService, bg_apiService);
|
||||
window.bg_folderService = bg_folderService = new FolderService(bg_cryptoService, bg_userService, bg_i18nService, bg_apiService);
|
||||
window.bg_collectionService = bg_collectionService = new CollectionService(bg_cryptoService, bg_userService, bg_i18nService, bg_apiService);
|
||||
window.bg_collectionService = bg_collectionService = new CollectionService(bg_cryptoService, bg_userService);
|
||||
window.bg_lockService = bg_lockService = new LockService(bg_cipherService, bg_folderService, bg_collectionService, bg_cryptoService, bg_utilsService, setIcon, refreshBadgeAndMenu);
|
||||
window.bg_syncService = bg_syncService = new SyncService(bg_userService, bg_apiService, bg_settingsService, bg_folderService, bg_cipherService, bg_cryptoService, bg_collectionService, logout);
|
||||
window.bg_passwordGenerationService = bg_passwordGenerationService = new PasswordGenerationService(bg_cryptoService);
|
||||
|
@ -3,7 +3,6 @@ import { Collection } from '../models/domain/collection';
|
||||
|
||||
import { CollectionData } from '../models/data/collectionData';
|
||||
|
||||
import ApiService from './api.service';
|
||||
import CryptoService from './crypto.service';
|
||||
import UserService from './user.service';
|
||||
import UtilsService from './utils.service';
|
||||
@ -15,8 +14,7 @@ const Keys = {
|
||||
export default class CollectionService {
|
||||
decryptedCollectionCache: any[];
|
||||
|
||||
constructor(private cryptoService: CryptoService, private userService: UserService,
|
||||
private apiService: ApiService) {
|
||||
constructor(private cryptoService: CryptoService, private userService: UserService) {
|
||||
}
|
||||
|
||||
clearCache(): void {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import UtilsService from './utils.service';
|
||||
|
||||
export default class ConstantsService {
|
||||
static readonly environmentUrlsKey: string = 'environmentUrls';
|
||||
static readonly disableGaKey: string = 'disableGa';
|
||||
@ -55,9 +57,20 @@ export default class ConstantsService {
|
||||
remember: 5,
|
||||
};
|
||||
|
||||
readonly twoFactorProviderInfo: any[];
|
||||
twoFactorProviderInfo: any[];
|
||||
|
||||
constructor(i18nService: any) {
|
||||
constructor(i18nService: any, utilsService: UtilsService) {
|
||||
if (utilsService.isEdge()) {
|
||||
// delay for i18n fetch
|
||||
setTimeout(() => {
|
||||
this.bootstrap(i18nService);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.bootstrap(i18nService);
|
||||
}
|
||||
}
|
||||
|
||||
private bootstrap(i18nService: any) {
|
||||
this.twoFactorProviderInfo = [
|
||||
{
|
||||
type: 0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
export default function i18nService(utilsService) {
|
||||
this.__edgeMessages = {};
|
||||
const self = this;
|
||||
|
||||
if (utilsService.isEdge()) {
|
||||
fetch('../_locales/en/messages.json').then((file) => {
|
||||
@ -8,7 +7,7 @@ export default function i18nService(utilsService) {
|
||||
}).then((locales) => {
|
||||
for (const prop in locales) {
|
||||
if (locales.hasOwnProperty(prop)) {
|
||||
self.__edgeMessages[prop] = chrome.i18n.getMessage(prop);
|
||||
this.__edgeMessages[prop] = chrome.i18n.getMessage(prop);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user