From 990da95cb071a05c4e68dda298ef8afe7e6090a5 Mon Sep 17 00:00:00 2001 From: BB9z Date: Tue, 24 Apr 2018 13:00:02 +0800 Subject: [PATCH 1/2] #doc fix typo. [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3720d2f..009e297 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ pod 'RFAPI' Specify develop branch to install the lastest version: ```ruby -pod 'RFMessageManager', +pod 'RFAPI', :git => 'https://github.com/RFUI/RFAPI.git', :branch => 'develop' ``` From 6239b1e9bdadb390347dd2f150a41e28db76311e Mon Sep 17 00:00:00 2001 From: BB9z Date: Mon, 29 Apr 2019 19:16:41 +0800 Subject: [PATCH 2/2] Upgrade RFMessageManager. --- Example/iOS-Swift/RFDAPITestViewController.m | 11 ++++++----- Example/iOS-Swift/RFDTestAPI.m | 8 ++++---- Example/iOS-Swift/TestAPIDefine.plist | 7 +++++++ Podfile | 2 +- RFAPI.h | 4 ++-- RFAPI.m | 8 ++++---- RFAPI.podspec | 8 ++++---- RFAPI.xcodeproj/project.pbxproj | 15 ++++++--------- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/Example/iOS-Swift/RFDAPITestViewController.m b/Example/iOS-Swift/RFDAPITestViewController.m index 1a1e3b4..f55bdd2 100644 --- a/Example/iOS-Swift/RFDAPITestViewController.m +++ b/Example/iOS-Swift/RFDAPITestViewController.m @@ -31,8 +31,12 @@ - (void)viewDidLoad { r4.title = @"Empty object"; r4.APIName = @"ObjEmpty"; // r4 no progress + + RFDAPITestRequestObject *r5 = [RFDAPITestRequestObject new]; + r5.title = @"Fail request"; + r5.APIName = @"NotFound"; - self.items = @[ r1, r2, r3, r4 ]; + self.items = @[ r1, r2, r3, r4, r5 ]; } #pragma mark - List @@ -54,10 +58,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath [RFDTestAPI requestWithName:requestDefine.APIName parameters:nil viewController:self forceLoad:NO loadingMessage:requestDefine.message modal:requestDefine.modal success:^(AFHTTPRequestOperation *operation, id responseObject) { @strongify(self); [self displayResponse:responseObject error:nil]; - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - @strongify(self); - [self displayResponse:nil error:error]; - } completion:nil]; + } failure:nil completion:nil]; } - (void)displayResponse:(id)responseObject error:(NSError *)error { diff --git a/Example/iOS-Swift/RFDTestAPI.m b/Example/iOS-Swift/RFDTestAPI.m index df9ad65..b2b6467 100644 --- a/Example/iOS-Swift/RFDTestAPI.m +++ b/Example/iOS-Swift/RFDTestAPI.m @@ -2,7 +2,7 @@ #import "RFDTestAPI.h" #import "AFURLResponseSerialization.h" #import -#import +#import @interface RFDTestAPI () @end @@ -13,7 +13,7 @@ + (instancetype)sharedInstance { static id sharedInstance = nil; static dispatch_once_t oncePredicate; dispatch_once(&oncePredicate, ^{ - sharedInstance = [[self alloc] init]; + sharedInstance = [self.alloc init]; }); return sharedInstance; } @@ -32,13 +32,13 @@ - (void)onInit { + (AFHTTPRequestOperation *)requestWithName:(NSString *)APIName parameters:(NSDictionary *)parameters viewController:(UIViewController *)viewController forceLoad:(BOOL)forceLoad loadingMessage:(NSString *)message modal:(BOOL)modal success:(void (^)(AFHTTPRequestOperation *, id))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure completion:(void (^)(AFHTTPRequestOperation *))completion { RFAPIControl *cn = [[RFAPIControl alloc] init]; if (message) { - cn.message = [[RFNetworkActivityIndicatorMessage alloc] initWithIdentifier:APIName title:nil message:message status:RFNetworkActivityIndicatorStatusLoading]; + cn.message = [[RFNetworkActivityMessage alloc] initWithIdentifier:APIName message:message status:RFNetworkActivityStatusLoading]; cn.message.modal = modal; } cn.identifier = APIName; cn.groupIdentifier = viewController.APIGroupIdentifier; cn.forceLoad = forceLoad; - return [[self sharedInstance] requestWithName:APIName parameters:parameters controlInfo:cn success:success failure:failure completion:completion]; + return [self.sharedInstance requestWithName:APIName parameters:parameters controlInfo:cn success:success failure:failure completion:completion]; } @end diff --git a/Example/iOS-Swift/TestAPIDefine.plist b/Example/iOS-Swift/TestAPIDefine.plist index 2602cee..39d25c4 100644 --- a/Example/iOS-Swift/TestAPIDefine.plist +++ b/Example/iOS-Swift/TestAPIDefine.plist @@ -57,5 +57,12 @@ Response Class RFDTestEntity + NotFound + + Path + 404.json + Response Type + 0 + diff --git a/Podfile b/Podfile index 724c121..51bd6b6 100644 --- a/Podfile +++ b/Podfile @@ -1,7 +1,7 @@ target 'Example-iOS' do platform :ios, '8.0' - pod 'RFMessageManager', :subspecs => ['SVProgressHUD'] + pod 'RFMessageManager', :subspecs => ['SVProgressHUD'], :git => 'https://github.com/RFUI/RFMessageManager.git', :branch => 'develop' pod 'RFAPI', :path => '.' target 'Test-iOS' do diff --git a/RFAPI.h b/RFAPI.h index 01a1018..916aac0 100644 --- a/RFAPI.h +++ b/RFAPI.h @@ -16,7 +16,7 @@ @class AFSecurityPolicy; @protocol AFMultipartFormData; -@class RFMessageManager, RFNetworkActivityIndicatorMessage, AFHTTPRequestOperation; +@class RFMessageManager, RFNetworkActivityMessage, AFHTTPRequestOperation; @class RFAPIControl, RFHTTPRequestFormData; @@ -171,7 +171,7 @@ extern NSString *_Nonnull const RFAPIRequestCustomizationControlKey; /** Activity message. 请求开始前,自动进入消息显示队列。结束时自动从队列中清除。 */ -@property (nullable, strong) RFNetworkActivityIndicatorMessage *message; +@property (nullable, strong) RFNetworkActivityMessage *message; /// Identifier for request. @property (nullable, copy) NSString *identifier; diff --git a/RFAPI.m b/RFAPI.m index c9b8480..a615f7e 100644 --- a/RFAPI.m +++ b/RFAPI.m @@ -121,12 +121,12 @@ - (nullable AFHTTPRequestOperation *)requestWithName:(nonnull NSString *)APIName // Request object get ready. // Build operation block. - RFNetworkActivityIndicatorMessage *message = controlInfo.message; + RFNetworkActivityMessage *message = controlInfo.message; void (^operationCompletion)(id) = ^(AFHTTPRequestOperation *blockOp) { dispatch_async_on_main(^{ NSString *mid = message.identifier; if (mid) { - [self.networkActivityIndicatorManager hideWithIdentifier:mid]; + [self.networkActivityIndicatorManager hideMessage:message]; } if (completion) { @@ -157,7 +157,7 @@ - (nullable AFHTTPRequestOperation *)requestWithName:(nonnull NSString *)APIName failure(blockOp, blockError); } else { - [self.networkActivityIndicatorManager alertError:blockError title:@"请求失败"]; + [self.networkActivityIndicatorManager alertError:blockError title:nil fallbackMessage:@"Request Failed"]; } }; operationCompletion(blockOp); @@ -417,7 +417,7 @@ - (nonnull id)initWithIdentifier:(nonnull NSString *)identifier loadingMessage:( self = [super init]; if (self) { _identifier = identifier; - _message = [[RFNetworkActivityIndicatorMessage alloc] initWithIdentifier:identifier title:nil message:message status:RFNetworkActivityIndicatorStatusLoading]; + _message = [[RFNetworkActivityMessage alloc] initWithIdentifier:identifier message:message status:RFNetworkActivityStatusLoading]; } return self; } diff --git a/RFAPI.podspec b/RFAPI.podspec index cb820ca..a49bdfb 100644 --- a/RFAPI.podspec +++ b/RFAPI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RFAPI' - s.version = '1.1.0' + s.version = '1.2.0' s.summary = 'API Manager.' s.homepage = 'https://github.com/RFUI/RFAPI' @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.requires_arc = true s.osx.deployment_target = '10.8' - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '8.0' # s.tvos.deployment_target = '9.0' s.dependency 'JSONModel' @@ -22,8 +22,8 @@ Pod::Spec.new do |s| s.dependency 'RFKit/Category/NSDictionary' s.dependency 'RFKit/Category/NSFileManager' s.dependency 'RFInitializing', '>= 1.1' - s.dependency 'RFMessageManager/Manager', '>= 0.3' - s.dependency 'RFMessageManager/RFNetworkActivityIndicatorMessage' + s.dependency 'RFMessageManager/Manager', '>= 0.5' + s.dependency 'RFMessageManager/RFNetworkActivityMessage' s.source_files = ['*.{h,m}', 'RFAPIDefine/*.{h,m}'] s.public_header_files = ['*.h', 'RFAPIDefine/*.h'] diff --git a/RFAPI.xcodeproj/project.pbxproj b/RFAPI.xcodeproj/project.pbxproj index 03d0555..dee0749 100644 --- a/RFAPI.xcodeproj/project.pbxproj +++ b/RFAPI.xcodeproj/project.pbxproj @@ -281,7 +281,6 @@ D54183BE206B685000DD25CE = { CreatedOnToolsVersion = 9.2; LastSwiftMigration = 0920; - ProvisioningStyle = Automatic; }; D54183D8206BBA7B00DD25CE = { CreatedOnToolsVersion = 9.2; @@ -369,7 +368,7 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-resources.sh", + "${PODS_ROOT}/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-resources.sh", "${PODS_ROOT}/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle", ); name = "[CP] Copy Pods Resources"; @@ -378,7 +377,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-resources.sh\"\n"; showEnvVarsInLog = 0; }; 59B0456C642D28AD86304270 /* [CP] Check Pods Manifest.lock */ = { @@ -423,7 +422,7 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS-Test-iOS/Pods-Example-iOS-Test-iOS-resources.sh", + "${PODS_ROOT}/Target Support Files/Pods-Example-iOS-Test-iOS/Pods-Example-iOS-Test-iOS-resources.sh", "${PODS_ROOT}/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle", ); name = "[CP] Copy Pods Resources"; @@ -432,7 +431,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example-iOS-Test-iOS/Pods-Example-iOS-Test-iOS-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example-iOS-Test-iOS/Pods-Example-iOS-Test-iOS-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -534,10 +533,9 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ""; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -600,10 +598,9 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ""; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11;