iOS: add show tree node action
This commit is contained in:
parent
7fd81ce92c
commit
d4477ac2a3
@ -24,4 +24,6 @@ Doric iOS Devkit for debugging & hotload.
|
|||||||
s.dependency 'DoricCore'
|
s.dependency 'DoricCore'
|
||||||
|
|
||||||
s.dependency 'SocketRocket'
|
s.dependency 'SocketRocket'
|
||||||
|
|
||||||
|
s.dependency 'RATreeView'
|
||||||
end
|
end
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#import "QRScanViewController.h"
|
#import "QRScanViewController.h"
|
||||||
#import "DoricDebugDriver.h"
|
#import "DoricDebugDriver.h"
|
||||||
#import "DoricSnapshotView.h"
|
#import "DoricSnapshotView.h"
|
||||||
|
#import "DoricShowNodeTreeViewController.h"
|
||||||
|
|
||||||
@interface DoricContextCell : UITableViewCell
|
@interface DoricContextCell : UITableViewCell
|
||||||
@property(nonatomic, strong) UILabel *tvId;
|
@property(nonatomic, strong) UILabel *tvId;
|
||||||
@ -106,6 +107,22 @@ - (void)onClick {
|
|||||||
}];
|
}];
|
||||||
[alertController addAction:cancel];
|
[alertController addAction:cancel];
|
||||||
[alertController addAction:viewSource];
|
[alertController addAction:viewSource];
|
||||||
|
|
||||||
|
UIAlertAction *showNodeTree = [UIAlertAction actionWithTitle:@"Show node tree" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||||
|
DoricShowNodeTreeViewController *doricShowNodeTreeViewController = [[DoricShowNodeTreeViewController alloc] init];
|
||||||
|
doricShowNodeTreeViewController.contextId = self.doricContext.contextId;
|
||||||
|
|
||||||
|
UIViewController *viewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
||||||
|
UINavigationController *navigationController;
|
||||||
|
if ([viewController isKindOfClass:[UINavigationController class]]) {
|
||||||
|
navigationController = (UINavigationController *) viewController;
|
||||||
|
} else {
|
||||||
|
navigationController = viewController.navigationController;
|
||||||
|
}
|
||||||
|
[navigationController pushViewController:doricShowNodeTreeViewController animated:NO];
|
||||||
|
}];
|
||||||
|
[alertController addAction:showNodeTree];
|
||||||
|
|
||||||
if (DoricDev.instance.isInDevMode) {
|
if (DoricDev.instance.isInDevMode) {
|
||||||
if ([self.doricContext.driver isKindOfClass:DoricDebugDriver.class]) {
|
if ([self.doricContext.driver isKindOfClass:DoricDebugDriver.class]) {
|
||||||
UIAlertAction *stopDebugging = [UIAlertAction actionWithTitle:@"Stop debugging" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
UIAlertAction *stopDebugging = [UIAlertAction actionWithTitle:@"Stop debugging" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||||
|
31
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewCell.h
Normal file
31
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewCell.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2019] [Doric.Pub]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// DoricShowNodeTreeViewController.h
|
||||||
|
// Doric
|
||||||
|
//
|
||||||
|
// Created by jingpeng.wang on 2021/7/14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface DoricShowNodeTreeViewCell : UITableViewCell
|
||||||
|
|
||||||
|
@property(nonatomic,strong)UILabel *nodeNameLabel;
|
||||||
|
@property(nonatomic,strong)UIImageView *nodeIcon;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
55
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewCell.m
Normal file
55
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewCell.m
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2019] [Doric.Pub]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// DoricShowNodeTreeViewController.m
|
||||||
|
// Doric
|
||||||
|
//
|
||||||
|
// Created by jingpeng.wang on 2021/7/12.
|
||||||
|
//
|
||||||
|
#import "DoricShowNodeTreeViewCell.h"
|
||||||
|
|
||||||
|
#import <DoricCore/Doric.h>
|
||||||
|
|
||||||
|
@implementation DoricShowNodeTreeViewCell
|
||||||
|
|
||||||
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||||
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
|
self.nodeIcon = [[UIImageView new] also:^(UIImageView *it) {
|
||||||
|
it.width = 20;
|
||||||
|
it.height = 20;
|
||||||
|
it.contentMode = UIViewContentModeScaleToFill;
|
||||||
|
[self.contentView addSubview:it];
|
||||||
|
}];
|
||||||
|
|
||||||
|
self.nodeNameLabel = [[UILabel new] also:^(UIImageView *it) {
|
||||||
|
it.contentMode = UIViewContentModeScaleToFill;
|
||||||
|
it.left = 30;
|
||||||
|
[self.contentView addSubview:it];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)layoutSubviews {
|
||||||
|
[super layoutSubviews];
|
||||||
|
|
||||||
|
self.nodeIcon.centerY = self.contentView.height / 2;
|
||||||
|
self.nodeNameLabel.centerY = self.contentView.height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
30
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewController.h
Normal file
30
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewController.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2019] [Doric.Pub]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// DoricShowNodeTreeViewController.h
|
||||||
|
// Doric
|
||||||
|
//
|
||||||
|
// Created by jingpeng.wang on 2021/7/8.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@interface DoricShowNodeTreeViewController : UIViewController
|
||||||
|
|
||||||
|
@property(nonatomic,strong)NSString *contextId;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
118
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewController.m
Normal file
118
doric-iOS/Devkit/Classes/DoricShowNodeTreeViewController.m
Normal file
File diff suppressed because one or more lines are too long
@ -87,6 +87,10 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
|
|||||||
UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"Devkit" style:UIBarButtonItemStylePlain target:self action:@selector(onOpenDevkit)];
|
UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"Devkit" style:UIBarButtonItemStylePlain target:self action:@selector(onOpenDevkit)];
|
||||||
doricViewController.navigationItem.rightBarButtonItem = rightBarItem;
|
doricViewController.navigationItem.rightBarButtonItem = rightBarItem;
|
||||||
[self.navigationController pushViewController:doricViewController animated:NO];
|
[self.navigationController pushViewController:doricViewController animated:NO];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[[DoricDev instance] openDevMode:self];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user