Skip to content

Commit

Permalink
✨ 首次进入时打开引导与更新时打开更新日志
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Aug 14, 2023
1 parent f355efb commit f400658
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 38 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scriptcat",
"version": "0.15.0-beta",
"version": "0.15.0",
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
"author": "CodFrm",
"license": "GPLv3",
Expand Down
4 changes: 2 additions & 2 deletions src/app/service/subscribe/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ export default class SubscribeManager extends Manager {
if (
checkSilenceUpdate(
newSubscribe.oldSubscribe!.metadata,
newSubscribe.metadata
newSubscribe.subscribe.metadata
)
) {
logger.info("silence update subscribe");
this.upsertHandler(newSubscribe);
this.upsertHandler(newSubscribe.subscribe);
return;
}
} catch (e) {
Expand Down
33 changes: 3 additions & 30 deletions src/app/service/system/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,36 +60,9 @@ export class SystemManager extends Manager {
if (details.reason === "install") {
chrome.tabs.create({ url: "https://docs.scriptcat.org/" });
} else if (details.reason === "update") {
let nid: string;
chrome.notifications.create(
{
type: "basic",
iconUrl: chrome.runtime.getURL("assets/logo.png"),
title: `ScriptCat 更新到 ${ExtVersion}`,
message: "ScriptCat已更新,点击查看更新日志",
},
(notificationId) => {
nid = notificationId;
}
);
// eslint-disable-next-line no-undef
let tm: NodeJS.Timeout;
const onClicked = (id: string) => {
if (nid !== id) {
return;
}
chrome.notifications.onClicked.removeListener(onClicked);
chrome.tabs.create({
url: `https://docs.scriptcat.org/docs/change/#${ExtVersion}`,
});
chrome.notifications.clear(nid);
clearTimeout(tm);
};
tm = setTimeout(() => {
chrome.notifications.clear(nid);
chrome.notifications.onClicked.removeListener(onClicked);
}, 60 * 60 * 1000);
chrome.notifications.onClicked.addListener(onClicked);
chrome.tabs.create({
url: `https://docs.scriptcat.org/docs/change/#${ExtVersion}`,
});
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "ScriptCat",
"version": "0.15.0.1010",
"version": "0.15.0",
"author": "CodFrm",
"description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.",
"options_ui": {
Expand Down
10 changes: 8 additions & 2 deletions src/pages/components/layout/SiderGuide.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useImperativeHandle, useState } from "react";
import React, { useEffect, useImperativeHandle, useState } from "react";
import { useTranslation } from "react-i18next";
import Joyride, { Step } from "react-joyride";
import { Path, useLocation, useNavigate } from "react-router-dom";
Expand All @@ -17,6 +17,13 @@ const SiderGuide: React.ForwardRefRenderFunction<{ open: () => void }, {}> = (
useImperativeHandle(ref, () => ({
open: () => setRun(true),
}));
useEffect(() => {
// 首次使用时,打开引导
if (localStorage.getItem("firstUse") === null) {
localStorage.setItem("firstUse", "false");
setRun(true);
}
});

const steps: Array<Step> = [
{
Expand Down Expand Up @@ -91,7 +98,6 @@ const SiderGuide: React.ForwardRefRenderFunction<{ open: () => void }, {}> = (
return (
<Joyride
callback={(data) => {
console.log(data);
if (
data.action === "stop" ||
data.action === "close" ||
Expand Down

0 comments on commit f400658

Please sign in to comment.