Skip to content

Commit

Permalink
JCRequester and JCNetworkReachability
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoych committed Jun 10, 2016
1 parent eec900d commit dd911d5
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 33 deletions.
54 changes: 36 additions & 18 deletions JCNetworking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

/* Begin PBXBuildFile section */
05A926779BF40BBF06BBF14A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 580BE4179B4567E57A50E8F8 /* libPods.a */; };
0FC2D0F11D0659C600C6FAA2 /* JCNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */; };
0FF08B8C1CD9D67900B6C820 /* JCBaseRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FF08B8B1CD9D67900B6C820 /* JCBaseRequest.m */; };
0FF08B951CD9ED4200B6C820 /* JCNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */; };
230C431F1C8C0315002D6D52 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 230C431E1C8C0315002D6D52 /* main.m */; };
230C43221C8C0315002D6D52 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 230C43211C8C0315002D6D52 /* AppDelegate.m */; };
230C43251C8C0315002D6D52 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 230C43241C8C0315002D6D52 /* ViewController.m */; };
Expand All @@ -22,19 +19,16 @@
236334B41D090712001932B9 /* JCDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334AD1D090712001932B9 /* JCDownloadOperation.m */; };
236334B51D090712001932B9 /* JCDownloadQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334B01D090712001932B9 /* JCDownloadQueue.m */; };
236334B61D090712001932B9 /* JCDownloadUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334B21D090712001932B9 /* JCDownloadUtilities.m */; };
236334CF1D0A5F77001932B9 /* JCBaseRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334C81D0A5F77001932B9 /* JCBaseRequest.m */; };
236334D01D0A5F77001932B9 /* JCNetworkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334CA1D0A5F77001932B9 /* JCNetworkManager.m */; };
236334D61D0A62C7001932B9 /* JCNetworkReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 236334D51D0A62C7001932B9 /* JCNetworkReachability.m */; };
2394E7441D025E02002A200F /* JCLargeFileDownloadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E73E1D025E02002A200F /* JCLargeFileDownloadViewController.m */; };
2394E7451D025E02002A200F /* JCTImageDownloadCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E7401D025E02002A200F /* JCTImageDownloadCell.m */; };
2394E7461D025E02002A200F /* JCTImageDownloadItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 2394E7421D025E02002A200F /* JCTImageDownloadItem.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0FBFB0321C1BCC0400B5A45D /* JCNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCNetworking.h; sourceTree = "<group>"; };
0FC2D0EF1D0659C600C6FAA2 /* JCNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkReachabilityManager.h; sourceTree = "<group>"; };
0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkReachabilityManager.m; sourceTree = "<group>"; };
0FF08B8A1CD9D67900B6C820 /* JCBaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCBaseRequest.h; sourceTree = "<group>"; };
0FF08B8B1CD9D67900B6C820 /* JCBaseRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCBaseRequest.m; sourceTree = "<group>"; };
0FF08B931CD9ED4200B6C820 /* JCNetworkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkManager.h; sourceTree = "<group>"; };
0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkManager.m; sourceTree = "<group>"; };
230C431B1C8C0315002D6D52 /* JCNetworkingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JCNetworkingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
230C431E1C8C0315002D6D52 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
230C43201C8C0315002D6D52 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand All @@ -57,6 +51,13 @@
236334B11D090712001932B9 /* JCDownloadUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadUtilities.h; sourceTree = "<group>"; };
236334B21D090712001932B9 /* JCDownloadUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadUtilities.m; sourceTree = "<group>"; };
236334B71D09075B001932B9 /* JCDownloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCDownloader.h; sourceTree = "<group>"; };
236334C71D0A5F77001932B9 /* JCBaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCBaseRequest.h; sourceTree = "<group>"; };
236334C81D0A5F77001932B9 /* JCBaseRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCBaseRequest.m; sourceTree = "<group>"; };
236334C91D0A5F77001932B9 /* JCNetworkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkManager.h; sourceTree = "<group>"; };
236334CA1D0A5F77001932B9 /* JCNetworkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkManager.m; sourceTree = "<group>"; };
236334D21D0A5FE7001932B9 /* JCRequester.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCRequester.h; sourceTree = "<group>"; };
236334D41D0A62C7001932B9 /* JCNetworkReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkReachability.h; sourceTree = "<group>"; };
236334D51D0A62C7001932B9 /* JCNetworkReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkReachability.m; sourceTree = "<group>"; };
2394E73D1D025E02002A200F /* JCLargeFileDownloadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCLargeFileDownloadViewController.h; sourceTree = "<group>"; };
2394E73E1D025E02002A200F /* JCLargeFileDownloadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCLargeFileDownloadViewController.m; sourceTree = "<group>"; };
2394E73F1D025E02002A200F /* JCTImageDownloadCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCTImageDownloadCell.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -104,12 +105,8 @@
isa = PBXGroup;
children = (
0FBFB0321C1BCC0400B5A45D /* JCNetworking.h */,
0FF08B8A1CD9D67900B6C820 /* JCBaseRequest.h */,
0FF08B8B1CD9D67900B6C820 /* JCBaseRequest.m */,
0FF08B931CD9ED4200B6C820 /* JCNetworkManager.h */,
0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */,
0FC2D0EF1D0659C600C6FAA2 /* JCNetworkReachabilityManager.h */,
0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */,
236334D31D0A62C7001932B9 /* JCNetworkReachability */,
236334C21D0A5F77001932B9 /* JCRequester */,
236334A91D090712001932B9 /* JCDownloader */,
);
path = JCNetworking;
Expand Down Expand Up @@ -166,6 +163,27 @@
path = JCDownloader;
sourceTree = "<group>";
};
236334C21D0A5F77001932B9 /* JCRequester */ = {
isa = PBXGroup;
children = (
236334C71D0A5F77001932B9 /* JCBaseRequest.h */,
236334C81D0A5F77001932B9 /* JCBaseRequest.m */,
236334C91D0A5F77001932B9 /* JCNetworkManager.h */,
236334CA1D0A5F77001932B9 /* JCNetworkManager.m */,
236334D21D0A5FE7001932B9 /* JCRequester.h */,
);
path = JCRequester;
sourceTree = "<group>";
};
236334D31D0A62C7001932B9 /* JCNetworkReachability */ = {
isa = PBXGroup;
children = (
236334D41D0A62C7001932B9 /* JCNetworkReachability.h */,
236334D51D0A62C7001932B9 /* JCNetworkReachability.m */,
);
path = JCNetworkReachability;
sourceTree = "<group>";
};
2394E73A1D025E02002A200F /* Classes */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -315,17 +333,17 @@
230C43251C8C0315002D6D52 /* ViewController.m in Sources */,
230C43221C8C0315002D6D52 /* AppDelegate.m in Sources */,
2394E7451D025E02002A200F /* JCTImageDownloadCell.m in Sources */,
0FC2D0F11D0659C600C6FAA2 /* JCNetworkReachabilityManager.m in Sources */,
232DD32D1D05B9E300D820BF /* JCWeixinSSOManager.m in Sources */,
0FF08B951CD9ED4200B6C820 /* JCNetworkManager.m in Sources */,
2394E7461D025E02002A200F /* JCTImageDownloadItem.m in Sources */,
2394E7441D025E02002A200F /* JCLargeFileDownloadViewController.m in Sources */,
236334D01D0A5F77001932B9 /* JCNetworkManager.m in Sources */,
230C431F1C8C0315002D6D52 /* main.m in Sources */,
236334D61D0A62C7001932B9 /* JCNetworkReachability.m in Sources */,
236334B31D090712001932B9 /* JCDownloadAgent.m in Sources */,
236334B41D090712001932B9 /* JCDownloadOperation.m in Sources */,
236334B51D090712001932B9 /* JCDownloadQueue.m in Sources */,
0FF08B8C1CD9D67900B6C820 /* JCBaseRequest.m in Sources */,
236334B61D090712001932B9 /* JCDownloadUtilities.m in Sources */,
236334CF1D0A5F77001932B9 /* JCBaseRequest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
12 changes: 6 additions & 6 deletions JCNetworking/JCDownloader/JCDownloadOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ typedef NS_ENUM(NSInteger, JCDownloadStatus) {

@end

extern NSString *const JCDownloadProgressNotification; //下载进度通知
extern NSString *const JCDownloadCompletionNotification; //下载完成通知
extern NSString *const JCDownloadIdKey; //下载Id Key,值为NSString对象
extern NSString *const JCDownloadProgressKey; //下载进度Key,值为NSProgress对象
extern NSString *const JCDownloadCompletionFilePathKey; //文件路径Key,值为NSURL对象
extern NSString *const JCDownloadCompletionErrorKey; //下载出错Key,值为NSError对象
FOUNDATION_EXPORT NSString *const JCDownloadProgressNotification; //下载进度通知
FOUNDATION_EXPORT NSString *const JCDownloadCompletionNotification; //下载完成通知
FOUNDATION_EXPORT NSString *const JCDownloadIdKey; //下载Id Key,值为NSString对象
FOUNDATION_EXPORT NSString *const JCDownloadProgressKey; //下载进度Key,值为NSProgress对象
FOUNDATION_EXPORT NSString *const JCDownloadCompletionFilePathKey; //文件路径Key,值为NSURL对象
FOUNDATION_EXPORT NSString *const JCDownloadCompletionErrorKey; //下载出错Key,值为NSError对象

/** 文件下载进度Block回调 */
typedef void(^JCDownloadProgressBlock)(NSProgress *progress);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// JCNetworkReachabilityManager.h
// JCNetworkReachability.h
// JCNetworking
//
// Created by ChenJianjun on 16/6/7.
Expand All @@ -12,7 +12,7 @@
FOUNDATION_EXPORT NSString * const JCNetworkingReachabilityDidChangeNotification;

/** 网络状态管理类 */
@interface JCNetworkReachabilityManager : NSObject
@interface JCNetworkReachability : NSObject

/** 是否连接网络 */
+ (BOOL)isReachable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//
// JCNetworkReachabilityManager.m
// JCNetworkReachability.m
// JCNetworking
//
// Created by ChenJianjun on 16/6/7.
// Copyright © 2016 Boych<https://github.com/Boych>. All rights reserved.
//

#import "JCNetworkReachabilityManager.h"
#import "JCNetworkReachability.h"
#import <AFNetworking/AFNetworking.h>

NSString * const JCNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change";

@implementation JCNetworkReachabilityManager
@implementation JCNetworkReachability

+ (BOOL)isReachable
{
Expand Down
7 changes: 3 additions & 4 deletions JCNetworking/JCNetworking.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
#ifndef JCNetworking_h
#define JCNetworking_h

#import "JCBaseRequest.h"
#import "JCNetworkManager.h"
#import "JCNetworkReachabilityManager.h"

#import "JCRequester.h"
#import "JCDownloader.h"

#import "JCNetworkReachability.h"

#endif /* JCNetworking_h */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions JCNetworking/JCRequester/JCRequester.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// JCRequester.h
// JCNetworking
//
// Created by ChenJianjun on 16/6/10.
// Copyright © 2016年 Boych<https://github.com/Boych>. All rights reserved.
//

#ifndef JCRequester_h
#define JCRequester_h

#import "JCBaseRequest.h"
#import "JCNetworkManager.h"

#endif /* JCRequester_h */

0 comments on commit dd911d5

Please sign in to comment.