From f15613666a3aab0ef8c223b52d67ff51cad39ba5 Mon Sep 17 00:00:00 2001 From: github0null Date: Fri, 20 Jan 2023 15:30:38 +0800 Subject: [PATCH 1/2] move usr-data.yaml file location --- src/ResManager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ResManager.ts b/src/ResManager.ts index 5a4e6121..96f0756f 100644 --- a/src/ResManager.ts +++ b/src/ResManager.ts @@ -229,7 +229,7 @@ export class ResManager extends events.EventEmitter { getAppUsrData(): { [key: string]: any } | undefined { - const dataFile = File.fromArray([this.GetAppDataDir().path, 'data.yaml']); + const dataFile = File.fromArray([this.getEideHomeFolder().path, 'usr-data.yaml']); if (dataFile.IsFile()) { try { @@ -246,8 +246,9 @@ export class ResManager extends events.EventEmitter { data[key] = val; - File.fromArray([this.GetAppDataDir().path, 'data.yaml']) - .Write(yaml.stringify(data)); + this.getEideHomeFolder().CreateDir(false); + + File.fromArray([this.getEideHomeFolder().path, 'usr-data.yaml']).Write(yaml.stringify(data)); } //===================== From d24a093d923899e41b1e36fd92c1ca640d0cd1c3 Mon Sep 17 00:00:00 2001 From: github0null Date: Fri, 20 Jan 2023 16:24:47 +0800 Subject: [PATCH 2/2] [other] show feedback/rating promt message --- src/StringTable.ts | 10 ++++++++++ src/extension.ts | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/StringTable.ts b/src/StringTable.ts index a2c6cee3..8c36eb37 100644 --- a/src/StringTable.ts +++ b/src/StringTable.ts @@ -592,8 +592,18 @@ export const view_str$prompt$project_is_opened_by_another = [ `Can't lock project: '{path}', maybe this project has been opened by another EIDE instance !` ][langIndex]; +export const view_str$prompt$feedback = [ + `已经过去了一段时间,Embedded IDE 这款插件有帮到你吗?您可以在插件商店给予一个评分以帮助我们了解您的感受!`, + `A few days passed, has this plugin(Embedded IDE) helped you ? You can help us know how you feel by giving us a rating in the plugin store !` +][langIndex]; + //---------------Select string------------------ +export const rating_text = [ + '打分', + 'Rating' +][langIndex]; + export const later_text = [ '稍后', 'Later on' diff --git a/src/extension.ts b/src/extension.ts index 336af55b..4759a6b8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -40,7 +40,7 @@ import { ResInstaller } from './ResInstaller'; import { ERROR, WARNING, INFORMATION, view_str$operation$serialport, view_str$operation$baudrate, view_str$operation$serialport_name, - txt_install_now, txt_yes + txt_install_now, txt_yes, view_str$prompt$feedback, rating_text, later_text } from './StringTable'; import { LogDumper } from './LogDumper'; import { StatusBarManager } from './StatusBarManager'; @@ -294,6 +294,23 @@ function postLaunchHook(extensionCtx: vscode.ExtensionContext) { } } + // not first launch + else { + + // A few days ago, show feedback message + const some_days = 7 * (24 * 3600 * 1000); + if (!appUsrData['Feedbacked'] && + Date.now() - appUsrData['InstallTime'] > some_days) { + resManager.setAppUsrData('Feedbacked', true); + const msg = view_str$prompt$feedback; + vscode.window.showInformationMessage(msg, rating_text).then((ans) => { + if (ans == rating_text) { + utility.openUrl(`https://marketplace.visualstudio.com/items?itemName=CL.eide&ssr=false#review-details`); + } + }); + } + } + // refresh external tools now ResInstaller.instance().refreshExternalToolsIndex().catch(err => { GlobalEvent.emit('globalLog', ExceptionToMessage(err, 'Warning'));