From 4c835115ac0ff8f447b0f1f18c780b8a77563fa1 Mon Sep 17 00:00:00 2001 From: Markus Olsson Date: Tue, 25 Jun 2024 11:41:47 +0200 Subject: [PATCH 1/2] Track user credential helper preference --- app/src/lib/stats/stats-store.ts | 17 +++++++++++++++++ .../use-external-credential-helper.ts | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/lib/stats/stats-store.ts b/app/src/lib/stats/stats-store.ts index f8dc26b405..616d7bf31a 100644 --- a/app/src/lib/stats/stats-store.ts +++ b/app/src/lib/stats/stats-store.ts @@ -34,6 +34,11 @@ import { getNotificationsEnabled } from '../stores/notifications-store' import { isInApplicationFolder } from '../../ui/main-process-proxy' import { getRendererGUID } from '../get-renderer-guid' import { ValidNotificationPullRequestReviewState } from '../valid-notification-pull-request-review' +import { + useExternalCredentialHelper, + useExternalCredentialHelperKey, +} from '../trampoline/use-external-credential-helper' +import { enableExternalCredentialHelper } from '../feature-flag' type PullRequestReviewStatFieldInfix = | 'Approved' @@ -398,6 +403,12 @@ interface ICalculatedStats { /** Whether or not the user has their accessibility setting set for viewing diff check marks */ readonly diffCheckMarksVisible: boolean + + /** + * Whether or not the user has enabled the external credential helper or null + * if the user has not yet made an active decision + **/ + readonly useExternalCredentialHelper: boolean | null } type DailyStats = ICalculatedStats & @@ -605,6 +616,12 @@ export class StatsStore implements IStatsStore { launchedFromApplicationsFolder, linkUnderlinesVisible, diffCheckMarksVisible, + ...(enableExternalCredentialHelper() + ? { + useExternalCredentialHelper: + getBoolean(useExternalCredentialHelperKey) ?? null, + } + : {}), } } diff --git a/app/src/lib/trampoline/use-external-credential-helper.ts b/app/src/lib/trampoline/use-external-credential-helper.ts index 9a2620f5b6..aaee7b92e1 100644 --- a/app/src/lib/trampoline/use-external-credential-helper.ts +++ b/app/src/lib/trampoline/use-external-credential-helper.ts @@ -2,7 +2,8 @@ import { enableExternalCredentialHelper } from '../feature-flag' import { getBoolean, setBoolean } from '../local-storage' export const useExternalCredentialHelperDefault = false -const useExternalCredentialHelperKey: string = 'useExternalCredentialHelper' +export const useExternalCredentialHelperKey: string = + 'useExternalCredentialHelper' export const useExternalCredentialHelper = () => enableExternalCredentialHelper() && From fa79a28cdad6322436b0e5091c2b3eb88b980dc3 Mon Sep 17 00:00:00 2001 From: Markus Olsson Date: Tue, 25 Jun 2024 11:57:08 +0200 Subject: [PATCH 2/2] One day I'll learn to develop the softwares --- app/src/lib/stats/stats-store.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/lib/stats/stats-store.ts b/app/src/lib/stats/stats-store.ts index 616d7bf31a..522f77f122 100644 --- a/app/src/lib/stats/stats-store.ts +++ b/app/src/lib/stats/stats-store.ts @@ -34,10 +34,7 @@ import { getNotificationsEnabled } from '../stores/notifications-store' import { isInApplicationFolder } from '../../ui/main-process-proxy' import { getRendererGUID } from '../get-renderer-guid' import { ValidNotificationPullRequestReviewState } from '../valid-notification-pull-request-review' -import { - useExternalCredentialHelper, - useExternalCredentialHelperKey, -} from '../trampoline/use-external-credential-helper' +import { useExternalCredentialHelperKey } from '../trampoline/use-external-credential-helper' import { enableExternalCredentialHelper } from '../feature-flag' type PullRequestReviewStatFieldInfix = @@ -408,7 +405,7 @@ interface ICalculatedStats { * Whether or not the user has enabled the external credential helper or null * if the user has not yet made an active decision **/ - readonly useExternalCredentialHelper: boolean | null + readonly useExternalCredentialHelper?: boolean | null } type DailyStats = ICalculatedStats &