mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
cleanup safari specific features
This commit is contained in:
@@ -52,7 +52,7 @@ export default class CommandsBackground {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async generatePasswordToClipboard() {
|
private async generatePasswordToClipboard() {
|
||||||
if (this.isSafari || this.isEdge) {
|
if (this.isEdge) {
|
||||||
// Safari does not support access to clipboard from background
|
// Safari does not support access to clipboard from background
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,6 +368,10 @@ export default class MainBackground {
|
|||||||
// Chrome APIs cannot open popup
|
// Chrome APIs cannot open popup
|
||||||
|
|
||||||
// TODO: Do we need to open this popup?
|
// TODO: Do we need to open this popup?
|
||||||
|
if (!this.isSafari) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await SafariApp.sendMessageToApp('showPopover');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!this.isSafari || !safari.extension.toolbarItems || !safari.extension.toolbarItems.length) {
|
if (!this.isSafari || !safari.extension.toolbarItems || !safari.extension.toolbarItems.length) {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ export class BrowserApi {
|
|||||||
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
|
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
|
||||||
win.close();
|
win.close();
|
||||||
} else if (BrowserApi.isSafariApi) {
|
} else if (BrowserApi.isSafariApi) {
|
||||||
SafariApp.sendMessageToApp('hideWindow');
|
SafariApp.sendMessageToApp('hidePopover');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ export class BrowserApi {
|
|||||||
if (win != null) {
|
if (win != null) {
|
||||||
return win.location.reload(true);
|
return win.location.reload(true);
|
||||||
} else if (BrowserApi.isSafariApi) {
|
} else if (BrowserApi.isSafariApi) {
|
||||||
SafariApp.sendMessageToApp('reloadWindow');
|
SafariApp.sendMessageToApp('reloadExtension');
|
||||||
} else if (!BrowserApi.isSafariApi) {
|
} else if (!BrowserApi.isSafariApi) {
|
||||||
return chrome.runtime.reload();
|
return chrome.runtime.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export class OptionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.showDisableContextMenu = this.showClearClipboard = !this.platformUtilsService.isSafari();
|
this.showDisableContextMenu = !this.platformUtilsService.isSafari();
|
||||||
|
|
||||||
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
|
||||||
ConstantsService.enableAutoFillOnPageLoadKey);
|
ConstantsService.enableAutoFillOnPageLoadKey);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async saveLockOption(newValue: number) {
|
async saveLockOption(newValue: number) {
|
||||||
if (newValue == null && !this.platformUtilsService.isSafari()) {
|
if (newValue == null) {
|
||||||
const confirmed = await this.platformUtilsService.showDialog(
|
const confirmed = await this.platformUtilsService.showDialog(
|
||||||
this.i18nService.t('neverLockWarning'), null,
|
this.i18nService.t('neverLockWarning'), null,
|
||||||
this.i18nService.t('yes'), this.i18nService.t('cancel'), 'warning');
|
this.i18nService.t('yes'), this.i18nService.t('cancel'), 'warning');
|
||||||
|
|||||||
@@ -135,9 +135,15 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if command == "hideWindow" {
|
} else if command == "hidePopover" {
|
||||||
dismissPopover()
|
dismissPopover()
|
||||||
replyMessage(message: m!)
|
replyMessage(message: m!)
|
||||||
|
} else if command == "showPopover" {
|
||||||
|
// TODO
|
||||||
|
replyMessage(message: m!)
|
||||||
|
} else if command == "reloadExtension" {
|
||||||
|
// TODO
|
||||||
|
replyMessage(message: m!)
|
||||||
} else if command == "copyToClipboard" {
|
} else if command == "copyToClipboard" {
|
||||||
let pasteboard = NSPasteboard.general
|
let pasteboard = NSPasteboard.general
|
||||||
pasteboard.declareTypes([NSPasteboard.PasteboardType.string], owner: nil)
|
pasteboard.declareTypes([NSPasteboard.PasteboardType.string], owner: nil)
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSafari()) {
|
if (this.isSafari()) {
|
||||||
|
// TODO
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user