Skip to content

Commit

Permalink
publish 1.0,this is first release version
Browse files Browse the repository at this point in the history
  • Loading branch information
coderyi committed Nov 17, 2015
1 parent 65f997f commit b91567b
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 20 deletions.
4 changes: 2 additions & 2 deletions NetworkEye.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "NetworkEye"
s.version = "0.9.9"
s.version = "1.0"
s.summary = "NetworkEye - a iOS network debug library ,It can monitor HTTP requests within the App and displays information related to the request."
s.homepage = "https://github.com/coderyi/NetworkEye"
s.license = "MIT"
s.authors = { "coderyi" => "coderyi@163.com" }
s.source = { :git => "https://github.com/coderyi/NetworkEye.git", :tag => "0.9.9" }
s.source = { :git => "https://github.com/coderyi/NetworkEye.git", :tag => "1.0" }
s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit'
s.library = "sqlite3"
s.platform = :ios, '7.0'
Expand Down
1 change: 1 addition & 0 deletions NetworkEye/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "AppDelegate.h"
#import "DemoViewController.h"
#import "NEHTTPEye.h"
#import "NetworkEye/NEHTTPModelManager.h"
@interface AppDelegate ()

@end
Expand Down
3 changes: 2 additions & 1 deletion NetworkEye/DemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ - (void)setupView{
label.textColor=[UIColor colorWithRed:0.24f green:0.51f blue:0.78f alpha:1.00f];
label.font=[UIFont systemFontOfSize:12];
label.numberOfLines=0;
label.text=@"监控App内所有HTTP请求并显示请求相关的所有信息,方便App开发的网络调试。";
label.text=@"NetworkEye - a iOS network debug library";
label.textAlignment=NSTextAlignmentCenter;

UIButton *btGoMonitorViewController=[UIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:btGoMonitorViewController];
Expand Down
4 changes: 2 additions & 2 deletions NetworkEye/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.7</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.9.7</string>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
6 changes: 5 additions & 1 deletion NetworkEye/NetworkEye/NEHTTPModelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
FMDatabaseQueue *sqliteDatabase;
NSMutableArray *allobjects;
}

@property(nonatomic,strong) NSString *sqlitePassword;
@property(nonatomic,assign) int saveRequestMaxCount;

/**
* get recorded requests 's SQLite filename
*
Expand All @@ -32,7 +36,7 @@
/**
* create NEHTTPModel table
*/
+(void)createTable;
-(void)createTable;


/**
Expand Down
25 changes: 18 additions & 7 deletions NetworkEye/NetworkEye/NEHTTPModelManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@

@implementation NEHTTPModelManager

- (id)init
{
self = [super init];
if (self) {
_sqlitePassword=kSQLitePassword;
self.saveRequestMaxCount=kSaveRequestMaxCount;
}
return self;
}

+(NEHTTPModelManager *)defaultManager{

static NEHTTPModelManager *staticManager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
staticManager=[[NEHTTPModelManager alloc] init];
[NEHTTPModelManager createTable];
[staticManager createTable];

});
return staticManager;

Expand All @@ -38,14 +49,14 @@ + (NSString *)filename{
return str;
}

+(void)createTable{
- (void)createTable{

NSMutableString *init_sqls=[NSMutableString stringWithCapacity:1024];
[init_sqls appendFormat:@"create table if not exists nenetworkhttpeyes(myID double primary key,startDateString text,endDateString text,requestURLString text,requestCachePolicy text,requestTimeoutInterval double,requestHTTPMethod text,requestAllHTTPHeaderFields text,requestHTTPBody text,responseMIMEType text,responseExpectedContentLength text,responseTextEncodingName text,responseSuggestedFilename text,responseStatusCode int,responseAllHeaderFields text,receiveJSONData text);"];

FMDatabaseQueue *queue= [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]];
[queue inDatabase:^(FMDatabase *db) {
[db setKey:kSQLitePassword];
[db setKey:_sqlitePassword];
[db executeUpdate:init_sqls];
}];

Expand All @@ -72,7 +83,7 @@ -(void)addModel:(NEHTTPModel *) aModel{
receiveJSONData=[self stringToSQLFilter:aModel.receiveJSONData];
NSString *sql=[NSString stringWithFormat:@"insert into nenetworkhttpeyes values('%lf','%@','%@','%@','%@','%lf','%@','%@','%@','%@','%@','%@','%@','%d','%@','%@')",aModel.myID,aModel.startDateString,aModel.endDateString,aModel.requestURLString,aModel.requestCachePolicy,aModel.requestTimeoutInterval,aModel.requestHTTPMethod,aModel.requestAllHTTPHeaderFields,aModel.requestHTTPBody,aModel.responseMIMEType,aModel.responseExpectedContentLength,aModel.responseTextEncodingName,aModel.responseSuggestedFilename,aModel.responseStatusCode,[self stringToSQLFilter:aModel.responseAllHeaderFields],receiveJSONData];
[queue inDatabase:^(FMDatabase *db) {
[db setKey:kSQLitePassword];
[db setKey:_sqlitePassword];
[db executeUpdate:sql];
}];

Expand All @@ -86,7 +97,7 @@ -(NSMutableArray *)allobjects{
NSString *sql =[NSString stringWithFormat:@"select * from nenetworkhttpeyes order by myID desc"];
NSMutableArray *array=[NSMutableArray array];
[queue inDatabase:^(FMDatabase *db) {
[db setKey:kSQLitePassword];
[db setKey:_sqlitePassword];
FMResultSet *rs = [db executeQuery:sql];
while ([rs next]) {
NEHTTPModel *model=[[NEHTTPModel alloc] init];
Expand All @@ -110,7 +121,7 @@ -(NSMutableArray *)allobjects{
}
}];

if (array.count>=kSaveRequestMaxCount) {
if (array.count>=self.saveRequestMaxCount) {
[[NSUserDefaults standardUserDefaults] setObject:@"a" forKey:@"nenetworkhttpeyecache"];
}

Expand All @@ -123,7 +134,7 @@ - (void) deleteAllItem{
NSString *sql=[NSString stringWithFormat:@"delete from nenetworkhttpeyes"];
FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]];
[queue inDatabase:^(FMDatabase *db) {
[db setKey:kSQLitePassword];
[db setKey:_sqlitePassword];
[db executeUpdate:sql];
}];

Expand Down
6 changes: 1 addition & 5 deletions NetworkEye/NetworkEye/NEURLSessionConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ - (void)swizzleSelector:(SEL)selector fromClass:(Class)original toClass:(Class)s
}

- (NSArray *)protocolClasses {
BOOL NetworkEyeEnable=[[[NSUserDefaults standardUserDefaults] objectForKey:@"NetworkEyeEnable"] boolValue];

// if (!NetworkEyeEnable) {
// return @[];
// }

return @[[NEHTTPEye class]];//如果需要导入其他的自定义NSURLProtocol请在这里增加,当然在使用NSURLSessionConfiguration时增加也可以
}

Expand Down
Binary file added NetworkEye/Resources/networkeye1_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ welcome to new pull request,that fix bug,add new features,add support other plat

```ruby
platform :ios, '7.0'
pod 'NetworkEye', '~> 0.9.9'
pod 'NetworkEye', '~> 1.0'
```


Expand Down Expand Up @@ -58,14 +58,19 @@ the database name is networkeye.sqlite,and stored in the cache directory.
#define kSaveRequestMaxCount 300
</pre>

you can change it use NEHTTPModelManager
<pre>
[NEHTTPModelManager defaultManager].saveRequestMaxCount=300;
[NEHTTPModelManager defaultManager].sqlitePassword=@"networkeye";
</pre>
NetworkEye rely FMDB and SQLCipher。
FMDB be used to store data,SQLCipher be used to encrypt the database。

Monitoring data interface supports some search conditions ,it is URL,statusCode,HTTPMethod,MIMEType。
####Preview
the monitor data interface of NetworkEye:

<img src="https://raw.githubusercontent.com/coderyi/NetworkEye/master/NetworkEye/Resources/networkeye1_2.png" width="320" height="570">
<img src="https://raw.githubusercontent.com/coderyi/NetworkEye/master/NetworkEye/Resources/networkeye1_3.png" width="320" height="570">

<img src="https://raw.githubusercontent.com/coderyi/NetworkEye/master/NetworkEye/Resources/networkeye2.png" width="320" height="570">

Expand Down

0 comments on commit b91567b

Please sign in to comment.