Skip to content

[MV3 Debug Extension] Fix isDevMode getter #1962

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

Merged
merged 1 commit into from
Feb 15, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dwds/debug_extension_mv3/web/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ void _setDebuggableIcon() {
}

void _setDefaultIcon() {
final iconPath = isDevMode()
? 'static_assets/dart_dev.png'
: 'static_assets/dart_grey.png';
final iconPath =
isDevMode ? 'static_assets/dart_dev.png' : 'static_assets/dart_grey.png';
setExtensionIcon(IconInfo(path: iconPath));
}

Expand Down
4 changes: 2 additions & 2 deletions dwds/debug_extension_mv3/web/devtools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void _maybeCreatePanels() async {
if (!isInternalBuild) return;
// Create a Debugger panel for all internal apps:
chrome.devtools.panels.create(
isDevMode() ? '[DEV] Dart Debugger' : 'Dart Debugger',
isDevMode ? '[DEV] Dart Debugger' : 'Dart Debugger',
'',
'static_assets/debugger_panel.html',
allowInterop((ExtensionPanel panel) => _onPanelAdded(panel, debugInfo)),
Expand All @@ -53,7 +53,7 @@ void _maybeCreatePanels() async {
final isFlutterApp = debugInfo.isFlutterApp ?? false;
if (isFlutterApp) {
chrome.devtools.panels.create(
isDevMode() ? '[DEV] Flutter Inspector' : 'Flutter Inspector',
isDevMode ? '[DEV] Flutter Inspector' : 'Flutter Inspector',
'',
'static_assets/inspector_panel.html',
allowInterop((ExtensionPanel panel) => _onPanelAdded(panel, debugInfo)),
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/web/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void _log(
_LogLevel? level,
String? prefix,
}) {
if (!verbose && !isDevMode()) return;
if (!verbose && !isDevMode) return;
final logMsg = prefix != null ? '[$prefix] $msg' : msg;
final logLevel = level ?? _LogLevel.info;
switch (logLevel) {
Expand Down
6 changes: 4 additions & 2 deletions dwds/debug_extension_mv3/web/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ void setExtensionIcon(IconInfo info) {

bool? _isDevMode;

bool isDevMode() {
bool get isDevMode {
if (_isDevMode != null) {
return _isDevMode!;
}
final extensionManifest = chrome.runtime.getManifest();
final extensionName = getProperty(extensionManifest, 'name') ?? '';
return extensionName.contains('DEV');
final isDevMode = extensionName.contains('DEV');
_isDevMode = isDevMode;
return isDevMode;
}

String addQueryParameters(
Expand Down