Skip to content

Commit

Permalink
1.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bawn committed Aug 25, 2017
1 parent 1033ed9 commit 9c4cae6
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 54 deletions.
3 changes: 1 addition & 2 deletions LCNetwork.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LCNetwork"
s.version = "1.3.5"
s.version = "1.4.0"
s.summary = "基于AFNetworking的网络库封装"
s.homepage = "https://github.com/bawn/LCNetwork"
s.license = 'MIT'
Expand All @@ -10,6 +10,5 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.source_files = 'LCNetwork/*.{h,m}'
s.dependency "AFNetworking"
s.dependency "TMCache", "~> 2.1.0"
s.framework = "CFNetwork"
end
10 changes: 0 additions & 10 deletions LCNetwork/LCBaseRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ typedef NS_ENUM(NSInteger , LCRequestSerializerType) {
*/
- (BOOL)useViceUrl;

/**
* 是否缓存数据 response 数据
*
* @return 是否缓存数据 response 数据
*/
- (BOOL)cacheResponse;

// 是否缓存数据 response 数据(旧版)
- (BOOL)withoutCache DEPRECATED_MSG_ATTRIBUTE("使用 - (BOOL)cacheResponse");

/**
* 自定义超时时间
Expand Down Expand Up @@ -237,7 +228,6 @@ typedef NS_ENUM(NSInteger , LCRequestSerializerType) {
@property (nonatomic, assign, readonly) BOOL isSuccess;

@property (nonatomic, strong) NSError *error;
@property (nonatomic, strong, readonly) id cacheJson;
@property (nonatomic, strong, readonly) NSString *urlString;
@property (nonatomic, strong, readonly) NSMutableArray *requestAccessories;
@property (nonatomic, copy) void (^successCompletionBlock)(LCBaseRequest *);
Expand Down
12 changes: 1 addition & 11 deletions LCNetwork/LCBaseRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
#import "LCBaseRequest.h"
#import "LCNetworkAgent.h"
#import "LCNetworkConfig.h"
#import "TMCache.h"

@interface LCBaseRequest ()

@property (nonatomic, strong) id cacheJson;
@property (nonatomic, weak) id<LCAPIRequest> child;
@property (nonatomic, strong) NSMutableArray *requestAccessories;
@property (nonatomic, strong) LCNetworkConfig *config;
Expand Down Expand Up @@ -137,7 +135,7 @@ - (BOOL)isSuccess{
BOOL isFail = [self.config.processRule isSuccess:_responseJSONObject];
return isFail;
}
return NO;
return YES;
}

- (NSString *)urlString{
Expand Down Expand Up @@ -168,14 +166,6 @@ - (NSString *)urlString{
return [self.child apiMethodName];
}

- (id)cacheJson{
if (_cacheJson) {
return _cacheJson;
}
else{
return [[TMCache sharedCache].diskCache objectForKey:self.urlString];
}
}

- (void)stop{
[self toggleAccessoriesWillStopCallBack];
Expand Down
14 changes: 0 additions & 14 deletions LCNetwork/LCNetworkAgent.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import "LCNetworkConfig.h"
#import "LCBaseRequest.h"
#import "AFNetworking.h"
#import "TMCache.h"
#import "LCBaseRequest+Internal.h"

@interface LCNetworkAgent ()
Expand Down Expand Up @@ -202,19 +201,6 @@ - (void)handleRequestSuccess:(NSURLSessionDataTask *)sessionDataTask{
if (request) {
[request toggleAccessoriesWillStopCallBack];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// 更新缓存
if (([request.child respondsToSelector:@selector(withoutCache)] && [request.child withoutCache])) {
[[[TMCache sharedCache] diskCache] setObject:request.responseJSONObject forKey:request.urlString];
}
#pragma clang diagnostic pop

// 更新缓存
if (([request.child respondsToSelector:@selector(cacheResponse)] && [request.child cacheResponse])) {
[[[TMCache sharedCache] diskCache] setObject:request.responseJSONObject forKey:request.urlString];
}

if (request.delegate != nil && [request.delegate respondsToSelector:@selector(requestSuccess:)]) {
[request.delegate requestSuccess:request];
}
Expand Down
4 changes: 0 additions & 4 deletions LCNetworkDemo/LCNetworkDemo/Api1.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ - (LCRequestMethod)requestMethod{
return LCRequestMethodGet;
}

// 是否缓存数据
- (BOOL)cacheResponse{
return YES;
}

- (id)responseProcess:(id)responseObject{
return responseObject[@"Weather"];
Expand Down
5 changes: 0 additions & 5 deletions LCNetworkDemo/LCNetworkDemo/Api2.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ - (instancetype)initWith:(NSString *)lat lng:(NSString *)lng{
return self;
}


- (BOOL)cacheResponse{
return YES;
}

// 接口地址
- (NSString *)apiMethodName{
return @"geo2loc_2.aspx";
Expand Down
8 changes: 0 additions & 8 deletions LCNetworkDemo/LCNetworkDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ @implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];

// Api2 *api2 = [[Api2 alloc] init];
//
// if (api2.cacheJson) {
// self.city1.text = api2.cacheJson;
// }



}

- (IBAction)firstAction:(id)sender{
Expand Down

0 comments on commit 9c4cae6

Please sign in to comment.