Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed ios6 bugs/ new sample project

  • Loading branch information...
commit b73a3fcc49b09d4143fae02bd63412a27628ef87 1 parent c9c2c6a
Jim Liu authored
Showing with 14,811 additions and 918 deletions.
  1. +2 −2 sample/Controllers/AccountsViewController.m
  2. +2 −2 sample/Controllers/ComposeViewController.m
  3. +79 −357 sample/Controllers/ComposeViewController.xib
  4. +3 −3 sample/Controllers/HomeViewController.m
  5. +27 −23 sample/Sample.xcodeproj/project.pbxproj
  6. +17 −0 sample_WeiboPlus/Controllers/AccountsViewController.h
  7. +193 −0 sample_WeiboPlus/Controllers/AccountsViewController.m
  8. +13 −0 sample_WeiboPlus/Controllers/DiscoverViewController.h
  9. +44 −0 sample_WeiboPlus/Controllers/DiscoverViewController.m
  10. +20 −0 sample_WeiboPlus/Controllers/HomeViewController.h
  11. +174 −0 sample_WeiboPlus/Controllers/HomeViewController.m
  12. +13 −0 sample_WeiboPlus/Controllers/MentionViewController.h
  13. +132 −0 sample_WeiboPlus/Controllers/MentionViewController.m
  14. +13 −0 sample_WeiboPlus/Controllers/ProfileViewController.h
  15. +44 −0 sample_WeiboPlus/Controllers/ProfileViewController.m
  16. +18 −0 sample_WeiboPlus/Controllers/WeiboTabBarController.h
  17. +75 −0 sample_WeiboPlus/Controllers/WeiboTabBarController.m
  18. +34 −0 sample_WeiboPlus/DataManager/DBAccess.h
  19. +95 −0 sample_WeiboPlus/DataManager/DBAccess.m
  20. +25 −0 sample_WeiboPlus/DataManager/TimelineStorage.h
  21. +216 −0 sample_WeiboPlus/DataManager/TimelineStorage.m
  22. +26 −0 sample_WeiboPlus/DataManager/WeiboDataManager.h
  23. +41 −0 sample_WeiboPlus/DataManager/WeiboDataManager.m
  24. +16 −0 sample_WeiboPlus/DataSources/Fonts.h
  25. +30 −0 sample_WeiboPlus/DataSources/Fonts.m
  26. +33 −0 sample_WeiboPlus/DataSources/Images.h
  27. +93 −0 sample_WeiboPlus/DataSources/Images.m
  28. +17 −0 sample_WeiboPlus/Models/WrapedStatus.h
  29. +13 −0 sample_WeiboPlus/Models/WrapedStatus.m
  30. +94 −0 sample_WeiboPlus/Network/ImageDownloader/ImageCache.h
  31. +607 −0 sample_WeiboPlus/Network/ImageDownloader/ImageCache.m
  32. +27 −0 sample_WeiboPlus/Network/ImageDownloader/ImageDownloadReceiver.h
  33. +61 −0 sample_WeiboPlus/Network/ImageDownloader/ImageDownloadReceiver.m
  34. +45 −0 sample_WeiboPlus/Network/ImageDownloader/ImageDownloader.h
  35. +327 −0 sample_WeiboPlus/Network/ImageDownloader/ImageDownloader.m
  36. +47 −0 sample_WeiboPlus/Network/ImageDownloader/ImageRequest.h
  37. +198 −0 sample_WeiboPlus/Network/ImageDownloader/ImageRequest.m
  38. +136 −0 sample_WeiboPlus/Network/Reachability2.h
  39. +593 −0 sample_WeiboPlus/Network/Reachability2.m
  40. BIN  sample_WeiboPlus/Resources/Images/ProfilePlaceholderOverBlue.png
  41. BIN  sample_WeiboPlus/Resources/Images/ProfilePlaceholderOverBlue@2x.png
  42. BIN  sample_WeiboPlus/Resources/Images/ProfilePlaceholderOverWhite.png
  43. BIN  sample_WeiboPlus/Resources/Images/ProfilePlaceholderOverWhite@2x.png
  44. BIN  sample_WeiboPlus/Resources/Images/TabBarGlow.png
  45. BIN  sample_WeiboPlus/Resources/Images/TabBarGlow@2x.png
  46. BIN  sample_WeiboPlus/Resources/Images/TableBlueSelectionGradient.png
  47. BIN  sample_WeiboPlus/Resources/Images/bg-tweet-inner.png
  48. BIN  sample_WeiboPlus/Resources/Images/bg-tweet-inner@2x.png
  49. BIN  sample_WeiboPlus/Resources/Images/bg-tweet-outer.png
  50. BIN  sample_WeiboPlus/Resources/Images/bg-tweet-outer1@2x.png
  51. BIN  sample_WeiboPlus/Resources/Images/bg-tweet-outer@2x.png
  52. BIN  sample_WeiboPlus/Resources/Images/bg_search_bar.png
  53. BIN  sample_WeiboPlus/Resources/Images/bg_search_bar@2x.png
  54. BIN  sample_WeiboPlus/Resources/Images/bg_tab_bar.png
  55. BIN  sample_WeiboPlus/Resources/Images/bg_tab_bar@2x.png
  56. BIN  sample_WeiboPlus/Resources/Images/bg_tab_bar_selected.png
  57. BIN  sample_WeiboPlus/Resources/Images/bg_tab_bar_selected@2x.png
  58. BIN  sample_WeiboPlus/Resources/Images/bg_texture.png
  59. BIN  sample_WeiboPlus/Resources/Images/bg_texture@2x.png
  60. BIN  sample_WeiboPlus/Resources/Images/bg_title_bar.png
  61. BIN  sample_WeiboPlus/Resources/Images/bg_title_bar@2x.png
  62. BIN  sample_WeiboPlus/Resources/Images/blue-check.png
  63. BIN  sample_WeiboPlus/Resources/Images/blue-check@2x.png
  64. BIN  sample_WeiboPlus/Resources/Images/btn_default.png
  65. BIN  sample_WeiboPlus/Resources/Images/btn_default@2x.png
  66. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_back.png
  67. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_back@2x.png
  68. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_back_pressed.png
  69. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_back_pressed@2x.png
  70. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_rect.png
  71. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_rect@2x.png
  72. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_rect_pressed.png
  73. BIN  sample_WeiboPlus/Resources/Images/btn_title_bar_rect_pressed@2x.png
  74. BIN  sample_WeiboPlus/Resources/Images/btn_tool_bar_rect_default.png
  75. BIN  sample_WeiboPlus/Resources/Images/btn_tool_bar_rect_default@2x.png
  76. BIN  sample_WeiboPlus/Resources/Images/btn_tool_bar_rect_pressed.png
  77. BIN  sample_WeiboPlus/Resources/Images/btn_tool_bar_rect_pressed@2x.png
  78. BIN  sample_WeiboPlus/Resources/Images/ic_pop_check.png
  79. BIN  sample_WeiboPlus/Resources/Images/ic_pop_check@2x.png
  80. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at.png
  81. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at@2x.png
  82. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at_default.png
  83. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at_default@2x.png
  84. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at_selected.png
  85. BIN  sample_WeiboPlus/Resources/Images/ic_tab_at_selected@2x.png
  86. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash.png
  87. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash@2x.png
  88. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash_default.png
  89. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash_default@2x.png
  90. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash_selected.png
  91. BIN  sample_WeiboPlus/Resources/Images/ic_tab_hash_selected@2x.png
  92. BIN  sample_WeiboPlus/Resources/Images/ic_tab_home_default.png
  93. BIN  sample_WeiboPlus/Resources/Images/ic_tab_home_default@2x.png
  94. BIN  sample_WeiboPlus/Resources/Images/ic_tab_home_selected.png
  95. BIN  sample_WeiboPlus/Resources/Images/ic_tab_home_selected@2x.png
  96. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile.png
  97. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile@2x.png
  98. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile_default.png
  99. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile_default@2x.png
  100. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile_selected.png
  101. BIN  sample_WeiboPlus/Resources/Images/ic_tab_profile_selected@2x.png
  102. +17 −0 sample_WeiboPlus/Resources/en.lproj/Localizable.strings
  103. +16 −0 sample_WeiboPlus/Resources/zh-Hans.lproj/Localizable.strings
  104. +44 −0 sample_WeiboPlus/Views/Cells/ABTableViewCell.h
  105. +172 −0 sample_WeiboPlus/Views/Cells/ABTableViewCell.m
  106. +18 −0 sample_WeiboPlus/Views/Cells/SimpleTableViewCell.h
  107. +94 −0 sample_WeiboPlus/Views/Cells/SimpleTableViewCell.m
  108. +29 −0 sample_WeiboPlus/Views/Cells/WeiboAccountCell.h
  109. +121 −0 sample_WeiboPlus/Views/Cells/WeiboAccountCell.m
  110. +62 −0 sample_WeiboPlus/Views/TweetView/TweetDocument.h
  111. +419 −0 sample_WeiboPlus/Views/TweetView/TweetDocument.m
  112. +43 −0 sample_WeiboPlus/Views/TweetView/TweetLayer.h
  113. +219 −0 sample_WeiboPlus/Views/TweetView/TweetLayer.m
  114. +40 −0 sample_WeiboPlus/Views/TweetView/TweetLink.h
  115. +87 −0 sample_WeiboPlus/Views/TweetView/TweetLink.m
  116. +25 −0 sample_WeiboPlus/Views/TweetView/TweetViewCell.h
  117. +184 −0 sample_WeiboPlus/Views/TweetView/TweetViewCell.m
  118. +60 −0 sample_WeiboPlus/Views/TweetView/TweetViewCellLayout.h
  119. +146 −0 sample_WeiboPlus/Views/TweetView/TweetViewCellLayout.m
  120. +37 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBar.h
  121. +105 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBar.m
  122. +28 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBarController.h
  123. +213 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBarController.m
  124. +25 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBarItem.h
  125. +110 −0 sample_WeiboPlus/Views/WeiboTabBar/TabBarItem.m
  126. +1,137 −0 sample_WeiboPlus/WeiboPlus.xcodeproj/project.pbxproj
  127. +20 −0 sample_WeiboPlus/WeiboPlus/AppDelegate.h
  128. +119 −0 sample_WeiboPlus/WeiboPlus/AppDelegate.m
  129. BIN  sample_WeiboPlus/WeiboPlus/Default-568h@2x.png
  130. BIN  sample_WeiboPlus/WeiboPlus/Default.png
  131. BIN  sample_WeiboPlus/WeiboPlus/Default@2x.png
  132. +38 −0 sample_WeiboPlus/WeiboPlus/WeiboPlus-Info.plist
  133. +14 −0 sample_WeiboPlus/WeiboPlus/WeiboPlus-Prefix.pch
  134. +2 −0  sample_WeiboPlus/WeiboPlus/en.lproj/InfoPlist.strings
  135. +18 −0 sample_WeiboPlus/WeiboPlus/main.m
  136. +2 −2 sample_nolib/Controllers/AccountsViewController.m
  137. +2 −2 sample_nolib/Controllers/ComposeViewController.m
  138. +79 −357 sample_nolib/Controllers/ComposeViewController.xib
  139. +3 −3 sample_nolib/Controllers/HomeViewController.m
  140. +159 −167 sample_nolib/WeiboSDK_Sample_NoLib.xcodeproj/project.pbxproj
  141. +29 −0 sdk/Additions/NSDictionaryAdditions.h
  142. +154 −0 sdk/Additions/NSDictionaryAdditions.m
  143. +24 −0 sdk/Models/GeoInfo.h
  144. +48 −0 sdk/Models/GeoInfo.m
  145. +23 −0 sdk/Models/Province.h
  146. +67 −0 sdk/Models/Province.m
  147. +20 −0 sdk/Models/Resources.h
  148. +64 −0 sdk/Models/Resources.m
  149. +68 −0 sdk/Models/Status.h
  150. +266 −0 sdk/Models/Status.m
  151. +82 −0 sdk/Models/User.h
  152. +178 −0 sdk/Models/User.m
  153. +26 −0 sdk/Utilities/PathHelper.h
  154. +69 −0 sdk/Utilities/PathHelper.m
  155. +27 −0 sdk/WeiboEngine/WeiboAccount.h
  156. +59 −0 sdk/WeiboEngine/WeiboAccount.m
  157. +39 −0 sdk/WeiboEngine/WeiboAccounts.h
  158. +158 −0 sdk/WeiboEngine/WeiboAccounts.m
  159. +40 −0 sdk/WeiboEngine/WeiboAuthentication.h
  160. +60 −0 sdk/WeiboEngine/WeiboAuthentication.m
  161. +17 −0 sdk/WeiboEngine/WeiboConfig.h
  162. +13 −0 sdk/WeiboEngine/WeiboEngine.h
  163. +13 −0 sdk/WeiboEngine/WeiboEngine.m
  164. +13 −0 sdk/WeiboEngine/WeiboQuery/StatusQuery.h
  165. +13 −0 sdk/WeiboEngine/WeiboQuery/StatusQuery.m
  166. +36 −0 sdk/WeiboEngine/WeiboQuery/TimelineQuery.h
  167. +96 −0 sdk/WeiboEngine/WeiboQuery/TimelineQuery.m
  168. +28 −0 sdk/WeiboEngine/WeiboQuery/UserQuery.h
  169. +58 −0 sdk/WeiboEngine/WeiboQuery/UserQuery.m
  170. +24 −0 sdk/WeiboEngine/WeiboQuery/WeiboQuery.h
  171. +98 −0 sdk/WeiboEngine/WeiboQuery/WeiboQuery.m
  172. +53 −0 sdk/WeiboEngine/WeiboRequest.h
  173. +283 −0 sdk/WeiboEngine/WeiboRequest.m
  174. +41 −0 sdk/WeiboEngine/WeiboSignIn.h
  175. +129 −0 sdk/WeiboEngine/WeiboSignIn.m
  176. +32 −0 sdk/WeiboEngine/WeiboSignInViewController.h
  177. +159 −0 sdk/WeiboEngine/WeiboSignInViewController.m
  178. +118 −0 sdk/WeiboEngine/WeiboSignInViewController.xib
  179. +587 −0 sdk/WeiboSDK.xcodeproj/project.pbxproj
  180. +7 −0 sdk/WeiboSDK/WeiboSDK-Prefix.pch
  181. +26 −0 sdk/WeiboSDK/WeiboSDK.h
  182. +13 −0 thirdparts/NULevelDB/NSLDBIterator.h
  183. +23 −0 thirdparts/NULevelDB/NSLDBIterator.mm
  184. +13 −0 thirdparts/NULevelDB/NULDBCache.h
  185. +30 −0 thirdparts/NULevelDB/NULDBCache.mm
  186. +13 −0 thirdparts/NULevelDB/NULDBComparator.h
  187. +23 −0 thirdparts/NULevelDB/NULDBComparator.mm
  188. +192 −0 thirdparts/NULevelDB/NULDBDB+BulkAccess.mm
  189. +221 −0 thirdparts/NULevelDB/NULDBDB+Enumeration.mm
  190. +321 −0 thirdparts/NULevelDB/NULDBDB+Serializing.mm
  191. +120 −0 thirdparts/NULevelDB/NULDBDB+SizeEstimation.mm
  192. +157 −0 thirdparts/NULevelDB/NULDBDB.h
  193. +466 −0 thirdparts/NULevelDB/NULDBDB.mm
  194. +140 −0 thirdparts/NULevelDB/NULDBDB_private.h
  195. +30 −0 thirdparts/NULevelDB/NULDBSerializable.h
  196. +64 −0 thirdparts/NULevelDB/NULDBSlice.h
  197. +199 −0 thirdparts/NULevelDB/NULDBSlice.mm
  198. +13 −0 thirdparts/NULevelDB/NULDBStatus.h
  199. +23 −0 thirdparts/NULevelDB/NULDBStatus.mm
  200. +13 −0 thirdparts/NULevelDB/NULDBTable.h
  201. +23 −0 thirdparts/NULevelDB/NULDBTable.mm
  202. +49 −0 thirdparts/NULevelDB/NULDBUtilities.h
  203. +80 −0 thirdparts/NULevelDB/NULDBUtilities.mm
  204. +21 −0 thirdparts/NULevelDB/NULDBWriteBatch.h
  205. +57 −0 thirdparts/NULevelDB/NULDBWriteBatch.mm
  206. BIN  thirdparts/NULevelDB/armv7-libleveldb.a
  207. +246 −0 thirdparts/NULevelDB/include/leveldb/c.h
  208. +99 −0 thirdparts/NULevelDB/include/leveldb/cache.h
  209. +63 −0 thirdparts/NULevelDB/include/leveldb/comparator.h
  210. +160 −0 thirdparts/NULevelDB/include/leveldb/db.h
  211. +323 −0 thirdparts/NULevelDB/include/leveldb/env.h
  212. +100 −0 thirdparts/NULevelDB/include/leveldb/iterator.h
  213. +187 −0 thirdparts/NULevelDB/include/leveldb/options.h
  214. +109 −0 thirdparts/NULevelDB/include/leveldb/slice.h
  215. +100 −0 thirdparts/NULevelDB/include/leveldb/status.h
  216. +70 −0 thirdparts/NULevelDB/include/leveldb/table.h
  217. +91 −0 thirdparts/NULevelDB/include/leveldb/table_builder.h
  218. +64 −0 thirdparts/NULevelDB/include/leveldb/write_batch.h
  219. BIN  thirdparts/NULevelDB/libleveldb.a
4 sample/Controllers/AccountsViewController.m
View
@@ -46,7 +46,7 @@ - (void)dealloc {
}
- (IBAction)close:(id)sender {
- [self dismissModalViewControllerAnimated:YES];
+ [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)add:(id)sender {
@@ -189,7 +189,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
WeiboAccount *account = [[[WeiboAccounts shared]accounts] objectAtIndex:indexPath.row];
[[WeiboAccounts shared] setCurrentAccount:account];
- [self dismissModalViewControllerAnimated:YES];
+ [self dismissViewControllerAnimated:YES completion:nil];
}
@end
4 sample/Controllers/ComposeViewController.m
View
@@ -80,7 +80,7 @@ - (IBAction)cancel:(id)sender {
imgAttachment.image = nil;
sendingView.hidden = YES;
- [self dismissModalViewControllerAnimated:YES];
+ [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)insert:(id)sender {
@@ -138,7 +138,7 @@ - (void)request:(WeiboRequest *)request didLoad:(id)result {
Status *status = [Status statusWithJsonDictionary:result];
NSLog(@"status id: %lld", status.statusId);
sendingView.hidden = YES;
- [self dismissModalViewControllerAnimated:YES];
+ [self dismissViewControllerAnimated:YES completion:nil];
[request release];
}
436 sample/Controllers/ComposeViewController.xib
View
@@ -1,31 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1056</int>
- <string key="IBDocument.SystemVersion">10H574</string>
- <string key="IBDocument.InterfaceBuilderVersion">823</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12C60</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2840</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">132</string>
+ <string key="NS.object.0">1926</string>
</object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="23"/>
+ <string>IBProxyObject</string>
+ <string>IBUIActivityIndicatorView</string>
+ <string>IBUIBarButtonItem</string>
+ <string>IBUIImageView</string>
+ <string>IBUILabel</string>
+ <string>IBUITextView</string>
+ <string>IBUIToolbar</string>
+ <string>IBUIView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -44,9 +46,10 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIToolbar" id="292314332">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">266</int>
+ <int key="NSvFlags">290</int>
<string key="NSFrameSize">{320, 44}</string>
<reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -77,6 +80,7 @@
<int key="NSvFlags">290</int>
<string key="NSFrame">{{0, 44}, {320, 156}}</string>
<reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
@@ -89,12 +93,22 @@
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <int key="type">1</int>
+ <double key="pointSize">17</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">17</double>
+ <int key="NSfFlags">16</int>
+ </object>
</object>
<object class="IBUIToolbar" id="711571891">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">266</int>
+ <int key="NSvFlags">290</int>
<string key="NSFrame">{{0, 200}, {320, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -114,6 +128,7 @@
<int key="NSvFlags">290</int>
<string key="NSFrame">{{80, 200}, {57, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
@@ -123,7 +138,7 @@
</object>
<object class="IBUIView" id="882001708">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">-2147483356</int>
+ <int key="NSvFlags">-2147483358</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIActivityIndicatorView" id="336475027">
@@ -131,6 +146,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{141, 85}, {37, 37}}</string>
<reference key="NSSuperview" ref="882001708"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHidesWhenStopped">NO</bool>
@@ -142,17 +158,13 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{0, 130}, {320, 43}}</string>
<reference key="NSSuperview" ref="882001708"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">发送中...</string>
- <object class="NSFont" key="IBUIFont">
- <string key="NSName">Helvetica</string>
- <double key="NSSize">36</double>
- <int key="NSfFlags">16</int>
- </object>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
@@ -167,10 +179,22 @@
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">1</int>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <string key="name">Helvetica</string>
+ <string key="family">Helvetica</string>
+ <int key="traits">0</int>
+ <double key="pointSize">36</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">36</double>
+ <int key="NSfFlags">16</int>
+ </object>
</object>
</object>
<string key="NSFrameSize">{320, 244}</string>
<reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAgMC41AA</bytes>
@@ -178,8 +202,9 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
- <string key="NSFrameSize">{320, 460}</string>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
@@ -243,20 +268,20 @@
<int key="connectionID">19</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">cancel:</string>
- <reference key="source" ref="86209737"/>
- <reference key="destination" ref="372490531"/>
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">sendingView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="882001708"/>
</object>
- <int key="connectionID">20</int>
+ <int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">insert:</string>
- <reference key="source" ref="734044265"/>
+ <string key="label">cancel:</string>
+ <reference key="source" ref="86209737"/>
<reference key="destination" ref="372490531"/>
</object>
- <int key="connectionID">21</int>
+ <int key="connectionID">20</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
@@ -267,12 +292,12 @@
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">sendingView</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="882001708"/>
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">insert:</string>
+ <reference key="source" ref="734044265"/>
+ <reference key="destination" ref="372490531"/>
</object>
- <int key="connectionID">25</int>
+ <int key="connectionID">21</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -280,7 +305,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <reference key="object" ref="0"/>
+ <object class="NSArray" key="object" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@@ -385,50 +412,36 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
+ <string>-1.IBPluginDependency</string>
<string>-2.CustomClassName</string>
- <string>1.IBEditorWindowLastContentRect</string>
+ <string>-2.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>10.IBPluginDependency</string>
- <string>10.IBViewBoundsToFrameTransform</string>
<string>11.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>13.IBPluginDependency</string>
- <string>13.IBViewBoundsToFrameTransform</string>
<string>23.IBPluginDependency</string>
<string>24.IBPluginDependency</string>
- <string>24.IBViewBoundsToFrameTransform</string>
<string>4.IBPluginDependency</string>
- <string>4.IBViewBoundsToFrameTransform</string>
<string>5.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ComposeViewController</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>UIResponder</string>
- <string>{{218, 271}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw3IAAA</bytes>
- </object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDBwAAwvAAAA</bytes>
- </object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAwyQAAA</bytes>
- </object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAwigAAA</bytes>
- </object>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -438,17 +451,13 @@
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">25</int>
@@ -467,7 +476,7 @@
<string>insert:</string>
<string>send:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
@@ -482,7 +491,7 @@
<string>insert:</string>
<string>send:</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">cancel:</string>
@@ -509,7 +518,7 @@
<string>messageTextField</string>
<string>sendingView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIBarButtonItem</string>
<string>UIBarButtonItem</string>
@@ -530,7 +539,7 @@
<string>messageTextField</string>
<string>sendingView</string>
</object>
- <object class="NSMutableArray" key="dict.values">
+ <object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">btnCancel</string>
@@ -560,293 +569,7 @@
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/ComposeViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ThirdPart/JSON/NSObject+SBJSON.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ThirdPart/JSON/SBProxyForJson.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UITextView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/Additions/UITextViewAdditions.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/Additions/UIView+Hierarchy.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/Additions/UIViewAdditions.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="601862048">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIActivityIndicatorView</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIActivityIndicatorView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIBarButtonItem</string>
- <string key="superclassName">UIBarItem</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIBarItem</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIImageView</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIImageView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UILabel</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIResponder</string>
- <string key="superclassName">NSObject</string>
- <reference key="sourceIdentifier" ref="601862048"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIScrollView</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UISearchBar</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UISearchDisplayController</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UITextView</string>
- <string key="superclassName">UIScrollView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIToolbar</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIToolbar.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIView</string>
- <string key="superclassName">UIResponder</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">UIViewController</string>
- <string key="superclassName">UIResponder</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+ <string key="minorKey">./Classes/ComposeViewController.h</string>
</object>
</object>
</object>
@@ -855,15 +578,14 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <integer value="1056" key="NS.object.0"/>
+ <real value="1536" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../SinaWeiboOAuthDemo.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">132</string>
+ <string key="IBCocoaTouchPluginVersion">1926</string>
</data>
</archive>
6 sample/Controllers/HomeViewController.m
View
@@ -58,7 +58,7 @@ - (void)displayAccountsViewController {
AccountsViewController *accountsViewController = [[[AccountsViewController alloc]initWithNibName:nil bundle:nil]autorelease];
UINavigationController *accountsNavigationController = [[[UINavigationController alloc]initWithRootViewController:accountsViewController] autorelease];
accountsNavigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
- [self presentModalViewController:accountsNavigationController animated:YES];
+ [self presentViewController:accountsNavigationController animated:YES completion:nil];
}
- (void)viewDidAppear:(BOOL)animated {
@@ -104,14 +104,14 @@ - (IBAction)refresh:(id)sender {
_query = nil;
[self.tableView reloadData];
};
- [_query queryFriendsTimelineWithCount:20];
+ [_query queryTimeline:StatusTimelineFriends count:20];
[self.tableView reloadData];
}
- (IBAction)compose:(id)sender {
ComposeViewController *composeViewController = [[[ComposeViewController alloc]initWithNibName:@"ComposeViewController" bundle:nil]autorelease];
composeViewController.statusText = @"Test #Zhiweibo#";
- [self presentModalViewController:composeViewController animated:YES];
+ [self presentViewController:composeViewController animated:YES completion:nil];
}
- (IBAction)displayAccountsController:(id)sender {
50 sample/Sample.xcodeproj/project.pbxproj
View
@@ -23,24 +23,24 @@
B559929D1608DF7C0037448E /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B55992951608DF7C0037448E /* Icon.png */; };
B559929E1608DF7C0037448E /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B55992961608DF7C0037448E /* Icon@2x.png */; };
B559929F1608DF7C0037448E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B55992981608DF7C0037448E /* ViewController.m */; };
- B55992B91608E7A90037448E /* libWeiboSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B559928A1608DEDD0037448E /* libWeiboSDK.a */; };
B55992BB1608E7C80037448E /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B55992BA1608E7C80037448E /* CFNetwork.framework */; };
B55992BD1608E7CF0037448E /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B55992BC1608E7CF0037448E /* SystemConfiguration.framework */; };
B55992BF1608E7D60037448E /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B55992BE1608E7D60037448E /* MobileCoreServices.framework */; };
B55992C11608E7E40037448E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B55992C01608E7E40037448E /* libz.dylib */; };
+ B5E35F451632F32600947A19 /* libWeiboSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5E35EF21632EEAD00947A19 /* libWeiboSDK.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- B55992891608DEDD0037448E /* PBXContainerItemProxy */ = {
+ B5E35EF11632EEAD00947A19 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
- containerPortal = B55992821608DEDD0037448E /* WeiboSDK.xcodeproj */;
+ containerPortal = B5E35EEA1632EEAD00947A19 /* WeiboSDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B55991641608DB8E0037448E;
remoteInfo = WeiboSDK;
};
- B559928B1608DF350037448E /* PBXContainerItemProxy */ = {
+ B5E35F461632F36B00947A19 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
- containerPortal = B55992821608DEDD0037448E /* WeiboSDK.xcodeproj */;
+ containerPortal = B5E35EEA1632EEAD00947A19 /* WeiboSDK.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = B55991631608DB8E0037448E;
remoteInfo = WeiboSDK;
@@ -61,7 +61,6 @@
B55992771608DE9E0037448E /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
B55992791608DE9E0037448E /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
B559927B1608DE9E0037448E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
- B55992821608DEDD0037448E /* WeiboSDK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WeiboSDK.xcodeproj; path = ../src/WeiboSDK.xcodeproj; sourceTree = "<group>"; };
B559928E1608DF7C0037448E /* AccountsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountsViewController.h; sourceTree = "<group>"; };
B559928F1608DF7C0037448E /* AccountsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountsViewController.m; sourceTree = "<group>"; };
B55992901608DF7C0037448E /* ComposeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComposeViewController.h; sourceTree = "<group>"; };
@@ -77,6 +76,7 @@
B55992BC1608E7CF0037448E /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
B55992BE1608E7D60037448E /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
B55992C01608E7E40037448E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
+ B5E35EEA1632EEAD00947A19 /* WeiboSDK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WeiboSDK.xcodeproj; path = ../sdk/WeiboSDK.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -84,12 +84,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ B5E35F451632F32600947A19 /* libWeiboSDK.a in Frameworks */,
B55992C11608E7E40037448E /* libz.dylib in Frameworks */,
B559926A1608DE9D0037448E /* CoreGraphics.framework in Frameworks */,
B55992BF1608E7D60037448E /* MobileCoreServices.framework in Frameworks */,
B55992BD1608E7CF0037448E /* SystemConfiguration.framework in Frameworks */,
B55992BB1608E7C80037448E /* CFNetwork.framework in Frameworks */,
- B55992B91608E7A90037448E /* libWeiboSDK.a in Frameworks */,
B55992661608DE9D0037448E /* UIKit.framework in Frameworks */,
B55992681608DE9D0037448E /* Foundation.framework in Frameworks */,
);
@@ -101,7 +101,7 @@
B55992561608DE9D0037448E = {
isa = PBXGroup;
children = (
- B55992821608DEDD0037448E /* WeiboSDK.xcodeproj */,
+ B5E35EEA1632EEAD00947A19 /* WeiboSDK.xcodeproj */,
B55992951608DF7C0037448E /* Icon.png */,
B55992961608DF7C0037448E /* Icon@2x.png */,
B559926B1608DE9D0037448E /* Sample */,
@@ -159,14 +159,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
- B55992831608DEDD0037448E /* Products */ = {
- isa = PBXGroup;
- children = (
- B559928A1608DEDD0037448E /* libWeiboSDK.a */,
- );
- name = Products;
- sourceTree = "<group>";
- };
B559928D1608DF7C0037448E /* Controllers */ = {
isa = PBXGroup;
children = (
@@ -181,6 +173,14 @@
path = Controllers;
sourceTree = SOURCE_ROOT;
};
+ B5E35EEB1632EEAD00947A19 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ B5E35EF21632EEAD00947A19 /* libWeiboSDK.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -195,7 +195,7 @@
buildRules = (
);
dependencies = (
- B559928C1608DF350037448E /* PBXTargetDependency */,
+ B5E35F471632F36B00947A19 /* PBXTargetDependency */,
);
name = Sample;
productName = Sample;
@@ -223,8 +223,8 @@
projectDirPath = "";
projectReferences = (
{
- ProductGroup = B55992831608DEDD0037448E /* Products */;
- ProjectRef = B55992821608DEDD0037448E /* WeiboSDK.xcodeproj */;
+ ProductGroup = B5E35EEB1632EEAD00947A19 /* Products */;
+ ProjectRef = B5E35EEA1632EEAD00947A19 /* WeiboSDK.xcodeproj */;
},
);
projectRoot = "";
@@ -235,11 +235,11 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
- B559928A1608DEDD0037448E /* libWeiboSDK.a */ = {
+ B5E35EF21632EEAD00947A19 /* libWeiboSDK.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libWeiboSDK.a;
- remoteRef = B55992891608DEDD0037448E /* PBXContainerItemProxy */;
+ remoteRef = B5E35EF11632EEAD00947A19 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@@ -278,10 +278,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- B559928C1608DF350037448E /* PBXTargetDependency */ = {
+ B5E35F471632F36B00947A19 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = WeiboSDK;
- targetProxy = B559928B1608DF350037448E /* PBXContainerItemProxy */;
+ targetProxy = B5E35F461632F36B00947A19 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@@ -320,6 +320,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
+ USER_HEADER_SEARCH_PATHS = "";
};
name = Debug;
};
@@ -340,6 +341,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
+ USER_HEADER_SEARCH_PATHS = "";
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -355,6 +357,7 @@
"-all_load",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ USER_HEADER_SEARCH_PATHS = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -370,6 +373,7 @@
"-all_load",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ USER_HEADER_SEARCH_PATHS = "";
WRAPPER_EXTENSION = app;
};
name = Release;
17 sample_WeiboPlus/Controllers/AccountsViewController.h
View
@@ -0,0 +1,17 @@
+//
+// AccountsViewController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-20.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "WeiboSignIn.h"
+#import "WeiboAccounts.h"
+
+@interface AccountsViewController : UITableViewController<WeiboSignInDelegate> {
+ WeiboSignIn *_weiboSignIn;
+}
+
+@end
193 sample_WeiboPlus/Controllers/AccountsViewController.m
View
@@ -0,0 +1,193 @@
+//
+// AccountsViewController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-20.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "AccountsViewController.h"
+#import "WeiboAccountCell.h"
+
+@interface AccountsViewController ()
+
+@end
+
+@implementation AccountsViewController
+
+- (id)initWithStyle:(UITableViewStyle)style
+{
+ self = [super initWithStyle:style];
+ if (self) {
+
+ }
+ return self;
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ UIBarButtonItem *closeButton = [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Button_Close", @"Button Close") style:UIBarButtonItemStyleBordered target:self action:@selector(close:)] autorelease];
+ self.navigationItem.leftBarButtonItem = closeButton;
+
+ UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add:)] autorelease];
+ self.navigationItem.rightBarButtonItem = addButton;
+
+ self.title = NSLocalizedString(@"AccountsViewController_Title", "Accounts");
+
+ _weiboSignIn = [[WeiboSignIn alloc] init];
+ _weiboSignIn.delegate = self;
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_weiboSignIn release];
+ [super dealloc];
+}
+
+- (IBAction)close:(id)sender {
+ [self dismissViewControllerAnimated:YES completion:nil];
+}
+
+- (IBAction)add:(id)sender {
+ [_weiboSignIn signInOnViewController:self];
+}
+
+- (void)finishedWithAuth:(WeiboAuthentication *)auth error:(NSError *)error {
+ if (error) {
+ NSLog(@"failed to auth: %@", error);
+ }
+ else {
+ NSLog(@"Success to auth: %@", auth.userId);
+ [[WeiboAccounts shared]addAccountWithAuthentication:auth];
+ }
+ [self.tableView reloadData];
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"btn_tool_bar_rect_default.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
+ [self.editButtonItem setBackgroundImage:[UIImage imageNamed:@"btn_tool_bar_rect_pressed.png"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
+ NSArray* toolbarItems = [NSArray arrayWithObjects:
+ self.editButtonItem,
+ nil];
+ self.toolbarItems = toolbarItems;
+ self.navigationController.toolbarHidden = NO;
+
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+
+ if (!self.modalViewController) {
+ if (![[WeiboAccounts shared]currentAccount] && [[WeiboAccounts shared]accounts].count == 0) {
+ [self add:nil];
+ }
+ }
+
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [[WeiboAccounts shared]accounts].count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"WeiboAccountCell";
+ WeiboAccountCell *cell = (WeiboAccountCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (!cell) {
+ cell = [[[WeiboAccountCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
+ }
+ WeiboAccount *account = [[[WeiboAccounts shared]accounts] objectAtIndex:indexPath.row];
+ NSString *name = account.screenName;
+ if (!name) {
+ name = account.userId;
+ }
+ cell.weiboAccount = account;
+
+ return cell;
+}
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ WeiboAccount *account = [[[WeiboAccounts shared]accounts] objectAtIndex:indexPath.row];
+ [[WeiboAccounts shared] removeWeiboAccount:account];
+ [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ }
+ else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
+{
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+#pragma mark - Table view delegate
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return 52;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
+ WeiboAccount *account = [[[WeiboAccounts shared]accounts] objectAtIndex:indexPath.row];
+ if ([[WeiboAccounts shared] currentAccount] == account) {
+ [self close:nil];
+ }
+ else {
+ [[WeiboAccounts shared] setCurrentAccount:account];
+ [self.tableView reloadData];
+ }
+}
+
+@end
13 sample_WeiboPlus/Controllers/DiscoverViewController.h
View
@@ -0,0 +1,13 @@
+//
+// DiscoverViewController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-1.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface DiscoverViewController : UIViewController
+
+@end
44 sample_WeiboPlus/Controllers/DiscoverViewController.m
View
@@ -0,0 +1,44 @@
+//
+// DiscoverViewController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-1.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "DiscoverViewController.h"
+
+@interface DiscoverViewController ()
+
+@end
+
+@implementation DiscoverViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ self.title = @"Discover";
+ self.tabBarItem.title = @"Discover";
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
20 sample_WeiboPlus/Controllers/HomeViewController.h
View
@@ -0,0 +1,20 @@
+//
+// HomeViewController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "TimelineQuery.h"
+#import "TweetViewCell.h"
+#import "TweetViewCellLayout.h"
+
+@interface HomeViewController : UITableViewController {
+ NSMutableArray *_statuses;
+}
+
+@property (nonatomic, retain) NSMutableArray *statuses;
+
+@end
174 sample_WeiboPlus/Controllers/HomeViewController.m
View
@@ -0,0 +1,174 @@
+//
+// HomeViewController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "HomeViewController.h"
+
+@interface HomeViewController ()
+
+@end
+
+@implementation HomeViewController
+@synthesize statuses = _statuses;
+
+- (id)initWithStyle:(UITableViewStyle)style
+{
+ self = [super initWithStyle:style];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ self.title = @"Home";
+ self.tabBarItem.title = @"Home";
+ _statuses = [[NSMutableArray alloc]init];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_statuses release];
+ [super dealloc];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+
+ TimelineQuery *query = [TimelineQuery query];
+ query.completionBlock = ^(WeiboRequest *request, NSMutableArray *statuses, NSError *error) {
+ if (error) {
+ //
+ NSLog(@"TimelineQuery error: %@, sessionDidExpire: %d", error, request.sessionDidExpire);
+ }
+ else {
+ [_statuses removeAllObjects];
+ for (Status *status in statuses) {
+ //NSLog(@"status: %@", status.text);
+ TweetViewCellLayout *layout = [[[TweetViewCellLayout alloc] init] autorelease];
+ layout.status = status;
+ [_statuses addObject:layout];
+ }
+ [self.tableView reloadData];
+ }
+ };
+
+ [query queryTimeline:StatusTimelineFriends count:200];
+
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ self.tableView.backgroundColor = [UIColor colorWithPatternImage:[Images textureBackgroundImage]];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return _statuses.count;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ TweetViewCellLayout *layout = [_statuses objectAtIndex:indexPath.row];
+ if (CGSizeEqualToSize(layout.size, CGSizeZero)) {
+ [layout layoutForWidth:self.tableView.bounds.size.width];
+ }
+ return layout.size.height;
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"Cell";
+ TweetViewCell *cell = (TweetViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (!cell) {
+ cell = [[[TweetViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
+ }
+
+ TweetViewCellLayout *layout = [_statuses objectAtIndex:indexPath.row];
+ cell.layout = layout;
+
+
+ return cell;
+}
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ }
+ else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+*/
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
+{
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+#pragma mark - Table view delegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Navigation logic may go here. Create and push another view controller.
+ /*
+ <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
+ // ...
+ // Pass the selected object to the new view controller.
+ [self.navigationController pushViewController:detailViewController animated:YES];
+ [detailViewController release];
+ */
+}
+
+@end
13 sample_WeiboPlus/Controllers/MentionViewController.h
View
@@ -0,0 +1,13 @@
+//
+// MentionViewController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MentionViewController : UITableViewController
+
+@end
132 sample_WeiboPlus/Controllers/MentionViewController.m
View
@@ -0,0 +1,132 @@
+//
+// MentionViewController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "MentionViewController.h"
+
+@interface MentionViewController ()
+
+@end
+
+@implementation MentionViewController
+
+- (id)initWithStyle:(UITableViewStyle)style
+{
+ self = [super initWithStyle:style];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ self.title = @"Mention";
+ self.tabBarItem.title = @"Mention";
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+#warning Potentially incomplete method implementation.
+ // Return the number of sections.
+ return 0;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+#warning Incomplete method implementation.
+ // Return the number of rows in the section.
+ return 0;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *CellIdentifier = @"Cell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+
+ // Configure the cell...
+
+ return cell;
+}
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the specified item to be editable.
+ return YES;
+}
+*/
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // Delete the row from the data source
+ [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ }
+ else if (editingStyle == UITableViewCellEditingStyleInsert) {
+ // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+ }
+}
+*/
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
+{
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Return NO if you do not want the item to be re-orderable.
+ return YES;
+}
+*/
+
+#pragma mark - Table view delegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ // Navigation logic may go here. Create and push another view controller.
+ /*
+ <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
+ // ...
+ // Pass the selected object to the new view controller.
+ [self.navigationController pushViewController:detailViewController animated:YES];
+ [detailViewController release];
+ */
+}
+
+@end
13 sample_WeiboPlus/Controllers/ProfileViewController.h
View
@@ -0,0 +1,13 @@
+//
+// ProfileViewController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-1.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ProfileViewController : UIViewController
+
+@end
44 sample_WeiboPlus/Controllers/ProfileViewController.m
View
@@ -0,0 +1,44 @@
+//
+// ProfileViewController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-1.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "ProfileViewController.h"
+
+@interface ProfileViewController ()
+
+@end
+
+@implementation ProfileViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ self.title = @"Me";
+ self.tabBarItem.title = @"Me";
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
18 sample_WeiboPlus/Controllers/WeiboTabBarController.h
View
@@ -0,0 +1,18 @@
+//
+// WeiboTabBarController.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "HomeViewController.h"
+#import "MentionViewController.h"
+#import "DiscoverViewController.h"
+#import "ProfileViewController.h"
+#import "TabBarController.h"
+
+@interface WeiboTabBarController : TabBarController
+
+@end
75 sample_WeiboPlus/Controllers/WeiboTabBarController.m
View
@@ -0,0 +1,75 @@
+//
+// WeiboTabBarController.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-8-25.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "WeiboTabBarController.h"
+
+@interface WeiboTabBarController ()
+
+@end
+
+@implementation WeiboTabBarController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ HomeViewController *homeViewController = [[[HomeViewController alloc]initWithNibName:nil bundle:nil] autorelease];
+ UINavigationController *homeNavicationController = [[[UINavigationController alloc]initWithRootViewController:homeViewController] autorelease];
+
+ MentionViewController *mentionViewController = [[[MentionViewController alloc]initWithNibName:nil bundle:nil] autorelease];
+ UINavigationController *mentionNavicationController = [[[UINavigationController alloc]initWithRootViewController:mentionViewController] autorelease];
+
+ DiscoverViewController *discoverViewController = [[[DiscoverViewController alloc]initWithNibName:nil bundle:nil] autorelease];
+ UINavigationController *discoverNavicationController = [[[UINavigationController alloc]initWithRootViewController:discoverViewController] autorelease];
+
+ ProfileViewController *profileViewController = [[[ProfileViewController alloc]initWithNibName:nil bundle:nil] autorelease];
+ UINavigationController *profileNavicationController = [[[UINavigationController alloc]initWithRootViewController:profileViewController] autorelease];
+
+ self.viewControllers = [NSArray arrayWithObjects:
+ homeNavicationController,
+ mentionNavicationController,
+ discoverNavicationController,
+ profileNavicationController,
+ nil];
+
+
+ NSArray *selectedImages = [NSArray arrayWithObjects:@"ic_tab_home_selected.png", @"ic_tab_at_selected.png", @"ic_tab_hash_selected.png", @"ic_tab_profile_selected.png", nil];
+ NSArray *unselectedImages = [NSArray arrayWithObjects:@"ic_tab_home_default.png", @"ic_tab_at_default.png", @"ic_tab_hash_default.png", @"ic_tab_profile_default.png", nil];
+
+ for (int i=0; i<self.tabBar.items.count; i++) {
+ TabBarItem *item = [self.tabBar.items objectAtIndex:i];
+ UIImage *selectedImage = [UIImage imageNamed:[selectedImages objectAtIndex:i]];
+ UIImage *unselectedImage = [UIImage imageNamed:[unselectedImages objectAtIndex:i]];
+ [item setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage];
+ if (i == 2) {
+ item.isGlowed = YES;
+ }
+ }
+
+
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
34 sample_WeiboPlus/DataManager/DBAccess.h
View
@@ -0,0 +1,34 @@
+//
+// DBAccess.h
+// WeiboPlus
+//
+// Created by junmin liu on 12-9-22.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "NULDBDB.h"
+#import "TimelineQuery.h"
+#import "Status.h"
+#import "User.h"
+
+@interface DBAccess : NSObject {
+ NULDBDB *_db;
+}
+
++ (DBAccess *)shared;
+
+- (void)saveStatus:(Status *)status;
+- (void)removeStatus:(long long)statusId;
+- (BOOL)containStatus:(long long)statusId;
+- (Status *)getStatus:(long long)statusId;
+
+- (void)saveUser:(User *)user;
+- (void)removeUser:(long long)userId;
+- (BOOL)containUser:(long long)userId;
+- (User *)getUser:(long long)userId;
+
+- (void)saveStatusIds:(NSMutableArray *)statusIds forTimeline:(StatusTimeline)timeline;
+- (NSMutableArray *)getTimelineStatusIds:(StatusTimeline)timeline;
+
+@end
95 sample_WeiboPlus/DataManager/DBAccess.m
View
@@ -0,0 +1,95 @@
+//
+// DBAccess.m
+// WeiboPlus
+//
+// Created by junmin liu on 12-9-22.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "DBAccess.h"
+
+static DBAccess *sharedInstance = nil;
+
+@implementation DBAccess
+
+- (id)init {
+ self = [super init];
+ if (self) {
+ NSString *dbFile = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
+ dbFile = [dbFile stringByAppendingPathComponent:@"weibo.db"];
+
+ _db = [[NULDBDB alloc]initWithLocation:dbFile];
+
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_db release];
+ [super dealloc];
+}
+
++ (DBAccess *)shared {
+ if (!sharedInstance) {
+ sharedInstance = [[DBAccess alloc]init];
+ }
+ return sharedInstance;
+}
+
+- (NSString *)statusKey:(long long)statusId {
+ return [NSString stringWithFormat:@"status-%lld", statusId];
+}
+
+- (void)saveStatus:(Status *)status {
+ [_db storeValue:status forKey:[self statusKey:status.statusId]];
+}
+
+- (void)removeStatus:(long long)statusId {
+ [_db deleteStoredValueForKey:[self statusKey:statusId]];
+}
+
+- (BOOL)containStatus:(long long)statusId {
+ return [_db storedValueExistsForKey:[self statusKey:statusId]];
+}
+
+- (Status *)getStatus:(long long)statusId {
+ return (Status *)[_db storedValueForKey:[self statusKey:statusId]];
+}
+
+
+- (NSString *)userKey:(long long)userId {
+ return [NSString stringWithFormat:@"user-%lld", userId];
+}
+
+- (void)saveUser:(User *)user {
+ [_db storeValue:user forKey:[self userKey:user.userId]];
+}
+
+- (void)removeUser:(long long)userId {
+ [_db deleteStoredValueForKey:[self userKey:userId]];
+}
+
+- (BOOL)containUser:(long long)userId {
+ return [_db storedValueExistsForKey:[self userKey:userId]];
+}
+
+- (User *)getUser:(long long)userId {
+ return (User *)[_db storedValueForKey:[self userKey:userId]];
+}
+
+- (NSString *)timelineStatusIdsKey:(StatusTimeline)timeline {
+ return [NSString stringWithFormat:@"StatusIds-%d", timeline];
+}
+
+
+- (NSMutableArray *)getTimelineStatusIds:(StatusTimeline)timeline {
+ return (NSMutableArray *)[_db storedValueForKey:[self timelineStatusIdsKey:timeline]];
+}
+
+- (void)saveStatusIds:(NSMutableArray *)statusIds forTimeline:(StatusTimeline)timeline {
+ [_db storeValue:statusIds forKey:[self timelineStatusIdsKey:timeline]];
+}
+
+
+
+@end
25 sample_WeiboPlus/DataManager/TimelineStorage.h
View
@@ -0,0 +1,25 @@
+//
+// TimelineStorage.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-11.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "TimelineQuery.h"
+#import "DBAccess.h"
+
+
+@interface TimelineStorage : NSObject {
+ StatusTimeline _timeline;
+ NSMutableArray *_statusIds;
+ DBAccess *_dbAccess;
+}
+
+- (id)initWithStatusTimeline:(StatusTimeline)timeline;
+
+- (NSMutableArray *)getStatusIds;
+- (void)saveStatusIds:(NSMutableArray *)statusIds;
+
+@end
216 sample_WeiboPlus/DataManager/TimelineStorage.m
View
@@ -0,0 +1,216 @@
+//
+// TimelineStorage.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-11.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "TimelineStorage.h"
+
+@implementation TimelineStorage
+
+- (id)initWithStatusTimeline:(StatusTimeline)timeline {
+ self = [super init];
+ if (self) {
+ _timeline = timeline;
+ NSMutableArray *statusIds = [self getStatusIds];
+ if (!statusIds) {
+ statusIds = [NSMutableArray array];
+ }
+ _statusIds = [statusIds retain];
+ _dbAccess = [DBAccess shared];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_statusIds release];
+ [super dealloc];
+}
+
+- (NSMutableArray *)getStatusIds {
+ return [_dbAccess getTimelineStatusIds:_timeline];
+}
+
+- (void)saveStatusIds:(NSMutableArray *)statusIds {
+ [_dbAccess saveStatusIds:statusIds forTimeline:_timeline];
+}
+
+- (void)recentStatus:(NSMutableArray *)statuses
+ isLoadCompleted:(BOOL)isLoadCompleted {
+
+ NSMutableArray *addedStatuses = [NSMutableArray array];
+ int unread = 0;
+ long long lastSyncStatusId = 0;
+ //int lastStatusCount = _statusIds.count;
+ NSNumber* lastStatusKey = _statusIds.count > 0 ? [_statusIds objectAtIndex:0] : nil;
+ for (Status* sts in statuses) {
+ long long statusId = sts.statusId;
+ if (lastSyncStatusId == 0 || statusId < lastSyncStatusId) {
+ lastSyncStatusId = statusId;
+ }
+ if (lastStatusKey
+ && statusId <= [lastStatusKey longLongValue]) {
+ // Ignore stale message
+ continue;
+ }
+ [_dbAccess saveStatus:sts];
+ [addedStatuses addObject:sts];
+ [_statusIds insertObject:sts.statusKey atIndex:0];
+
+ //todo: sync comment counts
+ //todo: download images
+ ++unread;
+ }
+
+ if (unread < statuses.count) {
+ isLoadCompleted = YES;
+ }
+
+ BOOL gap = NO;
+ if (!isLoadCompleted && lastStatusKey
+ && (lastSyncStatusId > [lastStatusKey longLongValue])) { // If we have not downloaded completely
+
+ [_statusIds insertObject:[NSNumber numberWithLongLong:-1] atIndex:unread];
+
+ gap = YES;
+ }
+
+ [self saveStatusIds:_statusIds];
+
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ addedStatuses, @"addedStatuses",
+ [NSNumber numberWithBool:gap], @"gap", nil];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"recentStatusDidLoad"
+ object:addedStatuses
+ userInfo:userInfo];
+
+}
+
+
+- (void)insertStatuses:(NSMutableArray *)statuses
+ insertPosition:(int)insertPosition
+ isLoadCompleted:(BOOL)isLoadCompleted {
+ NSNumber* preStatusKey = nil;
+ NSNumber* nextStatusKey = nil;
+ for (int i = insertPosition - 1; i >= 0; --i) {
+ NSNumber *statusKey = [_statusIds objectAtIndex:i];
+ if (statusKey && [statusKey longLongValue] > 0) {
+ preStatusKey = statusKey;
+ break;
+ }
+ }
+ for (int i = insertPosition + 1; i < _statusIds.count; ++i) {
+ NSNumber *statusKey = [_statusIds objectAtIndex:i];
+ if (statusKey && [statusKey longLongValue] > 0) {
+ nextStatusKey = statusKey;
+ break;
+ }
+ }
+
+ [_statusIds removeObjectAtIndex:insertPosition]; // remove Gap number
+
+ int unread = 0;
+ long long statusId;
+ long long lastSyncStatusId = 0;
+ NSMutableArray *addedStatuses = [NSMutableArray array];
+
+ for (Status* sts in statuses) {
+ statusId = sts.statusId;
+ if (lastSyncStatusId == 0 || statusId < lastSyncStatusId) {
+ lastSyncStatusId = statusId;
+ }
+ if (statusId <= 0
+ || (preStatusKey && statusId >= [preStatusKey longLongValue])
+ || (nextStatusKey && statusId <= [nextStatusKey longLongValue])) {
+ // Ignore stale message
+ continue;
+ }
+ [_dbAccess saveStatus:sts];
+ [_statusIds insertObject:sts.statusKey atIndex:insertPosition];
+ [addedStatuses addObject:sts];
+ // todo: sync comments
+ // todo: download images
+ unread++;
+ }
+
+ if (unread < statuses.count) {
+ isLoadCompleted = YES;
+ }
+
+ BOOL gap = NO;
+ if (!isLoadCompleted && nextStatusKey
+ && (lastSyncStatusId > [nextStatusKey longLongValue])) { // There is a gap between these new statuses and thonse old statuses
+
+ [_statusIds insertObject:[NSNumber numberWithLongLong:-1] atIndex:insertPosition + unread];
+ gap = YES;
+
+ }
+ [self saveStatusIds:_statusIds];
+
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ addedStatuses, @"addedStatuses",
+ [NSNumber numberWithBool:gap], @"gap",
+ [NSNumber numberWithInt:insertPosition], @"insertPosition",
+ nil];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"statusesDidInsert"
+ object:addedStatuses
+ userInfo:userInfo];
+
+}
+
+
+- (void)moreStatuses:(NSMutableArray *)statuses
+{
+ NSMutableArray *addedStatuses = [NSMutableArray array];
+ int insertPos = _statusIds.count;
+ NSNumber* firstStatusKey = nil;
+ for (int i = [_statusIds count] - 1; i >= 0; --i) {
+ NSNumber *statusKey = [_statusIds objectAtIndex:i];
+ if (statusKey && [statusKey isKindOfClass:[NSNumber class]]) {
+ firstStatusKey = statusKey;
+ break;
+ }
+ }
+ for (Status* sts in statuses) {
+ long long statusId = sts.statusId;
+ if (statusId <= 0
+ || (firstStatusKey && statusId >= [firstStatusKey longLongValue])) {
+ // Ignore stale message
+ continue;
+ }
+ [_dbAccess saveStatus:sts];
+ [_statusIds insertObject:sts.statusKey atIndex:insertPos];
+ [addedStatuses addObject:sts];
+ // todo: sync comments
+ // todo: download images
+ }
+
+ [self saveStatusIds:_statusIds];
+
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ addedStatuses, @"addedStatuses",
+ nil];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"moreStatusesDidLoad"
+ object:addedStatuses
+ userInfo:userInfo];
+
+}
+
+- (long long)lastStatusId {
+ NSNumber* firstStatusKey = nil;
+ for (int i = 0; i < [_statusIds count]; i++) {
+ NSNumber *statusKey = [_statusIds objectAtIndex:i];
+ if (statusKey && [statusKey longLongValue] > 0) {
+ firstStatusKey = statusKey;
+ break;
+ }
+ }
+ if (firstStatusKey) {
+ return [firstStatusKey longLongValue];
+ }
+ return -1;
+}
+
+@end
26 sample_WeiboPlus/DataManager/WeiboDataManager.h
View
@@ -0,0 +1,26 @@
+//
+// KeyValueDataManager.h
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-7.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "TimelineStorage.h"
+
+
+
+
+@interface WeiboDataManager : NSObject {
+ TimelineQuery *_query;
+ StatusTimeline _timeline;
+ TimelineStorage *_storage;
+}
+
+- (id)initWithStatusTimeline:(StatusTimeline)timeline;
+
+
+- (void)loadRecentStatus:(int)count;
+
+@end
41 sample_WeiboPlus/DataManager/WeiboDataManager.m
View
@@ -0,0 +1,41 @@
+//
+// KeyValueDataManager.m
+// ZhiWeiboPhone
+//
+// Created by junmin liu on 12-9-7.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import "WeiboDataManager.h"
+
+@implementation WeiboDataManager
+
+
+- (id)initWithStatusTimeline:(StatusTimeline)timeline {
+ self = [super init];
+ if (self) {
+ _timeline = timeline;
+ _storage = [[TimelineStorage alloc] initWithStatusTimeline:timeline];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [self cancelQuery];
+ [_storage release];
+ [super dealloc];
+}
+
+- (void)cancelQuery {
+ [_query cancel];
+ _query = nil;
+}
+
+- (void)loadRecentStatus:(int)count {
+ if (_query) {
+ [self cancelQuery];
+ }
+ _query = [TimelineQuery query];
+}
+
+@end
16 sample_WeiboPlus/DataSources/Fonts.h
View
@@ -0,0 +1,16 @@
+//
+// Fonts.h
+// WeiboPlus
+//
+// Created by junmin liu on 12-10-14.
+// Copyright (c) 2012年 idfsoft. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface Fonts : NSObject
+
++ (UIFont *)defaultFont;
++ (UIFont *)statusTimeFont;
+
+@end
30 sample_WeiboPlus/DataSources/Fonts.m
View
@@ -0,0 +1,30 @@
+//
+// Fonts.m