Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ xcuserdata/
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/
Podfile.lock

# Carthage
#
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## [1.1.0](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.1.0) (06/07/2018)

### Add screenshot function.

Increases the need to the permissions of the album, but it is not necessary, if the project has the authority, save will be synchronized to photo album, if the project doesn't have the permission, is saved into the sandbox alone, LLDebugTool will not actively apply for album permissions.

<div align="left">
<img src="https://raw.githubusercontent.com/HDB-Li/HDBImageRepository/master/LLDebugTool/ScreenGif-Screenshot.gif" width="20%"></img>
</div>

#### Add

* Add `LLScreenshotHelper` in `Helper` folder, used to control screenshot.
* Add `LLScreenshotView` folder in `UserInterface/Others` folder, used to show and draw screenshot.
* Add `LLDebugToolMacros.h`, used to manage public macros.

#### Update

* Update `LLBaseNavigationController` and `LLBaseViewController` to repair toolbar's frame is wrong when hiding tabbar.
* Update `LLAppHelper` to fix iPhone X getting network status error.
* Remove `LLog` macros in `LLDebugTool.h` and moved to `LLDebugToolMacros.h`

#### Additional Changes

* Update demo for saving screenshots to photo albums when screenshots are taken.

## [1.0.3](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.0.3) (05/31/2018)

Fix some leaks.
Expand Down
2 changes: 1 addition & 1 deletion LLDebugTool.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LLDebugTool"
s.version = "1.0.3"
s.version = "1.1.0"
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"
Expand Down
8 changes: 0 additions & 8 deletions LLDebugTool/DebugTool/LLDebugTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@

#ifndef LLSharedDebugTool
#define LLSharedDebugTool [LLDebugTool sharedTool]
#define LLog(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Event(event , fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Alert(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Alert_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Warning(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Warning_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Error(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Error_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:event message:(fmt, ##__VA_ARGS__)]
#endif

@class LLWindow;
Expand Down
11 changes: 7 additions & 4 deletions LLDebugTool/DebugTool/LLDebugTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
// SOFTWARE.

#import "LLDebugTool.h"
#import "LLScreenshotHelper.h"
#import "LLStorageManager.h"
#import "LLNetworkHelper.h"
#import "LLCrashHelper.h"
#import "LLLogHelper.h"
#import "LLAppHelper.h"
#import "LLWindow.h"
#import "LLLogHelper.h"



static LLDebugTool *_instance = nil;

Expand Down Expand Up @@ -65,6 +64,8 @@ - (void)startWorking{
[[LLNetworkHelper sharedHelper] setEnable:YES];
// Open app monitoring
[[LLAppHelper sharedHelper] startMonitoring];
// Open screenshot
[[LLScreenshotHelper sharedHelper] setEnable:YES];
// show window
[self.window showWindow];
}
Expand All @@ -75,6 +76,8 @@ - (void)stopWorking {
_isWorking = NO;
// Close app monitoring
[[LLAppHelper sharedHelper] stopMonitoring];
// Close screenshot
[[LLScreenshotHelper sharedHelper] setEnable:NO];
// Close network monitoring
[[LLNetworkHelper sharedHelper] setEnable:NO];
// Close log helper
Expand All @@ -87,7 +90,7 @@ - (void)stopWorking {
}

- (NSString *)version {
return @"1.0.3";
return @"1.1.0";
}

- (void)showDebugViewControllerWithIndex:(NSInteger)index {
Expand Down
52 changes: 52 additions & 0 deletions LLDebugTool/DebugTool/LLDebugToolMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// LLDebugToolMacros.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.

#ifndef LLDebugToolMacros_h
#define LLDebugToolMacros_h

#define LLog(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Event(event , fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelDefault onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Alert(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Alert_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelAlert onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Warning(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Warning_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelWarning onEvent:event message:(fmt, ##__VA_ARGS__)]
#define LLog_Error(fmt, ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:nil message:(fmt, ##__VA_ARGS__)]
#define LLog_Error_Event(event, fmt , ...) [LLSharedDebugTool logInFile:[[NSString stringWithUTF8String:__FILE__] lastPathComponent] function:NSStringFromSelector(_cmd) lineNo:__LINE__ level:LLConfigLogLevelError onEvent:event message:(fmt, ##__VA_ARGS__)]

/*
// If you only use LLDebugTool in Debug environment, you can copy the following part to your PCH file to resolve most Release environment errors.

#ifndef DEBUG
#define LLog(fmt, ...) NSLog(fmt)
#define LLog_Event(event , fmt , ...) NSLog(fmt)
#define LLog_Alert(fmt, ...) NSLog(fmt)
#define LLog_Alert_Event(event, fmt , ...) NSLog(fmt)
#define LLog_Warning(fmt, ...) NSLog(fmt)
#define LLog_Warning_Event(event, fmt , ...) NSLog(fmt)
#define LLog_Error(fmt, ...) NSLog(fmt)
#define LLog_Error_Event(event, fmt , ...) NSLog(fmt)
#endif

*/

#endif /* LLDebugToolMacros_h */
89 changes: 47 additions & 42 deletions LLDebugTool/Helper/AppHelper/LLAppHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,54 +332,59 @@ - (NSString *)currentWifiSSID
}

- (NSString *)networkingStatesFromStatebar {
NSString *stateString = @"Unknown";
UIApplication *app = [UIApplication sharedApplication];

NSArray *children;
if ([[app valueForKeyPath:@"_statusBar"] isKindOfClass:NSClassFromString(@"UIStatusBar_Modern")]) {
children = [[[[app valueForKeyPath:@"_statusBar"] valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];
// For iPhoneX
NSArray *children = [[[[app valueForKeyPath:@"_statusBar"] valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];
for (UIView *view in children) {
for (id child in view.subviews) {
if ([child isKindOfClass:NSClassFromString(@"_UIStatusBarWifiSignalView")]) {
stateString = @"WIFI";
break;
}
if ([child isKindOfClass:NSClassFromString(@"_UIStatusBarStringView")]) {
if ([[child valueForKey:@"_originalText"] containsString:@"G"]) {
stateString = [child valueForKey:@"_originalText"];
break;
}
}
}
}
} else {
children = [[[app valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];
}

int type = 0;
for (id child in children) {
if ([child isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
type = [[child valueForKeyPath:@"dataNetworkType"] intValue];
// For others iPhone
NSArray *children = [[[app valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];
int type = -1;
for (id child in children) {
if ([child isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
type = [[child valueForKeyPath:@"dataNetworkType"] intValue];
}
}
switch (type) {
case 0:
stateString = @"Not Reachable";
break;
case 1:
stateString = @"2G";
break;
case 2:
stateString = @"3G";
break;
case 3:
stateString = @"4G";
break;
case 4:
stateString = @"LTE";
break;
case 5:
stateString = @"WIFI";
break;
default:
stateString = @"Unknown";
break;
}
}

NSString *stateString = @"wifi";

switch (type) {
case 0:
stateString = @"notReachable";
break;

case 1:
stateString = @"2G";
break;

case 2:
stateString = @"3G";
break;

case 3:
stateString = @"4G";
break;

case 4:
stateString = @"LTE";
break;

case 5:
stateString = @"wifi";
break;

default:
stateString = @"unknown";
break;
}

return stateString;
}

Expand Down
45 changes: 45 additions & 0 deletions LLDebugTool/Helper/ScreenShotHelper/LLScreenshotHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// LLScreenshotHelper.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 <Foundation/Foundation.h>

@interface LLScreenshotHelper : NSObject

/**
Singleton to control screenshot.

@return Singleton
*/
+ (instancetype)sharedHelper;

/**
Set enable to screenshot.
*/
@property (nonatomic , assign) BOOL enable;

/**
Simulate user screenshot.
*/
- (void)simulateTakeScreenshot;

@end
Loading