From 8f0486329e9cf03bb6daeaad57f1e1fa1cb0cd3b Mon Sep 17 00:00:00 2001 From: pengfeizhou Date: Sun, 7 Feb 2021 15:58:11 +0800 Subject: [PATCH] feat:fix Register DevMonitor --- .../src/main/java/pub/doric/devkit/DevKit.java | 12 ++---------- doric-iOS/Devkit/Classes/DoricDev.m | 16 +--------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/doric-android/devkit/src/main/java/pub/doric/devkit/DevKit.java b/doric-android/devkit/src/main/java/pub/doric/devkit/DevKit.java index 8281be03..365b16e2 100644 --- a/doric-android/devkit/src/main/java/pub/doric/devkit/DevKit.java +++ b/doric-android/devkit/src/main/java/pub/doric/devkit/DevKit.java @@ -14,6 +14,7 @@ import pub.doric.Doric; import pub.doric.DoricContext; import pub.doric.DoricContextManager; import pub.doric.DoricLibrary; +import pub.doric.DoricNativeDriver; import pub.doric.DoricRegistry; import pub.doric.devkit.event.ConnectExceptionEvent; import pub.doric.devkit.event.EOFExceptionEvent; @@ -34,16 +35,7 @@ public class DevKit implements IDevKit { } private DevKit() { - Doric.registerLibrary(new DoricLibrary() { - @Override - public void load(DoricRegistry registry) { - registry.registerMonitor(new DoricDevMonitor()); - } - }); - for (DoricContext context : DoricContextManager.aliveContexts()) { - context.getDriver().getRegistry().registerMonitor(new DoricDevMonitor()); - break; - } + DoricNativeDriver.getInstance().getRegistry().registerMonitor(new DoricDevMonitor()); EventBus.getDefault().register(this); } diff --git a/doric-iOS/Devkit/Classes/DoricDev.m b/doric-iOS/Devkit/Classes/DoricDev.m index 710eda62..9c4e5f07 100644 --- a/doric-iOS/Devkit/Classes/DoricDev.m +++ b/doric-iOS/Devkit/Classes/DoricDev.m @@ -30,15 +30,6 @@ #import "DoricDevViewController.h" #import "DoricDevMonitor.h" -@interface DoricDevLibrary : DoricLibrary -@end - -@implementation DoricDevLibrary -- (void)load:(DoricRegistry *)registry { - -} -@end - @interface DoricDev () @property(nonatomic, strong) DoricWSClient *wsclient; @property(nonatomic, strong) DoricContext *context; @@ -56,12 +47,7 @@ - (instancetype)init { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onEnterDebugEvent) name:@"EnterDebugEvent" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onStopDebugEvent) name:@"StopDebugEvent" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDebuggerReadyEvent) name:@"DebuggerReadyEvent" object:nil]; - [Doric registerLibrary:[DoricDevLibrary new]]; - NSValue *value = DoricContextManager.instance.aliveContexts.firstObject; - if (value) { - DoricContext *context = value.nonretainedObjectValue; - [context.driver.registry registerMonitor:[DoricDevMonitor new]]; - } + [DoricNativeDriver.instance.registry registerMonitor:[DoricDevMonitor new]]; } return self; }