添加引导弹窗
This commit is contained in:
+60
-1
@@ -255,6 +255,7 @@ const DEFAULT_CPA_CALLBACK_MODE = 'step8';
|
||||
const MAIL_2925_MODE_PROVIDE = 'provide';
|
||||
const MAIL_2925_MODE_RECEIVE = 'receive';
|
||||
const DEFAULT_MAIL_2925_MODE = MAIL_2925_MODE_PROVIDE;
|
||||
const NEW_USER_GUIDE_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-new-user-guide-prompt-dismissed';
|
||||
const AUTO_SKIP_FAILURES_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-skip-failures-prompt-dismissed';
|
||||
const AUTO_RUN_FALLBACK_RISK_PROMPT_DISMISSED_STORAGE_KEY = 'multipage-auto-run-fallback-risk-prompt-dismissed';
|
||||
const CONTRIBUTION_CONTENT_PROMPT_DISMISSED_VERSION_STORAGE_KEY = 'multipage-contribution-content-prompt-dismissed-version';
|
||||
@@ -876,6 +877,59 @@ function setPromptDismissed(storageKey, dismissed) {
|
||||
}
|
||||
}
|
||||
|
||||
function isNewUserGuidePromptDismissed() {
|
||||
return isPromptDismissed(NEW_USER_GUIDE_PROMPT_DISMISSED_STORAGE_KEY);
|
||||
}
|
||||
|
||||
function setNewUserGuidePromptDismissed(dismissed) {
|
||||
setPromptDismissed(NEW_USER_GUIDE_PROMPT_DISMISSED_STORAGE_KEY, dismissed);
|
||||
}
|
||||
|
||||
function shouldPromptNewUserGuide() {
|
||||
if (isNewUserGuidePromptDismissed()) {
|
||||
return false;
|
||||
}
|
||||
if (!btnContributionMode || btnContributionMode.disabled) {
|
||||
return false;
|
||||
}
|
||||
if (latestState?.contributionMode) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getContributionPortalUrl() {
|
||||
return String(contributionContentService?.portalUrl || 'https://apikey.qzz.io').trim();
|
||||
}
|
||||
|
||||
function openNewUserGuidePrompt() {
|
||||
return openActionModal({
|
||||
title: '新手引导',
|
||||
message: '如果你是第一次使用,可以先查看贡献页里的公告和使用教程。点击“查看引导”会自动打开贡献页面。',
|
||||
alert: {
|
||||
text: '本提示仅出现一次。',
|
||||
},
|
||||
actions: [
|
||||
{ id: null, label: '取消', variant: 'btn-ghost' },
|
||||
{ id: 'confirm', label: '查看引导', variant: 'btn-primary' },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
async function maybeShowNewUserGuidePrompt() {
|
||||
if (!shouldPromptNewUserGuide()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setNewUserGuidePromptDismissed(true);
|
||||
const choice = await openNewUserGuidePrompt();
|
||||
if (choice === 'confirm') {
|
||||
openExternalUrl(getContributionPortalUrl());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDismissedContributionContentPromptVersion() {
|
||||
return String(localStorage.getItem(CONTRIBUTION_CONTENT_PROMPT_DISMISSED_VERSION_STORAGE_KEY) || '').trim();
|
||||
}
|
||||
@@ -4948,7 +5002,12 @@ restoreState().then(() => {
|
||||
updatePanelModeUI();
|
||||
updateButtonStates();
|
||||
updateStatusDisplay(latestState);
|
||||
return refreshContributionContentHint();
|
||||
return refreshContributionContentHint()
|
||||
.catch((error) => {
|
||||
console.warn('Failed to refresh contribution content hint during initialization:', error);
|
||||
return null;
|
||||
})
|
||||
.then(() => maybeShowNewUserGuidePrompt());
|
||||
}).catch((err) => {
|
||||
console.error('Failed to initialize sidepanel state:', err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user