Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use embed=one for DevTools URL #7417

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions flutter-idea/src/io/flutter/devtools/DevToolsUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DevToolsUrl {
private final FlutterSdkUtil sdkUtil;

private final boolean canUseDevToolsPathUrl;
private final boolean canUseMultiEmbed;

public final DevToolsIdeFeature ideFeature;

Expand Down Expand Up @@ -147,12 +148,13 @@ private DevToolsUrl(Builder builder) {

if (builder.workspaceCache != null && builder.workspaceCache.isBazel()) {
this.canUseDevToolsPathUrl = true;
}
else if (flutterSdkVersion != null) {
this.canUseMultiEmbed = true;
} else if (flutterSdkVersion != null) {
this.canUseDevToolsPathUrl = flutterSdkVersion.canUseDevToolsPathUrls();
}
else {
this.canUseMultiEmbed = flutterSdkVersion.canUseDevToolsMultiEmbed();
} else {
this.canUseDevToolsPathUrl = false;
this.canUseMultiEmbed = false;
}
}

Expand All @@ -172,7 +174,7 @@ public String getUrlString() {
params.add("theme=" + (isBright ? "light" : "dark"));
}
if (embed) {
params.add("embed=true");
params.add(this.canUseMultiEmbed ? "embedMode=one" : "embed=true");
}
if (fontSize != null) {
params.add("fontSize=" + fontSize);
Expand Down
7 changes: 7 additions & 0 deletions flutter-idea/src/io/flutter/sdk/FlutterSdkVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public class FlutterSdkVersion implements Comparable<FlutterSdkVersion> {
@NotNull
private static final FlutterSdkVersion MIN_SUPPORTS_DEEP_LINKS_TOOL = new FlutterSdkVersion("3.19.0");

@NotNull
private static final FlutterSdkVersion MIN_SUPPORTS_DEVTOOLS_MULTI_EMBED = new FlutterSdkVersion("3.23.0-0.1.pre");

@Nullable
private final Version version;
@Nullable
Expand Down Expand Up @@ -280,6 +283,10 @@ public boolean canUseDeepLinksTool() {
return version != null && this.compareTo(MIN_SUPPORTS_DEEP_LINKS_TOOL) >= 0;
}

public boolean canUseDevToolsMultiEmbed() {
return version != null && this.compareTo(MIN_SUPPORTS_DEVTOOLS_MULTI_EMBED) >= 0;
}

public boolean isValid() {
return version != null;
}
Expand Down