Skip to content

Commit 94ba248

Browse files
committed
Improve UX of core Frida setup/launch/intercept buttons
This now correctly doesn't try to show targets until the device is fully ready, and jumps to the View page as soon as something is successfully intercepted.
1 parent 41acf9a commit 94ba248

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,23 @@ class FridaConfig extends React.Component<{
183183
@computed
184184
get selectedHost() {
185185
if (!this.selectedHostId) return;
186-
const hosts = this.fridaHosts;
187-
return this.fridaHosts.find(host => host.id === this.selectedHostId && host.state !== 'unavailable');
186+
187+
const host = this.getHost(this.selectedHostId);
188+
if (host?.state === 'unavailable') return;
189+
190+
return host;
191+
}
192+
193+
private getHost(hostId: string) {
194+
return this.fridaHosts.find(host => host.id === hostId);
188195
}
189196

190197
@action.bound
191198
selectHost(hostId: string) {
192-
this.selectedHostId = hostId;
199+
const host = this.getHost(hostId);
193200

194-
const host = this.selectedHost;
195201
if (host?.state === 'available') {
202+
this.selectedHostId = hostId;
196203
this.searchInput = '';
197204
this.updateTargets();
198205
} else if (host?.state === 'launch-required') {
@@ -232,6 +239,8 @@ class FridaConfig extends React.Component<{
232239
action: 'intercept',
233240
hostId: host.id,
234241
targetId
242+
}).then(() => {
243+
this.props.reportSuccess();
235244
}).finally(action(() => {
236245
_.pull(this.inProgressTargetIds, targetId);
237246
}));
@@ -324,10 +333,6 @@ class FridaConfig extends React.Component<{
324333
</ConfigContainer>;
325334
}
326335

327-
onSuccess = () => {
328-
this.props.reportSuccess();
329-
};
330-
331336
}
332337

333338
export const FridaCustomUi = {

0 commit comments

Comments
 (0)