Skip to content

Commit b91567b

Browse files
committed
publish 1.0,this is first release version
1 parent 65f997f commit b91567b

9 files changed

Lines changed: 38 additions & 20 deletions

File tree

NetworkEye.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = "NetworkEye"
3-
s.version = "0.9.9"
3+
s.version = "1.0"
44
s.summary = "NetworkEye - a iOS network debug library ,It can monitor HTTP requests within the App and displays information related to the request."
55
s.homepage = "https://github.com/coderyi/NetworkEye"
66
s.license = "MIT"
77
s.authors = { "coderyi" => "coderyi@163.com" }
8-
s.source = { :git => "https://github.com/coderyi/NetworkEye.git", :tag => "0.9.9" }
8+
s.source = { :git => "https://github.com/coderyi/NetworkEye.git", :tag => "1.0" }
99
s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit'
1010
s.library = "sqlite3"
1111
s.platform = :ios, '7.0'

NetworkEye/AppDelegate.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "AppDelegate.h"
1010
#import "DemoViewController.h"
1111
#import "NEHTTPEye.h"
12+
#import "NetworkEye/NEHTTPModelManager.h"
1213
@interface AppDelegate ()
1314

1415
@end

NetworkEye/DemoViewController.m

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

4647
UIButton *btGoMonitorViewController=[UIButton buttonWithType:UIButtonTypeCustom];
4748
[self.view addSubview:btGoMonitorViewController];

NetworkEye/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.9.7</string>
18+
<string>1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.9.7</string>
22+
<string>1.0</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSAppTransportSecurity</key>

NetworkEye/NetworkEye/NEHTTPModelManager.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
FMDatabaseQueue *sqliteDatabase;
1616
NSMutableArray *allobjects;
1717
}
18+
19+
@property(nonatomic,strong) NSString *sqlitePassword;
20+
@property(nonatomic,assign) int saveRequestMaxCount;
21+
1822
/**
1923
* get recorded requests 's SQLite filename
2024
*
@@ -32,7 +36,7 @@
3236
/**
3337
* create NEHTTPModel table
3438
*/
35-
+(void)createTable;
39+
-(void)createTable;
3640

3741

3842
/**

NetworkEye/NetworkEye/NEHTTPModelManager.m

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,24 @@
1919

2020
@implementation NEHTTPModelManager
2121

22+
- (id)init
23+
{
24+
self = [super init];
25+
if (self) {
26+
_sqlitePassword=kSQLitePassword;
27+
self.saveRequestMaxCount=kSaveRequestMaxCount;
28+
}
29+
return self;
30+
}
31+
2232
+(NEHTTPModelManager *)defaultManager{
2333

2434
static NEHTTPModelManager *staticManager;
2535
static dispatch_once_t onceToken;
2636
dispatch_once(&onceToken, ^{
2737
staticManager=[[NEHTTPModelManager alloc] init];
28-
[NEHTTPModelManager createTable];
38+
[staticManager createTable];
39+
2940
});
3041
return staticManager;
3142

@@ -38,14 +49,14 @@ + (NSString *)filename{
3849
return str;
3950
}
4051

41-
+(void)createTable{
52+
- (void)createTable{
4253

4354
NSMutableString *init_sqls=[NSMutableString stringWithCapacity:1024];
4455
[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);"];
4556

4657
FMDatabaseQueue *queue= [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]];
4758
[queue inDatabase:^(FMDatabase *db) {
48-
[db setKey:kSQLitePassword];
59+
[db setKey:_sqlitePassword];
4960
[db executeUpdate:init_sqls];
5061
}];
5162

@@ -72,7 +83,7 @@ -(void)addModel:(NEHTTPModel *) aModel{
7283
receiveJSONData=[self stringToSQLFilter:aModel.receiveJSONData];
7384
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];
7485
[queue inDatabase:^(FMDatabase *db) {
75-
[db setKey:kSQLitePassword];
86+
[db setKey:_sqlitePassword];
7687
[db executeUpdate:sql];
7788
}];
7889

@@ -86,7 +97,7 @@ -(NSMutableArray *)allobjects{
8697
NSString *sql =[NSString stringWithFormat:@"select * from nenetworkhttpeyes order by myID desc"];
8798
NSMutableArray *array=[NSMutableArray array];
8899
[queue inDatabase:^(FMDatabase *db) {
89-
[db setKey:kSQLitePassword];
100+
[db setKey:_sqlitePassword];
90101
FMResultSet *rs = [db executeQuery:sql];
91102
while ([rs next]) {
92103
NEHTTPModel *model=[[NEHTTPModel alloc] init];
@@ -110,7 +121,7 @@ -(NSMutableArray *)allobjects{
110121
}
111122
}];
112123

113-
if (array.count>=kSaveRequestMaxCount) {
124+
if (array.count>=self.saveRequestMaxCount) {
114125
[[NSUserDefaults standardUserDefaults] setObject:@"a" forKey:@"nenetworkhttpeyecache"];
115126
}
116127

@@ -123,7 +134,7 @@ - (void) deleteAllItem{
123134
NSString *sql=[NSString stringWithFormat:@"delete from nenetworkhttpeyes"];
124135
FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:[NEHTTPModelManager filename]];
125136
[queue inDatabase:^(FMDatabase *db) {
126-
[db setKey:kSQLitePassword];
137+
[db setKey:_sqlitePassword];
127138
[db executeUpdate:sql];
128139
}];
129140

NetworkEye/NetworkEye/NEURLSessionConfiguration.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ - (void)swizzleSelector:(SEL)selector fromClass:(Class)original toClass:(Class)s
5757
}
5858

5959
- (NSArray *)protocolClasses {
60-
BOOL NetworkEyeEnable=[[[NSUserDefaults standardUserDefaults] objectForKey:@"NetworkEyeEnable"] boolValue];
61-
62-
// if (!NetworkEyeEnable) {
63-
// return @[];
64-
// }
60+
6561
return @[[NEHTTPEye class]];//如果需要导入其他的自定义NSURLProtocol请在这里增加,当然在使用NSURLSessionConfiguration时增加也可以
6662
}
6763

326 KB
Loading

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ welcome to new pull request,that fix bug,add new features,add support other plat
2121

2222
```ruby
2323
platform :ios, '7.0'
24-
pod 'NetworkEye', '~> 0.9.9'
24+
pod 'NetworkEye', '~> 1.0'
2525
```
2626

2727

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

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

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

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

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

0 commit comments

Comments
 (0)