Skip to content

Commit

Permalink
Indicate whether an app is a Flutter app via the app ID (#2406)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored Apr 16, 2024
1 parent 7d0d2d4 commit cfd5a6b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mv3_extension
publish_to: none
version: 2.1.2
version: 2.1.3
homepage: https://github.com/dart-lang/webdev
description: >-
A Chrome extension for Dart debugging.
Expand Down
4 changes: 4 additions & 0 deletions dwds/debug_extension_mv3/web/cider_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ Future<void> _sendInspectorUrl({String? appId}) async {
}

int _tabId(String appId) {
// The suffix "-f" is used to tell Cider that this is a Flutter app.
if (appId.endsWith('-f')) {
appId = appId.substring(0, appId.length - 2);
}
final tabId = appId.split('-').last;
return int.parse(tabId);
}
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/manifest_mv3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "2.1.2",
"version": "2.1.3",
"manifest_version": 3,
"devtools_page": "static_assets/devtools.html",
"action": {
Expand Down
4 changes: 3 additions & 1 deletion dwds/debug_extension_mv3/web/popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ Future<bool> _insertAppId() async {
final debugInfo = await _fetchDebugInfo(tabId);
if (debugInfo == null) return false;
final isInternalBuild = debugInfo.isInternalBuild ?? false;
final isFlutterApp = debugInfo.isFlutterApp ?? false;
final workspaceName = debugInfo.workspaceName;
if (isInternalBuild && workspaceName != null) {
_appId = '$workspaceName-$tabId';
// The suffix "-f" is used to tell Cider that this is a Flutter app.
_appId = '$workspaceName-$tabId${isFlutterApp ? '-f' : ''}';
final appIdSpan = document.getElementById(_appIdSpanId) as SpanElement;
appIdSpan.setInnerHtml(_appId);
return true;
Expand Down
1 change: 1 addition & 0 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ ${globalToolConfiguration.loadStrategy.loadModuleSnippet}("dart_sdk").developer.
throw RPCError(
method,
decodedResponse['code'] as int,
// ignore: avoid-unnecessary-type-casts
decodedResponse['message'] as String,
decodedResponse['data'] as Map,
);
Expand Down

0 comments on commit cfd5a6b

Please sign in to comment.