cleanup safari specific features

This commit is contained in:
Kyle Spearrin 2019-08-19 15:57:34 -04:00
parent c041fd7504
commit 2a7e361300
7 changed files with 17 additions and 6 deletions

View File

@ -52,7 +52,7 @@ export default class CommandsBackground {
}
private async generatePasswordToClipboard() {
if (this.isSafari || this.isEdge) {
if (this.isEdge) {
// Safari does not support access to clipboard from background
return;
}

View File

@ -368,6 +368,10 @@ export default class MainBackground {
// Chrome APIs cannot open 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) {

View File

@ -230,7 +230,7 @@ export class BrowserApi {
} else if (BrowserApi.isWebExtensionsApi || BrowserApi.isChromeApi) {
win.close();
} else if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp('hideWindow');
SafariApp.sendMessageToApp('hidePopover');
}
}
@ -293,7 +293,7 @@ export class BrowserApi {
if (win != null) {
return win.location.reload(true);
} else if (BrowserApi.isSafariApi) {
SafariApp.sendMessageToApp('reloadWindow');
SafariApp.sendMessageToApp('reloadExtension');
} else if (!BrowserApi.isSafariApi) {
return chrome.runtime.reload();
}

View File

@ -68,7 +68,7 @@ export class OptionsComponent implements OnInit {
}
async ngOnInit() {
this.showDisableContextMenu = this.showClearClipboard = !this.platformUtilsService.isSafari();
this.showDisableContextMenu = !this.platformUtilsService.isSafari();
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
ConstantsService.enableAutoFillOnPageLoadKey);

View File

@ -94,7 +94,7 @@ export class SettingsComponent implements OnInit {
}
async saveLockOption(newValue: number) {
if (newValue == null && !this.platformUtilsService.isSafari()) {
if (newValue == null) {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('neverLockWarning'), null,
this.i18nService.t('yes'), this.i18nService.t('cancel'), 'warning');

View File

@ -135,9 +135,15 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
}
}
}
} else if command == "hideWindow" {
} else if command == "hidePopover" {
dismissPopover()
replyMessage(message: m!)
} else if command == "showPopover" {
// TODO
replyMessage(message: m!)
} else if command == "reloadExtension" {
// TODO
replyMessage(message: m!)
} else if command == "copyToClipboard" {
let pasteboard = NSPasteboard.general
pasteboard.declareTypes([NSPasteboard.PasteboardType.string], owner: nil)

View File

@ -95,6 +95,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
}
if (this.isSafari()) {
// TODO
return false;
}