diff --git a/src/plus/drafts/actions.ts b/src/plus/drafts/actions.ts index 8a03a50..b512a88 100644 --- a/src/plus/drafts/actions.ts +++ b/src/plus/drafts/actions.ts @@ -1,10 +1,26 @@ +import type { MessageItem } from 'vscode'; +import { window } from 'vscode'; import { Container } from '../../container'; +import { configuration } from '../../system/configuration'; import type { WebviewViewShowOptions } from '../../webviews/webviewsController'; import type { ShowCreateDraft, ShowViewDraft } from '../webviews/patchDetails/registration'; type ShowCreateOrOpen = ShowCreateDraft | ShowViewDraft; -export function showPatchesView(createOrOpen: ShowCreateOrOpen, options?: WebviewViewShowOptions): Promise { +export async function showPatchesView(createOrOpen: ShowCreateOrOpen, options?: WebviewViewShowOptions): Promise { + const confirm: MessageItem = { title: 'Enable' }; + const cancel: MessageItem = { title: 'Cancel', isCloseAffordance: true }; + const result = await window.showInformationMessage( + 'Cloud Patches are currently disabled. Would you like to enable them?', + { modal: true }, + confirm, + cancel, + ); + + if (result !== confirm) return; + + await configuration.updateEffective('cloudPatches.enabled', true); + if (createOrOpen.mode === 'create') { options = { ...options, preserveFocus: false, preserveVisibility: false }; }