mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-10 09:59:48 +01:00
isPopoverOpen for safari app
This commit is contained in:
parent
deb5d2bf62
commit
7d2c4cbd9a
@ -168,14 +168,14 @@ export class BrowserApi {
|
||||
}
|
||||
}
|
||||
|
||||
static isPopupOpen(): boolean {
|
||||
static async isPopupOpen(): Promise<boolean> {
|
||||
if (BrowserApi.isChromeApi) {
|
||||
return chrome.extension.getViews({ type: 'popup' }).length > 0;
|
||||
return Promise.resolve(chrome.extension.getViews({ type: 'popup' }).length > 0);
|
||||
} else if (BrowserApi.isSafariApi) {
|
||||
// TODO
|
||||
return true;
|
||||
const open = await SafariApp.sendMessageToApp('isPopoverOpen');
|
||||
return open === 'true';
|
||||
} else {
|
||||
return null;
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,9 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||
self.replyMessage(message: m!)
|
||||
})
|
||||
}
|
||||
} else if command == "isPopoverOpen" {
|
||||
m!.responseData = "true";
|
||||
replyMessage(message: m!)
|
||||
} else if command == "reloadExtension" {
|
||||
webView?.reload()
|
||||
replyMessage(message: m!)
|
||||
|
@ -89,23 +89,23 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
return this.analyticsIdCache;
|
||||
}
|
||||
|
||||
isViewOpen(): Promise<boolean> {
|
||||
if (BrowserApi.isPopupOpen()) {
|
||||
return Promise.resolve(true);
|
||||
async isViewOpen(): Promise<boolean> {
|
||||
if (await BrowserApi.isPopupOpen()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.isSafari()) {
|
||||
return Promise.resolve(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
const sidebarView = this.sidebarViewName();
|
||||
const sidebarOpen = sidebarView != null && chrome.extension.getViews({ type: sidebarView }).length > 0;
|
||||
if (sidebarOpen) {
|
||||
return Promise.resolve(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
const tabOpen = chrome.extension.getViews({ type: 'tab' }).length > 0;
|
||||
return Promise.resolve(tabOpen);
|
||||
return tabOpen;
|
||||
}
|
||||
|
||||
lockTimeout(): number {
|
||||
|
Loading…
Reference in New Issue
Block a user