[feat] basic deep-link

This commit is contained in:
Purp1e
2025-03-19 22:03:32 +08:00
parent 0f3dca7428
commit d6602c4c5a
14 changed files with 372 additions and 36 deletions

View File

@@ -7,7 +7,6 @@ import LaunchOption from "@/components/cstb/LaunchOption"
import Notice from "@/components/cstb/Notice"
import PowerPlan from "@/components/cstb/PowerPlan"
import SmartTransfer from "@/components/cstb/SmartTranser"
const Home = () => {
return (
<section className="flex flex-col h-full gap-4">

View File

@@ -4,6 +4,7 @@ import { useEffect, useState } from "react"
import { steamStore, useSteamStore } from "@/store/steam"
import { open } from "@tauri-apps/plugin-dialog"
import { invoke } from "@tauri-apps/api/core"
import { onOpenUrl } from "@tauri-apps/plugin-deep-link"
import path from "path"
/**
@@ -33,6 +34,7 @@ export function Prepare() {
const [, setSteamDir] = useState(steam.state.dir)
const [, setCs2Dir] = useState(steam.state.csDir)
const [inited, setInited] = useState(false)
const [links, setLinks] = useState<string[]>([])
useEffect(() => {
const initValues = async () => {
@@ -47,6 +49,10 @@ export function Prepare() {
})
useEffect(() => {
void onOpenUrl((urls) => {
console.log("deep link:", urls)
setLinks(urls)
})
const checkPaths = async () => {
setChecking(true)
const exist: boolean =
@@ -138,6 +144,8 @@ export function Prepare() {
</Button>
</div>
<p className="text-white">{links || 'no'}</p>
<section className="flex justify-center w-full gap-3 mt-6">
<Button onPress={() => alert("获取")} variant="ghost" color="default" size="sm">