From dd911d52cb1a4eff42068122488a570e73b49603 Mon Sep 17 00:00:00 2001 From: boych Date: Fri, 10 Jun 2016 17:39:46 +0800 Subject: [PATCH] JCRequester and JCNetworkReachability --- JCNetworking.xcodeproj/project.pbxproj | 54 ++++++++++++------- .../JCDownloader/JCDownloadOperation.h | 12 ++--- .../JCNetworkReachability.h} | 4 +- .../JCNetworkReachability.m} | 6 +-- JCNetworking/JCNetworking.h | 7 ++- .../{ => JCRequester}/JCBaseRequest.h | 0 .../{ => JCRequester}/JCBaseRequest.m | 0 .../{ => JCRequester}/JCNetworkManager.h | 0 .../{ => JCRequester}/JCNetworkManager.m | 0 JCNetworking/JCRequester/JCRequester.h | 15 ++++++ 10 files changed, 65 insertions(+), 33 deletions(-) rename JCNetworking/{JCNetworkReachabilityManager.h => JCNetworkReachability/JCNetworkReachability.h} (87%) rename JCNetworking/{JCNetworkReachabilityManager.m => JCNetworkReachability/JCNetworkReachability.m} (86%) rename JCNetworking/{ => JCRequester}/JCBaseRequest.h (100%) rename JCNetworking/{ => JCRequester}/JCBaseRequest.m (100%) rename JCNetworking/{ => JCRequester}/JCNetworkManager.h (100%) rename JCNetworking/{ => JCRequester}/JCNetworkManager.m (100%) create mode 100644 JCNetworking/JCRequester/JCRequester.h diff --git a/JCNetworking.xcodeproj/project.pbxproj b/JCNetworking.xcodeproj/project.pbxproj index e9cdcc5..382fb10 100644 --- a/JCNetworking.xcodeproj/project.pbxproj +++ b/JCNetworking.xcodeproj/project.pbxproj @@ -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 */; }; @@ -22,6 +19,9 @@ 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 */; }; @@ -29,12 +29,6 @@ /* Begin PBXFileReference section */ 0FBFB0321C1BCC0400B5A45D /* JCNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCNetworking.h; sourceTree = ""; }; - 0FC2D0EF1D0659C600C6FAA2 /* JCNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkReachabilityManager.h; sourceTree = ""; }; - 0FC2D0F01D0659C600C6FAA2 /* JCNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkReachabilityManager.m; sourceTree = ""; }; - 0FF08B8A1CD9D67900B6C820 /* JCBaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCBaseRequest.h; sourceTree = ""; }; - 0FF08B8B1CD9D67900B6C820 /* JCBaseRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCBaseRequest.m; sourceTree = ""; }; - 0FF08B931CD9ED4200B6C820 /* JCNetworkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkManager.h; sourceTree = ""; }; - 0FF08B941CD9ED4200B6C820 /* JCNetworkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkManager.m; sourceTree = ""; }; 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 = ""; }; 230C43201C8C0315002D6D52 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -57,6 +51,13 @@ 236334B11D090712001932B9 /* JCDownloadUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCDownloadUtilities.h; sourceTree = ""; }; 236334B21D090712001932B9 /* JCDownloadUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCDownloadUtilities.m; sourceTree = ""; }; 236334B71D09075B001932B9 /* JCDownloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCDownloader.h; sourceTree = ""; }; + 236334C71D0A5F77001932B9 /* JCBaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCBaseRequest.h; sourceTree = ""; }; + 236334C81D0A5F77001932B9 /* JCBaseRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCBaseRequest.m; sourceTree = ""; }; + 236334C91D0A5F77001932B9 /* JCNetworkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkManager.h; sourceTree = ""; }; + 236334CA1D0A5F77001932B9 /* JCNetworkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkManager.m; sourceTree = ""; }; + 236334D21D0A5FE7001932B9 /* JCRequester.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JCRequester.h; sourceTree = ""; }; + 236334D41D0A62C7001932B9 /* JCNetworkReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCNetworkReachability.h; sourceTree = ""; }; + 236334D51D0A62C7001932B9 /* JCNetworkReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCNetworkReachability.m; sourceTree = ""; }; 2394E73D1D025E02002A200F /* JCLargeFileDownloadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCLargeFileDownloadViewController.h; sourceTree = ""; }; 2394E73E1D025E02002A200F /* JCLargeFileDownloadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JCLargeFileDownloadViewController.m; sourceTree = ""; }; 2394E73F1D025E02002A200F /* JCTImageDownloadCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCTImageDownloadCell.h; sourceTree = ""; }; @@ -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; @@ -166,6 +163,27 @@ path = JCDownloader; sourceTree = ""; }; + 236334C21D0A5F77001932B9 /* JCRequester */ = { + isa = PBXGroup; + children = ( + 236334C71D0A5F77001932B9 /* JCBaseRequest.h */, + 236334C81D0A5F77001932B9 /* JCBaseRequest.m */, + 236334C91D0A5F77001932B9 /* JCNetworkManager.h */, + 236334CA1D0A5F77001932B9 /* JCNetworkManager.m */, + 236334D21D0A5FE7001932B9 /* JCRequester.h */, + ); + path = JCRequester; + sourceTree = ""; + }; + 236334D31D0A62C7001932B9 /* JCNetworkReachability */ = { + isa = PBXGroup; + children = ( + 236334D41D0A62C7001932B9 /* JCNetworkReachability.h */, + 236334D51D0A62C7001932B9 /* JCNetworkReachability.m */, + ); + path = JCNetworkReachability; + sourceTree = ""; + }; 2394E73A1D025E02002A200F /* Classes */ = { isa = PBXGroup; children = ( @@ -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; }; diff --git a/JCNetworking/JCDownloader/JCDownloadOperation.h b/JCNetworking/JCDownloader/JCDownloadOperation.h index cc1a1bf..d24c39e 100644 --- a/JCNetworking/JCDownloader/JCDownloadOperation.h +++ b/JCNetworking/JCDownloader/JCDownloadOperation.h @@ -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); diff --git a/JCNetworking/JCNetworkReachabilityManager.h b/JCNetworking/JCNetworkReachability/JCNetworkReachability.h similarity index 87% rename from JCNetworking/JCNetworkReachabilityManager.h rename to JCNetworking/JCNetworkReachability/JCNetworkReachability.h index 52cb9bb..0c503d4 100644 --- a/JCNetworking/JCNetworkReachabilityManager.h +++ b/JCNetworking/JCNetworkReachability/JCNetworkReachability.h @@ -1,5 +1,5 @@ // -// JCNetworkReachabilityManager.h +// JCNetworkReachability.h // JCNetworking // // Created by ChenJianjun on 16/6/7. @@ -12,7 +12,7 @@ FOUNDATION_EXPORT NSString * const JCNetworkingReachabilityDidChangeNotification; /** 网络状态管理类 */ -@interface JCNetworkReachabilityManager : NSObject +@interface JCNetworkReachability : NSObject /** 是否连接网络 */ + (BOOL)isReachable; diff --git a/JCNetworking/JCNetworkReachabilityManager.m b/JCNetworking/JCNetworkReachability/JCNetworkReachability.m similarity index 86% rename from JCNetworking/JCNetworkReachabilityManager.m rename to JCNetworking/JCNetworkReachability/JCNetworkReachability.m index c0918d2..2b8aaf1 100644 --- a/JCNetworking/JCNetworkReachabilityManager.m +++ b/JCNetworking/JCNetworkReachability/JCNetworkReachability.m @@ -1,17 +1,17 @@ // -// JCNetworkReachabilityManager.m +// JCNetworkReachability.m // JCNetworking // // Created by ChenJianjun on 16/6/7. // Copyright © 2016 Boych. All rights reserved. // -#import "JCNetworkReachabilityManager.h" +#import "JCNetworkReachability.h" #import NSString * const JCNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; -@implementation JCNetworkReachabilityManager +@implementation JCNetworkReachability + (BOOL)isReachable { diff --git a/JCNetworking/JCNetworking.h b/JCNetworking/JCNetworking.h index c7252c7..b376d30 100644 --- a/JCNetworking/JCNetworking.h +++ b/JCNetworking/JCNetworking.h @@ -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 */ \ No newline at end of file diff --git a/JCNetworking/JCBaseRequest.h b/JCNetworking/JCRequester/JCBaseRequest.h similarity index 100% rename from JCNetworking/JCBaseRequest.h rename to JCNetworking/JCRequester/JCBaseRequest.h diff --git a/JCNetworking/JCBaseRequest.m b/JCNetworking/JCRequester/JCBaseRequest.m similarity index 100% rename from JCNetworking/JCBaseRequest.m rename to JCNetworking/JCRequester/JCBaseRequest.m diff --git a/JCNetworking/JCNetworkManager.h b/JCNetworking/JCRequester/JCNetworkManager.h similarity index 100% rename from JCNetworking/JCNetworkManager.h rename to JCNetworking/JCRequester/JCNetworkManager.h diff --git a/JCNetworking/JCNetworkManager.m b/JCNetworking/JCRequester/JCNetworkManager.m similarity index 100% rename from JCNetworking/JCNetworkManager.m rename to JCNetworking/JCRequester/JCNetworkManager.m diff --git a/JCNetworking/JCRequester/JCRequester.h b/JCNetworking/JCRequester/JCRequester.h new file mode 100644 index 0000000..c51ac22 --- /dev/null +++ b/JCNetworking/JCRequester/JCRequester.h @@ -0,0 +1,15 @@ +// +// JCRequester.h +// JCNetworking +// +// Created by ChenJianjun on 16/6/10. +// Copyright © 2016年 Boych. All rights reserved. +// + +#ifndef JCRequester_h +#define JCRequester_h + +#import "JCBaseRequest.h" +#import "JCNetworkManager.h" + +#endif /* JCRequester_h */