Skip to content

Commit

Permalink
refactor: new naming rule
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Jun 27, 2023
1 parent 582532e commit 95860bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
StructDeserializeStream,
} from '@yume-chan/stream-extra';

export class AdbPipingBackend implements AdbDaemonDevice {
export class AdbDaemonPipingDevice implements AdbDaemonDevice {
public readonly serial: string;
public readonly name: string | undefined = undefined;

Expand Down
15 changes: 7 additions & 8 deletions apps/demo/src/components/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import { GLOBAL_STATE } from "../state";
import { CommonStackTokens, Icons } from "../utils";

import {AdbPipingBackend} from "../adb-piping-backend";
import {AdbDaemonPipingDevice} from "../adb-daemon-piping";
import {useRouter} from "next/router";

const DropdownStyles = { dropdown: { width: "100%" } };
Expand Down Expand Up @@ -179,7 +179,7 @@ function _Connect(): JSX.Element | null {
});
}, []);

const [pipingBackendList, setPipingBackendList] = useState<AdbPipingBackend[]>([]);
const [pipingDeviceList, setPipingDeviceList] = useState<AdbDaemonPipingDevice[]>([]);

useEffect(() => {
const pipingSererUrl = router.query["server"] as string ?? "https://ppng.io";
Expand All @@ -190,15 +190,14 @@ function _Connect(): JSX.Element | null {
}
const headersString = router.query["headers"] as string | undefined;
const headers = headersString === undefined ? undefined : new Headers(JSON.parse(decodeURIComponent(headersString)));
const adbPipingBackend = new AdbPipingBackend({
const device = new AdbDaemonPipingDevice({
csUrl: urlJoin(pipingSererUrl, csPath),
scUrl: urlJoin(pipingSererUrl, scPath),
scHeaders: headers,
csHeaders: headers,
});
setPipingBackendList([adbPipingBackend]);
// setSelectedBackend(adbPipingBackend);
setSelected(adbPipingBackend);
setPipingDeviceList([device]);
setSelected(device);
const autoConnectString = router.query["auto_connect"] as string | undefined;
setAutoConnect(autoConnectString === "" || autoConnectString === "true" || autoConnectString === "1");
}, [router]);
Expand Down Expand Up @@ -310,9 +309,9 @@ function _Connect(): JSX.Element | null {
usbDeviceList,
webSocketDeviceList,
tcpDeviceList,
pipingBackendList,
pipingDeviceList,
),
[usbDeviceList, webSocketDeviceList, tcpDeviceList, pipingBackendList]
[usbDeviceList, webSocketDeviceList, tcpDeviceList, pipingDeviceList]
);

const deviceOptions = useMemo(() => {
Expand Down

1 comment on commit 95860bf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.