diff --git a/package.json b/package.json index 3e62326..83c0171 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "GPL-3.0-or-later", "icon": "icon.png", "publisher": "DivyanshuAgrawal", - "version": "5.10.0", + "version": "5.11.0", "engines": { "vscode": "^1.52.0" }, @@ -211,6 +211,12 @@ "default": true, "description": "A welcome message is shown when you run a testcase for the first time. This setting is updated automatically after the first message is shown." }, + "cph.general.onceMaintainerMessage": { + "title": "Show 'looking for a maintainer' message", + "type": "boolean", + "default": true, + "description": "A message from the maintainer is shown when you run a testcase for the first time. This setting is updated automatically after the first message is shown." + }, "cph.general.defaultLanguage": { "title": "Default language for new problems", "type": "string", diff --git a/src/preferences.ts b/src/preferences.ts index 953614b..d8ab4d7 100644 --- a/src/preferences.ts +++ b/src/preferences.ts @@ -62,6 +62,9 @@ export const getGoArgsPref = (): string[] => export const getFirstTimePref = (): boolean => getPreference('general.firstTime') || 'true'; +export const getLookingForMaintainerPerf = (): boolean => + getPreference('general.onceMaintainerMessage'); + export const getDefaultLangPref = (): string | null => { const pref = getPreference('general.defaultLanguage'); if (pref === 'none' || pref == ' ' || !pref) { diff --git a/src/types.ts b/src/types.ts index a08c584..6dd52e2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -27,7 +27,8 @@ export type prefSection = | 'language.python.Command' | 'general.retainWebviewContext' | 'general.autoShowJudge' - | 'general.defaultLanguageTemplateFileLocation'; + | 'general.defaultLanguageTemplateFileLocation' + | 'general.onceMaintainerMessage'; export type Language = { name: LangNames; diff --git a/src/utils.ts b/src/utils.ts index ca70a4b..6af5124 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -19,6 +19,8 @@ import { getRustCommand, getJavaCommand, getGoCommand, + getLookingForMaintainerPerf, + updatePreference, } from './preferences'; import { Language, Problem } from './types'; @@ -166,3 +168,22 @@ export const getProblemForDocument = ( const problem: Problem = JSON.parse(readFileSync(probPath).toString()); return problem; }; + +export const showMaintainerMessage = async () => { + /** Temporary maintainer's messaage **/ + if (getLookingForMaintainerPerf()) { + console.log("Showing maintainer's message"); + updatePreference('general.onceMaintainerMessage', false); + const openIssue = 'Details'; + const issueUrl = 'https://rb.gy/ohx17'; + const result = await vscode.window.showInformationMessage( + 'CPH is looking for a maintainer to continue development of extension!' + + 'Help the community by keeping this extension alive.', + openIssue, + ); + + if (result === openIssue) { + vscode.env.openExternal(vscode.Uri.parse(issueUrl)); + } + } +}; diff --git a/src/webview/processRunAll.ts b/src/webview/processRunAll.ts index f17523a..8e91849 100644 --- a/src/webview/processRunAll.ts +++ b/src/webview/processRunAll.ts @@ -2,7 +2,7 @@ import { Problem } from '../types'; import { runSingleAndSave } from './processRunSingle'; import { compileFile, getBinSaveLocation } from '../compiler'; import { deleteBinary } from '../executions'; -import { getLanguage } from '../utils'; +import { getLanguage, showMaintainerMessage } from '../utils'; import { getJudgeViewProvider } from '../extension'; /** @@ -11,6 +11,7 @@ import { getJudgeViewProvider } from '../extension'; **/ export default async (problem: Problem) => { console.log('Run all started', problem); + showMaintainerMessage(); const didCompile = await compileFile(problem.srcPath); if (!didCompile) { return;