safari fixes
This commit is contained in:
parent
2b6c2bd4e2
commit
61dc7454d3
|
@ -142,6 +142,7 @@ export default class MainBackground {
|
||||||
opr.sidebarAction : (window as any).chrome.sidebarAction;
|
opr.sidebarAction : (window as any).chrome.sidebarAction;
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
|
if (!this.isSafari) {
|
||||||
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService);
|
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService);
|
||||||
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
||||||
this.passwordGenerationService);
|
this.passwordGenerationService);
|
||||||
|
@ -152,6 +153,7 @@ export default class MainBackground {
|
||||||
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService);
|
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService);
|
||||||
this.windowsBackground = new WindowsBackground(this);
|
this.windowsBackground = new WindowsBackground(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async bootstrap() {
|
async bootstrap() {
|
||||||
this.containerService.attachToWindow(window);
|
this.containerService.attachToWindow(window);
|
||||||
|
|
|
@ -54,7 +54,6 @@ export default class BrowserApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getBackgroundPage(): any {
|
static getBackgroundPage(): any {
|
||||||
function getBackgroundPage(): any {
|
|
||||||
if (BrowserApi.isChromeApi) {
|
if (BrowserApi.isChromeApi) {
|
||||||
return chrome.extension.getBackgroundPage();
|
return chrome.extension.getBackgroundPage();
|
||||||
} else if (BrowserApi.isSafariApi) {
|
} else if (BrowserApi.isSafariApi) {
|
||||||
|
@ -63,5 +62,4 @@ export default class BrowserApi {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ export default function i18nService(platformUtilsService: PlatformUtilsService)
|
||||||
'zh-CN', 'zh-TW',
|
'zh-CN', 'zh-TW',
|
||||||
];
|
];
|
||||||
|
|
||||||
async function loadMessages(locale: string, messagesObj: any,
|
async function loadMessages(localesDir: string, locale: string, messagesObj: any,
|
||||||
messageCallback: (prop: string, message: string) => string): Promise<any> {
|
messageCallback: (prop: string, message: string) => string): Promise<any> {
|
||||||
const formattedLocale = locale.replace('-', '_');
|
const formattedLocale = locale.replace('-', '_');
|
||||||
const file = await fetch('../_locales/' + formattedLocale + '/messages.json');
|
const file = await fetch(localesDir + formattedLocale + '/messages.json');
|
||||||
const locales = await file.json();
|
const locales = await file.json();
|
||||||
for (const prop in locales) {
|
for (const prop in locales) {
|
||||||
if (locales.hasOwnProperty(prop)) {
|
if (locales.hasOwnProperty(prop)) {
|
||||||
|
@ -24,7 +24,7 @@ export default function i18nService(platformUtilsService: PlatformUtilsService)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platformUtilsService.isEdge()) {
|
if (platformUtilsService.isEdge()) {
|
||||||
loadMessages('en', localeMessages, (prop: string, message: string) => chrome.i18n.getMessage(prop));
|
loadMessages('../_locales/', 'en', localeMessages, (prop: string, message: string) => chrome.i18n.getMessage(prop));
|
||||||
return localeMessages;
|
return localeMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,10 @@ export default function i18nService(platformUtilsService: PlatformUtilsService)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMessages(lang, localeMessages, (prop: string, message: string) => message);
|
const dir = './_locales/';
|
||||||
|
loadMessages(dir, lang, localeMessages, (prop: string, message: string) => message);
|
||||||
if (lang !== supportedLocales[0]) {
|
if (lang !== supportedLocales[0]) {
|
||||||
loadMessages(supportedLocales[0], defaultMessages, (prop: string, message: string) => message);
|
loadMessages(dir, supportedLocales[0], defaultMessages, (prop: string, message: string) => message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue