From 6c21223466a88659ba5041fdbe8ede1b96b832d2 Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Mon, 6 May 2024 15:25:41 -0400 Subject: [PATCH] [PM-7662] Suppress welcome window on install when extension is in dev mode (#8864) * suppress welcome window on install when extension is in dev mode * use platformUtilsService.isDev instead of process.env.ENV * use devFlags.skipWelcomeOnInstall instead of platformUtilsService.isDev * update old dev_flags casing in base configs --- apps/browser/config/base.json | 2 +- apps/browser/config/development.json | 3 ++- apps/browser/src/background/runtime.background.ts | 8 +++++--- apps/desktop/config/base.json | 2 +- libs/common/src/platform/misc/flags.ts | 1 + 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/browser/config/base.json b/apps/browser/config/base.json index 8a3ccc14d3..6c428c43d2 100644 --- a/apps/browser/config/base.json +++ b/apps/browser/config/base.json @@ -1,5 +1,5 @@ { - "dev_flags": {}, + "devFlags": {}, "flags": { "showPasswordless": true, "enableCipherKeyEncryption": false, diff --git a/apps/browser/config/development.json b/apps/browser/config/development.json index aba10eb25b..e0925ebecc 100644 --- a/apps/browser/config/development.json +++ b/apps/browser/config/development.json @@ -2,7 +2,8 @@ "devFlags": { "managedEnvironment": { "base": "https://localhost:8080" - } + }, + "skipWelcomeOnInstall": true }, "flags": { "showPasswordless": true, diff --git a/apps/browser/src/background/runtime.background.ts b/apps/browser/src/background/runtime.background.ts index d8f3cf840f..1db32659d2 100644 --- a/apps/browser/src/background/runtime.background.ts +++ b/apps/browser/src/background/runtime.background.ts @@ -8,6 +8,7 @@ import { ConfigService } from "@bitwarden/common/platform/abstractions/config/co import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { SystemService } from "@bitwarden/common/platform/abstractions/system.service"; +import { devFlagEnabled } from "@bitwarden/common/platform/misc/flags"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherType } from "@bitwarden/common/vault/enums"; @@ -324,9 +325,10 @@ export default class RuntimeBackground { if (this.onInstalledReason != null) { if (this.onInstalledReason === "install") { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - BrowserApi.createNewTab("https://bitwarden.com/browser-start/"); + if (!devFlagEnabled("skipWelcomeOnInstall")) { + void BrowserApi.createNewTab("https://bitwarden.com/browser-start/"); + } + await this.autofillSettingsService.setInlineMenuVisibility( AutofillOverlayVisibility.OnFieldFocus, ); diff --git a/apps/desktop/config/base.json b/apps/desktop/config/base.json index cb408a87d8..1f4f624dc8 100644 --- a/apps/desktop/config/base.json +++ b/apps/desktop/config/base.json @@ -1,5 +1,5 @@ { - "dev_flags": {}, + "devFlags": {}, "flags": { "multithreadDecryption": false, "enableCipherKeyEncryption": false diff --git a/libs/common/src/platform/misc/flags.ts b/libs/common/src/platform/misc/flags.ts index cc463b1060..e0089a5451 100644 --- a/libs/common/src/platform/misc/flags.ts +++ b/libs/common/src/platform/misc/flags.ts @@ -10,6 +10,7 @@ export type SharedFlags = { // eslint-disable-next-line @typescript-eslint/ban-types export type SharedDevFlags = { noopNotifications: boolean; + skipWelcomeOnInstall: boolean; }; function getFlags(envFlags: string | T): T {