Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Commit b2ab32b

Browse files
committed
fix: part fix
1 parent 3a72883 commit b2ab32b

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

app/renderer/src/stores/controller.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function reload_init() {
1717

1818
async function connect(cfg: DeviceInfo, cb: (msg: string, detail: string) => void) {
1919
const { name, adb_path: path, adb_serial: serial, adb_type: type, adb_config: config } = cfg
20-
const ctrl = await Controller.initAdb({
20+
const ctrl = await Controller.init_adb({
2121
path,
2222
serial,
2323
type,
@@ -28,6 +28,7 @@ async function connect(cfg: DeviceInfo, cb: (msg: string, detail: string) => voi
2828
if (await ctrl.connected) {
2929
handles.value[ctrl.handle] = {
3030
cb: ctrl.cbId,
31+
ci: ctrl.rpcId,
3132

3233
name,
3334
cfg
@@ -42,7 +43,7 @@ async function connect(cfg: DeviceInfo, cb: (msg: string, detail: string) => voi
4243
async function disconnect(handle: ControllerHandle) {
4344
const ci = handles.value[handle]!
4445
delete handles.value[handle]
45-
await (await Controller.init_from(handle, ci.cb)).destroy()
46+
await (await Controller.init_from(handle, ci.cb, ci.ci)).destroy()
4647
}
4748

4849
async function disconnect_all() {
@@ -71,7 +72,8 @@ function info(serial?: string) {
7172
}
7273

7374
function init_from(handle: ControllerHandle) {
74-
return Controller.init_from(handle, handles.value[handle]!.cb)
75+
const ci = handles.value[handle]!
76+
return Controller.init_from(handle, ci.cb, ci.ci)
7577
}
7678

7779
function only_one() {

app/renderer/src/stores/instance.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ async function create_with(cfg: InstanceSaveInfo) {
6060
runtime: {
6161
instance: {
6262
handle: inst.handle,
63-
cb: inst.cbId
63+
cb: inst.cbId,
64+
ci: inst.rpcId
6465
},
6566
resource: {
6667
handle: res.handle,
67-
cb: res.cbId
68+
cb: res.cbId,
69+
ci: res.rpcId
6870
},
6971
controller: ctrl
7072
}
@@ -91,8 +93,8 @@ function is_created(id: string) {
9193
async function destroy(handle: InstanceHandle) {
9294
const ii = handles.value[handle]!.runtime
9395
delete handles.value[handle]
94-
await (await Instance.init_from(ii.instance.handle, ii.instance.cb)).destroy()
95-
await (await Resource.init_from(ii.resource.handle, ii.resource.cb)).destroy()
96+
await (await Instance.init_from(ii.instance.handle, ii.instance.cb, ii.instance.ci)).destroy()
97+
await (await Resource.init_from(ii.resource.handle, ii.resource.cb, ii.resource.ci)).destroy()
9698
}
9799

98100
async function destroy_all() {
@@ -223,14 +225,13 @@ function buildDiffConfig(
223225
}
224226

225227
function init_res_from(handle: InstanceHandle) {
226-
return Resource.init_from(
227-
handles.value[handle]!.runtime.resource.handle,
228-
handles.value[handle]!.runtime.resource.cb
229-
)
228+
const ri = handles.value[handle]!.runtime.resource
229+
return Resource.init_from(ri.handle, ri.cb, ri.ci)
230230
}
231231

232232
function init_from(handle: InstanceHandle) {
233-
return Instance.init_from(handle, handles.value[handle]!.runtime.instance.cb)
233+
const ii = handles.value[handle]!.runtime.instance
234+
return Instance.init_from(handle, ii.cb, ii.ci)
234235
}
235236

236237
async function run(

pkgs/type/src/handle.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ControllerHandle, DeviceInfo, InstanceHandle, ResourceHandle } fro
22

33
export type ControllerHandleInfo = {
44
cb: string
5+
ci: string
56

67
name: string
78
cfg: DeviceInfo
@@ -30,10 +31,12 @@ export type InstanceHandleInfo = InstanceSaveInfo & {
3031
resource: {
3132
handle: ResourceHandle
3233
cb: string
34+
ci: string
3335
}
3436
instance: {
3537
handle: InstanceHandle
3638
cb: string
39+
ci: string
3740
}
3841
}
3942
}

0 commit comments

Comments
 (0)