[feat] basic deep-link
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
自动获取
|
||||
|
||||
Reference in New Issue
Block a user