From 8d53b10c36cdd39ebf7573af4e177a8b771e0f1e Mon Sep 17 00:00:00 2001 From: Todd Martin Date: Sat, 10 May 2025 15:28:34 -0400 Subject: [PATCH] Added new features --- .../browser-platform-utils.service.ts | 4 ++++ .../electron-platform-utils.service.ts | 4 ++++ .../src/app/core/web-file-download.service.ts | 2 +- .../src/app/core/web-platform-utils.service.ts | 4 ++++ .../shared/secrets-list.component.ts | 18 ------------------ .../src/tools/send/add-edit.component.ts | 8 -------- .../abstractions/platform-utils.service.ts | 1 + 7 files changed, 14 insertions(+), 27 deletions(-) diff --git a/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.ts b/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.ts index 0fb9af7921f..e20747b33aa 100644 --- a/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.ts +++ b/apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.ts @@ -151,6 +151,10 @@ export abstract class BrowserPlatformUtilsService implements PlatformUtilsServic return this.getDevice() === DeviceType.SafariExtension; } + isDuckDuckGo(): boolean { + return false; + } + isIE(): boolean { return false; } diff --git a/apps/desktop/src/platform/services/electron-platform-utils.service.ts b/apps/desktop/src/platform/services/electron-platform-utils.service.ts index 2b3ab814f0d..8f9ab8261dd 100644 --- a/apps/desktop/src/platform/services/electron-platform-utils.service.ts +++ b/apps/desktop/src/platform/services/electron-platform-utils.service.ts @@ -55,6 +55,10 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { return false; } + isDuckDuckGo(): boolean { + return false; + } + isMacAppStore(): boolean { return ipc.platform.isMacAppStore; } diff --git a/apps/web/src/app/core/web-file-download.service.ts b/apps/web/src/app/core/web-file-download.service.ts index ad034702a55..bc25e4973af 100644 --- a/apps/web/src/app/core/web-file-download.service.ts +++ b/apps/web/src/app/core/web-file-download.service.ts @@ -12,7 +12,7 @@ export class WebFileDownloadService implements FileDownloadService { download(request: FileDownloadRequest): void { const builder = new FileDownloadBuilder(request); const a = window.document.createElement("a"); - if (!this.platformUtilsService.isSafari()) { + if (!(this.platformUtilsService.isSafari() || this.platformUtilsService.isDuckDuckGo())) { a.rel = "noreferrer"; a.target = "_blank"; } diff --git a/apps/web/src/app/core/web-platform-utils.service.ts b/apps/web/src/app/core/web-platform-utils.service.ts index 34579307635..b9664fb0886 100644 --- a/apps/web/src/app/core/web-platform-utils.service.ts +++ b/apps/web/src/app/core/web-platform-utils.service.ts @@ -88,6 +88,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService { return this.getDevice() === DeviceType.SafariBrowser; } + isDuckDuckGo(): boolean { + return this.getDevice() === DeviceType.DuckDuckGoBrowser; + } + isMacAppStore(): boolean { return false; } diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.ts index 37b9524238f..b02c6aa0bce 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/secrets-list.component.ts @@ -179,22 +179,4 @@ export class SecretsListComponent implements OnDestroy { i18nService.t("valueCopied", i18nService.t("uuid")), ); } - - /** - * TODO: Remove in favor of updating `PlatformUtilsService.copyToClipboard` - */ - private static copyToClipboardAsync( - text: Promise, - platformUtilsService: PlatformUtilsService, - ) { - if (platformUtilsService.isSafari()) { - return navigator.clipboard.write([ - new ClipboardItem({ - ["text/plain"]: text, - }), - ]); - } - - return text.then((t) => platformUtilsService.copyToClipboard(t)); - } } diff --git a/libs/angular/src/tools/send/add-edit.component.ts b/libs/angular/src/tools/send/add-edit.component.ts index 7e6180e5849..6a359a1dcc0 100644 --- a/libs/angular/src/tools/send/add-edit.component.ts +++ b/libs/angular/src/tools/send/add-edit.component.ts @@ -146,14 +146,6 @@ export class AddEditComponent implements OnInit, OnDestroy { return null; } - get isSafari() { - return this.platformUtilsService.isSafari(); - } - - get isDateTimeLocalSupported(): boolean { - return !(this.platformUtilsService.isFirefox() || this.platformUtilsService.isSafari()); - } - async ngOnInit() { this.accountService.activeAccount$ .pipe( diff --git a/libs/common/src/platform/abstractions/platform-utils.service.ts b/libs/common/src/platform/abstractions/platform-utils.service.ts index f1e26ed7da3..14b9454d8b6 100644 --- a/libs/common/src/platform/abstractions/platform-utils.service.ts +++ b/libs/common/src/platform/abstractions/platform-utils.service.ts @@ -21,6 +21,7 @@ export abstract class PlatformUtilsService { abstract isOpera(): boolean; abstract isVivaldi(): boolean; abstract isSafari(): boolean; + abstract isDuckDuckGo(): boolean; abstract isMacAppStore(): boolean; abstract isViewOpen(): Promise; abstract launchUri(uri: string, options?: any): void;