Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d662c36c
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d662c36c
编写于
3月 19, 2021
作者:
H
Harald Kirschner
提交者:
Johannes Rieken
3月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More CES heuristics work
上级
a49a633a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
21 deletion
+23
-21
src/vs/workbench/contrib/surveys/browser/ces.contribution.ts
src/vs/workbench/contrib/surveys/browser/ces.contribution.ts
+23
-21
未找到文件。
src/vs/workbench/contrib/surveys/browser/ces.contribution.ts
浏览文件 @
d662c36c
...
...
@@ -20,10 +20,9 @@ import { platform } from 'vs/base/common/process';
const
WAIT_TIME_TO_SHOW_SURVEY
=
1000
*
60
*
60
;
// 1 hours
const
MAX_INSTALL_AGE
=
1000
*
60
*
60
*
8
;
// 8 hours
const
REMIND_LATER_DELAY
=
1000
*
60
*
60
*
8
;
//
8
hours
const
SKIP_
VERSION_KEY
=
'
ces/skipVersion
'
;
const
REMIND_LATER_DELAY
=
1000
*
60
*
60
*
8
;
//
4
hours
const
SKIP_
SURVEY_KEY
=
'
ces/skipSurvey
'
;
const
REMIND_LATER_DATE_KEY
=
'
ces/remindLaterDate
'
;
const
IS_CANDIDATE_KEY
=
'
ces/isCandidate
'
;
class
CESContribution
implements
IWorkbenchContribution
{
...
...
@@ -35,26 +34,23 @@ class CESContribution implements IWorkbenchContribution {
@
IProductService
private
readonly
productService
:
IProductService
,
@
optional
(
ITASExperimentService
)
private
readonly
tasExperimentService
:
ITASExperimentService
,
)
{
console
.
log
(
this
);
if
(
!
productService
.
cesSurveyUrl
)
{
return
;
}
const
skip
Version
=
storageService
.
get
(
SKIP_VERSION
_KEY
,
StorageScope
.
GLOBAL
,
''
);
if
(
skip
Version
)
{
const
skip
Survey
=
storageService
.
get
(
SKIP_SURVEY
_KEY
,
StorageScope
.
GLOBAL
,
''
);
if
(
skip
Survey
)
{
return
;
}
this
.
scheduleSurvey
();
}
private
async
scheduleSurvey
():
Promise
<
void
>
{
const
isExperimentCandidate
=
await
this
.
tasExperimentService
?.
getTreatment
<
boolean
>
(
'
CESSurvey
'
);
const
isCandidate
=
this
.
storageService
.
getBoolean
(
IS_CANDIDATE_KEY
,
StorageScope
.
GLOBAL
,
isExperimentCandidate
);
this
.
storageService
.
store
(
IS_CANDIDATE_KEY
,
isCandidate
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
// Once the experiment service determined if a user is a survey candidate, this value will be stored and
// preferred to any changes in the experiment.
const
isCandidate
=
await
this
.
tasExperimentService
?.
getTreatment
<
boolean
>
(
'
CESSurvey
'
);
if
(
!
isCandidate
)
{
this
.
skip
Version
();
this
.
skip
Survey
();
return
;
}
...
...
@@ -70,48 +66,54 @@ class CESContribution implements IWorkbenchContribution {
const
timeFromInstall
=
Date
.
now
()
-
new
Date
(
info
.
firstSessionDate
).
getTime
();
const
isNewInstall
=
!
isNaN
(
timeFromInstall
)
&&
timeFromInstall
<
MAX_INSTALL_AGE
;
// Installation is older than MAX_INSTALL_AGE
if
(
!
isNewInstall
)
{
this
.
skipSurvey
();
return
;
}
waitTimeToShowSurvey
=
Math
.
max
(
WAIT_TIME_TO_SHOW_SURVEY
-
timeFromInstall
,
WAIT_TIME_TO_SHOW_SURVEY
);
}
setTimeout
(()
=>
{
// TODO: Telemetry
this
.
notificationService
.
prompt
(
Severity
.
Info
,
nls
.
localize
(
'
surveyQuestion
'
,
"
Please help us to improve VS Code.
"
),
nls
.
localize
(
'
surveyQuestion
'
,
'
👋 Got a moment to help the VS Code team? Please tell us about your experience with VS Code so far.
'
),
// Please help us to improve VS Code.
// Take a short break from code and help us improve VS Code.
// Got a moment? Tell us about your experience with VS Code so far.
// Your feedback can help us make VS Code better for everybody.
// Got feedback for us? Signed, the VS Code team ❤️
// How is VS Code working for you so far? ❤️, the VS Code team!
[{
label
:
nls
.
localize
(
'
takeSurvey
'
,
"
Take Short Survey
"
),
label
:
nls
.
localize
(
'
takeSurvey
'
,
"
Give Feedback
"
),
// Take Short Survey
// Open Survey
run
:
()
=>
{
// TODO: Telemetry for yes
this
.
telemetryService
.
getTelemetryInfo
().
then
(
info
=>
{
this
.
openerService
.
open
(
URI
.
parse
(
`
${
this
.
productService
.
cesSurveyUrl
}
?o=
${
encodeURIComponent
(
platform
)}
&v=
${
encodeURIComponent
(
this
.
productService
.
version
)}
&m=
${
encodeURIComponent
(
info
.
machineId
)}
}`
));
this
.
skip
Version
();
this
.
skip
Survey
();
});
}
},
{
label
:
nls
.
localize
(
'
remindLater
'
,
"
Remind Me later
"
),
// TODO: Telemetry for later
run
:
()
=>
this
.
storageService
.
store
(
REMIND_LATER_DATE_KEY
,
new
Date
().
toUTCString
(),
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
)
run
:
()
=>
{
this
.
storageService
.
store
(
REMIND_LATER_DATE_KEY
,
new
Date
().
toUTCString
(),
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
this
.
scheduleSurvey
();
}
},
{
label
:
nls
.
localize
(
'
neverAgain
'
,
"
Don't Show Again
"
),
// TODO: Telemetry for no
run
:
()
=>
this
.
skip
Version
()
run
:
()
=>
this
.
skip
Survey
()
}],
{
sticky
:
true
}
);
},
waitTimeToShowSurvey
);
}
skipVersion
():
void
{
this
.
storageService
.
store
(
IS_CANDIDATE_KEY
,
false
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
this
.
storageService
.
store
(
SKIP_VERSION_KEY
,
this
.
productService
.
version
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
skipSurvey
():
void
{
this
.
storageService
.
store
(
SKIP_SURVEY_KEY
,
this
.
productService
.
version
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录