afmotion 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AFMotion.gemspec +1 -1
- data/Gemfile.lock +1 -1
- data/lib/afmotion/version.rb +1 -1
- metadata +3 -67
- data/examples/AppDotNet/.gitignore +0 -13
- data/examples/AppDotNet/Gemfile +0 -4
- data/examples/AppDotNet/Gemfile.lock +0 -48
- data/examples/AppDotNet/Rakefile +0 -10
- data/examples/AppDotNet/app/app_delegate.rb +0 -28
- data/examples/AppDotNet/app/global_timeline_view_controller.rb +0 -84
- data/examples/AppDotNet/app/post.rb +0 -23
- data/examples/AppDotNet/app/post_table_view_cell.rb +0 -44
- data/examples/AppDotNet/app/user.rb +0 -9
- data/examples/AppDotNet/resources/profile-image-placeholder.png +0 -0
- data/examples/AppDotNet/resources/profile-image-placeholder@2x.png +0 -0
- data/examples/AppDotNet/spec/main_spec.rb +0 -9
- data/examples/AppDotNet/vendor/Podfile.lock +0 -11
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking.podspec +0 -28
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -574
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1187
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -341
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -108
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -237
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -136
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -131
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -44
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -145
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -652
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -169
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -180
- data/examples/AppDotNet/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/examples/AppDotNet/vendor/Pods/AFNetworking/README.md +0 -179
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -574
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -108
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -44
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -574
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -108
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -44
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/examples/AppDotNet/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/examples/AppDotNet/vendor/Pods/Pods-Acknowledgements.markdown +0 -26
- data/examples/AppDotNet/vendor/Pods/Pods-Acknowledgements.plist +0 -56
- data/examples/AppDotNet/vendor/Pods/Pods-prefix.pch +0 -12
- data/examples/AppDotNet/vendor/Pods/Pods-resources.sh +0 -19
- data/examples/AppDotNet/vendor/Pods/Pods.bridgesupport +0 -617
- data/examples/AppDotNet/vendor/Pods/Pods.xcconfig +0 -7
- data/examples/AppDotNet/vendor/Pods/Pods.xcodeproj/project.pbxproj +0 -998
- data/examples/AppDotNet/vendor/Pods/PodsDummy_Pods.m +0 -4
- data/pkg/afmotion-0.0.1.gem +0 -0
data/AFMotion.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.summary = "A RubyMotion Wrapper for AFNetworking"
|
11
11
|
s.description = "A RubyMotion Wrapper for AFNetworking"
|
12
12
|
|
13
|
-
s.files = `git ls-files`.split($\)
|
13
|
+
s.files = `git ls-files`.split($\).delete_if {|x| x.include? "example"}
|
14
14
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
|
data/Gemfile.lock
CHANGED
data/lib/afmotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afmotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -57,69 +57,6 @@ files:
|
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
59
|
- app/app_delegate.rb
|
60
|
-
- examples/AppDotNet/.gitignore
|
61
|
-
- examples/AppDotNet/Gemfile
|
62
|
-
- examples/AppDotNet/Gemfile.lock
|
63
|
-
- examples/AppDotNet/Rakefile
|
64
|
-
- examples/AppDotNet/app/app_delegate.rb
|
65
|
-
- examples/AppDotNet/app/global_timeline_view_controller.rb
|
66
|
-
- examples/AppDotNet/app/post.rb
|
67
|
-
- examples/AppDotNet/app/post_table_view_cell.rb
|
68
|
-
- examples/AppDotNet/app/user.rb
|
69
|
-
- examples/AppDotNet/resources/profile-image-placeholder.png
|
70
|
-
- examples/AppDotNet/resources/profile-image-placeholder@2x.png
|
71
|
-
- examples/AppDotNet/spec/main_spec.rb
|
72
|
-
- examples/AppDotNet/vendor/Podfile.lock
|
73
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking.podspec
|
74
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h
|
75
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m
|
76
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h
|
77
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m
|
78
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h
|
79
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m
|
80
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h
|
81
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m
|
82
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h
|
83
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m
|
84
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h
|
85
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h
|
86
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m
|
87
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h
|
88
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m
|
89
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h
|
90
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m
|
91
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h
|
92
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m
|
93
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/LICENSE
|
94
|
-
- examples/AppDotNet/vendor/Pods/AFNetworking/README.md
|
95
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h
|
96
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h
|
97
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h
|
98
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h
|
99
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h
|
100
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h
|
101
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h
|
102
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h
|
103
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h
|
104
|
-
- examples/AppDotNet/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h
|
105
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h
|
106
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h
|
107
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h
|
108
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h
|
109
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h
|
110
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFNetworking.h
|
111
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h
|
112
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h
|
113
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h
|
114
|
-
- examples/AppDotNet/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h
|
115
|
-
- examples/AppDotNet/vendor/Pods/Pods-Acknowledgements.markdown
|
116
|
-
- examples/AppDotNet/vendor/Pods/Pods-Acknowledgements.plist
|
117
|
-
- examples/AppDotNet/vendor/Pods/Pods-prefix.pch
|
118
|
-
- examples/AppDotNet/vendor/Pods/Pods-resources.sh
|
119
|
-
- examples/AppDotNet/vendor/Pods/Pods.bridgesupport
|
120
|
-
- examples/AppDotNet/vendor/Pods/Pods.xcconfig
|
121
|
-
- examples/AppDotNet/vendor/Pods/Pods.xcodeproj/project.pbxproj
|
122
|
-
- examples/AppDotNet/vendor/Pods/PodsDummy_Pods.m
|
123
60
|
- lib/afmotion.rb
|
124
61
|
- lib/afmotion/http.rb
|
125
62
|
- lib/afmotion/http_client.rb
|
@@ -128,7 +65,6 @@ files:
|
|
128
65
|
- lib/afmotion/operation.rb
|
129
66
|
- lib/afmotion/patch/NSString_NSUrl.rb
|
130
67
|
- lib/afmotion/version.rb
|
131
|
-
- pkg/afmotion-0.0.1.gem
|
132
68
|
- spec/http_client_spec.rb
|
133
69
|
- spec/http_spec.rb
|
134
70
|
- spec/operation_spec.rb
|
@@ -196,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
132
|
version: '0'
|
197
133
|
segments:
|
198
134
|
- 0
|
199
|
-
hash:
|
135
|
+
hash: 2603590834289563556
|
200
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
137
|
none: false
|
202
138
|
requirements:
|
@@ -205,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
141
|
version: '0'
|
206
142
|
segments:
|
207
143
|
- 0
|
208
|
-
hash:
|
144
|
+
hash: 2603590834289563556
|
209
145
|
requirements: []
|
210
146
|
rubyforge_project:
|
211
147
|
rubygems_version: 1.8.23
|
data/examples/AppDotNet/Gemfile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (3.2.8)
|
5
|
-
i18n (~> 0.6)
|
6
|
-
multi_json (~> 1.0)
|
7
|
-
addressable (2.3.2)
|
8
|
-
afmotion (0.0.1)
|
9
|
-
motion-cocoapods (>= 1.2.1)
|
10
|
-
cocoapods (0.15.2)
|
11
|
-
activesupport (~> 3.2.6)
|
12
|
-
colored (~> 1.2)
|
13
|
-
escape (~> 0.0.4)
|
14
|
-
faraday (~> 0.8.1)
|
15
|
-
json (~> 1.7.3)
|
16
|
-
octokit (~> 1.7)
|
17
|
-
open4 (~> 1.3.0)
|
18
|
-
rake (~> 0.9.0)
|
19
|
-
xcodeproj (~> 0.3.5)
|
20
|
-
colored (1.2)
|
21
|
-
escape (0.0.4)
|
22
|
-
faraday (0.8.4)
|
23
|
-
multipart-post (~> 1.1)
|
24
|
-
faraday_middleware (0.9.0)
|
25
|
-
faraday (>= 0.7.4, < 0.9)
|
26
|
-
hashie (1.2.0)
|
27
|
-
i18n (0.6.1)
|
28
|
-
json (1.7.5)
|
29
|
-
motion-cocoapods (1.2.1)
|
30
|
-
cocoapods (>= 0.14.0)
|
31
|
-
multi_json (1.3.6)
|
32
|
-
multipart-post (1.1.5)
|
33
|
-
octokit (1.18.0)
|
34
|
-
addressable (~> 2.2)
|
35
|
-
faraday (~> 0.8)
|
36
|
-
faraday_middleware (~> 0.8)
|
37
|
-
hashie (~> 1.2)
|
38
|
-
multi_json (~> 1.3)
|
39
|
-
open4 (1.3.0)
|
40
|
-
rake (0.9.2.2)
|
41
|
-
xcodeproj (0.3.5)
|
42
|
-
activesupport (~> 3.2.6)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
afmotion
|
data/examples/AppDotNet/Rakefile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
$:.unshift("/Library/RubyMotion/lib")
|
3
|
-
require 'motion/project'
|
4
|
-
$:.unshift("../../lib")
|
5
|
-
require 'afmotion'
|
6
|
-
|
7
|
-
Motion::Project::App.setup do |app|
|
8
|
-
# Use `rake config' to see complete project settings.
|
9
|
-
app.name = 'AppDotNet'
|
10
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class AppDelegate
|
2
|
-
attr_accessor :navigationController, :window
|
3
|
-
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
4
|
-
|
5
|
-
AFMotion::Client.build_shared("https://alpha-api.app.net/") do
|
6
|
-
header "Accept", "application/json"
|
7
|
-
|
8
|
-
operation :json
|
9
|
-
end
|
10
|
-
|
11
|
-
url_cache = NSURLCache.alloc.initWithMemoryCapacity(4 * 1024 * 1024, diskCapacity:20 * 1024 * 1024,diskPath:nil)
|
12
|
-
NSURLCache.setSharedURLCache(url_cache)
|
13
|
-
|
14
|
-
AFNetworkActivityIndicatorManager.sharedManager.enabled = true
|
15
|
-
|
16
|
-
viewController = GlobalTimelineViewController.alloc.initWithStyle(UITableViewStylePlain)
|
17
|
-
|
18
|
-
self.navigationController = UINavigationController.alloc.initWithRootViewController(viewController)
|
19
|
-
self.navigationController.navigationBar.tintColor = UIColor.darkGrayColor
|
20
|
-
|
21
|
-
self.window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
22
|
-
self.window.backgroundColor = UIColor.whiteColor
|
23
|
-
self.window.rootViewController = self.navigationController
|
24
|
-
self.window.makeKeyAndVisible
|
25
|
-
|
26
|
-
true
|
27
|
-
end
|
28
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
class GlobalTimelineViewController < UITableViewController
|
2
|
-
attr_accessor :posts
|
3
|
-
attr_accessor :activityIndicatorView
|
4
|
-
|
5
|
-
def reload
|
6
|
-
self.activityIndicatorView.startAnimating
|
7
|
-
self.navigationItem.rightBarButtonItem.enabled = true
|
8
|
-
|
9
|
-
Post.fetchGlobalTimelinePosts do |posts, error|
|
10
|
-
if (error)
|
11
|
-
UIAlertView.alloc.initWithTitle("Error",
|
12
|
-
message:error.localizedDescription,
|
13
|
-
delegate:nil,
|
14
|
-
cancelButtonTitle:nil,
|
15
|
-
otherButtonTitles:"OK", nil).show
|
16
|
-
else
|
17
|
-
self.posts = posts
|
18
|
-
end
|
19
|
-
|
20
|
-
self.activityIndicatorView.stopAnimating
|
21
|
-
self.navigationItem.rightBarButtonItem.enabled = true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def posts
|
26
|
-
@posts ||= []
|
27
|
-
end
|
28
|
-
|
29
|
-
def posts=(posts)
|
30
|
-
@posts = posts
|
31
|
-
self.tableView.reloadData
|
32
|
-
@posts
|
33
|
-
end
|
34
|
-
|
35
|
-
def loadView
|
36
|
-
super
|
37
|
-
|
38
|
-
self.activityIndicatorView = UIActivityIndicatorView.alloc.initWithActivityIndicatorStyle(UIActivityIndicatorViewStyleWhite)
|
39
|
-
self.activityIndicatorView.hidesWhenStopped = true
|
40
|
-
end
|
41
|
-
|
42
|
-
def viewDidLoad
|
43
|
-
super
|
44
|
-
|
45
|
-
self.title = "AFMotion"
|
46
|
-
|
47
|
-
self.navigationItem.leftBarButtonItem = UIBarButtonItem.alloc.initWithCustomView(self.activityIndicatorView)
|
48
|
-
self.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemRefresh, target:self, action: 'reload')
|
49
|
-
|
50
|
-
self.tableView.rowHeight = 70
|
51
|
-
|
52
|
-
self.reload
|
53
|
-
end
|
54
|
-
|
55
|
-
def viewDidUnload
|
56
|
-
self.activityIndicatorView = nil
|
57
|
-
|
58
|
-
super
|
59
|
-
end
|
60
|
-
|
61
|
-
def tableView(tableView, numberOfRowsInSection:section)
|
62
|
-
self.posts.count
|
63
|
-
end
|
64
|
-
|
65
|
-
def tableView(tableView, cellForRowAtIndexPath:indexPath)
|
66
|
-
@@identifier ||= "Cell"
|
67
|
-
|
68
|
-
cell = tableView.dequeueReusableCellWithIdentifier(@@identifier) || begin
|
69
|
-
PostTableViewCell.alloc.initWithStyle(UITableViewCellStyleSubtitle, reuseIdentifier:@@identifier)
|
70
|
-
end
|
71
|
-
|
72
|
-
cell.post = self.posts[indexPath.row]
|
73
|
-
|
74
|
-
cell
|
75
|
-
end
|
76
|
-
|
77
|
-
def tableView(tableView, heightForRowAtIndexPath:indexPath)
|
78
|
-
PostTableViewCell.heightForCellWithPost(self.posts[indexPath.row])
|
79
|
-
end
|
80
|
-
|
81
|
-
def tableView(tableView, didSelectRowAtIndexPath:indexPath)
|
82
|
-
tableView.deselectRowAtIndexPath(indexPath, animated:true)
|
83
|
-
end
|
84
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class Post
|
2
|
-
attr_accessor :id, :text, :user
|
3
|
-
|
4
|
-
def initialize(attributes = {})
|
5
|
-
self.id = attributes["id"].to_i
|
6
|
-
self.text = attributes["text"].to_s
|
7
|
-
self.user = User.new(attributes["user"])
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.fetchGlobalTimelinePosts(&callback)
|
11
|
-
AFMotion::Client.shared.get("stream/0/posts/stream/global") do |result|
|
12
|
-
if result.success?
|
13
|
-
posts = []
|
14
|
-
result.object["data"].each do |attributes|
|
15
|
-
posts << Post.new(attributes)
|
16
|
-
end
|
17
|
-
callback.call(posts, nil)
|
18
|
-
else
|
19
|
-
callback.call([], result.error)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
class PostTableViewCell < UITableViewCell
|
2
|
-
attr_accessor :post
|
3
|
-
|
4
|
-
def initWithStyle(style, reuseIdentifier:reuseIdentifier)
|
5
|
-
super
|
6
|
-
|
7
|
-
self.textLabel.adjustsFontSizeToFitWidth = true
|
8
|
-
self.textLabel.textColor = UIColor.darkGrayColor
|
9
|
-
self.detailTextLabel.font = UIFont.systemFontOfSize 12
|
10
|
-
self.detailTextLabel.numberOfLines = 0
|
11
|
-
self.selectionStyle = UITableViewCellSelectionStyleGray
|
12
|
-
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def post=(post)
|
17
|
-
@post = post
|
18
|
-
|
19
|
-
self.textLabel.text = self.post.user.username
|
20
|
-
self.detailTextLabel.text = self.post.text
|
21
|
-
self.imageView.url = {url: self.post.user.avatar_url.to_url, placeholder: UIImage.imageNamed("profile-image-placeholder")}
|
22
|
-
|
23
|
-
self.setNeedsLayout
|
24
|
-
|
25
|
-
@post
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.heightForCellWithPost(post)
|
29
|
-
sizeToFit = post.text.sizeWithFont(UIFont.systemFontOfSize(12), constrainedToSize: CGSizeMake(220, Float::MAX), lineBreakMode:UILineBreakModeWordWrap)
|
30
|
-
|
31
|
-
return [70, sizeToFit.height + 45].max
|
32
|
-
end
|
33
|
-
|
34
|
-
def layoutSubviews
|
35
|
-
super
|
36
|
-
|
37
|
-
self.imageView.frame = CGRectMake(10, 10, 50, 50);
|
38
|
-
self.textLabel.frame = CGRectMake(70, 10, 240, 20);
|
39
|
-
|
40
|
-
detailTextLabelFrame = CGRectOffset(self.textLabel.frame, 0, 25);
|
41
|
-
detailTextLabelFrame.size.height = self.class.heightForCellWithPost(self.post) - 45
|
42
|
-
self.detailTextLabel.frame = detailTextLabelFrame
|
43
|
-
end
|
44
|
-
end
|
Binary file
|
Binary file
|
@@ -1,28 +0,0 @@
|
|
1
|
-
Pod::Spec.new do |s|
|
2
|
-
s.name = 'AFNetworking'
|
3
|
-
s.version = '1.0'
|
4
|
-
s.license = 'MIT'
|
5
|
-
s.summary = 'A delightful iOS and OS X networking framework.'
|
6
|
-
s.homepage = 'https://github.com/AFNetworking/AFNetworking'
|
7
|
-
s.authors = { 'Mattt Thompson' => 'm@mattt.me', 'Scott Raymond' => 'sco@gowalla.com' }
|
8
|
-
s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => '1.0' }
|
9
|
-
s.source_files = 'AFNetworking'
|
10
|
-
s.requires_arc = true
|
11
|
-
|
12
|
-
s.ios.deployment_target = '5.0'
|
13
|
-
s.ios.frameworks = 'MobileCoreServices', 'SystemConfiguration'
|
14
|
-
|
15
|
-
s.osx.deployment_target = '10.7'
|
16
|
-
s.osx.frameworks = 'CoreServices', 'SystemConfiguration'
|
17
|
-
|
18
|
-
s.prefix_header_contents = <<-EOS
|
19
|
-
#import <Availability.h>
|
20
|
-
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
21
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
22
|
-
#import <MobileCoreServices/MobileCoreServices.h>
|
23
|
-
#else
|
24
|
-
#import <SystemConfiguration/SystemConfiguration.h>
|
25
|
-
#import <CoreServices/CoreServices.h>
|
26
|
-
#endif
|
27
|
-
EOS
|
28
|
-
end
|