From d49f6274f2213b1038685f2151c5583f8f5b288b Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Sat, 29 Feb 2020 10:13:53 +0800 Subject: [PATCH] feat:for reloading add "__dev__" case --- .../src/main/java/pub/doric/devkit/DevKit.java | 12 ++++++------ doric-iOS/Devkit/Classes/DoricWSClient.m | 2 +- 2 files changed, 7 insertions(+), 7 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 3832b7cf..4326bddf 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 @@ -100,12 +100,12 @@ public class DevKit implements IDevKit { @Subscribe(threadMode = ThreadMode.MAIN) public void onReloadEvent(ReloadEvent reloadEvent) { for (DoricContext context : DoricContextManager.aliveContexts()) { - if (reloadEvent.source.contains(context.getSource())) { - if (doricContextDebuggable != null && - doricContextDebuggable.isDebugging && - doricContextDebuggable.getContext().getContextId().equals(context.getContextId())) { - System.out.println("is debugging context id: " + context.getContextId()); - } else { + if (doricContextDebuggable != null && + doricContextDebuggable.isDebugging && + doricContextDebuggable.getContext().getContextId().equals(context.getContextId())) { + System.out.println("is debugging context id: " + context.getContextId()); + } else { + if (reloadEvent.source.contains(context.getSource()) || context.getSource().equals("__dev__")) { context.reload(reloadEvent.script); } } diff --git a/doric-iOS/Devkit/Classes/DoricWSClient.m b/doric-iOS/Devkit/Classes/DoricWSClient.m index 7ceba8f1..8ede50d0 100644 --- a/doric-iOS/Devkit/Classes/DoricWSClient.m +++ b/doric-iOS/Devkit/Classes/DoricWSClient.m @@ -66,7 +66,7 @@ - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message { NSString *script = [dic valueForKey:@"script"]; for (NSValue *value in [[DoricContextManager instance] aliveContexts]) { DoricContext *context = value.nonretainedObjectValue; - if ([source containsString:context.source]) { + if ([source containsString:context.source] || [context.source isEqualToString:@"__dev__"]) { [context reload:script]; } }