1 package expo.modules.devmenu
2 
3 import android.os.Bundle
4 import com.facebook.react.ReactInstanceManager
5 import expo.modules.devmenu.devtools.DevMenuDevToolsDelegate
6 
7 object DevMenuDevSettings {
getDevSettingsnull8   fun getDevSettings(reactInstanceManager: ReactInstanceManager): Bundle {
9     val devDelegate = DevMenuDevToolsDelegate(DevMenuManager, reactInstanceManager)
10     val devSettings = devDelegate.devSettings
11 
12     val jsBundleURL = reactInstanceManager.devSupportManager.jsBundleURLForRemoteDebugging
13 
14     if (devSettings != null) {
15       return Bundle().apply {
16         putBoolean("isDebuggingRemotely", devSettings.isRemoteJSDebugEnabled)
17         putBoolean("isElementInspectorShown", devSettings.isElementInspectorEnabled)
18         putBoolean("isHotLoadingEnabled", devDelegate.devInternalSettings?.isHotModuleReplacementEnabled ?: false)
19         putBoolean("isPerfMonitorShown", devSettings.isFpsDebugEnabled)
20         putBoolean("isRemoteDebuggingAvailable", jsBundleURL.isNotEmpty())
21         putBoolean("isElementInspectorAvailable", devSettings.isJSDevModeEnabled)
22         putBoolean("isHotLoadingAvailable", devSettings.isJSDevModeEnabled)
23         putBoolean("isPerfMonitorAvailable", devSettings.isJSDevModeEnabled)
24         putBoolean(
25           "isJSInspectorAvailable",
26           run {
27             val jsExecutorName = reactInstanceManager.jsExecutorName
28             jsExecutorName.contains("Hermes") || jsExecutorName.contains("V8")
29           }
30         )
31       }
32     }
33 
34     return Bundle().apply {
35       putBoolean("isDebuggingRemotely", false)
36       putBoolean("isElementInspectorShown", false)
37       putBoolean("isHotLoadingEnabled", false)
38       putBoolean("isPerfMonitorShown", false)
39       putBoolean("isRemoteDebuggingAvailable", false)
40       putBoolean("isElementInspectorAvailable", false)
41       putBoolean("isHotLoadingAvailable", false)
42       putBoolean("isPerfMonitorAvailable", false)
43       putBoolean("isJSInspectorAvailable", false)
44     }
45   }
46 }
47