Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-548][iOS] Weex devtool can not debug recycle list (#1395)
Browse files Browse the repository at this point in the history
* [WEEX-548][iOS] Weex devtool can not debug recycle list

* * [iOS] update Weex Devtool's version
  • Loading branch information
doumafang authored and cxfeng1 committed Aug 16, 2018
1 parent eddf67e commit 87eeb6d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ios/playground/Podfile
Expand Up @@ -4,7 +4,7 @@ platform :ios, '8.0'

def common
pod 'WeexSDK', :path=>'../../'
pod 'WXDevtool', '0.15.3'
pod 'WXDevtool','0.16.2'
pod 'SDWebImage', '3.7.5'
pod 'SocketRocket', '0.4.2'
pod 'ATSDK-Weex', '0.0.1',:configurations => ['Debug']
Expand Down
3 changes: 1 addition & 2 deletions ios/playground/WeexDemo/Scanner/WXScannerVC.m
Expand Up @@ -23,8 +23,7 @@
#import "UIViewController+WXDemoNaviBar.h"
#import "WXDemoViewController.h"
#import "WXDebugTool.h"

#import <TBWXDevTool/WXDevTool.h>
#import "WXDevTool.h"
#import <AudioToolbox/AudioToolbox.h>

@interface WXScannerVC ()
Expand Down
17 changes: 9 additions & 8 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Expand Up @@ -808,30 +808,31 @@ - (void)executeJsMethod:(WXCallJSMethod *)method
[self performSelector:@selector(_sendQueueLoop) withObject:nil];
}

- (void)callJSMethod:(NSString *)method args:(NSArray *)args onContext:(id<WXBridgeProtocol>)bridge completion:(void (^)(JSValue * value))complection
- (void)callJSMethod:(NSString *)method args:(NSArray *)args onContext:(id<WXBridgeProtocol>)bridge completion:(void (^)(JSValue * value))completion
{
NSMutableArray *newArg = nil;
if (!bridge) {
bridge = self.jsBridge;
}
if (self.frameworkLoadFinished) {
newArg = [args mutableCopy];
if ([newArg containsObject:complection]) {
[newArg removeObject:complection];
if ([newArg containsObject:completion]) {
[newArg removeObject:completion];
}
WXLogDebug(@"Calling JS... method:%@, args:%@", method, args);
if ([bridge isKindOfClass:[WXJSCoreBridge class]]) {
if (([bridge isKindOfClass:[WXJSCoreBridge class]]) ||
([bridge isKindOfClass:NSClassFromString(@"WXDebugger") ]) ) {
JSValue *value = [bridge callJSMethod:method args:args];
if (complection) {
complection(value);
if (completion) {
completion(value);
}
} else {
[bridge callJSMethod:method args:args];
}
} else {
newArg = [args mutableCopy];
if (complection) {
[newArg addObject:complection];
if (completion) {
[newArg addObject:completion];
}
[_methodQueue addObject:@{@"method":method, @"args":[newArg copy]}];
}
Expand Down
Expand Up @@ -105,7 +105,7 @@ - (void)updateBindingData:(NSDictionary *)data
__componentId++;
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
[[WXSDKManager bridgeMgr] callComponentHook:self.weexInstance.instanceId componentId:self.attributes[@"@templateId"] type:@"lifecycle" hook:@"create" args:@[self->_virtualComponentId, newData] competion:^(JSValue *value) {
[newData addEntriesFromDictionary:[value toDictionary][@"0"]];
[newData addEntriesFromDictionary:[value toArray][0]];
[newData setObject:indexPath forKey:@"indexPath"];
[newData setObject:listRef forKey:@"recycleListComponentRef"];
[[recycleListComponent dataManager] updateVirtualComponentData:self->_virtualComponentId data:newData];
Expand Down
4 changes: 1 addition & 3 deletions ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
Expand Up @@ -356,17 +356,15 @@ + (void)connectDevToolServer:(NSString *)URL
+ (void)_originalRegisterComponents:(NSDictionary *)components {
NSMutableDictionary * mutableComponents = [components mutableCopy];
void (^componentBlock)(id, id, BOOL *) = ^(id mKey, id mObj, BOOL * mStop) {

NSString *name = mObj[@"name"];
NSString *componentClass = mObj[@"clazz"];
NSDictionary *pros = nil;
if (mObj[@"pros"]) {
pros = mObj[@""];
pros = mObj[@"pros"];
}
[self registerComponent:name withClass:NSClassFromString(componentClass) withProperties:pros];
};
[mutableComponents enumerateKeysAndObjectsUsingBlock:componentBlock];

}

+ (void)_originalRegisterModules:(NSDictionary *)modules {
Expand Down
4 changes: 2 additions & 2 deletions ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
Expand Up @@ -359,7 +359,7 @@ - (void)fireEvent:(NSString *)instanceId ref:(NSString *)ref type:(NSString *)ty
[self callJsMethod:method];
}

- (void)callComponentHook:(NSString*)instanceId componentId:(NSString*)componentId type:(NSString*)type hook:(NSString*)hookPhase args:(NSArray*)args competion:(void (^)(JSValue * value))complection
- (void)callComponentHook:(NSString*)instanceId componentId:(NSString*)componentId type:(NSString*)type hook:(NSString*)hookPhase args:(NSArray*)args competion:(void (^)(JSValue * value))completion
{
WXPerformBlockOnBridgeThread(^{
if (!type || !instanceId || !hookPhase) {
Expand All @@ -369,7 +369,7 @@ - (void)callComponentHook:(NSString*)instanceId componentId:(NSString*)component
NSArray *newArgs = @[componentId, type, hookPhase, args?:@[]];

WXCallJSMethod * method = [[WXCallJSMethod alloc] initWithModuleName:nil methodName:@"componentHook" arguments:newArgs instance:[WXSDKManager instanceForID:instanceId]];
[self.bridgeCtx callJSMethod:@"callJS" args:@[instanceId, @[method.callJSTask]] onContext:nil completion:complection];
[self.bridgeCtx callJSMethod:@"callJS" args:@[instanceId, @[method.callJSTask]] onContext:nil completion:completion];
});
}

Expand Down

0 comments on commit 87eeb6d

Please sign in to comment.