Skip to content

Commit 8dbc381

Browse files
committed
Autoclose Frida & ADB intercept config if devices disappear
1 parent aa75e18 commit 8dbc381

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/components/intercept/config/android-adb-config.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as _ from 'lodash';
22
import * as React from 'react';
3-
import { computed, observable, action } from 'mobx';
4-
import { observer, inject } from 'mobx-react';
3+
import { computed, observable, action, autorun } from 'mobx';
4+
import { observer, inject, disposeOnUnmount } from 'mobx-react';
55

66
import { styled } from '../../../styles';
77

@@ -85,6 +85,12 @@ class AndroidAdbConfig extends React.Component<{
8585
this.interceptDevice(this.deviceIds[0]);
8686
this.props.closeSelf();
8787
}
88+
89+
disposeOnUnmount(this, autorun(() => {
90+
if (this.deviceIds?.length === 0) {
91+
this.props.closeSelf();
92+
}
93+
}));
8894
}
8995

9096
render() {

src/components/intercept/config/frida-config.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ class FridaConfig extends React.Component<{
184184
if (this.selectedHostId && !this.fridaHosts.some(host => host.id === this.selectedHostId)) {
185185
this.deselectHost();
186186
}
187+
188+
if (this.fridaHosts?.length === 0) {
189+
this.props.closeSelf();
190+
}
187191
}));
188192

189193
this.updateTargets();

0 commit comments

Comments
 (0)