sparkling-debug-tool 2.1.0-rc.12 → 2.1.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,12 @@ object SparklingDebugTool {
22
22
 
23
23
  @JvmStatic
24
24
  fun init(application: Application) {
25
+ // Preset values must be set BEFORE LynxEnv flags so the DevTool
26
+ // service picks them up during initialization.
27
+ LynxDevToolService.INSTANCE.setLynxDebugPresetValue(true)
28
+ LynxDevToolService.INSTANCE.setLogBoxPresetValue(true)
29
+ LynxDevToolService.INSTANCE.setLoadJsBridge(true)
30
+
25
31
  LynxServiceCenter.inst().registerService(LynxDevToolService.INSTANCE)
26
32
  LynxEnv.inst().enableLynxDebug(true)
27
33
  LynxEnv.inst().enableDevtool(true)
@@ -11,9 +11,27 @@ public class SparklingDebugTool: NSObject {
11
11
  private static let devURLKey = "sparkling.debug.dev_url"
12
12
 
13
13
  public static func setup() {
14
- LynxEnv.sharedInstance().lynxDebugEnabled = true
15
- LynxEnv.sharedInstance().devtoolEnabled = true
16
- LynxEnv.sharedInstance().logBoxEnabled = true
14
+ // Preset values must be set BEFORE LynxEnv flags so the DevTool
15
+ // service picks them up during initialization.
16
+ if let devtool = LynxServices.getInstanceWith(
17
+ NSProtocolFromString("LynxServiceDevToolProtocol")!
18
+ ) as? LynxServiceDevToolProtocol {
19
+ devtool.logBoxPresetValue = true
20
+ devtool.lynxDebugPresetValue = true
21
+ }
22
+
23
+ let env = LynxEnv.sharedInstance()
24
+ env.lynxDebugEnabled = true
25
+ env.devtoolEnabled = true
26
+ env.logBoxEnabled = true
27
+
28
+ // Enable DebugRouter so the DevTool desktop app can discover and
29
+ // connect to this app (via USB or network).
30
+ if let routerClass = NSClassFromString("DebugRouter"),
31
+ let instance = routerClass.perform(NSSelectorFromString("instance"))?.takeUnretainedValue(),
32
+ instance.responds(to: NSSelectorFromString("enableAllSessions")) {
33
+ instance.perform(NSSelectorFromString("enableAllSessions"))
34
+ }
17
35
  }
18
36
 
19
37
  public static func devURL(fallback: String) -> String {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkling-debug-tool",
3
- "version": "2.1.0-rc.12",
3
+ "version": "2.1.0-rc.14",
4
4
  "description": "Sparkling debug tool SDK",
5
5
  "homepage": "https://tiktok.github.io/sparkling/",
6
6
  "repository": {