Skip to content

Commit f400658

Browse files
committed
✨ 首次进入时打开引导与更新时打开更新日志
1 parent f355efb commit f400658

File tree

6 files changed

+17
-38
lines changed

6 files changed

+17
-38
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scriptcat",
3-
"version": "0.15.0-beta",
3+
"version": "0.15.0",
44
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
55
"author": "CodFrm",
66
"license": "GPLv3",

src/app/service/subscribe/manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ export default class SubscribeManager extends Manager {
178178
if (
179179
checkSilenceUpdate(
180180
newSubscribe.oldSubscribe!.metadata,
181-
newSubscribe.metadata
181+
newSubscribe.subscribe.metadata
182182
)
183183
) {
184184
logger.info("silence update subscribe");
185-
this.upsertHandler(newSubscribe);
185+
this.upsertHandler(newSubscribe.subscribe);
186186
return;
187187
}
188188
} catch (e) {

src/app/service/system/manager.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,9 @@ export class SystemManager extends Manager {
6060
if (details.reason === "install") {
6161
chrome.tabs.create({ url: "https://docs.scriptcat.org/" });
6262
} else if (details.reason === "update") {
63-
let nid: string;
64-
chrome.notifications.create(
65-
{
66-
type: "basic",
67-
iconUrl: chrome.runtime.getURL("assets/logo.png"),
68-
title: `ScriptCat 更新到 ${ExtVersion}`,
69-
message: "ScriptCat已更新,点击查看更新日志",
70-
},
71-
(notificationId) => {
72-
nid = notificationId;
73-
}
74-
);
75-
// eslint-disable-next-line no-undef
76-
let tm: NodeJS.Timeout;
77-
const onClicked = (id: string) => {
78-
if (nid !== id) {
79-
return;
80-
}
81-
chrome.notifications.onClicked.removeListener(onClicked);
82-
chrome.tabs.create({
83-
url: `https://docs.scriptcat.org/docs/change/#${ExtVersion}`,
84-
});
85-
chrome.notifications.clear(nid);
86-
clearTimeout(tm);
87-
};
88-
tm = setTimeout(() => {
89-
chrome.notifications.clear(nid);
90-
chrome.notifications.onClicked.removeListener(onClicked);
91-
}, 60 * 60 * 1000);
92-
chrome.notifications.onClicked.addListener(onClicked);
63+
chrome.tabs.create({
64+
url: `https://docs.scriptcat.org/docs/change/#${ExtVersion}`,
65+
});
9366
}
9467
});
9568
}

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "ScriptCat",
4-
"version": "0.15.0.1010",
4+
"version": "0.15.0",
55
"author": "CodFrm",
66
"description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.",
77
"options_ui": {

src/pages/components/layout/SiderGuide.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useImperativeHandle, useState } from "react";
1+
import React, { useEffect, useImperativeHandle, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import Joyride, { Step } from "react-joyride";
44
import { Path, useLocation, useNavigate } from "react-router-dom";
@@ -17,6 +17,13 @@ const SiderGuide: React.ForwardRefRenderFunction<{ open: () => void }, {}> = (
1717
useImperativeHandle(ref, () => ({
1818
open: () => setRun(true),
1919
}));
20+
useEffect(() => {
21+
// 首次使用时,打开引导
22+
if (localStorage.getItem("firstUse") === null) {
23+
localStorage.setItem("firstUse", "false");
24+
setRun(true);
25+
}
26+
});
2027

2128
const steps: Array<Step> = [
2229
{
@@ -91,7 +98,6 @@ const SiderGuide: React.ForwardRefRenderFunction<{ open: () => void }, {}> = (
9198
return (
9299
<Joyride
93100
callback={(data) => {
94-
console.log(data);
95101
if (
96102
data.action === "stop" ||
97103
data.action === "close" ||

0 commit comments

Comments
 (0)