diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a981a1..f0d1bc3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.3.3](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.3) (10/18/2019) + +### Add `Html` function. + +You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `ViewController` in your app at any time. + +#### Add + +* Now `LLURLProtocol` can correctly observe `WKWebView`. + ## [1.3.2](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.2) (09/29/2019) ### Add `Ruler`, `Widget Border` function. diff --git a/LLDebugTool.podspec b/LLDebugTool.podspec index 91d23d2f..8a3b4c00 100644 --- a/LLDebugTool.podspec +++ b/LLDebugTool.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LLDebugTool" - s.version = "1.3.2" + s.version = "1.3.3" s.summary = "LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations." s.homepage = "https://github.com/HDB-Li/LLDebugTool" s.license = "MIT" diff --git a/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m b/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m index 88de7418..0e99dd93 100644 --- a/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m +++ b/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m @@ -112,17 +112,17 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } } -#pragma mark - UISearchController -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - [super searchBar:searchBar textDidChange:searchText]; - if (searchText.length == 0) { +#pragma mark - UITextFieldDelegate +- (void)textFieldDidChange:(NSString *)text { + [super textFieldDidChange:text]; + if (text.length == 0) { [self.searchDataArray removeAllObjects]; [self.searchDataArray addObjectsFromArray:self.oriDataArray]; [self.tableView reloadData]; } else { [self.searchDataArray removeAllObjects]; for (LLCrashModel *model in self.oriDataArray) { - if ([model.name.lowercaseString containsString:searchText.lowercaseString] || [model.reason.lowercaseString containsString:searchText.lowercaseString]) { + if ([model.name.lowercaseString containsString:text.lowercaseString] || [model.reason.lowercaseString containsString:text.lowercaseString]) { [self.searchDataArray addObject:model]; } } diff --git a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemModel.m b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemModel.m index e2db512b..39a64704 100644 --- a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemModel.m +++ b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemModel.m @@ -35,6 +35,7 @@ #import "LLMagnifierComponent.h" #import "LLRulerComponent.h" #import "LLWidgetBorderComponent.h" +#import "LLHtmlComponent.h" #import "LLSettingComponent.h" #import "LLImageNameConfig.h" @@ -78,6 +79,8 @@ - (LLComponent *)componentFromAction:(LLDebugToolAction)action { return [[LLRulerComponent alloc] init]; case LLDebugToolActionWidgetBorder: return [[LLWidgetBorderComponent alloc] init]; + case LLDebugToolActionHtml: + return [[LLHtmlComponent alloc] init]; } } @@ -109,6 +112,8 @@ - (NSString *)titleFromAction:(LLDebugToolAction)action { return @"Ruler"; case LLDebugToolActionWidgetBorder: return @"Widget Border"; + case LLDebugToolActionHtml: + return @"Html5"; } } @@ -138,6 +143,8 @@ - (NSString *)imageNameFromAction:(LLDebugToolAction)action { return kRulerImageName; case LLDebugToolActionWidgetBorder: return kWidgetBorderImageName; + case LLDebugToolActionHtml: + return kHtml5ImageName; } } diff --git a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionViewController.m b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionViewController.m index cdcc7430..bcbc45d7 100644 --- a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionViewController.m +++ b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionViewController.m @@ -106,7 +106,7 @@ - (void)loadData { [items addObject:[[LLFunctionItemModel alloc] initWithAction:LLDebugToolActionMagnifier]]; [items addObject:[[LLFunctionItemModel alloc] initWithAction:LLDebugToolActionRuler]]; [items addObject:[[LLFunctionItemModel alloc] initWithAction:LLDebugToolActionWidgetBorder]]; - + [items addObject:[[LLFunctionItemModel alloc] initWithAction:LLDebugToolActionHtml]]; self.shortCutContainerView.dataArray = [items copy]; self.shortCutContainerView.title = @"Short Cut"; diff --git a/LLDebugTool/Core/Component/Html/LLHtmlComponent.h b/LLDebugTool/Core/Component/Html/LLHtmlComponent.h new file mode 100644 index 00000000..2298768a --- /dev/null +++ b/LLDebugTool/Core/Component/Html/LLHtmlComponent.h @@ -0,0 +1,30 @@ +// +// LLHtmlComponent.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLComponent.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlComponent : LLComponent + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/LLHtmlComponent.m b/LLDebugTool/Core/Component/Html/LLHtmlComponent.m new file mode 100644 index 00000000..75299e93 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/LLHtmlComponent.m @@ -0,0 +1,46 @@ +// +// LLHtmlComponent.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlComponent.h" +#import "LLWindowManager.h" +#import "LLNavigationController.h" + +@implementation LLHtmlComponent + +- (void)componentDidLoad:(NSDictionary *)data { + LLHtmlWindow *window = [LLWindowManager htmlWindow]; + if (data[kLLComponentWindowRootViewControllerKey]) { + Class rootViewControllerClass = NSClassFromString(data[kLLComponentWindowRootViewControllerKey]); + if (rootViewControllerClass != nil) { + UIViewController *viewController = [[rootViewControllerClass alloc] init]; + NSDictionary *properties = data[kLLComponentWindowRootViewControllerPropertiesKey]; + for (NSString *key in properties) { + id value = properties[key]; + [viewController setValue:value forKey:key]; + } + LLNavigationController *nav = [[LLNavigationController alloc] initWithRootViewController:viewController]; + window.rootViewController = nav; + } + } + [[LLWindowManager shared] showWindow:window animated:YES]; +} + +@end diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.h b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.h new file mode 100644 index 00000000..f16e2bb8 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.h @@ -0,0 +1,17 @@ +// +// LLHtmlConfigViewController.h +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/11. +// Copyright © 2019 li. All rights reserved. +// + +#import "LLTitleViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlConfigViewController : LLTitleViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m new file mode 100644 index 00000000..6af81d6f --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m @@ -0,0 +1,183 @@ +// +// LLHtmlConfigViewController.m +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/11. +// Copyright © 2019 li. All rights reserved. +// + +#import "LLHtmlConfigViewController.h" +#import "LLTitleCellCategoryModel.h" +#import "LLSettingManager.h" +#import "LLFactory.h" +#import "LLMacros.h" +#import "LLConst.h" +#import "UIView+LL_Utils.h" +#import "LLThemeManager.h" +#import "LLToastUtils.h" +#import "LLHtmlViewController.h" +#import "LLHtmlUIWebViewController.h" +#import "LLHtmlWkWebViewController.h" +#import "LLConfig.h" +#import + +@interface LLHtmlConfigViewController () + +@property (nonatomic, copy) NSString *webViewClass; + +@property (nonatomic, strong) UIView *headerView; + +@property (nonatomic, strong) UITextField *headerTextField; + +@end + +@implementation LLHtmlConfigViewController + +#pragma mark - Life cycle +- (void)viewDidLoad { + [super viewDidLoad]; + [self setUpUI]; + [self loadData]; +} + +- (void)viewWillDisappear:(BOOL)animated { + if ([self.headerTextField isFirstResponder]) { + [self.headerTextField resignFirstResponder]; + } +} + +#pragma mark - Over write +- (void)rightItemClick:(UIButton *)sender { + NSString *urlString = [self currentUrlString]; + if (!urlString) { + [[LLToastUtils shared] toastMessage:@"Empty URL"]; + return; + } + if (![urlString.lowercaseString hasPrefix:@"https://"] && ![urlString.lowercaseString hasPrefix:@"http://"]) { + [[LLToastUtils shared] toastMessage:@"URL must has prefix with https:// or http://"]; + return; + } + Class cls = NSClassFromString(self.webViewClass); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (cls != [UIWebView class] && cls != [WKWebView class]) { +#pragma clang diagnostic pop + [[LLToastUtils shared] toastMessage:@"Invalid webView class"]; + return; + } + + [LLSettingManager shared].lastWebViewUrl = urlString; + + LLHtmlViewController *vc = nil; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (cls == [UIWebView class]) { +#pragma clang diagnostic pop + vc = [[LLHtmlUIWebViewController alloc] init]; + } else { + vc = [[LLHtmlWkWebViewController alloc] init]; + } + vc.webViewClass = self.webViewClass; + vc.urlString = [self currentUrlString]; + [self.navigationController pushViewController:vc animated:YES]; +} + +#pragma mark - UITextFieldDelegate +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + [textField resignFirstResponder]; + return YES; +} + +#pragma mark - Primary +- (void)setUpUI { + self.title = @"WebView Config"; + [self initNavigationItemWithTitle:@"Go" imageName:nil isLeft:NO]; + + self.webViewClass = [LLSettingManager shared].webViewClass ?: NSStringFromClass([WKWebView class]); + + self.tableView.tableHeaderView = self.headerView; +} + +- (void)loadData { + NSMutableArray *settings = [[NSMutableArray alloc] init]; + + // Short Cut + [settings addObject:[self getWebViewStyleModel]]; + LLTitleCellCategoryModel *category0 = [[LLTitleCellCategoryModel alloc] initWithTitle:nil items:settings]; + [settings removeAllObjects]; + + [self.dataArray removeAllObjects]; + [self.dataArray addObjectsFromArray:@[category0]]; + [self.tableView reloadData]; +} + +- (LLTitleCellModel *)getWebViewStyleModel { + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitleSelector:self.webViewClass]; + __weak typeof(self) weakSelf = self; + model.block = ^{ + [weakSelf showWebViewClassAlert]; + }; + return model; +} + +- (void)showWebViewClassAlert { + __block NSMutableArray *actions = [[NSMutableArray alloc] init]; + [actions addObject:NSStringFromClass([WKWebView class])]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [actions addObject:NSStringFromClass([UIWebView class])]; +#pragma clang diagnostic pop + __weak typeof(self) weakSelf = self; + [self showActionSheetWithTitle:@"Web View Style" actions:actions currentAction:self.webViewClass completion:^(NSInteger index) { + [weakSelf setNewWebViewClass:actions[index]]; + }]; +} + +- (void)setNewWebViewClass:(NSString *)aClass { + self.webViewClass = aClass; + [LLSettingManager shared].webViewClass = aClass; + [self loadData]; +} + +- (NSString *)currentUrlString { + NSString *text = self.headerTextField.text; + text = [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if (!text || text.length == 0) { + return nil; + } + return text; +} + +#pragma mark - Getters and setters +- (UIView *)headerView { + if (!_headerView) { + _headerView = [LLFactory getView]; + _headerView.frame = CGRectMake(0, 0, LL_SCREEN_WIDTH, 60); + [_headerView addSubview:self.headerTextField]; + self.headerTextField.frame = CGRectMake(kLLGeneralMargin, kLLGeneralMargin, _headerView.LL_width - kLLGeneralMargin * 2, _headerView.LL_height - kLLGeneralMargin * 2); + } + return _headerView; +} + +- (UITextField *)headerTextField { + if (!_headerTextField) { + _headerTextField = [LLFactory getTextField]; + _headerTextField.tintColor = [LLThemeManager shared].primaryColor; + _headerTextField.backgroundColor = [LLThemeManager shared].backgroundColor; + [_headerTextField LL_setBorderColor:[LLThemeManager shared].primaryColor borderWidth:1]; + [_headerTextField LL_setCornerRadius:5]; + _headerTextField.font = [UIFont systemFontOfSize:14]; + _headerTextField.textColor = [LLThemeManager shared].primaryColor; + _headerTextField.delegate = self; + _headerTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + _headerTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Pleace input url" attributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].placeHolderColor}]; + _headerTextField.text = [LLSettingManager shared].lastWebViewUrl ?: ([LLConfig shared].defaultHtmlUrl ?: @"https://"); + UIView *leftView = [LLFactory getView]; + leftView.frame = CGRectMake(0, 0, 10, 1); + _headerTextField.leftView = leftView; + _headerTextField.leftViewMode = UITextFieldViewModeAlways; + } + return _headerTextField; +} + +@end diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.h b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.h new file mode 100644 index 00000000..3ceb4969 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.h @@ -0,0 +1,30 @@ +// +// LLHtmlUIWebViewController.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlUIWebViewController : LLHtmlViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.m new file mode 100644 index 00000000..f17d7e72 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlUIWebViewController.m @@ -0,0 +1,103 @@ +// +// LLHtmlUIWebViewController.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlUIWebViewController.h" +#import "LLTool.h" + +@interface LLHtmlUIWebViewController () + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +@property (nonatomic, strong) UIWebView *webView; +#pragma clang diagnostic pop + +@end + +@implementation LLHtmlUIWebViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setUpUI]; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.webView.frame = self.view.bounds; +} + +#pragma mark - UIWebViewDelegate + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (void)webViewDidStartLoad:(UIWebView *)webView { + [LLTool log:[NSString stringWithFormat:@"UIWebView start load %@",self.urlString]]; +} + +- (void)webViewDidFinishLoad:(UIWebView *)webView { + [LLTool log:[NSString stringWithFormat:@"UIWebView finish load %@",self.urlString]]; +} + +- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { + [LLTool log:[NSString stringWithFormat:@"UIWebView failed in %@, with error %@", self.urlString, error.debugDescription]]; +} +#pragma clang diagnostic pop + +#pragma mark - Primary +- (void)setUpUI { + if (![self webViewClassIsValid]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + self.webViewClass = NSStringFromClass([UIWebView class]); +#pragma clang diagnostic pop + } + [self.view addSubview:self.webView]; + + [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; +} + +- (BOOL)webViewClassIsValid { + if (!self.webViewClass || self.webViewClass.length == 0) { + return NO; + } + Class cls = NSClassFromString(self.webViewClass); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (cls != [UIWebView class]) { +#pragma clang diagnostic pop + return NO; + } + return YES; +} + +#pragma mark - Getters and setters +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (UIWebView *)webView { + if (!_webView) { + _webView = (UIWebView *)[[NSClassFromString(self.webViewClass) alloc] init]; + _webView.delegate = self; + } + return _webView; +} +#pragma clang diagnostic pop + +@end diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.h b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.h new file mode 100644 index 00000000..1868b931 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.h @@ -0,0 +1,34 @@ +// +// LLHtmlViewController.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLBaseComponentViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlViewController : LLBaseComponentViewController + +@property (nonatomic, copy) NSString *webViewClass; + +@property (nonatomic, copy) NSString *urlString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.m new file mode 100644 index 00000000..96ddf9f7 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlViewController.m @@ -0,0 +1,42 @@ +// +// LLHtmlViewController.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlViewController.h" +#import "LLTool.h" + +@interface LLHtmlViewController () + +@end + +@implementation LLHtmlViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + if (!self.urlString || self.urlString.length == 0) { + self.urlString = @"https://github.com/HDB-Li/LLDebugTool"; + [LLTool log:@"None url string"]; + } + + NSURL *url = [NSURL URLWithString:self.urlString]; + self.title = url.host ?: self.urlString; +} + +@end diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.h b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.h new file mode 100644 index 00000000..7a3e4846 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.h @@ -0,0 +1,30 @@ +// +// LLHtmlWindow.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLComponentWindow.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlWindow : LLComponentWindow + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.m new file mode 100644 index 00000000..aa3d3a88 --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWindow.m @@ -0,0 +1,53 @@ +// +// LLHtmlWindow.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlWindow.h" +#import "LLComponentNavigationController.h" +#import "LLHtmlConfigViewController.h" +#import "LLWindowManager.h" +#import "LLConfig.h" + +@implementation LLHtmlWindow + +#pragma mark - Life cycle +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + if (!self.rootViewController) { + UINavigationController *nav = nil; + if ([LLConfig shared].htmlViewControllerProvider) { + UIViewController *vc = [LLConfig shared].htmlViewControllerProvider(); + nav = [[LLComponentNavigationController alloc] initWithRootViewController:vc]; + } else { + UIViewController *vc = [[LLHtmlConfigViewController alloc] init]; + nav = [[LLNavigationController alloc] initWithRootViewController:vc]; + } + self.rootViewController = nav; + } + } + return self; +} + +#pragma mark - Over write +- (void)componentDidFinish { + [[LLWindowManager shared] showEntryWindow]; +} + +@end diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.h b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.h new file mode 100644 index 00000000..eb5ebb0a --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.h @@ -0,0 +1,30 @@ +// +// LLHtmlWkWebViewController.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLHtmlWkWebViewController : LLHtmlViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.m new file mode 100644 index 00000000..f01f665c --- /dev/null +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlWkWebViewController.m @@ -0,0 +1,141 @@ +// +// LLHtmlWkWebViewController.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLHtmlWkWebViewController.h" +#import + +@interface LLHtmlWkWebViewController () + +@property (nonatomic, strong) WKWebView *webView; + +@property (nonatomic, strong) WKWebViewConfiguration *webViewConfiguration; + +@property (nonatomic, strong) WKPreferences *preferences; + +@end + +@implementation LLHtmlWkWebViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setUpUI]; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.webView.frame = self.view.bounds; +} + +#pragma mark - WKNavigationDelegate +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { + decisionHandler(WKNavigationActionPolicyAllow); +} + +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { + NSLog(@"%@",NSStringFromSelector(_cmd)); +} + +#pragma mark - WKUIDelegate +- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler { + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:message?:@"" preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:([UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + completionHandler(); + }])]; + [self presentViewController:alertController animated:YES completion:nil]; +} + +- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:message?:@"" preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:([UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + completionHandler(NO); + }])]; + [alertController addAction:([UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + completionHandler(YES); + }])]; + [self presentViewController:alertController animated:YES completion:nil]; +} + +- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable))completionHandler{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:prompt message:nil preferredStyle:UIAlertControllerStyleAlert]; + [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + textField.text = defaultText; + }]; + [alertController addAction:([UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + completionHandler(alertController.textFields[0].text?:@""); + }])]; + [self presentViewController:alertController animated:YES completion:nil]; +} + +- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures { + if (!navigationAction.targetFrame.isMainFrame) { + [webView loadRequest:navigationAction.request]; + } + return nil; +} + +#pragma mark - Primary +- (void)setUpUI { + if (![self webViewClassIsValid]) { + self.webViewClass = NSStringFromClass([WKWebView class]); + } + [self.view addSubview:self.webView]; + + [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlString]]]; +} + +- (BOOL)webViewClassIsValid { + if (!self.webViewClass || self.webViewClass.length == 0) { + return NO; + } + Class cls = NSClassFromString(self.webViewClass); + if (cls != [WKWebView class]) { + return NO; + } + return YES; +} + +#pragma mark - Getters and setters +- (WKWebView *)webView { + if (!_webView) { + _webView = (WKWebView *)[[NSClassFromString(self.webViewClass) alloc] initWithFrame:CGRectZero configuration:self.webViewConfiguration]; + _webView.UIDelegate = self; + _webView.navigationDelegate = self; + } + return _webView; +} + +- (WKWebViewConfiguration *)webViewConfiguration { + if (!_webViewConfiguration) { + _webViewConfiguration = [[WKWebViewConfiguration alloc] init]; + _webViewConfiguration.preferences = self.preferences; + } + return _webViewConfiguration; +} + +- (WKPreferences *)preferences { + if (!_preferences) { + _preferences = [[WKPreferences alloc] init]; + _preferences.javaScriptCanOpenWindowsAutomatically = YES; + } + return _preferences; +} + +@end diff --git a/LLDebugTool/Core/Component/LLComponent.h b/LLDebugTool/Core/Component/LLComponent.h index 1036d54b..11515717 100644 --- a/LLDebugTool/Core/Component/LLComponent.h +++ b/LLDebugTool/Core/Component/LLComponent.h @@ -22,19 +22,10 @@ // SOFTWARE. #import +#import "LLComponentDelegate.h" NS_ASSUME_NONNULL_BEGIN -FOUNDATION_EXTERN NSString *const kLLComponentWindowRootViewControllerKey; - -FOUNDATION_EXTERN NSString *const kLLComponentWindowRootViewControllerPropertiesKey; - -@protocol LLComponentDelegate - -- (void)componentDidLoad:(NSDictionary *_Nullable)data; - -@end - @interface LLComponent : NSObject @end diff --git a/LLDebugTool/Core/Component/LLComponentDelegate.h b/LLDebugTool/Core/Component/LLComponentDelegate.h new file mode 100644 index 00000000..4a230167 --- /dev/null +++ b/LLDebugTool/Core/Component/LLComponentDelegate.h @@ -0,0 +1,38 @@ +// +// LLComponentDelegate.h +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXTERN NSString *const kLLComponentWindowRootViewControllerKey; + +FOUNDATION_EXTERN NSString *const kLLComponentWindowRootViewControllerPropertiesKey; + +@protocol LLComponentDelegate + +- (void)componentDidLoad:(NSDictionary *_Nullable)data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m b/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m index 73ef09e9..1e4f50ec 100644 --- a/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m +++ b/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m @@ -32,6 +32,8 @@ #import "LLSearchBar.h" #import "NSObject+LL_Utils.h" #import "LLToastUtils.h" +#import "UIView+LL_Utils.h" +#import "LLConst.h" static NSString *const kLogCellID = @"LLLogCell"; @@ -74,7 +76,7 @@ - (void)viewDidLoad { // TableView [self.tableView registerClass:[LLLogCell class] forCellReuseIdentifier:kLogCellID]; - self.filterView = [[LLLogFilterView alloc] initWithFrame:CGRectMake(0, self.searchBar.frame.size.height, LL_SCREEN_WIDTH, 40)]; + self.filterView = [[LLLogFilterView alloc] initWithFrame:CGRectMake(0, self.searchTextField.LL_bottom + kLLGeneralMargin, LL_SCREEN_WIDTH, 40)]; __weak typeof(self) weakSelf = self; self.filterView.changeBlock = ^(NSArray *levels, NSArray *events, NSString *file, NSString *func, NSDate *from, NSDate *end, NSArray *userIdentities) { weakSelf.currentLevels = levels; @@ -89,7 +91,7 @@ - (void)viewDidLoad { [self.filterView configWithData:self.oriDataArray]; [self.headerView addSubview:self.filterView]; - self.headerView.frame = CGRectMake(self.headerView.frame.origin.x, self.headerView.frame.origin.y, self.headerView.frame.size.width, self.headerView.frame.size.height + self.filterView.frame.size.height); + self.headerView.frame = CGRectMake(self.headerView.LL_x, self.headerView.LL_y, self.headerView.LL_width, self.filterView.LL_bottom); [self loadData]; } @@ -175,7 +177,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - return self.searchBar.frame.size.height + 40; + return self.headerView.LL_height; } #pragma mark - UIScrollViewDelegate @@ -184,22 +186,21 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [self.filterView cancelFiltering]; } -#pragma mark - UISearchBarDelegate -- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { - [super searchBarTextDidBeginEditing:searchBar]; +#pragma mark - UITextFieldDelegate +- (void)textFieldDidBeginEditing:(UITextField *)textField { + [super textFieldDidBeginEditing:textField]; [self.filterView cancelFiltering]; } -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - [super - searchBar:searchBar textDidChange:searchText]; +- (void)textFieldDidChange:(NSString *)text { + [super textFieldDidChange:text]; [self.filterView cancelFiltering]; [self filterData]; } #pragma mark - Primary - (void)loadData { - self.searchBar.text = nil; + self.searchTextField.text = nil; __weak typeof(self) weakSelf = self; [[LLToastUtils shared] loadingMessage:@"Loading"]; [[LLStorageManager shared] getModels:[LLLogModel class] launchDate:_launchDate complete:^(NSArray *result) { @@ -221,8 +222,8 @@ - (void)filterData { NSMutableArray *tempArray = [[NSMutableArray alloc] init]; for (LLLogModel *model in self.oriDataArray) { // Filter "Search" - if (self.searchBar.text.length) { - if (![model.message.lowercaseString containsString:self.searchBar.text.lowercaseString]) { + if (self.searchTextField.text.length) { + if (![model.message.lowercaseString containsString:self.searchTextField.text.lowercaseString]) { [tempArray addObject:model]; continue; } diff --git a/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.h b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.h new file mode 100644 index 00000000..8d2e167d --- /dev/null +++ b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.h @@ -0,0 +1,33 @@ +// +// LLNetworkHelper+WKWebView.h +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLNetworkHelper.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LLNetworkHelper (WKWebView) + +//@property (nonatomic, strong, readonly) NSMutableDictionary *webViews; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.m b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.m new file mode 100644 index 00000000..78a39c8e --- /dev/null +++ b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper+WKWebView.m @@ -0,0 +1,147 @@ +// +// LLNetworkHelper+WKWebView.m +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLNetworkHelper+WKWebView.h" +#import "NSObject+LL_Runtime.h" +#import "LLNetworkModel.h" +#import "LLFormatterTool.h" +#import "NSData+LL_Utils.h" +#import "NSInputStream+LL_Utils.h" +#import "NSHTTPURLResponse+LL_Utils.h" +#import "LLStorageManager.h" +#import "LLAppInfoHelper.h" +#import "LLTool.h" + +@implementation LLNetworkHelper (WKWebView) + +//+ (void)load { +// Protocol *proto = @protocol(WKNavigationDelegate); //objc_getProtocol("WKNavigationDelegate"); +// unsigned int count; +// struct objc_method_description *methods = protocol_copyMethodDescriptionList(proto, NO, YES, &count); +// for(unsigned int i = 0; i < count; i++) { +// SEL sel = methods[i].name; +// if (!class_respondsToSelector([self class], sel)) { +// [LLTool log:[NSString stringWithFormat:@"LLNetworkHelper didn't implementation selector : %@",NSStringFromSelector(sel)]]; +// } +// } +// if (methods) { +// free(methods); +// } +//} +// +////#pragma mark - WKNavigationDelegate +//- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView decidePolicyForNavigationAction:navigationAction decisionHandler:decisionHandler]; +// } else { +// decisionHandler(WKNavigationActionPolicyAllow); +// } +//} +// +//- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences * _Nonnull))decisionHandler API_AVAILABLE(ios(13.0)){ +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView decidePolicyForNavigationAction:navigationAction preferences:preferences decisionHandler:decisionHandler]; +// } else if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:decisionHandler:)]) { +// [webView.navigationDelegate webView:webView decidePolicyForNavigationAction:navigationAction decisionHandler:^(WKNavigationActionPolicy policy) { +// decisionHandler(policy, preferences); +// }]; +// } else { +// decisionHandler(WKNavigationActionPolicyAllow, preferences); +// } +//} +// +//- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView decidePolicyForNavigationResponse:navigationResponse decisionHandler:decisionHandler]; +// } else { +// decisionHandler(WKNavigationResponsePolicyAllow); +// } +//} +// +//- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { +// self.webViews[[NSString stringWithFormat:@"%p",webView]] = [NSDate date]; +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didStartProvisionalNavigation:navigation]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didReceiveServerRedirectForProvisionalNavigation:navigation]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { +// [self saveNetworkModel:webView error:error]; +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didFailProvisionalNavigation:navigation withError:error]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didCommitNavigation:navigation]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { +// [self saveNetworkModel:webView error:nil]; +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didFinishNavigation:navigation]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error { +// [self saveNetworkModel:webView error:error]; +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didFailNavigation:navigation withError:error]; +// } +//} +// +//- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webView:webView didReceiveAuthenticationChallenge:challenge completionHandler:completionHandler]; +// } else { +// completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); +// } +//} +// +//- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView API_AVAILABLE(ios(9.0)) { +// if (webView.navigationDelegate != self && [webView.navigationDelegate respondsToSelector:_cmd]) { +// [webView.navigationDelegate webViewWebContentProcessDidTerminate:webView]; +// } +//} +// +//#pragma mark - Primary +//- (void)saveNetworkModel:(WKWebView *)webView error:(NSError *)error { +// +//} +// +//#pragma mark - Getters and setters +//- (NSMutableDictionary *)webViews { +// if (!objc_getAssociatedObject(self, _cmd)) { +// objc_setAssociatedObject(self, _cmd, [[NSMutableDictionary alloc] init], OBJC_ASSOCIATION_RETAIN_NONATOMIC); +// } +// return objc_getAssociatedObject(self, _cmd); +//} + + +@end diff --git a/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper.m b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper.m index 9d56133a..aa0624ab 100644 --- a/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper.m +++ b/LLDebugTool/Core/Component/Network/Function/LLNetworkHelper.m @@ -26,6 +26,7 @@ #import "LLReachability.h" #import "LLTool.h" #import "NSObject+LL_Runtime.h" +#import "LLConfig.h" static LLNetworkHelper *_instance = nil; @@ -77,10 +78,32 @@ - (void)registerLLURLProtocol { if (![NSURLProtocol registerClass:[LLURLProtocol class]]) { [LLTool log:@"LLNetworkHelper reigsiter URLProtocol fail."]; } + if ([LLConfig shared].observerWebView) { + Class cls = NSClassFromString(@"WKBrowsingContextController"); + SEL sel = NSSelectorFromString(@"registerSchemeForCustomProtocol:"); + if (cls && [cls respondsToSelector:sel]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [cls performSelector:sel withObject:@"http"]; + [cls performSelector:sel withObject:@"https"]; +#pragma clang diagnostic pop + } + } } - (void)unregisterLLURLProtocol { [NSURLProtocol unregisterClass:[LLURLProtocol class]]; + if ([LLConfig shared].observerWebView) { + Class cls = NSClassFromString(@"WKBrowsingContextController"); + SEL sel = NSSelectorFromString(@"unregisterSchemeForCustomProtocol:"); + if (cls && [cls respondsToSelector:sel]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [cls performSelector:sel withObject:@"http"]; + [cls performSelector:sel withObject:@"https"]; +#pragma clang diagnostic pop + } + } } - (LLNetworkStatus)networkStateFromStatebar { diff --git a/LLDebugTool/Core/Component/Network/Function/LLURLProtocol.m b/LLDebugTool/Core/Component/Network/Function/LLURLProtocol.m index ea23acf7..f32434d9 100644 --- a/LLDebugTool/Core/Component/Network/Function/LLURLProtocol.m +++ b/LLDebugTool/Core/Component/Network/Function/LLURLProtocol.m @@ -30,6 +30,7 @@ #import "NSData+LL_Utils.h" #import "LLTool.h" #import "LLAppInfoHelper.h" +#import "NSInputStream+LL_Utils.h" static NSString *const HTTPHandledIdentifier = @"HttpHandleIdentifier"; @@ -106,8 +107,11 @@ - (void)stopLoading { model.headerFields = [self.request.allHTTPHeaderFields mutableCopy]; NSData *data = [self.request.HTTPBody copy]; - if (data == nil && self.request.HTTPBodyStream) { - data = [self dataFromInputStream:self.request.HTTPBodyStream]; + if (data == nil) { + NSInputStream *stream = self.request.HTTPBodyStream; + if (stream) { + data = [stream LL_toData]; + } } if (data && [data length] > 0) { model.requestBody = [data LL_toJsonString]; @@ -192,18 +196,4 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPer } } -#pragma mark - Primary -- (NSData *)dataFromInputStream:(NSInputStream *)stream { - NSMutableData *data = [[NSMutableData alloc] init]; - if (stream.streamStatus != NSStreamStatusOpen) { - [stream open]; - } - NSInteger readLength; - uint8_t buffer[1024]; - while((readLength = [stream read:buffer maxLength:1024]) > 0) { - [data appendBytes:buffer length:readLength]; - } - return data; -} - @end diff --git a/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m b/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m index 117ed6be..e820699d 100644 --- a/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m +++ b/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m @@ -34,6 +34,8 @@ #import "LLMacros.h" #import "NSObject+LL_Utils.h" #import "LLToastUtils.h" +#import "UIView+LL_Utils.h" +#import "LLConst.h" static NSString *const kNetworkCellID = @"NetworkCellID"; @@ -72,7 +74,7 @@ - (void)viewDidLoad { [self.tableView registerClass:[LLNetworkCell class] forCellReuseIdentifier:kNetworkCellID]; - self.filterView = [[LLNetworkFilterView alloc] initWithFrame:CGRectMake(0, self.searchBar.frame.size.height, LL_SCREEN_WIDTH, 40)]; + self.filterView = [[LLNetworkFilterView alloc] initWithFrame:CGRectMake(0, self.searchTextField.LL_bottom + kLLGeneralMargin, LL_SCREEN_WIDTH, 40)]; __weak typeof(self) weakSelf = self; self.filterView.changeBlock = ^(NSArray *hosts, NSArray *types, NSDate *from, NSDate *end) { weakSelf.currentHost = hosts; @@ -83,7 +85,7 @@ - (void)viewDidLoad { }; [self.filterView configWithData:self.oriDataArray]; [self.headerView addSubview:self.filterView]; - self.headerView.frame = CGRectMake(self.headerView.frame.origin.x, self.headerView.frame.origin.y, self.headerView.frame.size.width, self.headerView.frame.size.height + self.filterView.frame.size.height); + self.headerView.frame = CGRectMake(self.headerView.LL_x, self.headerView.LL_y, self.headerView.LL_width, self.filterView.LL_bottom); [self loadData]; } @@ -144,7 +146,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - return [super tableView:tableView heightForHeaderInSection:section] + 40; + return self.headerView.LL_height; } #pragma mark - UIScrollViewDelegate @@ -153,22 +155,21 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [self.filterView cancelFiltering]; } -#pragma mark - UISearchBarDelegate -- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { - [super searchBarTextDidBeginEditing:searchBar]; +#pragma mark - UITextFieldDelegate +- (void)textFieldDidBeginEditing:(UITextField *)textField { + [super textFieldDidBeginEditing:textField]; [self.filterView cancelFiltering]; } -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - [super - searchBar:searchBar textDidChange:searchText]; +- (void)textFieldDidChange:(NSString *)text { + [super textFieldDidChange:text]; [self.filterView cancelFiltering]; [self filterData]; } #pragma mark - Primary - (void)loadData { - self.searchBar.text = nil; + self.searchTextField.text = nil; __weak typeof(self) weakSelf = self; [[LLToastUtils shared] loadingMessage:@"Loading"]; [[LLStorageManager shared] getModels:[LLNetworkModel class] launchDate:_launchDate complete:^(NSArray *result) { @@ -200,7 +201,7 @@ - (void)filterData { } // Filter "Search" - if (self.searchBar.text.length) { + if (self.searchTextField.text.length) { NSMutableArray *filterArray = [[NSMutableArray alloc] initWithObjects:model.url.absoluteString ?:model.url.host, nil]; BOOL checkHeader = [self.currentTypes containsObject:@"Header"]; BOOL checkBody = [self.currentTypes containsObject:@"Body"]; @@ -220,7 +221,7 @@ - (void)filterData { } for (NSString *filter in filterArray) { - if ([filter.lowercaseString containsString:self.searchBar.text.lowercaseString]) { + if ([filter.lowercaseString containsString:self.searchTextField.text.lowercaseString]) { needPop = NO; break; } diff --git a/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m b/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m index 12dc0ace..1c5d8441 100644 --- a/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m +++ b/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m @@ -103,7 +103,7 @@ - (void)deleteFilesWithIndexPaths:(NSArray *)indexPaths { } } [self.oriDataArray removeObjectsInArray:finishedModels]; - [self searchBar:self.searchBar textDidChange:self.searchBar.text]; + [self textFieldDidChange:self.searchTextField.text]; } - (NSMutableArray *)oriDataArray { @@ -169,17 +169,17 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } } -#pragma mark - UISearchBar -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - [super searchBar:searchBar textDidChange:searchText]; - if (searchText.length == 0) { +#pragma mark - UITextFieldDelegate +- (void)textFieldDidChange:(NSString *)text { + [super textFieldDidChange:text]; + if (text.length == 0) { [self.searchDataArray removeAllObjects]; [self.searchDataArray addObjectsFromArray:self.oriDataArray]; [self.tableView reloadData]; } else { [self.searchDataArray removeAllObjects]; for (LLSandboxModel *model in self.oriDataArray) { - [self.searchDataArray addObjectsFromArray:[self modelsByFilter:searchText.lowercaseString model:model]]; + [self.searchDataArray addObjectsFromArray:[self modelsByFilter:text.lowercaseString model:model]]; } [self.tableView reloadData]; } diff --git a/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.h b/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.h new file mode 100644 index 00000000..918e27a6 --- /dev/null +++ b/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.h @@ -0,0 +1,34 @@ +// +// NSInputStream+LL_Utils.h +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSInputStream (LL_Utils) + +- (NSData *)LL_toData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.m b/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.m new file mode 100644 index 00000000..fcf212ea --- /dev/null +++ b/LLDebugTool/Core/Others/Category/NSInputStream/NSInputStream+LL_Utils.m @@ -0,0 +1,41 @@ +// +// NSInputStream+LL_Utils.m +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "NSInputStream+LL_Utils.h" + +@implementation NSInputStream (LL_Utils) + +- (NSData *)LL_toData { + NSMutableData *data = [[NSMutableData alloc] init]; + if (self.streamStatus != NSStreamStatusOpen) { + [self open]; + } + NSInteger readLength; + uint8_t buffer[1024]; + while((readLength = [self read:buffer maxLength:1024]) > 0) { + [data appendBytes:buffer length:readLength]; + } + return [data copy]; +} + +@end diff --git a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h index 69c0ebcb..81353fef 100644 --- a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h +++ b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h @@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN - (UIViewController *_Nullable)LL_currentShowingViewController; +- (UIButton *)LL_navigationButtonWithTitle:(NSString *_Nullable)title imageName:(NSString *_Nullable)imageName target:(id _Nullable)target action:(SEL _Nullable)action; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m index 9b7be6e2..e94701df 100644 --- a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m +++ b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m @@ -22,6 +22,9 @@ // SOFTWARE. #import "UIViewController+LL_Utils.h" +#import "LLFactory.h" +#import "LLThemeManager.h" +#import "UIImage+LL_Utils.h" @implementation UIViewController (LL_Utils) @@ -40,4 +43,19 @@ - (UIViewController *)LL_currentShowingViewController { return vc; } +- (UIButton *)LL_navigationButtonWithTitle:(NSString *_Nullable)title imageName:(NSString *_Nullable)imageName target:(id _Nullable)target action:(SEL _Nullable)action { + UIButton *btn = [LLFactory getButton:nil frame:CGRectMake(0, 0, 30, 40) target:target action:action]; + btn.showsTouchWhenHighlighted = NO; + btn.tintColor = [LLThemeManager shared].primaryColor; + if ([title length]) { + [btn setTitle:title forState:UIControlStateNormal]; + [btn setTitleColor:[LLThemeManager shared].primaryColor forState:UIControlStateNormal]; + } + if (imageName) { + UIImageRenderingMode mode = UIImageRenderingModeAlwaysTemplate; + [btn setImage:[[UIImage LL_imageNamed:imageName] imageWithRenderingMode:mode] forState:UIControlStateNormal]; + } + return btn; +} + @end diff --git a/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.h b/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.h new file mode 100644 index 00000000..32d74311 --- /dev/null +++ b/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.h @@ -0,0 +1,35 @@ +// +// WKWebView+LL_Utils.h +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface WKWebView (LL_Utils) + +//// Record really target. +//@property (nullable, nonatomic, weak) id LL_realNavigationDelegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.m b/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.m new file mode 100644 index 00000000..f453cf06 --- /dev/null +++ b/LLDebugTool/Core/Others/Category/WKWebView/WKWebView+LL_Utils.m @@ -0,0 +1,54 @@ +// +// WKWebView+LL_Utils.m +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "WKWebView+LL_Utils.h" +#import "NSObject+LL_Runtime.h" +#import "LLNetworkHelper+WKWebView.h" + +@implementation WKWebView (LL_Utils) + +//+ (void)load { +// [self LL_swizzleInstanceMethodWithOriginSel:@selector(setNavigationDelegate:) swizzledSel:@selector(LL_setNavigationDelegate:)]; +// [self LL_swizzleInstanceMethodWithOriginSel:@selector(navigationDelegate) swizzledSel:@selector(LL_navigationDelegate)]; +//} +// +//- (void)LL_setNavigationDelegate:(id)navigationDelegate { +// [self setLL_realNavigationDelegate:navigationDelegate]; +// [self LL_setNavigationDelegate:[LLNetworkHelper shared]]; +//} +// +//- (id)LL_navigationDelegate { +// return [self LL_realNavigationDelegate]; +//} +// +//#pragma mark - Getters and setters +//- (void)setLL_realNavigationDelegate:(id)LL_realNavigationDelegate { +// objc_setAssociatedObject(self, @selector(LL_realNavigationDelegate), LL_realNavigationDelegate, OBJC_ASSOCIATION_ASSIGN); +//} +// +//- (id)LL_realNavigationDelegate { +// return objc_getAssociatedObject(self, _cmd); +//} + + +@end diff --git a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m index fac4addd..3824b96a 100644 --- a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m +++ b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m @@ -27,6 +27,7 @@ #import "LLConfig.h" #import "LLFactory.h" #import "LLThemeManager.h" +#import "UIViewController+LL_Utils.h" @interface LLBaseViewController () @@ -99,12 +100,12 @@ - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { - (void)initNavigationItemWithTitle:(NSString *_Nullable)title imageName:(NSString *_Nullable)imageName isLeft:(BOOL)flag { if (flag) { - UIButton *btn = [self navigationButtonWithTitle:title imageName:imageName target:self action:@selector(leftItemClick:)]; + UIButton *btn = [self LL_navigationButtonWithTitle:title imageName:imageName target:self action:@selector(leftItemClick:)]; btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; self.leftNavigationButton = btn; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; } else { - UIButton *btn = [self navigationButtonWithTitle:title imageName:imageName target:self action:@selector(rightItemClick:)]; + UIButton *btn = [self LL_navigationButtonWithTitle:title imageName:imageName target:self action:@selector(rightItemClick:)]; btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; self.rightNavigationButton = btn; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; @@ -121,7 +122,6 @@ - (void)primaryColorChanged { - (void)backgroundColorChanged { self.view.backgroundColor = [LLThemeManager shared].backgroundColor; - self.navigationController.navigationBar.barTintColor = [LLThemeManager shared].backgroundColor; } #pragma mark - Over Write @@ -141,7 +141,6 @@ - (void)resetDefaultSettings { #pragma clang diagnostic ignored "-Wdeprecated-declarations" self.automaticallyAdjustsScrollViewInsets = YES; #pragma clang diagnostic pop - self.navigationController.navigationBar.translucent = YES; } - (void)setNavigationSettings { @@ -151,15 +150,11 @@ - (void)setNavigationSettings { [self initCloseLeftNavigationItem]; NSInteger index = [self.navigationController.viewControllers indexOfObject:self]; if (index > 0) { - UIButton *btn = [self navigationButtonWithTitle:nil imageName:kBackImageName target:self action:@selector(backAction:)]; + UIButton *btn = [self LL_navigationButtonWithTitle:nil imageName:kBackImageName target:self action:@selector(backAction:)]; btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; self.navigationItem.leftBarButtonItems = @[backButtonItem, self.navigationItem.leftBarButtonItem]; } - [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].primaryColor}]; - self.navigationController.navigationBar.translucent = YES; - self.navigationController.navigationBar.tintColor = [LLThemeManager shared].primaryColor; - self.navigationController.navigationBar.barTintColor = [LLThemeManager shared].backgroundColor; } } @@ -172,20 +167,6 @@ - (void)initCloseLeftNavigationItem { [self initNavigationItemWithTitle:nil imageName:kCloseImageName isLeft:YES]; } -- (UIButton *)navigationButtonWithTitle:(NSString *_Nullable)title imageName:(NSString *_Nullable)imageName target:(id _Nullable)target action:(SEL _Nullable)action { - UIButton *btn = [LLFactory getButton:nil frame:CGRectMake(0, 0, 30, 40) target:target action:action]; - btn.showsTouchWhenHighlighted = NO; - btn.tintColor = [LLThemeManager shared].primaryColor; - if ([title length]) { - [btn setTitle:title forState:UIControlStateNormal]; - } - if (imageName) { - UIImageRenderingMode mode = UIImageRenderingModeAlwaysTemplate; - [btn setImage:[[UIImage LL_imageNamed:imageName] imageWithRenderingMode:mode] forState:UIControlStateNormal]; - } - return btn; -} - - (void)layoutViewsAndSubviews:(UIView *)view { [view setNeedsLayout]; for (UIView *subview in view.subviews) { diff --git a/LLDebugTool/Core/Others/CommonUI/View/FilterView/LLFilterOtherView.m b/LLDebugTool/Core/Others/CommonUI/View/FilterView/LLFilterOtherView.m index 1ca8715f..26f2c164 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/FilterView/LLFilterOtherView.m +++ b/LLDebugTool/Core/Others/CommonUI/View/FilterView/LLFilterOtherView.m @@ -54,6 +54,8 @@ @interface LLFilterOtherView () *items; -- (instancetype)initWithTitle:(NSString *)title items:(NSArray *)items; +- (instancetype)initWithTitle:(NSString *_Nullable)title items:(NSArray *)items; @end diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.h b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.h new file mode 100644 index 00000000..73e901e0 --- /dev/null +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.h @@ -0,0 +1,32 @@ +// +// LLComponentNavigationController.h +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLNavigationController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface LLComponentNavigationController : LLNavigationController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.m new file mode 100644 index 00000000..411f4266 --- /dev/null +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentNavigationController/LLComponentNavigationController.m @@ -0,0 +1,60 @@ +// +// LLComponentNavigationController.m +// +// Copyright (c) 2018 LLDebugTool Software Foundation (https://github.com/HDB-Li/LLDebugTool) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#import "LLComponentNavigationController.h" +#import "LLBaseViewController.h" +#import "UIViewController+LL_Utils.h" +#import "LLImageNameConfig.h" +#import "LLComponentWindow.h" +#import "LLThemeManager.h" + +@interface LLComponentNavigationController () + +@end + +@implementation LLComponentNavigationController + +- (instancetype)initWithRootViewController:(UIViewController *)rootViewController { + if (self = [super initWithRootViewController:rootViewController]) { + if (![rootViewController isKindOfClass:[LLBaseViewController class]]) { + UIButton *btn = [self LL_navigationButtonWithTitle:nil imageName:kCloseImageName target:self action:@selector(leftItemClick:)]; + btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + rootViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; + } + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [LLThemeManager shared].backgroundColor; +} + +- (void)leftItemClick:(UIButton *)sender { + if ([self.view.window isKindOfClass:[LLComponentWindow class]]) { + LLComponentWindow *window = (LLComponentWindow *)self.view.window; + [window componentDidFinish]; + } +} + +@end diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/LLComponentViewController/LLBaseComponentViewController.h b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentViewController/LLBaseComponentViewController.h similarity index 100% rename from LLDebugTool/Core/Others/CommonUI/ViewController/LLComponentViewController/LLBaseComponentViewController.h rename to LLDebugTool/Core/Others/CommonUI/ViewController/ComponentViewController/LLBaseComponentViewController.h diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/LLComponentViewController/LLBaseComponentViewController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/ComponentViewController/LLBaseComponentViewController.m similarity index 100% rename from LLDebugTool/Core/Others/CommonUI/ViewController/LLComponentViewController/LLBaseComponentViewController.m rename to LLDebugTool/Core/Others/CommonUI/ViewController/ComponentViewController/LLBaseComponentViewController.m diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.h b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.h index 5931b67e..5635439f 100644 --- a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.h +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface LLEditTableViewController : LLBaseTableViewController +@interface LLEditTableViewController : LLBaseTableViewController /** * Whether use searchBar. Default is NO. @@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN /** * The searchBar in view controller. */ -@property (nonatomic, strong, nullable, readonly) UISearchBar *searchBar; +@property (nonatomic, strong, nullable, readonly) UITextField *searchTextField; /** * Select all item in toolbar. @@ -112,6 +112,10 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)isSearching; +/** + Called when text field's text did changed. + */ +- (void)textFieldDidChange:(NSString *)text; @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m index a7a62dbe..5e040677 100644 --- a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m @@ -28,7 +28,8 @@ #import "LLFactory.h" #import "LLThemeManager.h" #import "LLTableViewSelectableModel.h" -#import +#import "LLConst.h" +#import "UIView+LL_Utils.h" @interface LLEditTableViewController () @@ -58,8 +59,8 @@ - (void)viewDidLoad { - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; if (self.isSearchEnable) { - if (self.searchBar.isFirstResponder) { - [self.searchBar resignFirstResponder]; + if (self.searchTextField.isFirstResponder) { + [self.searchTextField resignFirstResponder]; } } if (self.isSelectEnable) { @@ -95,23 +96,33 @@ - (void)deleteFilesWithIndexPaths:(NSArray *)indexPaths { } - (BOOL)isSearching { - return self.searchBar.text.length; + return self.searchTextField.text.length; } #pragma mark - Primary - (void)initSearchEnableFunction { - _searchBar = [[UISearchBar alloc] init]; - self.searchBar.barTintColor = [LLThemeManager shared].backgroundColor; - self.searchBar.tintColor = [LLThemeManager shared].primaryColor; - self.searchBar.delegate = self; - self.searchBar.enablesReturnKeyAutomatically = NO; - [self.searchBar sizeToFit]; + _searchTextField = [LLFactory getTextField]; + self.searchTextField.textColor = [LLThemeManager shared].primaryColor; + self.searchTextField.tintColor = [LLThemeManager shared].primaryColor; + self.searchTextField.delegate = self; + [self.searchTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; + self.searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + self.searchTextField.returnKeyType = UIReturnKeySearch; + self.searchTextField.backgroundColor = [LLThemeManager shared].containerColor; + self.searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Input filter text." attributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].placeHolderColor, NSFontAttributeName : [UIFont systemFontOfSize:14]}]; + self.searchTextField.frame = CGRectMake(kLLGeneralMargin, kLLGeneralMargin, LL_SCREEN_WIDTH - kLLGeneralMargin * 2, 35); + self.searchTextField.leftView = ({ + UIView *view = [LLFactory getView]; + view.frame = CGRectMake(0, 0, kLLGeneralMargin, kLLGeneralMargin); + view; + }); + self.searchTextField.leftViewMode = UITextFieldViewModeAlways; _headerView = [LLFactory getView]; _headerView.backgroundColor = [LLThemeManager shared].backgroundColor; - _headerView.frame = CGRectMake(0, LL_NAVIGATION_HEIGHT, LL_SCREEN_WIDTH, self.searchBar.frame.size.height); + _headerView.frame = CGRectMake(0, LL_NAVIGATION_HEIGHT, LL_SCREEN_WIDTH, self.searchTextField.LL_bottom + kLLGeneralMargin); [self.view addSubview:_headerView]; - [self.headerView addSubview:self.searchBar]; + [self.headerView addSubview:self.searchTextField]; } - (void)initSelectEnableFunction { @@ -151,8 +162,8 @@ - (void)initSelectEnableFunction { - (void)leftItemClick:(UIButton *)sender { if (self.isSearchEnable) { - if (self.searchBar.isFirstResponder) { - [self.searchBar resignFirstResponder]; + if (self.searchTextField.isFirstResponder) { + [self.searchTextField resignFirstResponder]; } } [super leftItemClick:sender]; @@ -297,20 +308,20 @@ - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleFo - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (self.isSearchEnable) { - return self.searchBar.frame.size.height; + return self.searchTextField.LL_bottom + kLLGeneralMargin; } return [super tableView:tableView heightForHeaderInSection:section]; } #pragma mark - UIScrollView - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { - if (self.isSearchEnable && self.searchBar.isFirstResponder) { - [self.searchBar resignFirstResponder]; + if (self.isSearchEnable && self.searchTextField.isFirstResponder) { + [self.searchTextField resignFirstResponder]; } } -#pragma mark - UISearchBar -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { +#pragma mark - UITextFieldDelegate +- (void)textFieldDidChange:(NSString *)text { if ([self.selectAllItem.title isEqualToString:self.cancelAllString]) { self.selectAllItem.title = self.selectAllString; } @@ -320,12 +331,13 @@ - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText } } -- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { - [searchBar resignFirstResponder]; - [self searchBar:searchBar textDidChange:searchBar.text]; +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + [self textFieldDidChange:textField.text]; + [textField resignFirstResponder]; + return YES; } -- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { +- (void)textFieldDidBeginEditing:(UITextField *)textField { } diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/NavigationController/LLNavigationController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/NavigationController/LLNavigationController.m index 1710da23..fb4eec87 100644 --- a/LLDebugTool/Core/Others/CommonUI/ViewController/NavigationController/LLNavigationController.m +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/NavigationController/LLNavigationController.m @@ -31,6 +31,20 @@ @interface LLNavigationController () @implementation LLNavigationController +#pragma mark - Life cycle +- (void)viewDidLoad { + [super viewDidLoad]; + self.navigationBar.translucent = YES; + self.navigationBar.translucent = YES; + [self primaryColorChanged]; + [self backgroundColorChanged]; + [self addObservers]; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + #pragma mark - Over write - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.viewControllers.count > 0) { @@ -65,4 +79,29 @@ - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; } +#pragma mark - kThemeManagerUpdatePrimaryColorNotificaionName +- (void)didReceiveThemeManagerUpdatePrimaryColorNotificaion:(NSNotification *)notification { + [self primaryColorChanged]; +} + +#pragma mark - kThemeManagerUpdateBackgroundColorNotificaionName +- (void)didReceiveThemeManagerUpdateBackgroundColorNotificaion:(NSNotification *)notification { + [self backgroundColorChanged]; +} + +#pragma mark - Primary +- (void)addObservers { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveThemeManagerUpdatePrimaryColorNotificaion:) name:kThemeManagerUpdatePrimaryColorNotificaionName object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveThemeManagerUpdateBackgroundColorNotificaion:) name:kThemeManagerUpdateBackgroundColorNotificaionName object:nil]; +} + +- (void)primaryColorChanged { + [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].primaryColor}]; + self.navigationBar.tintColor = [LLThemeManager shared].primaryColor; +} + +- (void)backgroundColorChanged { + self.navigationBar.barTintColor = [LLThemeManager shared].backgroundColor; +} + @end diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/TitleViewController/LLTitleViewController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/TitleViewController/LLTitleViewController.m index c861508b..b5a116b9 100644 --- a/LLDebugTool/Core/Others/CommonUI/ViewController/TitleViewController/LLTitleViewController.m +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/TitleViewController/LLTitleViewController.m @@ -64,13 +64,20 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - LLTitleView *view = [[LLTitleView alloc] initWithFrame:CGRectMake(0, 0, LL_SCREEN_WIDTH, 40)]; LLTitleCellCategoryModel *model = self.dataArray[section]; + if (!model.title) { + return nil; + } + LLTitleView *view = [[LLTitleView alloc] initWithFrame:CGRectMake(0, 0, LL_SCREEN_WIDTH, 40)]; view.titleLabel.text = model.title; return view; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + LLTitleCellCategoryModel *model = self.dataArray[section]; + if (!model.title) { + return [super tableView:tableView heightForHeaderInSection:section]; + } return 40; } diff --git a/LLDebugTool/Core/Others/Factory/LLFactory.h b/LLDebugTool/Core/Others/Factory/LLFactory.h index 88704281..240ee001 100644 --- a/LLDebugTool/Core/Others/Factory/LLFactory.h +++ b/LLDebugTool/Core/Others/Factory/LLFactory.h @@ -85,6 +85,14 @@ NS_ASSUME_NONNULL_BEGIN font:(CGFloat)fontSize textColor:(UIColor *_Nullable)textColor; +#pragma mark - UITextField +/** + Get textField + + @return UITextField + */ ++ (UITextField *)getTextField; + #pragma mark - UITextView /** Get textView. @@ -363,6 +371,13 @@ Get Slider. */ + (UIScrollView *)getScrollView; +#pragma mark - UISearchBar + +/** + Get search bar. + */ ++ (UISearchBar *)getSearchBar; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/Factory/LLFactory.m b/LLDebugTool/Core/Others/Factory/LLFactory.m index d2afc1f1..a0a85bbc 100644 --- a/LLDebugTool/Core/Others/Factory/LLFactory.m +++ b/LLDebugTool/Core/Others/Factory/LLFactory.m @@ -71,6 +71,12 @@ + (UILabel *)getLabel:(UIView *_Nullable)toView return label; } +#pragma mark - UITextField ++ (UITextField *)getTextField { + UITextField *textField = [[UITextField alloc] initWithFrame:CGRectZero]; + return textField; +} + #pragma mark - UITextView + (UITextView *)getTextView { return [self getTextView:nil]; @@ -258,4 +264,10 @@ + (UIScrollView *)getScrollView { return scrollView; } +#pragma mark - UISearchBar ++ (UISearchBar *)getSearchBar { + UISearchBar *bar = [[UISearchBar alloc] init]; + return bar; +} + @end diff --git a/LLDebugTool/Core/Others/FormatterTool/LLFormatterTool.m b/LLDebugTool/Core/Others/FormatterTool/LLFormatterTool.m index 8195e44d..ba348c5e 100644 --- a/LLDebugTool/Core/Others/FormatterTool/LLFormatterTool.m +++ b/LLDebugTool/Core/Others/FormatterTool/LLFormatterTool.m @@ -59,6 +59,9 @@ + (instancetype)shared { } - (NSString *)stringFromDate:(NSDate *)date style:(FormatterToolDateStyle)style { + if (!date) { + return nil; + } NSDateFormatter *formatter = self.formatters[@(style)]; if (formatter) { return [formatter stringFromDate:date]; diff --git a/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.h b/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.h index 32b7110d..58e1b9ff 100644 --- a/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.h +++ b/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.h @@ -49,6 +49,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSNumber *hierarchyIgnorePrivateClass; +@property (nonatomic, copy) NSString *webViewClass; + +@property (nonatomic, copy) NSString *lastWebViewUrl; + + (instancetype)shared; @end diff --git a/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.m b/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.m index 6137014c..77729909 100644 --- a/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.m +++ b/LLDebugTool/Core/Others/Manager/SettingManager/LLSettingManager.m @@ -39,6 +39,8 @@ static NSString *magnifierSizeKey = @"magnifierSizeKey"; static NSString *showWidgetBorderKey = @"showWidgetBorderKey"; static NSString *hierarchyIgnorePrivateClassKey = @"hierarchyIgnorePrivateClassKey"; +static NSString *webViewClassKey = @"webViewClassKey"; +static NSString *lastWebViewUrlKey = @"lastWebViewUrlKey"; @implementation LLSettingManager @@ -139,4 +141,20 @@ - (NSNumber *)hierarchyIgnorePrivateClass { return [NSUserDefaults LL_numberForKey:hierarchyIgnorePrivateClassKey]; } +- (void)setWebViewClass:(NSString *)webViewClass { + [NSUserDefaults LL_setString:webViewClass forKey:webViewClassKey]; +} + +- (NSString *)webViewClass { + return [NSUserDefaults LL_stringForKey:webViewClassKey]; +} + +- (void)setLastWebViewUrl:(NSString *)lastWebViewUrl { + [NSUserDefaults LL_setString:lastWebViewUrl forKey:lastWebViewUrlKey]; +} + +- (NSString *)lastWebViewUrl { + return [NSUserDefaults LL_stringForKey:lastWebViewUrlKey]; +} + @end diff --git a/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.h b/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.h index 444e879f..4cc42844 100644 --- a/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.h +++ b/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.h @@ -46,6 +46,11 @@ FOUNDATION_EXTERN NSString *const kThemeManagerUpdateBackgroundColorNotificaionN */ @property (nonatomic, copy, readonly) UIColor *containerColor; +/** + PlaceHolder color, use on textField/textView, should different with backgroundColor. + */ +@property (nonatomic, copy, readonly) UIColor *placeHolderColor; + /** Window's statusBarStyle when show. */ diff --git a/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.m b/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.m index 5e85f7a7..fa97b916 100644 --- a/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.m +++ b/LLDebugTool/Core/Others/Manager/ThemeManager/LLThemeManager.m @@ -83,6 +83,7 @@ - (void)calculateColorIfNeeded { } _containerColor = [_backgroundColor LL_mixtureWithColor:_primaryColor radio:0.1]; + _placeHolderColor = [_primaryColor LL_mixtureWithColor:_backgroundColor radio:0.5]; } @end diff --git a/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.h b/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.h index f6c4b706..b27a779a 100644 --- a/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.h +++ b/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.h @@ -36,6 +36,7 @@ #import "LLRulerWindow.h" #import "LLWidgetBorderWindow.h" #import "LLSettingWindow.h" +#import "LLHtmlWindow.h" NS_ASSUME_NONNULL_BEGIN @@ -133,6 +134,13 @@ Widget border window. */ + (LLWidgetBorderWindow *)widgetBorderWindow; +/** + Html window. + + @return LLHtmlWindow. + */ ++ (LLHtmlWindow *)htmlWindow; + /** Setting window. diff --git a/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.m b/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.m index 7a58040e..6cdee4b8 100644 --- a/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.m +++ b/LLDebugTool/Core/Others/Manager/WindowManager/LLWindowManager.m @@ -103,6 +103,10 @@ + (LLWidgetBorderWindow *)widgetBorderWindow { return (LLWidgetBorderWindow *)[self createWindowWithClassName:NSStringFromClass([LLWidgetBorderWindow class])]; } ++ (LLHtmlWindow *)htmlWindow { + return (LLHtmlWindow *)[self createWindowWithClassName:NSStringFromClass([LLHtmlWindow class])]; +} + + (LLSettingWindow *)settingWindow { return (LLSettingWindow *)[self createWindowWithClassName:NSStringFromClass([LLSettingWindow class])]; } diff --git a/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@2x.png b/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@2x.png new file mode 100644 index 00000000..9e827e0d Binary files /dev/null and b/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@2x.png differ diff --git a/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@3x.png b/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@3x.png new file mode 100644 index 00000000..e8d7f3f2 Binary files /dev/null and b/LLDebugTool/Core/Others/Resource/LLDebugTool.bundle/LL-html5@3x.png differ diff --git a/LLDebugTool/Core/Others/Resource/LLImageNameConfig.h b/LLDebugTool/Core/Others/Resource/LLImageNameConfig.h index 6ca043e8..37c3812c 100644 --- a/LLDebugTool/Core/Others/Resource/LLImageNameConfig.h +++ b/LLDebugTool/Core/Others/Resource/LLImageNameConfig.h @@ -11,7 +11,7 @@ #import "UIImage+LL_Utils.h" -// TabBar Icon +// TabBar Icon 0xBDBDBD static NSString *const kCrashImageName = @"LL-crash"; static NSString *const kNetworkImageName = @"LL-network"; static NSString *const kLogImageName = @"LL-log"; @@ -22,6 +22,7 @@ static NSString *const kHierarchyImageName = @"LL-hierarchy"; static NSString *const kMagnifierImageName = @"LL-magnifier"; static NSString *const kRulerImageName = @"LL-ruler"; static NSString *const kWidgetBorderImageName = @"LL-widget-border"; +static NSString *const kHtml5ImageName = @"LL-html5"; // Navigation Item Icon static NSString *const kClearImageName = @"LL-clear"; diff --git a/LLDebugTool/DebugTool/LLConfig.h b/LLDebugTool/DebugTool/LLConfig.h index 6c593bc2..b001beb5 100644 --- a/LLDebugTool/DebugTool/LLConfig.h +++ b/LLDebugTool/DebugTool/LLConfig.h @@ -161,7 +161,8 @@ typedef NS_ENUM(NSUInteger, LLDebugToolAction) { LLDebugToolActionHierarchy, LLDebugToolActionMagnifier, LLDebugToolActionRuler, - LLDebugToolActionWidgetBorder + LLDebugToolActionWidgetBorder, + LLDebugToolActionHtml }; FOUNDATION_EXPORT NSNotificationName _Nonnull const LLConfigDidUpdateWindowStyleNotificationName; @@ -277,6 +278,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, strong, nullable) NSArray *ignoredHosts; +/** + Whether observer webView request. + */ +@property (nonatomic, assign) BOOL observerWebView; + #pragma mark - Hierarchy /** @@ -291,6 +297,18 @@ Whether show widget border. Default is NO. */ @property (nonatomic, assign, getter=isShowWidgetBorder) BOOL showWidgetBorder; +#pragma mark - Html5 + +/** + Default html5 url string used in Html function. must has prefix with http:// or https:// + */ +@property (nonatomic, copy, nullable) NSString *defaultHtmlUrl; + +/** + Custom view controller used in html function. you can use your custom viewController to dynamic debug your web view. must comply with `LLComponentDelegate`. ViewController must set background color. + */ +@property (nonatomic, copy, nullable) UIViewController *(^htmlViewControllerProvider)(void); + #pragma mark - LLDebugTool /** Whether to print LLDebugTool's log event. Default is YES. diff --git a/LLDebugTool/DebugTool/LLDebugTool.m b/LLDebugTool/DebugTool/LLDebugTool.m index 8fd6c454..d3073eb9 100644 --- a/LLDebugTool/DebugTool/LLDebugTool.m +++ b/LLDebugTool/DebugTool/LLDebugTool.m @@ -163,7 +163,7 @@ - (void)initial { // Set Default _isBetaVersion = NO; - _versionNumber = @"1.3.2"; + _versionNumber = @"1.3.3"; _version = _isBetaVersion ? [_versionNumber stringByAppendingString:@"(BETA)"] : _versionNumber; diff --git a/LLDebugToolDemo.xcodeproj/project.pbxproj b/LLDebugToolDemo.xcodeproj/project.pbxproj index 3467f89a..ddef4eee 100644 --- a/LLDebugToolDemo.xcodeproj/project.pbxproj +++ b/LLDebugToolDemo.xcodeproj/project.pbxproj @@ -9,6 +9,9 @@ /* Begin PBXBuildFile section */ 208678B3E17E2AAB3B0E945F /* libPods-LLDebugToolDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 533ECC0E7675B1A81455CB56 /* libPods-LLDebugToolDemo.a */; }; 256DF576EB32FE0F9D9E099F /* libPods-LLDebugToolDemoUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 250A2DF7939C9F66F595658E /* libPods-LLDebugToolDemoUITests.a */; }; + 360075E2235571EF00A606AC /* TestHtmlViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 360075E1235571EF00A606AC /* TestHtmlViewController.m */; }; + 360075E5235576A800A606AC /* CustomWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 360075E4235576A800A606AC /* CustomWebViewController.m */; }; + 3600762D2355AEE500A606AC /* LLComponentNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3600762C2355AEE500A606AC /* LLComponentNavigationController.m */; }; 3603883D23335DF40026BC9E /* LLTitleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3603883C23335DF40026BC9E /* LLTitleViewController.m */; }; 360AE6372330DC160073FECD /* LLSettingComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 360AE6362330DC160073FECD /* LLSettingComponent.m */; }; 360AE63A2330DC620073FECD /* LLSettingWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 360AE6392330DC620073FECD /* LLSettingWindow.m */; }; @@ -28,6 +31,9 @@ 362F87AB2326607A00A27F05 /* LLRulerWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 362F87AA2326607A00A27F05 /* LLRulerWindow.m */; }; 362F87AE232660A000A27F05 /* LLRulerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 362F87AD232660A000A27F05 /* LLRulerViewController.m */; }; 362F87B12326614000A27F05 /* LLRulerPickerInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 362F87B02326614000A27F05 /* LLRulerPickerInfoView.m */; }; + 363158972356C37A003DEF8C /* NSInputStream+LL_Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 363158962356C37A003DEF8C /* NSInputStream+LL_Utils.m */; }; + 3631589B2356EB57003DEF8C /* WKWebView+LL_Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3631589A2356EB57003DEF8C /* WKWebView+LL_Utils.m */; }; + 3631589E2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3631589D2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.m */; }; 3633F584232F395100C62185 /* LLWidgetBorderComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 3633F583232F395100C62185 /* LLWidgetBorderComponent.m */; }; 363DEC532325DFE90090E78C /* LLTitleSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 363DEC522325DFE90090E78C /* LLTitleSliderCell.m */; }; 364570F72313B80800C29200 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 364570F32313B80800C29200 /* LICENSE */; }; @@ -53,6 +59,8 @@ 3668D0CA2303BB1F00D58C0B /* LLSettingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3668D0C92303BB1F00D58C0B /* LLSettingManager.m */; }; 366BC4A2233C64F4009BDA4A /* LLFilterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 366BC4A1233C64F4009BDA4A /* LLFilterView.m */; }; 36743D412313879700002A92 /* LLReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 36743D3F2313879700002A92 /* LLReachability.m */; }; + 3678AD142354274F00AC0B2C /* LLHtmlUIWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3678AD132354274F00AC0B2C /* LLHtmlUIWebViewController.m */; }; + 3678AD172354275B00AC0B2C /* LLHtmlWkWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3678AD162354275B00AC0B2C /* LLHtmlWkWebViewController.m */; }; 367E27A120A1A8480032EF0D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 367E27A320A1A8480032EF0D /* Localizable.strings */; }; 368CB9E1233DFC3A009DFFDB /* LLTableViewSelectableModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 368CB9E0233DFC3A009DFFDB /* LLTableViewSelectableModel.m */; }; 3691A61B20C7E63B00E22192 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3691A61D20C7E63B00E22192 /* InfoPlist.strings */; }; @@ -73,6 +81,10 @@ 36CD3A7423306D6000C9C22C /* LLWidgetBorderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CD3A7323306D6000C9C22C /* LLWidgetBorderViewController.m */; }; 36CD3A7823307BEA00C9C22C /* LLWidgetBorderHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CD3A7723307BEA00C9C22C /* LLWidgetBorderHelper.m */; }; 36CD3A7B23307D2600C9C22C /* UIView+LLWidgetBorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CD3A7A23307D2600C9C22C /* UIView+LLWidgetBorder.m */; }; + 36CDFBC823506374002A913F /* LLHtmlComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CDFBC723506374002A913F /* LLHtmlComponent.m */; }; + 36CDFBCB23506388002A913F /* LLHtmlWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CDFBCA23506388002A913F /* LLHtmlWindow.m */; }; + 36CDFBCE2350639E002A913F /* LLHtmlViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CDFBCD2350639E002A913F /* LLHtmlViewController.m */; }; + 36CDFBD123506C9A002A913F /* LLHtmlConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 36CDFBD023506C9A002A913F /* LLHtmlConfigViewController.m */; }; 36DC10FD22FA60B90078B7BC /* LLToastUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 36DC10FC22FA60B90078B7BC /* LLToastUtils.m */; }; 36DDED7623331967008DD7F9 /* LLDetailTitleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 36DDED7523331967008DD7F9 /* LLDetailTitleCell.m */; }; 36E248882123BAE300D03F44 /* LLDebugToolDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 36E248872123BAE300D03F44 /* LLDebugToolDemoTests.m */; }; @@ -223,6 +235,13 @@ 0857CAF55E62609DE772D43C /* Pods-LLDebugToolDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLDebugToolDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LLDebugToolDemo/Pods-LLDebugToolDemo.release.xcconfig"; sourceTree = ""; }; 250A2DF7939C9F66F595658E /* libPods-LLDebugToolDemoUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-LLDebugToolDemoUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 34ACB65EBB30B1CA47DFC39F /* Pods-LLDebugToolDemoUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLDebugToolDemoUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-LLDebugToolDemoUITests/Pods-LLDebugToolDemoUITests.release.xcconfig"; sourceTree = ""; }; + 360075DF23556DAF00A606AC /* LLComponentDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLComponentDelegate.h; sourceTree = ""; }; + 360075E0235571EF00A606AC /* TestHtmlViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestHtmlViewController.h; sourceTree = ""; }; + 360075E1235571EF00A606AC /* TestHtmlViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestHtmlViewController.m; sourceTree = ""; }; + 360075E3235576A800A606AC /* CustomWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomWebViewController.h; sourceTree = ""; }; + 360075E4235576A800A606AC /* CustomWebViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomWebViewController.m; sourceTree = ""; }; + 3600762B2355AEE500A606AC /* LLComponentNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLComponentNavigationController.h; sourceTree = ""; }; + 3600762C2355AEE500A606AC /* LLComponentNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLComponentNavigationController.m; sourceTree = ""; }; 3603883B23335DF40026BC9E /* LLTitleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLTitleViewController.h; sourceTree = ""; }; 3603883C23335DF40026BC9E /* LLTitleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLTitleViewController.m; sourceTree = ""; }; 360AE6352330DC160073FECD /* LLSettingComponent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLSettingComponent.h; sourceTree = ""; }; @@ -261,6 +280,12 @@ 362F87AD232660A000A27F05 /* LLRulerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLRulerViewController.m; sourceTree = ""; }; 362F87AF2326614000A27F05 /* LLRulerPickerInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLRulerPickerInfoView.h; sourceTree = ""; }; 362F87B02326614000A27F05 /* LLRulerPickerInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLRulerPickerInfoView.m; sourceTree = ""; }; + 363158952356C37A003DEF8C /* NSInputStream+LL_Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSInputStream+LL_Utils.h"; sourceTree = ""; }; + 363158962356C37A003DEF8C /* NSInputStream+LL_Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSInputStream+LL_Utils.m"; sourceTree = ""; }; + 363158992356EB57003DEF8C /* WKWebView+LL_Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WKWebView+LL_Utils.h"; sourceTree = ""; }; + 3631589A2356EB57003DEF8C /* WKWebView+LL_Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "WKWebView+LL_Utils.m"; sourceTree = ""; }; + 3631589C2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LLNetworkHelper+WKWebView.h"; sourceTree = ""; }; + 3631589D2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "LLNetworkHelper+WKWebView.m"; sourceTree = ""; }; 3633F582232F395100C62185 /* LLWidgetBorderComponent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLWidgetBorderComponent.h; sourceTree = ""; }; 3633F583232F395100C62185 /* LLWidgetBorderComponent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLWidgetBorderComponent.m; sourceTree = ""; }; 363DEC512325DFE90090E78C /* LLTitleSliderCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLTitleSliderCell.h; sourceTree = ""; }; @@ -306,6 +331,10 @@ 366BC4A1233C64F4009BDA4A /* LLFilterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLFilterView.m; sourceTree = ""; }; 36743D3F2313879700002A92 /* LLReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LLReachability.m; sourceTree = ""; }; 36743D402313879700002A92 /* LLReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLReachability.h; sourceTree = ""; }; + 3678AD122354274F00AC0B2C /* LLHtmlUIWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlUIWebViewController.h; sourceTree = ""; }; + 3678AD132354274F00AC0B2C /* LLHtmlUIWebViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlUIWebViewController.m; sourceTree = ""; }; + 3678AD152354275B00AC0B2C /* LLHtmlWkWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlWkWebViewController.h; sourceTree = ""; }; + 3678AD162354275B00AC0B2C /* LLHtmlWkWebViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlWkWebViewController.m; sourceTree = ""; }; 367E279720A1A7880032EF0D /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; 367E279820A1A7880032EF0D /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; 367E27A220A1A8480032EF0D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -349,6 +378,14 @@ 36CD3A7723307BEA00C9C22C /* LLWidgetBorderHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLWidgetBorderHelper.m; sourceTree = ""; }; 36CD3A7923307D2600C9C22C /* UIView+LLWidgetBorder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+LLWidgetBorder.h"; sourceTree = ""; }; 36CD3A7A23307D2600C9C22C /* UIView+LLWidgetBorder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+LLWidgetBorder.m"; sourceTree = ""; }; + 36CDFBC623506374002A913F /* LLHtmlComponent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlComponent.h; sourceTree = ""; }; + 36CDFBC723506374002A913F /* LLHtmlComponent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlComponent.m; sourceTree = ""; }; + 36CDFBC923506388002A913F /* LLHtmlWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlWindow.h; sourceTree = ""; }; + 36CDFBCA23506388002A913F /* LLHtmlWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlWindow.m; sourceTree = ""; }; + 36CDFBCC2350639E002A913F /* LLHtmlViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlViewController.h; sourceTree = ""; }; + 36CDFBCD2350639E002A913F /* LLHtmlViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlViewController.m; sourceTree = ""; }; + 36CDFBCF23506C9A002A913F /* LLHtmlConfigViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLHtmlConfigViewController.h; sourceTree = ""; }; + 36CDFBD023506C9A002A913F /* LLHtmlConfigViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLHtmlConfigViewController.m; sourceTree = ""; }; 36DC10FB22FA60B90078B7BC /* LLToastUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLToastUtils.h; sourceTree = ""; }; 36DC10FC22FA60B90078B7BC /* LLToastUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LLToastUtils.m; sourceTree = ""; }; 36DDED7423331967008DD7F9 /* LLDetailTitleCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LLDetailTitleCell.h; sourceTree = ""; }; @@ -643,6 +680,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3600762A2355AEC400A606AC /* ComponentNavigationController */ = { + isa = PBXGroup; + children = ( + 3600762B2355AEE500A606AC /* LLComponentNavigationController.h */, + 3600762C2355AEE500A606AC /* LLComponentNavigationController.m */, + ); + path = ComponentNavigationController; + sourceTree = ""; + }; 3603883A23335DC30026BC9E /* TitleViewController */ = { isa = PBXGroup; children = ( @@ -701,6 +747,10 @@ 3629E38A2136830A00226C79 /* TestWindowStyleViewController.m */, 36FA2639215E1F4300462EA8 /* TestHierarchyViewController.h */, 36FA263A215E1F4300462EA8 /* TestHierarchyViewController.m */, + 360075E0235571EF00A606AC /* TestHtmlViewController.h */, + 360075E1235571EF00A606AC /* TestHtmlViewController.m */, + 360075E3235576A800A606AC /* CustomWebViewController.h */, + 360075E4235576A800A606AC /* CustomWebViewController.m */, ); path = DemoViewControllers; sourceTree = ""; @@ -714,6 +764,24 @@ path = PickerView; sourceTree = ""; }; + 363158942356C370003DEF8C /* NSInputStream */ = { + isa = PBXGroup; + children = ( + 363158952356C37A003DEF8C /* NSInputStream+LL_Utils.h */, + 363158962356C37A003DEF8C /* NSInputStream+LL_Utils.m */, + ); + path = NSInputStream; + sourceTree = ""; + }; + 363158982356EB48003DEF8C /* WKWebView */ = { + isa = PBXGroup; + children = ( + 363158992356EB57003DEF8C /* WKWebView+LL_Utils.h */, + 3631589A2356EB57003DEF8C /* WKWebView+LL_Utils.m */, + ); + path = WKWebView; + sourceTree = ""; + }; 3633F581232F390600C62185 /* WidgetBorder */ = { isa = PBXGroup; children = ( @@ -933,6 +1001,33 @@ path = Function; sourceTree = ""; }; + 36CDFBC323506361002A913F /* Html */ = { + isa = PBXGroup; + children = ( + 36CDFBC523506361002A913F /* UserInterface */, + 36CDFBC623506374002A913F /* LLHtmlComponent.h */, + 36CDFBC723506374002A913F /* LLHtmlComponent.m */, + ); + path = Html; + sourceTree = ""; + }; + 36CDFBC523506361002A913F /* UserInterface */ = { + isa = PBXGroup; + children = ( + 36CDFBC923506388002A913F /* LLHtmlWindow.h */, + 36CDFBCA23506388002A913F /* LLHtmlWindow.m */, + 36CDFBCC2350639E002A913F /* LLHtmlViewController.h */, + 36CDFBCD2350639E002A913F /* LLHtmlViewController.m */, + 36CDFBCF23506C9A002A913F /* LLHtmlConfigViewController.h */, + 36CDFBD023506C9A002A913F /* LLHtmlConfigViewController.m */, + 3678AD122354274F00AC0B2C /* LLHtmlUIWebViewController.h */, + 3678AD132354274F00AC0B2C /* LLHtmlUIWebViewController.m */, + 3678AD152354275B00AC0B2C /* LLHtmlWkWebViewController.h */, + 3678AD162354275B00AC0B2C /* LLHtmlWkWebViewController.m */, + ); + path = UserInterface; + sourceTree = ""; + }; 36DA3B862340504D0081BCC6 /* ComponentWindow */ = { isa = PBXGroup; children = ( @@ -951,13 +1046,13 @@ path = InfoView; sourceTree = ""; }; - 36DA3B88234050D10081BCC6 /* LLComponentViewController */ = { + 36DA3B88234050D10081BCC6 /* ComponentViewController */ = { isa = PBXGroup; children = ( C4B4E41A22F9C90900F70277 /* LLBaseComponentViewController.h */, C4B4E42322F9C90900F70277 /* LLBaseComponentViewController.m */, ); - path = LLComponentViewController; + path = ComponentViewController; sourceTree = ""; }; 36DC10FA22FA60AA0078B7BC /* ToastUtils */ = { @@ -1107,8 +1202,10 @@ C498571122EDE31200E9FBE2 /* Magnifier */, 364CF3D7232659EB000B513F /* Ruler */, 3633F581232F390600C62185 /* WidgetBorder */, + 36CDFBC323506361002A913F /* Html */, C4B4E3FD22F9C90900F70277 /* Function */, 36AB4494231F9CD600AC772B /* Setting */, + 360075DF23556DAF00A606AC /* LLComponentDelegate.h */, C49856E722EDACD200E9FBE2 /* LLComponent.h */, C49856E822EDACD200E9FBE2 /* LLComponent.m */, ); @@ -1380,8 +1477,10 @@ C49856D722ED90DD00E9FBE2 /* LLNetworkModel.m */, 36743D402313879700002A92 /* LLReachability.h */, 36743D3F2313879700002A92 /* LLReachability.m */, - C49856D522ED90DD00E9FBE2 /* LLURLProtocol.m */, C49856D622ED90DD00E9FBE2 /* LLURLProtocol.h */, + C49856D522ED90DD00E9FBE2 /* LLURLProtocol.m */, + 3631589C2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.h */, + 3631589D2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.m */, ); path = Function; sourceTree = ""; @@ -1453,6 +1552,8 @@ C4B4E39122F9C90900F70277 /* Category */ = { isa = PBXGroup; children = ( + 363158982356EB48003DEF8C /* WKWebView */, + 363158942356C370003DEF8C /* NSInputStream */, 3655D50E2329E01300490B36 /* UIResponder */, 36BB1E2B2320F941000D8F29 /* NSUserDefaults */, C4B4E39222F9C90900F70277 /* UIImage */, @@ -1747,7 +1848,8 @@ C4B4E3FC22F9C90900F70277 /* ViewController */ = { isa = PBXGroup; children = ( - 36DA3B88234050D10081BCC6 /* LLComponentViewController */, + 3600762A2355AEC400A606AC /* ComponentNavigationController */, + 36DA3B88234050D10081BCC6 /* ComponentViewController */, 36BB9BCA23404F9700629053 /* EditTableViewController */, 36BB9BC923404EF700629053 /* NavigationController */, 3603883A23335DC30026BC9E /* TitleViewController */, @@ -2110,6 +2212,7 @@ 362F3CE622F01AF70087B0E4 /* LLHierarchyWindow.m in Sources */, C45BA2D122F47997006B833A /* LLScreenshotPreviewViewController.m in Sources */, 3668D0CA2303BB1F00D58C0B /* LLSettingManager.m in Sources */, + 36CDFBD123506C9A002A913F /* LLHtmlConfigViewController.m in Sources */, C4B4E44D22F9C90900F70277 /* LLConst.m in Sources */, 36BC8E25231D052300E4D29B /* LLEntryView.m in Sources */, 362F833C2302BE8F007C9168 /* LLEntryBallView.m in Sources */, @@ -2117,6 +2220,7 @@ 36743D412313879700002A92 /* LLReachability.m in Sources */, C4B4E47322F9C90900F70277 /* LLEditTableViewController.m in Sources */, C4B4E45622F9C90900F70277 /* LLButton.m in Sources */, + 3678AD142354274F00AC0B2C /* LLHtmlUIWebViewController.m in Sources */, C49856DB22ED90DD00E9FBE2 /* LLNetworkHelper.m in Sources */, 36940514232636AC00C4B146 /* LLTitleSwitchCell.m in Sources */, C45537F622F1E486001A9749 /* LLHierarchyDetailViewController.m in Sources */, @@ -2124,9 +2228,13 @@ 3629E3922136830A00226C79 /* BaseTestViewController.m in Sources */, C49856D922ED90DD00E9FBE2 /* LLURLProtocol.m in Sources */, C498569322ED8D4800E9FBE2 /* LLNetworkViewController.m in Sources */, + 363158972356C37A003DEF8C /* NSInputStream+LL_Utils.m in Sources */, 364EF648232204630067C7D7 /* LLHSBPreviewView.m in Sources */, + 36CDFBCE2350639E002A913F /* LLHtmlViewController.m in Sources */, + 3631589B2356EB57003DEF8C /* WKWebView+LL_Utils.m in Sources */, 360D8A5222FD636D003693AE /* LLHierarchyViewController.m in Sources */, C4B4E43F22F9C90900F70277 /* UIButton+LL_Utils.m in Sources */, + 36CDFBCB23506388002A913F /* LLHtmlWindow.m in Sources */, C49856D022ED90C800E9FBE2 /* LLLogModel.m in Sources */, 36596BC822FD065D00BBB6FA /* LLMoveView.m in Sources */, C4B4E47622F9C90900F70277 /* LLBaseTableViewCell.m in Sources */, @@ -2152,8 +2260,10 @@ C49856EC22EDAEFE00E9FBE2 /* LLAppInfoWindow.m in Sources */, C4B4E43B22F9C90900F70277 /* UIImage+LL_Utils.m in Sources */, 36596BCE22FD172D00BBB6FA /* LLInfoView.m in Sources */, + 3678AD172354275B00AC0B2C /* LLHtmlWkWebViewController.m in Sources */, C4B4E47722F9C90900F70277 /* LLBaseModel.m in Sources */, 36596BC222FD055C00BBB6FA /* LLMagnifierViewController.m in Sources */, + 360075E2235571EF00A606AC /* TestHtmlViewController.m in Sources */, 36E5602723331FA100B8D388 /* LLBaseTableViewController.m in Sources */, C498567F22ED8D4800E9FBE2 /* LLScreenshotImageView.m in Sources */, C4B4E44E22F9C90900F70277 /* LLStorageManager.m in Sources */, @@ -2171,8 +2281,11 @@ C49856FB22EDB2BC00E9FBE2 /* LLCrashComponent.m in Sources */, 36BB1E2E2320F954000D8F29 /* NSUserDefaults+LL_Utils.m in Sources */, 362F87AE232660A000A27F05 /* LLRulerViewController.m in Sources */, + 3631589E2356EC6E003DEF8C /* LLNetworkHelper+WKWebView.m in Sources */, C4B4E46622F9C90900F70277 /* LLFunctionItemModel.m in Sources */, + 3600762D2355AEE500A606AC /* LLComponentNavigationController.m in Sources */, 36AB449B231FC57D00AC772B /* LLTitleCellModel.m in Sources */, + 360075E5235576A800A606AC /* CustomWebViewController.m in Sources */, 364CF3DB23265A1C000B513F /* LLRulerComponent.m in Sources */, C498567E22ED8D4800E9FBE2 /* LLScreenshotToolbar.m in Sources */, C49856A122ED8D4800E9FBE2 /* LLPreviewController.m in Sources */, @@ -2228,6 +2341,7 @@ 36BB1E1B2320E679000D8F29 /* LLDetailTitleSelectorCell.m in Sources */, C4B4E46422F9C90900F70277 /* LLFunctionItemContainerView.m in Sources */, 36BC8E28231D1BDB00E4D29B /* LLEntryTitleView.m in Sources */, + 36CDFBC823506374002A913F /* LLHtmlComponent.m in Sources */, C49855A922ED8D0E00E9FBE2 /* LLDebugTool.m in Sources */, C498570122EDB35000E9FBE2 /* LLNetworkComponent.m in Sources */, 365912502320B3E300FDA6A0 /* LLTitleCell.m in Sources */, @@ -2496,6 +2610,7 @@ INFOPLIST_FILE = LLDebugToolDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.3.3; PRODUCT_BUNDLE_IDENTIFIER = myCompany.HDB.LLDebugToolDemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2516,6 +2631,7 @@ INFOPLIST_FILE = LLDebugToolDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.3.3; PRODUCT_BUNDLE_IDENTIFIER = myCompany.HDB.LLDebugToolDemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/LLDebugToolDemo/AppDelegate.m b/LLDebugToolDemo/AppDelegate.m index 789b1c0c..e0cc8805 100644 --- a/LLDebugToolDemo/AppDelegate.m +++ b/LLDebugToolDemo/AppDelegate.m @@ -35,6 +35,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // Uncomment one of the following lines to change the window style. // config.entryWindowStyle = LLConfigEntryWindowStyleTitle; + //####################### Html #######################// + config.defaultHtmlUrl = @"https://github.com/HDB-Li/LLDebugTool"; + }]; return YES; diff --git a/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.h b/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.h new file mode 100644 index 00000000..6e77bf5c --- /dev/null +++ b/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.h @@ -0,0 +1,17 @@ +// +// CustomWebViewController.h +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/15. +// Copyright © 2019 li. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CustomWebViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.m b/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.m new file mode 100644 index 00000000..82dd9b8b --- /dev/null +++ b/LLDebugToolDemo/DemoViewControllers/CustomWebViewController.m @@ -0,0 +1,56 @@ +// +// CustomWebViewController.m +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/15. +// Copyright © 2019 li. All rights reserved. +// + +#import "CustomWebViewController.h" +#import + +@interface CustomWebViewController () + +@property (nonatomic, strong) UILabel *titleLabel; + +@property (nonatomic, strong) WKWebView *webView; + +@end + +@implementation CustomWebViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:self.titleLabel]; + [self.view addSubview:self.webView]; + + [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://github.com/HDB-Li/LLDebugTool"]]]; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height + self.navigationController.navigationBar.frame.origin.y; + self.titleLabel.frame = CGRectMake(0, navigationBarHeight, self.view.frame.size.width, 100); + self.webView.frame = CGRectMake(0, navigationBarHeight + 100, self.view.frame.size.width, self.view.frame.size.height - 100 - navigationBarHeight); +} + +#pragma mark - Getters and setters +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + _titleLabel.font = [UIFont boldSystemFontOfSize:20]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.text = NSLocalizedString(@"custom.html.view.controller", nil); + } + return _titleLabel; +} + +- (WKWebView *)webView { + if (!_webView) { + _webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:[[WKWebViewConfiguration alloc] init]]; + } + return _webView; +} + +@end diff --git a/LLDebugToolDemo/DemoViewControllers/TestHierarchyViewController.m b/LLDebugToolDemo/DemoViewControllers/TestHierarchyViewController.m index 6178cab4..eaf98271 100644 --- a/LLDebugToolDemo/DemoViewControllers/TestHierarchyViewController.m +++ b/LLDebugToolDemo/DemoViewControllers/TestHierarchyViewController.m @@ -58,7 +58,18 @@ - (UIView *)getCellView:(NSInteger)index { UIView *view = nil; if (index == 0) { view = [[UIView alloc] init]; - view.backgroundColor = [UIColor groupTableViewBackgroundColor]; + if (@available(iOS 13.0, *)) { +#ifdef __IPHONE_13_0 + view.backgroundColor = [UIColor systemGroupedBackgroundColor]; +#else + view.backgroundColor = [UIColor performSelector:NSSelectorFromString(@"systemGroupedBackgroundColor")]; +#endif + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + view.backgroundColor = [UIColor groupTableViewBackgroundColor]; +#pragma clang diagnostic pop + } } else if (index == 1) { UILabel *label = [[UILabel alloc] init]; label.text = @"Label"; @@ -141,7 +152,10 @@ - (UIView *)getCellView:(NSInteger)index { view = bar; } view.frame = CGRectMake(10 * 2 + [UIScreen mainScreen].bounds.size.width / 2.0, 5, [UIScreen mainScreen].bounds.size.width - 10 * 3 - [UIScreen mainScreen].bounds.size.width / 2.0, 44 - 5 * 2); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" view.backgroundColor = [UIColor groupTableViewBackgroundColor]; +#pragma clang diagnostic pop view.tag = 100; return view; } diff --git a/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.h b/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.h new file mode 100644 index 00000000..db982858 --- /dev/null +++ b/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.h @@ -0,0 +1,17 @@ +// +// TestHtmlViewController.h +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/15. +// Copyright © 2019 li. All rights reserved. +// + +#import "BaseTestViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface TestHtmlViewController : BaseTestViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.m b/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.m new file mode 100644 index 00000000..2154e461 --- /dev/null +++ b/LLDebugToolDemo/DemoViewControllers/TestHtmlViewController.m @@ -0,0 +1,64 @@ +// +// TestHtmlViewController.m +// LLDebugToolDemo +// +// Created by admin10000 on 2019/10/15. +// Copyright © 2019 li. All rights reserved. +// + +#import "TestHtmlViewController.h" +#import "CustomWebViewController.h" +#import "LLDebugTool.h" + +@interface TestHtmlViewController () + +@end + +@implementation TestHtmlViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.title = NSLocalizedString(@"test.html", nil); +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 2; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; + + if (indexPath.row == 0) { + cell.textLabel.text = NSLocalizedString(@"show.html", nil); + } else if (indexPath.row == 1) { + cell.textLabel.text = NSLocalizedString(@"show.custom.html", nil); + } + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.row == 0) { + [self testHtml]; + } else if (indexPath.row == 1) { + [self testCustomHtmlViewController]; + } +} + +#pragma mark - Action +- (void)testHtml { + if ([LLConfig shared].htmlViewControllerProvider) { + [LLConfig shared].htmlViewControllerProvider = nil; + } + [[LLDebugTool sharedTool] executeAction:LLDebugToolActionHtml]; +} + +- (void)testCustomHtmlViewController { + if (![LLConfig shared].htmlViewControllerProvider) { + [LLConfig shared].htmlViewControllerProvider = ^UIViewController * _Nonnull{ + return [[CustomWebViewController alloc] init]; + }; + } + [[LLDebugTool sharedTool] executeAction:LLDebugToolActionHtml]; +} + +@end diff --git a/LLDebugToolDemo/Info.plist b/LLDebugToolDemo/Info.plist index ba6e5bcb..71fe3eaf 100644 --- a/LLDebugToolDemo/Info.plist +++ b/LLDebugToolDemo/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.2 + $(MARKETING_VERSION) CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/LLDebugToolDemo/ViewController.m b/LLDebugToolDemo/ViewController.m index 84ecd58f..58913b38 100644 --- a/LLDebugToolDemo/ViewController.m +++ b/LLDebugToolDemo/ViewController.m @@ -21,6 +21,7 @@ #import "TestColorStyleViewController.h" #import "TestWindowStyleViewController.h" #import "TestHierarchyViewController.h" +#import "TestHtmlViewController.h" #import "LLStorageManager.h" @@ -170,9 +171,14 @@ - (void)testWidgetBorder { [[LLDebugTool sharedTool] executeAction:LLDebugToolActionWidgetBorder]; } +- (void)testHtml { + TestHtmlViewController *vc = [[TestHtmlViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; +} + #pragma mark - UITableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 11; + return 12; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -271,6 +277,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.textLabel.text = NSLocalizedString(@"test.ruler", nil); } else if (indexPath.section == 10) { cell.textLabel.text = NSLocalizedString(@"test.widget.border", nil); + } else if (indexPath.section == 11) { + cell.textLabel.text = NSLocalizedString(@"test.html", nil); } return cell; } @@ -302,6 +310,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath [self testRuler]; } else if (indexPath.section == 10) { [self testWidgetBorder]; + } else if (indexPath.section == 11) { + [self testHtml]; } [self.tableView reloadData]; } @@ -329,6 +339,8 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte return @"Ruler"; } else if (section == 10) { return @"Widget Border"; + } else if (section == 11) { + return @"Html"; } return nil; } diff --git a/LLDebugToolDemo/en.lproj/Localizable.strings b/LLDebugToolDemo/en.lproj/Localizable.strings index 3a4eff26..5cdc2f37 100644 --- a/LLDebugToolDemo/en.lproj/Localizable.strings +++ b/LLDebugToolDemo/en.lproj/Localizable.strings @@ -37,6 +37,10 @@ "color.custom" = "Use custom color config"; "color.none" = "Don't use color config"; +"show.html" = "Show html webView function"; +"show.custom.html" = "Show custom html view controller function"; +"custom.html.view.controller" = "Custom Web View Controller"; + "test.network.request" = "Show network request function"; "test.log" = "Show log function"; "test.crash" = "Show crash catch function"; @@ -47,6 +51,7 @@ "test.magnifier" = "Show magnifier function"; "test.ruler" = "Show ruler function"; "test.widget.border" = "Show widget border function"; +"test.html" = "Show html webview function"; "new.version" = "A new version demo is available"; "crash.tip" = "If your project/Demo under run XCode contains Exception Breakpoint, you need to after the program crashes, Continue to click on the XCode ` Continue program execution `(Tip 1), until the end of the program completely(Tip 2). This function can be used normally when non-xcode runs, and when run under XCode, Exception Breakpoint takes precedence over LLDebugTool intercept crash."; diff --git a/LLDebugToolDemo/zh-Hans.lproj/Localizable.strings b/LLDebugToolDemo/zh-Hans.lproj/Localizable.strings index 28785344..9f25e83f 100644 --- a/LLDebugToolDemo/zh-Hans.lproj/Localizable.strings +++ b/LLDebugToolDemo/zh-Hans.lproj/Localizable.strings @@ -37,6 +37,10 @@ "color.custom" = "使用自定义颜色配置"; "color.none" = "不使用颜色配置"; +"show.html" = "展示WebView功能"; +"show.custom.html" = "展示自定义WebViewController功能"; +"custom.html.view.controller" = "自定义WebViewController"; + "test.network.request" = "展示网络功能"; "test.log" = "展示日志功能"; "test.crash" = "展示崩溃收集功能"; @@ -47,6 +51,7 @@ "test.magnifier" = "展示放大镜功能"; "test.ruler" = "展示格尺功能"; "test.widget.border" = "展示元素边框功能"; +"test.html" = "展示WebView功能"; "new.version" = "有新版本Demo可用"; "crash.tip" = "如果你的项目/Demo在XCode运行下中包含Exception Breakpoint,你需要在程序崩溃后,继续点击XCode上的`Continue program execution`(Tip 1),直到程序完全结束(Tip 2)。这个功能在非XCode运行时可以正常使用,在XCode下运行时Exception Breakpoint会优先于LLDebugTool拦截崩溃。"; diff --git a/README-cn.md b/README-cn.md index 37e905cc..e0a3226f 100644 --- a/README-cn.md +++ b/README-cn.md @@ -3,7 +3,7 @@

[![Version](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg)](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg) -[![CocoaPods Compatible](https://img.shields.io/badge/Pod-v1.3.2-blue.svg)](https://img.shields.io/badge/Pod-v1.3.2-blue.svg) +[![CocoaPods Compatible](https://img.shields.io/badge/Pod-v1.3.3-blue.svg)](https://img.shields.io/badge/Pod-v1.3.3-blue.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)](https://img.shields.io/badge/Platform-iOS-lightgrey.svg) [![License](https://img.shields.io/badge/License-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) @@ -27,7 +27,7 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助
- +
#### 预览 @@ -45,23 +45,15 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 -## 最近更新 (1.3.2) +## 最近更新 (1.3.3) -### 新增 `格尺`,`元素边框` 功能。 +### 新增 `Html` 功能。 -格尺功能:方便的工具显示触点信息。 - -元素边框功能:显示元素边框,方便查看视图的Frame信息。 +你可以在你的app中随时调试通过 `WKWebView`,`UIWebView` 或者你自定义的`ViewController`来调试html页面。 #### 新增 -* 添加 `LLSettingManager` 来控制工具中的一些设置,您可以动态配置 `LLConfig` 的选项,而无需重新打包。 - -* 添加 `Hierarchy Detail Info` 功能,显示更多目标视图的详细信息。类似于XCode中的 `Debug View Hierarchy` 功能。 - -#### 删除 - -* 删除所有xib文件,这会浪费编译时间。相反,您需要引入[Masonry](https://github.com/snapkit/Masonry)。 +* 现在 `LLURLProtocol` 可以正确的监听 `WKWebView`。 ## 我能用LLDebugTool做什么? @@ -96,7 +88,7 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 ##### Objective - C > 1. 添加 `pod 'LLDebugTool' , '~> 1.0.0'` 到你的Podfile里。 -> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugTool' , '1.3.2' ,:configurations => ['Debug']`。 +> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugTool' , '1.3.3' ,:configurations => ['Debug']`。 > 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugTool' , '~> 1.0.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugTool`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 > 4. 终端输入`pod install`来进行集成。搜索不到`LLDebugTool`或者搜不到最新版本时,可先运行`pod repo update`,再执行`pod install`。 > 5. 在你需要使用LLDebugTool的文件里添加`#import "LLDebug.h"`,或者直接在pch文件中添加`#import "LLDebug.h"`。 @@ -104,7 +96,7 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 ##### Swift > 1. 添加 `pod 'LLDebugToolSwift' , '~> 1.0.0'` 到你的Podfile里。 -> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugToolSwift' , '1.3.2' ,:configurations => ['Debug']`。 +> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugToolSwift' , '1.3.3' ,:configurations => ['Debug']`。 > 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugToolSwift' , '~> 1.0.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugToolSwift`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 > 4. 必须在Podfile中添加 **`use_frameworks!`** 。 > 5. 终端输入`pod install`来进行集成。搜索不到`LLDebugToolSwift`或者搜不到最新版本时,可先运行`pod repo update`,再执行`pod install`。 @@ -346,10 +338,14 @@ LLDebugTool提供了一个格尺工具,用于便捷的获取和对比位置信 LLDebugTool提供了一个元素边框工具,便捷的查看元素边框及位置。 +### HTML + +LLDebugTool可以在你的app中随时调试通过 `WKWebView`,`UIWebView` 或者你自定义的`ViewController`来调试html页面。 + ### 更多使用 * 你可以通过查看[Wiki](https://github.com/HDB-Li/LLDebugTool/wiki),获得更多帮助。 -* 你可以下载并运行[LLDebugToolDemo](https://github.com/HDB-Li/LLDebugTool/archive/master.zip)或[LLDebugToolSwiftDemo](https://github.com/HDB-Li/LLDebugToolSwift/archive/master.zip)来发现LLDebugTool的更多使用方式。Demo是在MacOS 10.14.6,XCode 11.0,iOS 13.0,CocoaPods 1.7.5下运行的,如果有任何版本兼容问题,请告诉我。 +* 你可以下载并运行[LLDebugToolDemo](https://github.com/HDB-Li/LLDebugTool/archive/master.zip)或[LLDebugToolSwiftDemo](https://github.com/HDB-Li/LLDebugToolSwift/archive/master.zip)来发现LLDebugTool的更多使用方式。Demo是在MacOS 10.15,XCode 11.1,iOS 13.0,CocoaPods 1.8.4下运行的,如果有任何版本兼容问题,请告诉我。 ## 要求 diff --git a/README.md b/README.md index 7adefbef..11b005e1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

[![Version](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg)](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg) -[![CocoaPods Compatible](https://img.shields.io/badge/pod-v1.3.2-blue.svg)](https://img.shields.io/badge/pod-v1.3.2-blue.svg) +[![CocoaPods Compatible](https://img.shields.io/badge/pod-v1.3.3-blue.svg)](https://img.shields.io/badge/pod-v1.3.3-blue.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)](https://img.shields.io/badge/Platform-iOS-lightgrey.svg) [![License](https://img.shields.io/badge/License-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) @@ -27,7 +27,7 @@ Choose LLDebugTool for your next project, or migrate over your existing projects
- +
#### Preview @@ -45,23 +45,15 @@ Choose LLDebugTool for your next project, or migrate over your existing projects -## What's new in 1.3.2 +## What's new in 1.3.3 -### Add `Ruler`, `Widget Border` function. +### Add `Html` function. -Ruler function : Convenient tools to display touch point information. - -Widget Border function : Display element border, convenient to see the view's frame. +You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `ViewController` in your app at any time. #### Add -* Add `LLSettingManager` to control some settings in tool, you can configure `LLConfig`'s options dynamically without re-archiving. - -* Add `Hierarchy Detail Info` function to show more detail info of target view. Similar to `Debug View Hierarchy` function in XCode. - -#### Remove - -* Remove all xib files, it wastes compilation time. In contrast, you need to introduce [Masonry](https://github.com/SnapKit/Masonry) lib. +* Now `LLURLProtocol` can correctly observe `WKWebView`. ## What can you do with LLDebugTool? @@ -96,7 +88,7 @@ Widget Border function : Display element border, convenient to see the view's fr ##### Objective - C > 1. Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0.0'`. -> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugTool' , '1.3.2' ,:configurations => ['Debug']`. +> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugTool' , '1.3.3' ,:configurations => ['Debug']`. > 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugTool', '~> 1.0.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). > 4. Install the pod(s) by running `pod install`. If you can't search `LLDebugTool` or you can't find the newest release version, running `pod repo update` before `pod install`. > 5. Include LLDebugTool wherever you need it with `#import "LLDebug.h"` or you can write `#import "LLDebug.h"` in your .pch in your .pch file. @@ -104,7 +96,7 @@ Widget Border function : Display element border, convenient to see the view's fr ##### Swift > 1. Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0.0'`. -> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugToolSwift' , '1.3.2' ,:configurations => ['Debug']`. +> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugToolSwift' , '1.3.3' ,:configurations => ['Debug']`. > 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugToolSwift', '~> 1.0.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). > 4. Must be added in the Podfile **`use_frameworks!`**. > 5. Install the pod(s) by running `pod install`. If you can't search `LLDebugToolSwift` or you can't find the newest release version, running `pod repo update` before `pod install`. @@ -346,10 +338,14 @@ LLDebugTool provides a convenient tools to display touch point information. LLDebugTool provides a function to display element border, convenient to see the view's frame. +### HTML + +LLDebugTool can debug HTML pages through `WKWebView`, `UIWebView` or your customized `ViewController` in your app at any time. + ### More Usage * You can get more help by looking at the [Wiki](https://github.com/HDB-Li/LLDebugTool/wiki). -* You can download and run the [LLDebugToolDemo](https://github.com/HDB-Li/LLDebugTool/archive/master.zip) or [LLDebugToolSwiftDemo](https://github.com/HDB-Li/LLDebugToolSwift/archive/master.zip) to find more use with LLDebugTool. The demo is build under MacOS 10.14.6, XCode 11.0, iOS 13.0, CocoaPods 1.7.5. If there is any version compatibility problem, please let me know. +* You can download and run the [LLDebugToolDemo](https://github.com/HDB-Li/LLDebugTool/archive/master.zip) or [LLDebugToolSwiftDemo](https://github.com/HDB-Li/LLDebugToolSwift/archive/master.zip) to find more use with LLDebugTool. The demo is build under MacOS 10.15, XCode 11.1, iOS 13.0, CocoaPods 1.8.4. If there is any version compatibility problem, please let me know. ## Requirements