TemplateInfo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +2 -0
  3. data/TemplateInfo.gemspec +1 -1
  4. data/bin/tif_create.rb +157 -0
  5. data/lib/TemplateInfo/version.rb +1 -1
  6. data/test.xctemplate/.DS_Store +0 -0
  7. data/test.xctemplate/TemplateInfo.plist +2830 -0
  8. data/test.xctemplate/TemplateInfo.xml +2842 -0
  9. data/test.xctemplate/libs/BeeFramework/Bee.h +35 -0
  10. data/test.xctemplate/libs/BeeFramework/Bee_Precompile.h +143 -0
  11. data/test.xctemplate/libs/BeeFramework/Core/Bee_Core.h +36 -0
  12. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.h +54 -0
  13. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.mm +33 -0
  14. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.h +64 -0
  15. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.mm +164 -0
  16. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.h +111 -0
  17. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.mm +122 -0
  18. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.h +98 -0
  19. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.mm +437 -0
  20. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.h +45 -0
  21. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.mm +81 -0
  22. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.h +47 -0
  23. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.mm +34 -0
  24. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.h +62 -0
  25. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.m +147 -0
  26. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.h +64 -0
  27. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.mm +91 -0
  28. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.h +76 -0
  29. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.m +300 -0
  30. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.h +44 -0
  31. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.m +92 -0
  32. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.h +44 -0
  33. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.m +85 -0
  34. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.h +90 -0
  35. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m +509 -0
  36. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.h +50 -0
  37. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.m +64 -0
  38. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.h +43 -0
  39. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.m +116 -0
  40. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.h +66 -0
  41. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.m +150 -0
  42. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.h +210 -0
  43. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.m +34 -0
  44. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.h +41 -0
  45. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.m +156 -0
  46. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.h +49 -0
  47. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.m +109 -0
  48. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.h +86 -0
  49. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.m +464 -0
  50. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.h +36 -0
  51. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.m +33 -0
  52. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.h +144 -0
  53. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.m +560 -0
  54. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.h +99 -0
  55. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.m +742 -0
  56. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h +62 -0
  57. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m +175 -0
  58. data/test.xctemplate/libs/BeeFramework/Core/Storage/0.2.4.zip +0 -0
  59. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.h +133 -0
  60. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.m +641 -0
  61. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.h +106 -0
  62. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.m +1956 -0
  63. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.h +91 -0
  64. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.m +318 -0
  65. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.h +223 -0
  66. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.m +3007 -0
  67. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.h +55 -0
  68. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.m +173 -0
  69. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.h +39 -0
  70. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.m +33 -0
  71. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.h +47 -0
  72. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.m +81 -0
  73. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.h +44 -0
  74. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.m +57 -0
  75. data/test.xctemplate/libs/BeeFramework/MVC/Bee_MVC.h +49 -0
  76. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.h +66 -0
  77. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.mm +228 -0
  78. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.h +209 -0
  79. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.mm +873 -0
  80. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.h +75 -0
  81. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.mm +389 -0
  82. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.h +52 -0
  83. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.m +150 -0
  84. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.h +49 -0
  85. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.mm +201 -0
  86. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.h +52 -0
  87. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.mm +118 -0
  88. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.h +49 -0
  89. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.mm +78 -0
  90. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.h +57 -0
  91. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.mm +138 -0
  92. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.h +64 -0
  93. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.m +190 -0
  94. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.h +71 -0
  95. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.m +307 -0
  96. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.h +52 -0
  97. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.m +152 -0
  98. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.h +73 -0
  99. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.m +234 -0
  100. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.h +97 -0
  101. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.m +424 -0
  102. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.h +78 -0
  103. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.m +362 -0
  104. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.h +82 -0
  105. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.m +298 -0
  106. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.h +110 -0
  107. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.m +541 -0
  108. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.h +74 -0
  109. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.m +243 -0
  110. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.h +46 -0
  111. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.m +99 -0
  112. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.h +124 -0
  113. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.m +821 -0
  114. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.h +57 -0
  115. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.m +161 -0
  116. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.h +60 -0
  117. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.m +146 -0
  118. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.h +61 -0
  119. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.m +190 -0
  120. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.h +47 -0
  121. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.m +113 -0
  122. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.h +71 -0
  123. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.m +236 -0
  124. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.h +146 -0
  125. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.m +1487 -0
  126. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.h +60 -0
  127. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.m +192 -0
  128. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.h +126 -0
  129. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.m +453 -0
  130. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.h +70 -0
  131. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.m +249 -0
  132. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.h +67 -0
  133. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.m +242 -0
  134. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.h +75 -0
  135. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.m +311 -0
  136. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.h +184 -0
  137. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.m +911 -0
  138. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.h +65 -0
  139. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.m +242 -0
  140. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.h +91 -0
  141. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.m +444 -0
  142. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.h +72 -0
  143. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.m +38 -0
  144. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.h +79 -0
  145. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.m +288 -0
  146. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.h +65 -0
  147. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.m +161 -0
  148. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.h +45 -0
  149. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.m +137 -0
  150. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.h +56 -0
  151. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.m +218 -0
  152. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.h +105 -0
  153. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.m +556 -0
  154. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.h +53 -0
  155. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.m +104 -0
  156. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.h +52 -0
  157. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.m +170 -0
  158. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.h +54 -0
  159. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.m +166 -0
  160. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.h +54 -0
  161. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.m +184 -0
  162. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.h +57 -0
  163. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.m +275 -0
  164. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.h +212 -0
  165. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.m +1219 -0
  166. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.h +111 -0
  167. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.m +694 -0
  168. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.h +71 -0
  169. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.m +258 -0
  170. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.h +45 -0
  171. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.m +36 -0
  172. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.h +57 -0
  173. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.m +151 -0
  174. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.h +53 -0
  175. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.m +92 -0
  176. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.h +72 -0
  177. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +175 -0
  178. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.h +59 -0
  179. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.m +249 -0
  180. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.h +199 -0
  181. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.m +1170 -0
  182. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.h +113 -0
  183. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.m +710 -0
  184. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.h +66 -0
  185. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.m +189 -0
  186. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.h +69 -0
  187. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.m +210 -0
  188. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.h +45 -0
  189. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.m +59 -0
  190. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.h +45 -0
  191. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.m +55 -0
  192. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.h +45 -0
  193. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.m +54 -0
  194. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.h +45 -0
  195. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.m +54 -0
  196. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.h +45 -0
  197. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.m +438 -0
  198. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.h +60 -0
  199. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.m +37 -0
  200. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.h +45 -0
  201. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.m +55 -0
  202. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.h +45 -0
  203. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.m +55 -0
  204. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.h +41 -0
  205. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.m +100 -0
  206. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.h +41 -0
  207. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.m +101 -0
  208. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.h +41 -0
  209. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.m +48 -0
  210. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.h +41 -0
  211. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.m +77 -0
  212. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.h +41 -0
  213. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.m +47 -0
  214. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.h +52 -0
  215. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.m +177 -0
  216. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.h +44 -0
  217. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.m +57 -0
  218. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.h +50 -0
  219. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.m +283 -0
  220. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.h +52 -0
  221. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.m +178 -0
  222. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.h +44 -0
  223. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.m +58 -0
  224. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.h +44 -0
  225. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.m +57 -0
  226. 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