feat(harmony): add folder transfers and HDC device management
This commit is contained in:
@@ -63,11 +63,42 @@ const entries = [
|
||||
];
|
||||
window.__TROVE_CONTEXT__ = {
|
||||
curioId: "dev.trove.harmony-connector",
|
||||
version: "0.1.1",
|
||||
version: "0.2.0",
|
||||
instanceId: "ui-fixture",
|
||||
platform: "macos",
|
||||
};
|
||||
window.__TROVE_BRIDGE__ = createMockBridge({
|
||||
"@self.hdc.status": () => ({ busy: false, job: null }),
|
||||
"@self.hdc.tool": () => ({
|
||||
available: true,
|
||||
version: "HDC · 模拟数据",
|
||||
path: "/fixture/official-sdk/hdc",
|
||||
}),
|
||||
"@self.hdc.devices": () => ({
|
||||
devices: attached
|
||||
? [{ id: "fixture-device", transport: "USB", state: "Connected" }]
|
||||
: [],
|
||||
}),
|
||||
"@self.hdc.inspect": () => ({
|
||||
capabilities: Object.fromEntries(
|
||||
["apps", "launch", "screenshot", "logs", "report"].map((key) => [
|
||||
key,
|
||||
{ available: true },
|
||||
]),
|
||||
),
|
||||
info: { text: "HUAWEI Pura 70 Ultra · 界面测试数据" },
|
||||
}),
|
||||
"@self.hdc.apps": () => ({
|
||||
apps: ["com.example.gallery", "com.example.notes", "com.example.reader"],
|
||||
}),
|
||||
"@self.hdc.app": ({ bundle }) => ({
|
||||
bundle,
|
||||
versionName: "1.2.0",
|
||||
versionCode: 12,
|
||||
debug: bundle.endsWith("notes"),
|
||||
abilities: [{ name: "Home", module: "entry" }],
|
||||
details: {},
|
||||
}),
|
||||
"@self.info": () => ({ connection, busy: false }),
|
||||
"@self.devices": () => ({ devices: attached ? [device] : [] }),
|
||||
"@self.monitor": () => ({
|
||||
@@ -104,6 +135,15 @@ window.__TROVE_BRIDGE__ = createMockBridge({
|
||||
"@self.transferStatus": () => {
|
||||
if (job?.state === "running") {
|
||||
job.sent += 524288;
|
||||
job.statistics = {
|
||||
bytesPerSecond: 1310720,
|
||||
averageBytesPerSecond: 1210720,
|
||||
elapsedSeconds: job.sent / 1310720,
|
||||
remainingSeconds: (job.total - job.sent) / 1310720,
|
||||
filesTotal: 3,
|
||||
filesCompleted: Math.floor((job.sent / job.total) * 3),
|
||||
currentFile: "Documents/设计稿.zip",
|
||||
};
|
||||
if (job.sent >= job.total) {
|
||||
job.state = "completed";
|
||||
job.result = { name: "界面测试文件", bytes: job.total };
|
||||
|
||||
Reference in New Issue
Block a user