TemplateInfo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +2 -0
- data/TemplateInfo.gemspec +1 -1
- data/bin/tif_create.rb +157 -0
- data/lib/TemplateInfo/version.rb +1 -1
- data/test.xctemplate/.DS_Store +0 -0
- data/test.xctemplate/TemplateInfo.plist +2830 -0
- data/test.xctemplate/TemplateInfo.xml +2842 -0
- data/test.xctemplate/libs/BeeFramework/Bee.h +35 -0
- data/test.xctemplate/libs/BeeFramework/Bee_Precompile.h +143 -0
- data/test.xctemplate/libs/BeeFramework/Core/Bee_Core.h +36 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.h +54 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.mm +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.h +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.mm +164 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.h +111 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.mm +122 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.h +98 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.mm +437 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.h +45 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.mm +81 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.h +47 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.mm +34 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.h +62 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.m +147 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.h +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.mm +91 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.h +76 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.m +300 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.m +92 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.m +85 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.h +90 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m +509 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.h +50 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.m +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.h +43 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.m +116 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.h +66 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.m +150 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.h +210 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.m +34 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.h +41 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.m +156 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.h +49 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.m +109 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.h +86 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.m +464 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.h +36 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.m +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.h +144 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.m +560 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.h +99 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.m +742 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h +62 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m +175 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/0.2.4.zip +0 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.h +133 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.m +641 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.h +106 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.m +1956 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.h +91 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.m +318 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.h +223 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.m +3007 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.h +55 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.m +173 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.h +39 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.m +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.h +47 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.m +81 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.m +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Bee_MVC.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.h +66 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.mm +228 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.h +209 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.mm +873 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.h +75 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.mm +389 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.m +150 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.mm +201 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.mm +118 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.mm +78 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.mm +138 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.h +64 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.m +190 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.m +307 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.m +152 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.h +73 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.m +234 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.h +97 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.m +424 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.h +78 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.m +362 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.h +82 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.m +298 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.h +110 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.m +541 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.h +74 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.m +243 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.h +46 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.m +99 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.h +124 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.m +821 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.m +161 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.m +146 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.h +61 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.m +190 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.h +47 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.m +113 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.m +236 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.h +146 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.m +1487 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.m +192 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.h +126 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.m +453 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.h +70 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.m +249 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.h +67 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.m +242 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.h +75 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.m +311 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.h +184 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.m +911 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.h +65 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.m +242 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.h +91 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.m +444 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.h +72 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.m +38 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.h +79 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.m +288 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.h +65 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.m +161 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.m +137 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.h +56 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.m +218 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.h +105 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.m +556 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.h +53 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.m +104 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.m +170 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.h +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.m +166 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.h +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.m +184 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.m +275 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.h +212 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.m +1219 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.h +111 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.m +694 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.m +258 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.m +36 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.m +151 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.h +53 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.m +92 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.h +72 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +175 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.h +59 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.m +249 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.h +199 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.m +1170 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.h +113 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.m +710 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.h +66 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.m +189 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.h +69 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.m +210 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.m +59 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.m +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.m +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.m +438 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.m +37 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.m +100 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.m +101 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.m +48 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.m +77 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.m +47 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.m +177 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.m +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.h +50 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.m +283 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.m +178 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.m +58 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.m +57 -0
- metadata +226 -3
@@ -0,0 +1,742 @@
|
|
1
|
+
//
|
2
|
+
// ______ ______ ______
|
3
|
+
// /\ __ \ /\ ___\ /\ ___\
|
4
|
+
// \ \ __< \ \ __\_ \ \ __\_
|
5
|
+
// \ \_____\ \ \_____\ \ \_____\
|
6
|
+
// \/_____/ \/_____/ \/_____/
|
7
|
+
//
|
8
|
+
// Copyright (c) 2012 BEE creators
|
9
|
+
// http://www.whatsbug.com
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
12
|
+
// copy of this software and associated documentation files (the "Software"),
|
13
|
+
// to deal in the Software without restriction, including without limitation
|
14
|
+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
15
|
+
// and/or sell copies of the Software, and to permit persons to whom the
|
16
|
+
// Software is furnished to do so, subject to the following conditions:
|
17
|
+
//
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
19
|
+
// all copies or substantial portions of the Software.
|
20
|
+
//
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
27
|
+
// IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
//
|
30
|
+
// Bee_Network.m
|
31
|
+
//
|
32
|
+
|
33
|
+
#include <execinfo.h>
|
34
|
+
|
35
|
+
#import "Bee_Precompile.h"
|
36
|
+
#import "Bee_Log.h"
|
37
|
+
#import "Bee_RequestQueue.h"
|
38
|
+
|
39
|
+
#pragma mark -
|
40
|
+
|
41
|
+
#undef DEFAULT_BLACKLIST_TIMEOUT
|
42
|
+
#define DEFAULT_BLACKLIST_TIMEOUT (60.0f * 5.0f) // 黑名单超时5分钟
|
43
|
+
|
44
|
+
#undef DEFAULT_GET_TIMEOUT
|
45
|
+
#define DEFAULT_GET_TIMEOUT (30.0f) // 取图30秒超时
|
46
|
+
|
47
|
+
#undef DEFAULT_POST_TIMEOUT
|
48
|
+
#define DEFAULT_POST_TIMEOUT (30.0f) // 发协议30秒超时
|
49
|
+
|
50
|
+
#undef DEFAULT_PUT_TIMEOUT
|
51
|
+
#define DEFAULT_PUT_TIMEOUT (30.0f) // 上传30秒超时
|
52
|
+
|
53
|
+
#undef DEFAULT_UPLOAD_TIMEOUT
|
54
|
+
#define DEFAULT_UPLOAD_TIMEOUT (120.0f) // 上传图片120秒超时
|
55
|
+
|
56
|
+
#pragma mark -
|
57
|
+
|
58
|
+
@interface BeeRequestQueue(Private)
|
59
|
+
|
60
|
+
- (BOOL)checkResourceBroken:(NSString *)url;
|
61
|
+
|
62
|
+
- (BeeRequest *)GET:(NSString *)url sync:(BOOL)sync;
|
63
|
+
- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync;
|
64
|
+
- (BeeRequest *)PUT:(NSString *)url sync:(BOOL)sync;
|
65
|
+
|
66
|
+
- (void)cancelRequest:(BeeRequest *)request;
|
67
|
+
- (void)cancelRequestByResponder:(id)responder;
|
68
|
+
- (void)cancelAllRequests;
|
69
|
+
|
70
|
+
- (void)blockURL:(NSString *)url;
|
71
|
+
- (void)unblockURL:(NSString *)url;
|
72
|
+
|
73
|
+
- (BOOL)requesting:(NSString *)url;
|
74
|
+
- (BOOL)requesting:(NSString *)url byResponder:(id)responder;
|
75
|
+
|
76
|
+
- (NSArray *)requests:(NSString *)url;
|
77
|
+
- (NSArray *)requests:(NSString *)url byResponder:(id)responder;
|
78
|
+
|
79
|
+
@end
|
80
|
+
|
81
|
+
#pragma mark -
|
82
|
+
|
83
|
+
@implementation BeeRequestQueue
|
84
|
+
|
85
|
+
@synthesize merge = _merge;
|
86
|
+
@synthesize online = _online;
|
87
|
+
|
88
|
+
@synthesize blackListEnable = _blackListEnable;
|
89
|
+
@synthesize blackListTimeout = _blackListTimeout;
|
90
|
+
@synthesize blackList = _blackList;
|
91
|
+
|
92
|
+
@synthesize bytesUpload = _bytesUpload;
|
93
|
+
@synthesize bytesDownload = _bytesDownload;
|
94
|
+
|
95
|
+
@synthesize delay = _delay;
|
96
|
+
@synthesize requests = _requests;
|
97
|
+
|
98
|
+
@synthesize whenCreate = _whenCreate;
|
99
|
+
@synthesize whenUpdate = _whenUpdate;
|
100
|
+
|
101
|
+
+ (BOOL)isReachableViaWIFI
|
102
|
+
{
|
103
|
+
return YES;
|
104
|
+
}
|
105
|
+
|
106
|
+
+ (BOOL)isReachableViaWLAN
|
107
|
+
{
|
108
|
+
return YES;
|
109
|
+
}
|
110
|
+
|
111
|
+
+ (BOOL)isNetworkInUse
|
112
|
+
{
|
113
|
+
return ([[BeeRequestQueue sharedInstance].requests count] > 0) ? YES : NO;
|
114
|
+
}
|
115
|
+
|
116
|
+
+ (NSUInteger)bandwidthUsedPerSecond
|
117
|
+
{
|
118
|
+
return [ASIHTTPRequest averageBandwidthUsedPerSecond];
|
119
|
+
}
|
120
|
+
|
121
|
+
+ (BeeRequestQueue *)sharedInstance
|
122
|
+
{
|
123
|
+
static BeeRequestQueue * __sharedInstance = nil;
|
124
|
+
|
125
|
+
@synchronized(self)
|
126
|
+
{
|
127
|
+
if ( nil == __sharedInstance )
|
128
|
+
{
|
129
|
+
__sharedInstance = [[BeeRequestQueue alloc] init];
|
130
|
+
|
131
|
+
// [ASIHTTPRequest setShouldThrottleBandwidthForWWAN:YES];
|
132
|
+
// [ASIHTTPRequest throttleBandwidthForWWANUsingLimit:32 * 1024]; // 32K
|
133
|
+
[ASIHTTPRequest setDefaultUserAgentString:@"Bee"];
|
134
|
+
[[ASIHTTPRequest sharedQueue] setMaxConcurrentOperationCount:10];
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
return (BeeRequestQueue *)__sharedInstance;
|
139
|
+
}
|
140
|
+
|
141
|
+
- (id)init
|
142
|
+
{
|
143
|
+
self = [super init];
|
144
|
+
if ( self )
|
145
|
+
{
|
146
|
+
_delay = 0.1f;
|
147
|
+
_merge = YES;
|
148
|
+
_online = YES;
|
149
|
+
_requests = [[NSMutableArray alloc] init];
|
150
|
+
|
151
|
+
_blackListEnable = YES;
|
152
|
+
_blackListTimeout = DEFAULT_BLACKLIST_TIMEOUT;
|
153
|
+
_blackList = [[NSMutableDictionary alloc] init];
|
154
|
+
}
|
155
|
+
|
156
|
+
return self;
|
157
|
+
}
|
158
|
+
|
159
|
+
- (void)setOnline:(BOOL)en
|
160
|
+
{
|
161
|
+
_online = en;
|
162
|
+
|
163
|
+
if ( NO == _online )
|
164
|
+
{
|
165
|
+
[self cancelAllRequests];
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
- (void)dealloc
|
170
|
+
{
|
171
|
+
[self cancelAllRequests];
|
172
|
+
|
173
|
+
[_requests removeAllObjects];
|
174
|
+
[_requests release];
|
175
|
+
|
176
|
+
[_blackList removeAllObjects];
|
177
|
+
[_blackList release];
|
178
|
+
|
179
|
+
self.whenCreate = nil;
|
180
|
+
self.whenUpdate = nil;
|
181
|
+
|
182
|
+
[super dealloc];
|
183
|
+
}
|
184
|
+
|
185
|
+
- (BOOL)checkResourceBroken:(NSString *)url
|
186
|
+
{
|
187
|
+
if ( _blackListEnable )
|
188
|
+
{
|
189
|
+
NSDate * date = nil;
|
190
|
+
NSDate * now = [NSDate date];
|
191
|
+
|
192
|
+
date = [_blackList objectForKey:url];
|
193
|
+
if ( date && ([date timeIntervalSince1970] - [now timeIntervalSince1970]) < _blackListTimeout )
|
194
|
+
{
|
195
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
196
|
+
CC( @"resource broken: %@", url );
|
197
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
198
|
+
|
199
|
+
return YES;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
return NO;
|
204
|
+
}
|
205
|
+
|
206
|
+
+ (BeeRequest *)GET:(NSString *)url
|
207
|
+
{
|
208
|
+
return [[BeeRequestQueue sharedInstance] GET:url sync:NO];
|
209
|
+
}
|
210
|
+
|
211
|
+
- (BeeRequest *)GET:(NSString *)url sync:(BOOL)sync
|
212
|
+
{
|
213
|
+
if ( NO == _online )
|
214
|
+
return nil;
|
215
|
+
|
216
|
+
if ( [self checkResourceBroken:url] )
|
217
|
+
{
|
218
|
+
return nil;
|
219
|
+
}
|
220
|
+
|
221
|
+
BeeRequest * request = nil;
|
222
|
+
|
223
|
+
if ( NO == sync && _merge )
|
224
|
+
{
|
225
|
+
for ( BeeRequest * req in _requests )
|
226
|
+
{
|
227
|
+
if ( [req.url.absoluteString isEqualToString:url] )
|
228
|
+
{
|
229
|
+
return req;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
235
|
+
CC( @"GET %@\n", url );
|
236
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
237
|
+
|
238
|
+
request = [[BeeRequest alloc] initWithURL:[NSURL URLWithString:url]];
|
239
|
+
request.timeOutSeconds = DEFAULT_GET_TIMEOUT;
|
240
|
+
request.requestMethod = @"GET";
|
241
|
+
request.postBody = nil;
|
242
|
+
[request setDelegate:self];
|
243
|
+
[request setDownloadProgressDelegate:self];
|
244
|
+
[request setUploadProgressDelegate:self];
|
245
|
+
|
246
|
+
[request setNumberOfTimesToRetryOnTimeout:2];
|
247
|
+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
248
|
+
[request setShouldContinueWhenAppEntersBackground:YES];
|
249
|
+
#endif // #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
250
|
+
|
251
|
+
[request setThreadPriority:0.5];
|
252
|
+
[request setQueuePriority:NSOperationQueuePriorityLow];
|
253
|
+
|
254
|
+
[_requests addObject:request];
|
255
|
+
|
256
|
+
if ( self.whenCreate )
|
257
|
+
{
|
258
|
+
self.whenCreate( request );
|
259
|
+
}
|
260
|
+
|
261
|
+
if ( sync )
|
262
|
+
{
|
263
|
+
[request startSynchronous];
|
264
|
+
}
|
265
|
+
else
|
266
|
+
{
|
267
|
+
if ( _delay )
|
268
|
+
{
|
269
|
+
[request performSelector:@selector(startAsynchronous)
|
270
|
+
withObject:nil
|
271
|
+
afterDelay:_delay];
|
272
|
+
}
|
273
|
+
else
|
274
|
+
{
|
275
|
+
[request startAsynchronous];
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
return [request autorelease];
|
280
|
+
}
|
281
|
+
|
282
|
+
+ (BeeRequest *)POST:(NSString *)url
|
283
|
+
{
|
284
|
+
return [[BeeRequestQueue sharedInstance] POST:url sync:NO];
|
285
|
+
}
|
286
|
+
|
287
|
+
- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync
|
288
|
+
{
|
289
|
+
if ( NO == _online )
|
290
|
+
return nil;
|
291
|
+
|
292
|
+
BeeRequest * request = nil;
|
293
|
+
|
294
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
295
|
+
CC( @"POST %@\n", url );
|
296
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
297
|
+
|
298
|
+
request = [[BeeRequest alloc] initWithURL:[NSURL URLWithString:url]];
|
299
|
+
request.timeOutSeconds = DEFAULT_POST_TIMEOUT;
|
300
|
+
request.requestMethod = @"POST";
|
301
|
+
request.postFormat = ASIMultipartFormDataPostFormat; // ASIRawPostFormat;
|
302
|
+
[request setDelegate:self];
|
303
|
+
[request setDownloadProgressDelegate:self];
|
304
|
+
[request setUploadProgressDelegate:self];
|
305
|
+
[request setNumberOfTimesToRetryOnTimeout:2];
|
306
|
+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
307
|
+
[request setShouldContinueWhenAppEntersBackground:YES];
|
308
|
+
#endif // #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
309
|
+
|
310
|
+
[request setThreadPriority:1.0];
|
311
|
+
[request setQueuePriority:NSOperationQueuePriorityHigh];
|
312
|
+
|
313
|
+
[_requests addObject:request];
|
314
|
+
|
315
|
+
if ( self.whenCreate )
|
316
|
+
{
|
317
|
+
self.whenCreate( request );
|
318
|
+
}
|
319
|
+
|
320
|
+
if ( sync )
|
321
|
+
{
|
322
|
+
[request startSynchronous];
|
323
|
+
}
|
324
|
+
else
|
325
|
+
{
|
326
|
+
if ( _delay )
|
327
|
+
{
|
328
|
+
[request performSelector:@selector(startAsynchronous)
|
329
|
+
withObject:nil
|
330
|
+
afterDelay:_delay];
|
331
|
+
}
|
332
|
+
else
|
333
|
+
{
|
334
|
+
[request startAsynchronous];
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
return [request autorelease];
|
339
|
+
}
|
340
|
+
|
341
|
+
+ (BeeRequest *)PUT:(NSString *)url
|
342
|
+
{
|
343
|
+
return [[BeeRequestQueue sharedInstance] PUT:url sync:NO];
|
344
|
+
}
|
345
|
+
|
346
|
+
- (BeeRequest *)PUT:(NSString *)url sync:(BOOL)sync
|
347
|
+
{
|
348
|
+
if ( NO == _online )
|
349
|
+
return nil;
|
350
|
+
|
351
|
+
BeeRequest * request = nil;
|
352
|
+
|
353
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
354
|
+
CC( @"PUT %@\n", url );
|
355
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
356
|
+
|
357
|
+
request = [[BeeRequest alloc] initWithURL:[NSURL URLWithString:url]];
|
358
|
+
request.timeOutSeconds = DEFAULT_PUT_TIMEOUT;
|
359
|
+
request.requestMethod = @"PUT";
|
360
|
+
request.postFormat = ASIURLEncodedPostFormat; // ASIRawPostFormat;
|
361
|
+
[request setDelegate:self];
|
362
|
+
[request setDownloadProgressDelegate:self];
|
363
|
+
[request setUploadProgressDelegate:self];
|
364
|
+
[request setNumberOfTimesToRetryOnTimeout:2];
|
365
|
+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
366
|
+
[request setShouldContinueWhenAppEntersBackground:YES];
|
367
|
+
#endif // #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
|
368
|
+
|
369
|
+
[request setThreadPriority:1.0];
|
370
|
+
[request setQueuePriority:NSOperationQueuePriorityHigh];
|
371
|
+
|
372
|
+
[_requests addObject:request];
|
373
|
+
|
374
|
+
if ( self.whenCreate )
|
375
|
+
{
|
376
|
+
self.whenCreate( request );
|
377
|
+
}
|
378
|
+
|
379
|
+
if ( sync )
|
380
|
+
{
|
381
|
+
[request startSynchronous];
|
382
|
+
}
|
383
|
+
else
|
384
|
+
{
|
385
|
+
if ( _delay )
|
386
|
+
{
|
387
|
+
[request performSelector:@selector(startAsynchronous)
|
388
|
+
withObject:nil
|
389
|
+
afterDelay:_delay];
|
390
|
+
}
|
391
|
+
else
|
392
|
+
{
|
393
|
+
[request startAsynchronous];
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
return [request autorelease];
|
398
|
+
}
|
399
|
+
|
400
|
+
+ (BOOL)requesting:(NSString *)url
|
401
|
+
{
|
402
|
+
return [[BeeRequestQueue sharedInstance] requesting:url];
|
403
|
+
}
|
404
|
+
|
405
|
+
- (BOOL)requesting:(NSString *)url
|
406
|
+
{
|
407
|
+
for ( BeeRequest * request in _requests )
|
408
|
+
{
|
409
|
+
if ( [[request.url absoluteString] isEqualToString:url] )
|
410
|
+
{
|
411
|
+
return YES;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
return NO;
|
416
|
+
}
|
417
|
+
|
418
|
+
+ (BOOL)requesting:(NSString *)url byResponder:(id)responder
|
419
|
+
{
|
420
|
+
return [[BeeRequestQueue sharedInstance] requesting:url byResponder:responder];
|
421
|
+
}
|
422
|
+
|
423
|
+
- (BOOL)requesting:(NSString *)url byResponder:(id)responder
|
424
|
+
{
|
425
|
+
for ( BeeRequest * request in _requests )
|
426
|
+
{
|
427
|
+
if ( responder && NO == [request hasResponder:responder] /*request.responder != responder*/ )
|
428
|
+
continue;
|
429
|
+
|
430
|
+
if ( nil == url || [[request.url absoluteString] isEqualToString:url] )
|
431
|
+
{
|
432
|
+
return YES;
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
return NO;
|
437
|
+
}
|
438
|
+
|
439
|
+
+ (NSArray *)requests:(NSString *)url
|
440
|
+
{
|
441
|
+
return [[BeeRequestQueue sharedInstance] requests:url];
|
442
|
+
}
|
443
|
+
|
444
|
+
- (NSArray *)requests:(NSString *)url
|
445
|
+
{
|
446
|
+
NSMutableArray * array = [NSMutableArray array];
|
447
|
+
|
448
|
+
for ( BeeRequest * request in _requests )
|
449
|
+
{
|
450
|
+
if ( [[request.url absoluteString] isEqualToString:url] )
|
451
|
+
{
|
452
|
+
[array addObject:request];
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
return array;
|
457
|
+
}
|
458
|
+
|
459
|
+
+ (NSArray *)requests:(NSString *)url byResponder:(id)responder
|
460
|
+
{
|
461
|
+
return [[BeeRequestQueue sharedInstance] requests:url byResponder:responder];
|
462
|
+
}
|
463
|
+
|
464
|
+
- (NSArray *)requests:(NSString *)url byResponder:(id)responder
|
465
|
+
{
|
466
|
+
NSMutableArray * array = [NSMutableArray array];
|
467
|
+
|
468
|
+
for ( BeeRequest * request in _requests )
|
469
|
+
{
|
470
|
+
if ( responder && NO == [request hasResponder:responder] /* request.responder != responder */ )
|
471
|
+
continue;
|
472
|
+
|
473
|
+
if ( nil == url || [[request.url absoluteString] isEqualToString:url] )
|
474
|
+
{
|
475
|
+
[array addObject:request];
|
476
|
+
}
|
477
|
+
}
|
478
|
+
|
479
|
+
return array;
|
480
|
+
}
|
481
|
+
|
482
|
+
+ (void)cancelRequest:(BeeRequest *)request
|
483
|
+
{
|
484
|
+
[[BeeRequestQueue sharedInstance] cancelRequest:request];
|
485
|
+
}
|
486
|
+
|
487
|
+
- (void)cancelRequest:(BeeRequest *)request
|
488
|
+
{
|
489
|
+
[NSObject cancelPreviousPerformRequestsWithTarget:request selector:@selector(startAsynchronous) object:nil];
|
490
|
+
|
491
|
+
if ( [_requests containsObject:request] )
|
492
|
+
{
|
493
|
+
if ( request.created || request.sending || request.recving )
|
494
|
+
{
|
495
|
+
[request changeState:BeeRequest.STATE_CANCELLED];
|
496
|
+
}
|
497
|
+
|
498
|
+
[request clearDelegatesAndCancel];
|
499
|
+
[request removeAllResponders];
|
500
|
+
|
501
|
+
[_requests removeObject:request];
|
502
|
+
}
|
503
|
+
}
|
504
|
+
|
505
|
+
+ (void)cancelRequestByResponder:(id)responder
|
506
|
+
{
|
507
|
+
[[BeeRequestQueue sharedInstance] cancelRequestByResponder:responder];
|
508
|
+
}
|
509
|
+
|
510
|
+
- (void)cancelRequestByResponder:(id)responder
|
511
|
+
{
|
512
|
+
if ( nil == responder )
|
513
|
+
{
|
514
|
+
[self cancelAllRequests];
|
515
|
+
}
|
516
|
+
else
|
517
|
+
{
|
518
|
+
NSMutableArray * tempArray = [NSMutableArray array];
|
519
|
+
|
520
|
+
for ( BeeRequest * request in _requests )
|
521
|
+
{
|
522
|
+
if ( [request hasResponder:responder] /* request.responder == responder */ )
|
523
|
+
{
|
524
|
+
[tempArray addObject:request];
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
for ( BeeRequest * request in tempArray )
|
529
|
+
{
|
530
|
+
[self cancelRequest:request];
|
531
|
+
}
|
532
|
+
}
|
533
|
+
}
|
534
|
+
|
535
|
+
+ (void)cancelAllRequests
|
536
|
+
{
|
537
|
+
[[BeeRequestQueue sharedInstance] cancelAllRequests];
|
538
|
+
}
|
539
|
+
|
540
|
+
- (void)cancelAllRequests
|
541
|
+
{
|
542
|
+
for ( BeeRequest * request in _requests )
|
543
|
+
{
|
544
|
+
[self cancelRequest:request];
|
545
|
+
}
|
546
|
+
}
|
547
|
+
|
548
|
+
+ (void)blockURL:(NSString *)url
|
549
|
+
{
|
550
|
+
[[BeeRequestQueue sharedInstance] blockURL:url];
|
551
|
+
}
|
552
|
+
|
553
|
+
- (void)blockURL:(NSString *)url
|
554
|
+
{
|
555
|
+
[_blackList setObject:[NSDate date] forKey:url];
|
556
|
+
}
|
557
|
+
|
558
|
+
+ (void)unblockURL:(NSString *)url
|
559
|
+
{
|
560
|
+
[[BeeRequestQueue sharedInstance] unblockURL:url];
|
561
|
+
}
|
562
|
+
|
563
|
+
- (void)unblockURL:(NSString *)url
|
564
|
+
{
|
565
|
+
if ( [_blackList objectForKey:url] )
|
566
|
+
{
|
567
|
+
NSDate * date = [NSDate dateWithTimeInterval:(_blackListTimeout + 1.0f) sinceDate:[NSDate date]];
|
568
|
+
[_blackList setObject:date forKey:url];
|
569
|
+
}
|
570
|
+
}
|
571
|
+
|
572
|
+
- (NSArray *)requests
|
573
|
+
{
|
574
|
+
return _requests;
|
575
|
+
}
|
576
|
+
|
577
|
+
#pragma mark -
|
578
|
+
#pragma mark ASIHTTPRequestDelegate
|
579
|
+
|
580
|
+
- (void)requestStarted:(ASIHTTPRequest *)request
|
581
|
+
{
|
582
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
583
|
+
return;
|
584
|
+
|
585
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
586
|
+
[networkRequest changeState:BeeRequest.STATE_SENDING];
|
587
|
+
|
588
|
+
_bytesUpload += request.postLength;
|
589
|
+
|
590
|
+
if ( self.whenUpdate )
|
591
|
+
{
|
592
|
+
self.whenUpdate( networkRequest );
|
593
|
+
}
|
594
|
+
}
|
595
|
+
|
596
|
+
- (void)request:(ASIHTTPRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders
|
597
|
+
{
|
598
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
599
|
+
return;
|
600
|
+
|
601
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
602
|
+
[networkRequest changeState:BeeRequest.STATE_RECVING];
|
603
|
+
|
604
|
+
if ( self.whenUpdate )
|
605
|
+
{
|
606
|
+
self.whenUpdate( networkRequest );
|
607
|
+
}
|
608
|
+
}
|
609
|
+
|
610
|
+
- (void)requestFinished:(ASIHTTPRequest *)request
|
611
|
+
{
|
612
|
+
_bytesDownload += [[request rawResponseData] length];
|
613
|
+
|
614
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
615
|
+
return;
|
616
|
+
|
617
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
618
|
+
|
619
|
+
#if __BEE_DEVELOPMENT__
|
620
|
+
CC( @"HTTP %d(%@)\n%@\n",
|
621
|
+
request.responseStatusCode,
|
622
|
+
request.responseStatusMessage,
|
623
|
+
[request.url absoluteString] );
|
624
|
+
#endif
|
625
|
+
|
626
|
+
if ( [request.requestMethod isEqualToString:@"GET"] )
|
627
|
+
{
|
628
|
+
if ( request.responseStatusCode >= 400 && request.responseStatusCode < 500 )
|
629
|
+
{
|
630
|
+
[self blockURL:[request.url absoluteString]];
|
631
|
+
}
|
632
|
+
}
|
633
|
+
|
634
|
+
if ( 200 == request.responseStatusCode )
|
635
|
+
{
|
636
|
+
[networkRequest changeState:BeeRequest.STATE_SUCCEED];
|
637
|
+
}
|
638
|
+
else
|
639
|
+
{
|
640
|
+
[networkRequest changeState:BeeRequest.STATE_FAILED];
|
641
|
+
}
|
642
|
+
|
643
|
+
[networkRequest clearDelegatesAndCancel];
|
644
|
+
[networkRequest removeAllResponders];
|
645
|
+
|
646
|
+
[_requests removeObject:networkRequest];
|
647
|
+
|
648
|
+
if ( self.whenUpdate )
|
649
|
+
{
|
650
|
+
self.whenUpdate( networkRequest );
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
- (void)requestFailed:(ASIHTTPRequest *)request
|
655
|
+
{
|
656
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
657
|
+
return;
|
658
|
+
|
659
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
660
|
+
|
661
|
+
networkRequest.errorCode = -1;
|
662
|
+
[networkRequest changeState:BeeRequest.STATE_FAILED];
|
663
|
+
|
664
|
+
[networkRequest clearDelegatesAndCancel];
|
665
|
+
[networkRequest removeAllResponders];
|
666
|
+
|
667
|
+
[_requests removeObject:networkRequest];
|
668
|
+
|
669
|
+
if ( self.whenUpdate )
|
670
|
+
{
|
671
|
+
self.whenUpdate( networkRequest );
|
672
|
+
}
|
673
|
+
}
|
674
|
+
|
675
|
+
#pragma mark -
|
676
|
+
|
677
|
+
- (void)request:(ASIHTTPRequest *)request willRedirectToURL:(NSURL *)newURL
|
678
|
+
{
|
679
|
+
[self requestFailed:request];
|
680
|
+
}
|
681
|
+
|
682
|
+
- (void)requestRedirected:(ASIHTTPRequest *)request
|
683
|
+
{
|
684
|
+
[self requestFailed:request];
|
685
|
+
}
|
686
|
+
|
687
|
+
- (void)authenticationNeededForRequest:(ASIHTTPRequest *)request
|
688
|
+
{
|
689
|
+
[self requestFailed:request];
|
690
|
+
}
|
691
|
+
|
692
|
+
- (void)proxyAuthenticationNeededForRequest:(ASIHTTPRequest *)request
|
693
|
+
{
|
694
|
+
[self requestFailed:request];
|
695
|
+
}
|
696
|
+
|
697
|
+
#pragma mark -
|
698
|
+
|
699
|
+
// Called when the request receives some data - bytes is the length of that data
|
700
|
+
- (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes
|
701
|
+
{
|
702
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
703
|
+
return;
|
704
|
+
|
705
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
706
|
+
[networkRequest updateRecvProgress];
|
707
|
+
}
|
708
|
+
|
709
|
+
// Called when the request sends some data
|
710
|
+
// The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
|
711
|
+
// bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
|
712
|
+
- (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes
|
713
|
+
{
|
714
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
715
|
+
return;
|
716
|
+
|
717
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
718
|
+
[networkRequest updateSendProgress];
|
719
|
+
}
|
720
|
+
|
721
|
+
// Called when a request needs to change the length of the content to download
|
722
|
+
- (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength
|
723
|
+
{
|
724
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
725
|
+
return;
|
726
|
+
|
727
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
728
|
+
[networkRequest updateRecvProgress];
|
729
|
+
}
|
730
|
+
|
731
|
+
// Called when a request needs to change the length of the content to upload
|
732
|
+
// newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
|
733
|
+
- (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength
|
734
|
+
{
|
735
|
+
if ( NO == [request isKindOfClass:[BeeRequest class]] )
|
736
|
+
return;
|
737
|
+
|
738
|
+
BeeRequest * networkRequest = (BeeRequest *)request;
|
739
|
+
[networkRequest updateSendProgress];
|
740
|
+
}
|
741
|
+
|
742
|
+
@end
|