update layout
This commit is contained in:
parent
84f18b6141
commit
725d41f61f
17 changed files with 1859 additions and 408 deletions
|
|
@ -166,8 +166,7 @@ const AndroidPage: React.FC = () => {
|
|||
const scrcpyOption = new ScrcpyOptions1_25({
|
||||
maxFps: 60,
|
||||
control: true,
|
||||
logLevel: ScrcpyLogLevel1_18.Debug,
|
||||
stayAwake: true
|
||||
logLevel: ScrcpyLogLevel1_18.Debug
|
||||
})
|
||||
const _client = await AdbScrcpyClient.start(
|
||||
adb!,
|
||||
|
|
@ -182,7 +181,7 @@ const AndroidPage: React.FC = () => {
|
|||
if (videoStream) {
|
||||
const _decoder = new WebCodecsDecoder(ScrcpyVideoCodecId.H264)
|
||||
|
||||
_decoder.renderer.style.maxHeight = 'inherit'
|
||||
_decoder.renderer.style.maxHeight = '900px'
|
||||
screenRef.current?.appendChild(_decoder.renderer)
|
||||
videoStream?.stream.pipeTo(_decoder.writable)
|
||||
setDecoder(_decoder)
|
||||
|
|
@ -192,6 +191,7 @@ const AndroidPage: React.FC = () => {
|
|||
const react = _decoder.renderer.getBoundingClientRect()
|
||||
const x = e.clientX - react.left
|
||||
const y = e.clientY - react.top
|
||||
console.log('mouse down at ' + x + ' ' + y)
|
||||
_client.controlMessageWriter?.injectTouch({
|
||||
action: AndroidMotionEventAction.Down,
|
||||
pointerId: ScrcpyPointerId.Mouse,
|
||||
|
|
@ -209,6 +209,7 @@ const AndroidPage: React.FC = () => {
|
|||
const react = _decoder.renderer.getBoundingClientRect()
|
||||
const x = e.clientX - react.left
|
||||
const y = e.clientY - react.top
|
||||
console.log('mouse move at ' + x + ' ' + y)
|
||||
_client.controlMessageWriter?.injectTouch({
|
||||
action: AndroidMotionEventAction.Move,
|
||||
pointerId: ScrcpyPointerId.Mouse,
|
||||
|
|
@ -226,6 +227,7 @@ const AndroidPage: React.FC = () => {
|
|||
const react = _decoder.renderer.getBoundingClientRect()
|
||||
const x = e.clientX - react.left
|
||||
const y = e.clientY - react.top
|
||||
console.log('mouse up at ' + x + ' ' + y)
|
||||
_client.controlMessageWriter?.injectTouch({
|
||||
action: AndroidMotionEventAction.Up,
|
||||
pointerId: ScrcpyPointerId.Mouse,
|
||||
|
|
@ -264,8 +266,22 @@ const AndroidPage: React.FC = () => {
|
|||
setDecoder(undefined)
|
||||
}
|
||||
|
||||
function rebootDevice() {
|
||||
adb?.power.reboot()
|
||||
async function rebootDevice() {
|
||||
const res = await adb?.power.reboot()
|
||||
console.log('[rebootDevice] res: ', res)
|
||||
}
|
||||
|
||||
async function killScrcpyServer() {
|
||||
const res = await adb?.subprocess.spawn(
|
||||
'kill -9 $(pidof -s com.genymobile.scrcpy.Server)'
|
||||
)
|
||||
res?.stdout.pipeThrough(new DecodeUtf8Stream()).pipeTo(
|
||||
new WritableStream({
|
||||
write(chunk) {
|
||||
console.log(chunk)
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -286,6 +302,7 @@ const AndroidPage: React.FC = () => {
|
|||
{client ? 'Disconnect' : 'Connect'}
|
||||
</button>
|
||||
{adb ? <button onClick={rebootDevice}>Reboot</button> : ''}
|
||||
{adb ? <button onClick={killScrcpyServer}>Kill Scrcpy</button> : ''}
|
||||
</div>
|
||||
<div className="bg-white">{adb && device ? device.name : ''}</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { Button } from '@/components/ui/button'
|
||||
import { RocketIcon } from '@radix-ui/react-icons'
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
|
|
@ -5,9 +7,12 @@ const HomePage: React.FC = () => {
|
|||
return (
|
||||
<div>
|
||||
<h1>This is Home Page!!!!!!!</h1>
|
||||
<button className="btn btn-primary">
|
||||
<Link to="/android">Go to Android Page</Link>
|
||||
</button>
|
||||
<Button asChild>
|
||||
<Link to="/android">
|
||||
<RocketIcon className="mr-2 h-5 w-5" />
|
||||
Go to Android Page
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const LoginPage: React.FC = () => {
|
|||
const navigate = useNavigate()
|
||||
|
||||
const redirectUrl =
|
||||
new URLSearchParams(window.location.search).get('redirect') ?? '/'
|
||||
new URLSearchParams(window.location.search).get('redirect_to') ?? '/'
|
||||
|
||||
const loginWithGoogle = () => {
|
||||
// if is web mode then use window.open
|
||||
|
|
@ -41,7 +41,6 @@ const LoginPage: React.FC = () => {
|
|||
window.addEventListener('message', event => {
|
||||
if (event.data.payload === 'loginSuccess') {
|
||||
// const { access_token, max_age, refresh_token } = event.data.data
|
||||
|
||||
// setPassword(
|
||||
// import.meta.env.TAOBIN_RECIPE_MANAGER_KEY_CHAIN_SERVICE_NAME,
|
||||
// import.meta.env
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue