mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
Revert "Safari Web Extension Port from App Extension"
This commit is contained in:
@@ -27,7 +27,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
return this.deviceCache;
|
||||
}
|
||||
|
||||
if (navigator.userAgent.indexOf(' Safari/') !== -1) {
|
||||
if (this.isSafariExtension()) {
|
||||
this.deviceCache = DeviceType.SafariExtension;
|
||||
} else if (navigator.userAgent.indexOf(' Firefox/') !== -1 || navigator.userAgent.indexOf(' Gecko/') !== -1) {
|
||||
this.deviceCache = DeviceType.FirefoxExtension;
|
||||
@@ -190,7 +190,13 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
}
|
||||
const clearing = options ? !!options.clearing : false;
|
||||
const clearMs: number = options && options.clearMs ? options.clearMs : null;
|
||||
if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.writeText) {
|
||||
if (this.isSafariExtension()) {
|
||||
SafariApp.sendMessageToApp('copyToClipboard', text).then(() => {
|
||||
if (!clearing && this.clipboardWriteCallback != null) {
|
||||
this.clipboardWriteCallback(text, clearMs);
|
||||
}
|
||||
});
|
||||
} else if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.writeText) {
|
||||
(win as any).navigator.clipboard.writeText(text).then(() => {
|
||||
if (!clearing && this.clipboardWriteCallback != null) {
|
||||
this.clipboardWriteCallback(text, clearMs);
|
||||
@@ -238,7 +244,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
doc = options.doc;
|
||||
}
|
||||
|
||||
if (this.isSafari()) {
|
||||
if (this.isSafariExtension()) {
|
||||
return await SafariApp.sendMessageToApp('readFromClipboard');
|
||||
} else if (this.isFirefox() && (win as any).navigator.clipboard && (win as any).navigator.clipboard.readText) {
|
||||
return await (win as any).navigator.clipboard.readText();
|
||||
@@ -305,6 +311,10 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
return false;
|
||||
}
|
||||
|
||||
private isSafariExtension(): boolean {
|
||||
return (window as any).safariAppExtension === true;
|
||||
}
|
||||
|
||||
getDefaultSystemTheme() {
|
||||
return this.prefersColorSchemeDark.matches ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user