Skip to content

Commit

Permalink
🐛 解决最小化无法唤起问题
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Oct 11, 2023
1 parent 3b0bc4b commit f6bea9b
Showing 1 changed file with 34 additions and 36 deletions.
70 changes: 34 additions & 36 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,43 +167,41 @@ async function initData(): Promise<void> {
}
async function getDeepLink(): Promise<void> {
await event.listen("active_deep_link", (e) => {
new TauriWindow.WebviewWindow("TeyvatGuide")
.setFocus()
.then(async () => {
if (typeof e.payload !== "string") {
showSnackbar({
text: "无效的 deep link!",
color: "error",
timeout: 3000,
});
return;
}
if (e.payload === "") return;
// 导入格式: teyvatguide://import_uigf?app=appName
// 跳转格式: localhost:4000/achievements/?app=appName
if (e.payload.startsWith("teyvatguide://import_uigf")) {
const param = (<string>e.payload).split("teyvatguide://import_uigf/?")[1];
let appName = "";
if (param) {
appName = param.split("app=")[1];
}
if (appName === "") {
await router.push("/achievements");
} else {
await router.push("/achievements/?app=" + appName);
}
} else {
showSnackbar({
text: "无效的 deep link!",
color: "error",
timeout: 3000,
});
}
})
.catch((e) => {
console.log(e);
await event.listen("active_deep_link", async (e) => {
const windowGet = new TauriWindow.WebviewWindow("TeyvatGuide");
if (await windowGet.isMinimized()) {
await windowGet.unminimize();
}
await windowGet.setFocus();
if (typeof e.payload !== "string") {
showSnackbar({
text: "无效的 deep link!",
color: "error",
timeout: 3000,
});
return;
}
if (e.payload === "") return;
// 导入格式: teyvatguide://import_uigf?app=appName
// 跳转格式: localhost:4000/achievements/?app=appName
if (e.payload.startsWith("teyvatguide://import_uigf")) {
const param = (<string>e.payload).split("teyvatguide://import_uigf/?")[1];
let appName = "";
if (param) {
appName = param.split("app=")[1];
}
if (appName === "") {
await router.push("/achievements");
} else {
await router.push("/achievements/?app=" + appName);
}
} else {
showSnackbar({
text: "无效的 deep link!",
color: "error",
timeout: 3000,
});
}
});
}
</script>
Expand Down

0 comments on commit f6bea9b

Please sign in to comment.