Skip to content

Commit 5a5e453

Browse files
authored
Merge pull request #79 from HDB-Li/1.3.6
1.3.6
2 parents f9bc14a + ffb865c commit 5a5e453

15 files changed

Lines changed: 79 additions & 47 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [1.3.6](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.6) (11/07/2019)
2+
3+
### Optimize functional experience
4+
5+
* Remove `Masonry`.
6+
* Fix some bugs.
7+
* More code comments.
8+
* Fix error in XCode 10.
9+
* Fix a crash when call twice load method.
10+
111
## [1.3.5](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.5) (11/07/2019)
212

313
### Optimize functional experience

LLDebugTool.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "LLDebugTool"
3-
s.version = "1.3.5"
3+
s.version = "1.3.6"
44
s.summary = "LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations."
55
s.homepage = "https://github.com/HDB-Li/LLDebugTool"
66
s.license = "MIT"

LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,20 @@ - (void)rightItemClick:(UIButton *)sender {
6565
}
6666
Class cls = NSClassFromString(self.webViewClass);
6767

68-
UIViewController *customViewController = [LLConfig shared].htmlViewControllerProvider(urlString);
69-
if (customViewController && cls == [customViewController class]) {
70-
[LLSettingManager shared].lastWebViewUrl = urlString;
71-
[self.navigationController pushViewController:customViewController animated:YES];
72-
return;
73-
}
74-
7568
#pragma clang diagnostic push
7669
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
7770
if (cls != [UIWebView class] && cls != [WKWebView class]) {
7871
#pragma clang diagnostic pop
72+
if ([LLConfig shared].htmlViewControllerProvider != nil) {
73+
UIViewController *customViewController = [LLConfig shared].htmlViewControllerProvider(urlString);
74+
if (customViewController && cls == [customViewController class]) {
75+
[LLSettingManager shared].lastWebViewUrl = urlString;
76+
[self.navigationController pushViewController:customViewController animated:YES];
77+
return;
78+
}
79+
[[LLToastUtils shared] toastMessage:@"Provider custom webView failed."];
80+
return;
81+
}
7982
[[LLToastUtils shared] toastMessage:@"Invalid webView class"];
8083
return;
8184
}
@@ -141,9 +144,11 @@ - (void)showWebViewClassAlert {
141144
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
142145
[actions addObject:NSStringFromClass([UIWebView class])];
143146
#pragma clang diagnostic pop
144-
UIViewController *vc = [LLConfig shared].htmlViewControllerProvider(nil);
145-
if (vc) {
146-
[actions addObject:NSStringFromClass([vc class])];
147+
if ([LLConfig shared].htmlViewControllerProvider != nil) {
148+
UIViewController *vc = [LLConfig shared].htmlViewControllerProvider(nil);
149+
if (vc) {
150+
[actions addObject:NSStringFromClass([vc class])];
151+
}
147152
}
148153
__weak typeof(self) weakSelf = self;
149154
[self LL_showActionSheetWithTitle:@"Web View Style" actions:actions currentAction:self.webViewClass completion:^(NSInteger index) {

LLDebugTool/Core/Component/Network/Function/LLNetworkHelper.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#import "LLConfig.h"
2929
#import "LLTool.h"
3030

31-
#import "NSObject+LL_Runtime.h"
32-
3331
static LLNetworkHelper *_instance = nil;
3432

3533
@interface LLNetworkHelper ()

LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#import "LLConst.h"
3838

3939
#import "UIViewController+LL_Utils.h"
40-
#import "NSObject+LL_Runtime.h"
4140

4241
@interface LLSettingViewController () <UITableViewDataSource>
4342

LLDebugTool/Core/Component/WidgetBorder/Function/UIView+LLWidgetBorder.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
@implementation UIView (LLWidgetBorder)
3535

3636
+ (void)load {
37-
[self LL_swizzleInstanceMethodWithOriginSel:@selector(layoutSubviews) swizzledSel:@selector(LL_layoutSubviews)];
37+
static dispatch_once_t onceToken;
38+
dispatch_once(&onceToken, ^{
39+
[[UIView class] LL_swizzleInstanceMethodWithOriginSel:@selector(layoutSubviews) swizzledSel:@selector(LL_layoutSubviews)];
40+
});
3841
}
3942

4043
- (void)LL_layoutSubviews {

LLDebugTool/Core/Others/Category/NSURLSession/NSURLSession+LL_Utils.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
@implementation NSURLSession (LL_Utils)
3232

3333
+ (void)load {
34-
[self LL_swizzleClassMethodWithOriginSel:@selector(sessionWithConfiguration:delegate:delegateQueue:) swizzledSel:@selector(LL_sessionWithConfiguration:delegate:delegateQueue:)];
34+
static dispatch_once_t onceToken;
35+
dispatch_once(&onceToken, ^{
36+
[[NSURLSession class] LL_swizzleClassMethodWithOriginSel:@selector(sessionWithConfiguration:delegate:delegateQueue:) swizzledSel:@selector(LL_sessionWithConfiguration:delegate:delegateQueue:)];
37+
});
3538
}
3639

3740
+ (NSURLSession *)LL_sessionWithConfiguration:(NSURLSessionConfiguration *)configuration delegate:(nullable id <NSURLSessionDelegate>)delegate delegateQueue:(nullable NSOperationQueue *)queue {

LLDebugTool/Core/Others/Category/NSURLSessionConfiguration/NSURLSessionConfiguration+LL_Utils.m

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@
3131
@implementation NSURLSessionConfiguration (LL_Utils)
3232

3333
+ (void)load {
34-
[self LL_swizzleClassMethodWithOriginSel:@selector(defaultSessionConfiguration) swizzledSel:@selector(LL_defaultSessionConfiguration)];
35-
36-
[self LL_swizzleClassMethodWithOriginSel:@selector(ephemeralSessionConfiguration) swizzledSel:@selector(LL_ephemeralSessionConfiguration)];
37-
38-
Class cls = NSClassFromString(@"__NSCFURLSessionConfiguration") ? : NSClassFromString(@"NSURLSessionConfiguration");
39-
40-
Method method1 = class_getInstanceMethod(cls, @selector(protocolClasses));
41-
Method method2 = class_getInstanceMethod([NSURLSessionConfiguration class], @selector(LL_protocolClasses));
42-
43-
[self LL_swizzleMethod:method1 anotherMethod:method2];
34+
static dispatch_once_t onceToken;
35+
dispatch_once(&onceToken, ^{
36+
[[NSURLSessionConfiguration class] LL_swizzleClassMethodWithOriginSel:@selector(defaultSessionConfiguration) swizzledSel:@selector(LL_defaultSessionConfiguration)];
37+
38+
[[NSURLSessionConfiguration class] LL_swizzleClassMethodWithOriginSel:@selector(ephemeralSessionConfiguration) swizzledSel:@selector(LL_ephemeralSessionConfiguration)];
39+
40+
Class cls = NSClassFromString(@"__NSCFURLSessionConfiguration") ? : NSClassFromString(@"NSURLSessionConfiguration");
41+
42+
Method method1 = class_getInstanceMethod(cls, @selector(protocolClasses));
43+
Method method2 = class_getInstanceMethod([NSURLSessionConfiguration class], @selector(LL_protocolClasses));
44+
45+
[[NSURLSessionConfiguration class] LL_swizzleMethod:method1 anotherMethod:method2];
46+
});
4447
}
4548

4649
+ (NSURLSessionConfiguration *)LL_defaultSessionConfiguration {

LLDebugTool/Core/Others/Category/UIResponder/UIResponder+LL_Utils.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
@implementation UIResponder (LL_Utils)
3131

3232
+ (void)load {
33-
[self LL_swizzleInstanceMethodWithOriginSel:@selector(motionBegan:withEvent:) swizzledSel:@selector(LL_motionBegan:withEvent:)];
33+
static dispatch_once_t onceToken;
34+
dispatch_once(&onceToken, ^{
35+
[[UIResponder class] LL_swizzleInstanceMethodWithOriginSel:@selector(motionBegan:withEvent:) swizzledSel:@selector(LL_motionBegan:withEvent:)];
36+
});
3437
}
3538

3639
- (void)LL_motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {

LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
@implementation UIView (LL_Utils)
3232

3333
+ (void)load {
34-
[self LL_swizzleInstanceMethodWithOriginSel:@selector(sizeToFit) swizzledSel:@selector(LL_sizeToFit)];
34+
static dispatch_once_t onceToken;
35+
dispatch_once(&onceToken, ^{
36+
[[UIView class] LL_swizzleInstanceMethodWithOriginSel:@selector(sizeToFit) swizzledSel:@selector(LL_sizeToFit)];
37+
});
3538
}
3639

3740
- (void)setLL_horizontalPadding:(CGFloat)LL_horizontalPadding {

0 commit comments

Comments
 (0)