[go: nahoru, domu]

Skip to content

Commit

Permalink
Handle forwarded Flutter events to launch browser windows
Browse files Browse the repository at this point in the history
Fixes #4292, but requires Flutter change to land.
  • Loading branch information
DanTup committed Nov 30, 2022
1 parent a6e1409 commit 88a2e9f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/extension/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,21 @@ export class DebugCommands implements IAmDisposable {
this.logger.error(`Failed to expose URL ${originalUrl}: ${e}`);
session.session.customRequest("exposeUrlResponse", { originalUrl, exposedUrl: originalUrl });
}
} else if (e.event === "flutter.forwardedEvent") {
const event = e.body.event;
const params = e.body.params;
switch (event) {
case "app.webLaunchUrl":
const url = params.url as string;
const launched = !!params.launched;
if (!launched) {
try {
await envUtils.openInBrowser(url, this.logger);
} catch (e: any) {
this.logger.error(`Failed to launch URL from Flutter app.webLaunchUrl event: ${url}`);
}
}
}
} else if (e.event === "flutter.forwardedRequest") {
const id = e.body.id;
const method = e.body.method;
Expand Down

0 comments on commit 88a2e9f

Please sign in to comment.