Skip to content

Commit

Permalink
Merge pull request #29 from HDB-Li/1.1.5
Browse files Browse the repository at this point in the history
1.1.5
  • Loading branch information
HDB-Li authored Aug 29, 2018
2 parents 386d15f + 6baae26 commit ed41cc3
Show file tree
Hide file tree
Showing 58 changed files with 1,221 additions and 504 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## [1.1.5](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.1.5) (08/29/2018)

### Start/stop function module dynamically

Add a options `LLConfigAvailableFeature` in `LLConfig` used to control whether to enable ` LLDebugTool` one of function module, now you can dynamically start/stop a module. More changes can be viewed in [Version 1.1.5 Project](https://github.com/HDB-Li/LLDebugTool/projects/4).

#### Add

* Add a options `LLConfigAvailableFeature` in `LLConfig` used to control whether to enable ` LLDebugTool` one of function module, now you can dynamically start/stop a module.
* Add enumeration values `LLConfigLogFileFuncDesc` and `LLConfigLogFileDesc` in `LLConfigLogStyle`.

#### Update

* Update `LLAppHelper` and `LLConfig`, Cleaner code.
* Update `LLConfig`, now you can dynamic change `colorStyle` and `windowStyle` in running, See demo for more effects.
* Update `LLSubTitleTableViewCell` to fix UITextView bug under ios 8.

#### Extra

* Update demo file, It looks more comfortable now.

## [1.1.4](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.1.4) (08/27/2018)

### Increase network traffic monitoring
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.1.4"
s.version = "1.1.5"
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
71 changes: 58 additions & 13 deletions LLDebugTool/Config/LLConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,25 @@
#import <UIKit/UIKit.h>

#ifndef LLCONFIG_CUSTOM_COLOR
#define LLCONFIG_CUSTOM_COLOR ([LLConfig sharedConfig].useSystemColor == NO)
#define LLCONFIG_TEXT_COLOR [LLConfig sharedConfig].textColor
#define LLCONFIG_BACKGROUND_COLOR [LLConfig sharedConfig].backgroundColor
#define LLCONFIG_CUSTOM_COLOR (YES)
#endif

#define LLCONFIG_TEXT_COLOR [LLConfig sharedConfig].textColor
#define LLCONFIG_BACKGROUND_COLOR [LLConfig sharedConfig].backgroundColor

/**
Color style enum
- LLConfigColorStyleHack: Green backgroundColor and white textColor.
- LLConfigColorStyleSimple: White backgroundColor and darkTextColor textColor.
- LLConfigColorStyleSystem: White backgroundColor and system tint textColor.
- LLConfigColorStyleCustom: Use custom backgroundColor and textColor.
*/
typedef NS_ENUM(NSUInteger, LLConfigColorStyle) {
LLConfigColorStyleHack,
LLConfigColorStyleSimple,
LLConfigColorStyleSystem,
LLConfigColorStyleCustom,
};

/**
Expand Down Expand Up @@ -75,16 +77,52 @@ typedef NS_ENUM(NSUInteger, LLConfigWindowStyle) {
/**
Log style for [LLDebugTool logInFile...]. Customize the log you want.
- LLConfigLogDetail: Show all detail info, contain event,file,line,func,date,desc.
- LLConfigLogDetail: Show all detail info. Contain event, file, line, func, date and desc.
- LLConfigLogFileFuncDesc : Show with event, file, func and desc.
- LLConfigLogFileDesc : Show with event, file and desc.
- LLConfigLogNormal: Show as system NSLog
- LLConfigLogNone: Don't show anything.
*/
typedef NS_ENUM(NSUInteger, LLConfigLogStyle) {
LLConfigLogDetail,
LLConfigLogFileFuncDesc,
LLConfigLogFileDesc,
LLConfigLogNormal,
LLConfigLogNone,
};

/**
Customize available Features.
- LLConfigAvailableNetwork: Network functions available.
- LLConfigAvailableLog: Log functions avalable.
- LLConfigAvailableCrash: Crash functions available.
- LLConfigAvailableAppInfo: AppInfo functions available.
- LLConfigAvailableSandbox: Sandbox functions available.
- LLConfigAvailableScreenshot: Screenshot functions available.
- LLConfigAvailableAll: All available.
*/
typedef NS_OPTIONS(NSUInteger, LLConfigAvailableFeature) {
LLConfigAvailableNetwork = 1 << 0,
LLConfigAvailableLog = 1 << 1,
LLConfigAvailableCrash = 1 << 2,
LLConfigAvailableAppInfo = 1 << 3,
LLConfigAvailableSandbox = 1 << 4,
LLConfigAvailableScreenshot = 1 << 5,
LLConfigAvailableAll = 0xFF,

// Quick options
LLConfigAvailableNoneNetwork = 0xFF - (1 << 0),
LLConfigAvailableNoneLog = 0xFF - (1 << 1),
LLConfigAvailableNoneCrash = 0xFF - (1 << 2),
LLConfigAvailableNoneAppInfo = 0xFF - (1 << 3),
LLConfigAvailableNoneSandbox = 0xFF - (1 << 4),
LLConfigAvailableNoneScreenshot = 0xFF - (1 << 5),
};

UIKIT_EXTERN NSNotificationName _Nonnull const LLConfigDidUpdateColorStyleNotificationName;
UIKIT_EXTERN NSNotificationName _Nonnull const LLConfigDidUpdateWindowStyleNotificationName;

/**
Config file. Must config properties before [LLDebugTool enable].
*/
Expand All @@ -110,28 +148,22 @@ typedef NS_ENUM(NSUInteger, LLConfigLogStyle) {
@property (assign , nonatomic) LLConfigColorStyle colorStyle;

/**
UIControl's background color. Default is [UIColor blackColor]. Set this property will also change useSystemColor to NO.
UIControl's background color. Default is [UIColor blackColor]..
*/
@property (strong , nonatomic , nonnull , readonly) UIColor *backgroundColor;

/**
UIControl's text color. Default is [UIColor greenColor]. Set this property will also change useSystemColor to NO.
UIControl's text color. Default is [UIColor greenColor].
*/
@property (strong , nonatomic , nonnull , readonly) UIColor *textColor;

/**
Use system color or not. If YES, window will draw by system tint color. If NO, window will draw by [backgroundColor] and [textColor].
Default is NO.
*/
@property (assign , nonatomic) BOOL useSystemColor;

/**
System tint color.
*/
@property (strong , nonatomic , readonly , nonnull) UIColor *systemTintColor;

/**
Customizing the custom color configuration.
Customizing the custom color configuration, will auto set colorStyle to LLConfigColorStyleCustom.
*/
- (void)configBackgroundColor:(UIColor *_Nonnull)backgroundColor textColor:(UIColor *_Nonnull)textColor statusBarStyle:(UIStatusBarStyle)statusBarStyle;

Expand Down Expand Up @@ -191,6 +223,12 @@ typedef NS_ENUM(NSUInteger, LLConfigLogStyle) {
*/
@property (assign , nonatomic) LLConfigWindowStyle windowStyle;

/**
Available features. Default is LLConfigAvailableAll.
It can affect tabbar's display and features on or off. If this value is modified at run time, will automatic called [LLDebugTool stopWorking] and [LLDebugTool startWorking] again to start or close the features, also the tabbar will be updated automatically the next time it appears.
*/
@property (assign , nonatomic) LLConfigAvailableFeature availables;

#pragma mark - Folder Path
/**
The folder path for LLDebugTool. The database is created and read in this directory.
Expand All @@ -209,4 +247,11 @@ typedef NS_ENUM(NSUInteger, LLConfigLogStyle) {
*/
@property (strong , nonatomic , readonly , nullable) NSBundle *XIBBundle;

#pragma mark - DEPRECATED
/**
Use system color or not. If YES, window will draw by system tint color. If NO, window will draw by [backgroundColor] and [textColor].
Default is NO.
*/
@property (assign , nonatomic) BOOL useSystemColor DEPRECATED_MSG_ATTRIBUTE("Unsupported, Use colorStyle LLConfigColorStyleSimple replace.");;

@end
75 changes: 69 additions & 6 deletions LLDebugTool/Config/LLConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@
#import "LLLogHelperEventDefine.h"
#import "LLDebugToolMacros.h"
#import "LLDebugTool.h"
#import "LLNetworkHelper.h"
#import "LLLogHelper.h"
#import "LLCrashHelper.h"
#import "LLAppHelper.h"
#import "LLScreenshotHelper.h"

static LLConfig *_instance = nil;

NSNotificationName const LLConfigDidUpdateColorStyleNotificationName = @"LLConfigDidUpdateColorStyleNotificationName";
NSNotificationName const LLConfigDidUpdateWindowStyleNotificationName = @"LLConfigDidUpdateWindowStyleNotificationName";

@implementation LLConfig

+ (instancetype)sharedConfig {
Expand All @@ -40,18 +48,56 @@ + (instancetype)sharedConfig {
}

- (void)setColorStyle:(LLConfigColorStyle)colorStyle {
// if (_colorStyle != colorStyle) {
_colorStyle = colorStyle;
_useSystemColor = NO;
[self updateColor];
// }
if (colorStyle != LLConfigColorStyleCustom) {
_colorStyle = colorStyle;
[self updateColor];
[[NSNotificationCenter defaultCenter] postNotificationName:LLConfigDidUpdateColorStyleNotificationName object:nil userInfo:nil];
}
}

- (void)setWindowStyle:(LLConfigWindowStyle)windowStyle {
if (_windowStyle != windowStyle) {
_windowStyle = windowStyle;
[[NSNotificationCenter defaultCenter] postNotificationName:LLConfigDidUpdateWindowStyleNotificationName object:nil userInfo:nil];
}
}

- (void)setAvailables:(LLConfigAvailableFeature)availables {
if (_availables != availables) {
BOOL networkEnable = availables & LLConfigAvailableNetwork;
BOOL logEnable = availables & LLConfigAvailableLog;
BOOL crashEnable = availables & LLConfigAvailableCrash;
BOOL appInfoEnable = availables & LLConfigAvailableAppInfo;
BOOL sandboxEnable = availables & LLConfigAvailableSandbox;
BOOL screenshotEnable = availables & LLConfigAvailableScreenshot;
if (!networkEnable && !logEnable && !crashEnable && !appInfoEnable && !sandboxEnable && !screenshotEnable) {
// Can't set none availables.
return;
}
BOOL allEnable = networkEnable && logEnable && crashEnable && appInfoEnable && sandboxEnable && screenshotEnable;
if (allEnable && (availables != LLConfigAvailableAll)) {
// Check if input wrong.
_availables = LLConfigAvailableAll;
} else {
_availables = availables;
}
// Start or close features.
if ([LLDebugTool sharedTool].isWorking) {
[[LLNetworkHelper sharedHelper] setEnable:networkEnable];
[[LLLogHelper sharedHelper] setEnable:logEnable];
[[LLCrashHelper sharedHelper] setEnable:crashEnable];
[[LLAppHelper sharedHelper] setEnable:appInfoEnable];
[[LLScreenshotHelper sharedHelper] setEnable:screenshotEnable];
}
}
}

- (void)configBackgroundColor:(UIColor *)backgroundColor textColor:(UIColor *)textColor statusBarStyle:(UIStatusBarStyle)statusBarStyle {
_useSystemColor = NO;
_colorStyle = LLConfigColorStyleCustom;
_backgroundColor = backgroundColor;
_textColor = textColor;
_statusBarStyle = statusBarStyle;
[[NSNotificationCenter defaultCenter] postNotificationName:LLConfigDidUpdateColorStyleNotificationName object:nil userInfo:nil];
}

#pragma mark - Primary
Expand Down Expand Up @@ -99,6 +145,9 @@ - (void)initial {
// Set default window's style.
_windowStyle = LLConfigWindowSuspensionBall;

// Set default availables.
_availables = LLConfigAvailableAll;

// Update color.
[self updateColor];
}
Expand All @@ -115,6 +164,10 @@ - (void)updateColor {
_backgroundColor = [UIColor whiteColor];
_textColor = self.systemTintColor;
_statusBarStyle = UIStatusBarStyleDefault;
}
break;
case LLConfigColorStyleCustom:{

}
break;
case LLConfigColorStyleHack:
Expand All @@ -127,4 +180,14 @@ - (void)updateColor {
}
}

#pragma mark - DEPRECATED
- (void)setUseSystemColor:(BOOL)useSystemColor {
if (_useSystemColor != useSystemColor) {
_useSystemColor = useSystemColor;
if (useSystemColor && (self.colorStyle != LLConfigColorStyleSimple)) {
self.colorStyle = LLConfigColorStyleSimple;
}
}
}

@end
37 changes: 24 additions & 13 deletions LLDebugTool/DebugTool/LLDebugTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,27 @@ + (instancetype)sharedTool {
- (void)startWorking{
if (!_isWorking) {
_isWorking = YES;
// Open crash helper
[[LLCrashHelper sharedHelper] setEnable:YES];
// Open log helper
[[LLLogHelper sharedHelper] setEnable:YES];
// Open network monitoring
[[LLNetworkHelper sharedHelper] setEnable:YES];
// Open app monitoring
[[LLAppHelper sharedHelper] startMonitoring];
// Open screenshot
[[LLScreenshotHelper sharedHelper] setEnable:YES];
LLConfigAvailableFeature available = [LLConfig sharedConfig].availables;
if (available & LLConfigAvailableCrash) {
// Open crash helper
[[LLCrashHelper sharedHelper] setEnable:YES];
}
if (available & LLConfigAvailableLog) {
// Open log helper
[[LLLogHelper sharedHelper] setEnable:YES];
}
if (available & LLConfigAvailableNetwork) {
// Open network monitoring
[[LLNetworkHelper sharedHelper] setEnable:YES];
}
if (available & LLConfigAvailableAppInfo) {
// Open app monitoring
[[LLAppHelper sharedHelper] setEnable:YES];
}
if (available & LLConfigAvailableScreenshot) {
// Open screenshot
[[LLScreenshotHelper sharedHelper] setEnable:YES];
}
// show window
[self.window showWindow];
}
Expand All @@ -80,10 +91,10 @@ - (void)startWorking{
- (void)stopWorking {
if (_isWorking) {
_isWorking = NO;
// Close app monitoring
[[LLAppHelper sharedHelper] stopMonitoring];
// Close screenshot
[[LLScreenshotHelper sharedHelper] setEnable:NO];
// Close app monitoring
[[LLAppHelper sharedHelper] setEnable:NO];
// Close network monitoring
[[LLNetworkHelper sharedHelper] setEnable:NO];
// Close log helper
Expand Down Expand Up @@ -116,7 +127,7 @@ - (void)logInFile:(NSString *)file function:(NSString *)function lineNo:(int)lin
- (void)initial {
// Set Default
_isBetaVersion = NO;
_versionNumber = @"1.1.4";
_versionNumber = @"1.1.5";
_version = _isBetaVersion ? [_versionNumber stringByAppendingString:@"(BETA)"] : _versionNumber;

// Check version.
Expand Down
19 changes: 12 additions & 7 deletions LLDebugTool/Helper/AppHelper/LLAppHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,9 @@ UIKIT_EXTERN NSString * _Nonnull const LLAppHelperTotalDataTrafficKey;
+ (instancetype _Nonnull)sharedHelper;

/**
Start monitoring CPU/FPS/Memory
Set enable to monitoring network request.
*/
- (void)startMonitoring;

/**
Stop monitoring CPU/FPS/Memory
*/
- (void)stopMonitoring;
@property (nonatomic , assign , getter=isEnabled) BOOL enable;

/**
Get current app infos. Include "CPU Usage","Memory Usage","FPS","Data Traffic","App Name","Bundle Identifier","App Version","App Start Time","Device Model","Device Name","System Version","Screen Resolution","Language Code","Battery Level","CPU Type","Disk","Network State" and "SSID".
Expand Down Expand Up @@ -168,6 +163,16 @@ UIKIT_EXTERN NSString * _Nonnull const LLAppHelperTotalDataTrafficKey;
*/
- (NSString *_Nonnull)launchDate DEPRECATED_MSG_ATTRIBUTE("Use [NSObject launchDate] replace.");

/**
Start monitoring CPU/FPS/Memory
*/
- (void)startMonitoring DEPRECATED_MSG_ATTRIBUTE("Use [setEnable:YES] replace.");

/**
Stop monitoring CPU/FPS/Memory
*/
- (void)stopMonitoring DEPRECATED_MSG_ATTRIBUTE("Use [setEnable:NO] replace.");

#pragma mark - PRIMARY (This part of the method is used for internal calls, and users do not actively invoke these interfaces, nor need to care about them.)
/**
Update data traffic when finish a network request.
Expand Down
Loading

0 comments on commit ed41cc3

Please sign in to comment.