From 01adc71ade1c3453705e5c744fa836aa2ca23e3c Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Tue, 20 Jun 2017 16:52:31 -0700 Subject: [PATCH] add cmd+opt+ctrl+D to globally invoke dev menu for Android Reviewed By: frantic Differential Revision: D5280788 fbshipit-source-id: ce11d122ee17a2ba8d8aa2e91fc6639610791577 --- .../com/facebook/react/devsupport/DevServerHelper.java | 7 +++++++ .../react/devsupport/DevSupportManagerImpl.java | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java index 1767bd123..5b0bce641 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java @@ -98,6 +98,7 @@ public class DevServerHelper { public interface PackagerCommandListener { void onPackagerReloadCommand(); + void onPackagerDevMenuCommand(); void onCaptureHeapCommand(final Responder responder); void onPokeSamplingProfilerCommand(final Responder responder); } @@ -145,6 +146,12 @@ public class DevServerHelper { commandListener.onPackagerReloadCommand(); } }); + handlers.put("devMenu", new NotificationOnlyHandler() { + @Override + public void onNotification(@Nullable Object params) { + commandListener.onPackagerDevMenuCommand(); + } + }); handlers.put("captureHeap", new RequestOnlyHandler() { @Override public void onRequest(@Nullable Object params, Responder responder) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java index 4f0b422d3..74fc0794b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java @@ -682,6 +682,16 @@ public class DevSupportManagerImpl implements }); } + @Override + public void onPackagerDevMenuCommand() { + UiThreadUtil.runOnUiThread(new Runnable() { + @Override + public void run() { + showDevOptionsDialog(); + } + }); + } + @Override public void onCaptureHeapCommand(final Responder responder) { UiThreadUtil.runOnUiThread(new Runnable() {