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

[WEEX-548][iOS] Weex devtool can not debug recycle list #1395

Merged
merged 2 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ios/playground/Podfile
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -797,30 +797,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,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 @@ -365,7 +365,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