ProMotion 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/app/app_delegate.rb +2 -2
- data/app/screens/basic_screen.rb +1 -1
- data/lib/ProMotion/delegate/delegate_helper.rb +6 -6
- data/lib/ProMotion/screen_helpers/screen_navigation.rb +1 -1
- data/lib/ProMotion/screens/_compatibility/formotion_screen.rb +1 -1
- data/lib/ProMotion/screens/_screen_module.rb +5 -2
- data/lib/ProMotion/screens/_tables/_refreshable_table.rb +1 -1
- data/lib/ProMotion/screens/_tables/table_data.rb +26 -1
- data/lib/ProMotion/screens/_tables/table_view_cell_module.rb +0 -10
- data/lib/ProMotion/version.rb +1 -1
- data/spec/functional/func_searchable_table_spec.rb +4 -4
- data/spec/helpers/functional_screen.rb +4 -4
- data/spec/helpers/screen_module_view_controller.rb +1 -1
- data/spec/helpers/table_screen_searchable.rb +1 -1
- data/spec/helpers/test_delegate.rb +1 -1
- data/spec/unit/delegate_spec.rb +5 -5
- data/spec/unit/logger_spec.rb +1 -1
- data/spec/unit/tables/table_view_cell_spec.rb +12 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -96,7 +96,7 @@ Create a Gemfile and add the following lines:
|
|
96
96
|
|
97
97
|
```ruby
|
98
98
|
source 'https://rubygems.org'
|
99
|
-
gem "ProMotion", "~> 0.7.
|
99
|
+
gem "ProMotion", "~> 0.7.5"
|
100
100
|
```
|
101
101
|
|
102
102
|
Run `bundle install` in Terminal to install ProMotion.
|
@@ -507,4 +507,5 @@ incorporated.
|
|
507
507
|
* Silas Matson: [@silasjmatson](https://twitter.com/silasjmatson)
|
508
508
|
* Matt Brewer: [@macfanatic](https://twitter.com/macfanatic)
|
509
509
|
* [Many others](https://github.com/clearsightstudio/ProMotion/graphs/contributors)
|
510
|
+
* If you really want to know, run `git shortlog -s -n -e`
|
510
511
|
|
data/app/app_delegate.rb
CHANGED
data/app/screens/basic_screen.rb
CHANGED
@@ -4,13 +4,13 @@ module ProMotion
|
|
4
4
|
attr_accessor :window, :aps_notification, :home_screen
|
5
5
|
|
6
6
|
def application(application, didFinishLaunchingWithOptions:launch_options)
|
7
|
-
|
7
|
+
|
8
8
|
apply_status_bar
|
9
|
-
|
9
|
+
|
10
10
|
on_load application, launch_options
|
11
11
|
|
12
12
|
check_for_push_notification launch_options
|
13
|
-
|
13
|
+
|
14
14
|
# This will work when RubyMotion fixes a bug.
|
15
15
|
# defined?(super) ? super : true
|
16
16
|
|
@@ -18,11 +18,11 @@ module ProMotion
|
|
18
18
|
super rescue true
|
19
19
|
PM.logger.info "You can ignore the NoMethodError -- this is a RubyMotion bug that should be fixed soon."
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def applicationWillTerminate(application)
|
23
|
-
|
23
|
+
|
24
24
|
on_unload if respond_to?(:on_unload)
|
25
|
-
|
25
|
+
|
26
26
|
end
|
27
27
|
|
28
28
|
def app_delegate
|
@@ -107,7 +107,7 @@ module ProMotion
|
|
107
107
|
screen.hidesBottomBarWhenPushed = args[:hide_tab_bar] == true
|
108
108
|
|
109
109
|
# Wrap in a PM::NavigationController?
|
110
|
-
screen.add_nav_bar if args[:nav_bar] && screen.respond_to?(:add_nav_bar)
|
110
|
+
screen.add_nav_bar(args) if args[:nav_bar] && screen.respond_to?(:add_nav_bar)
|
111
111
|
|
112
112
|
# Return modified screen instance
|
113
113
|
screen
|
@@ -67,10 +67,13 @@ module ProMotion
|
|
67
67
|
self.tabBarItem = create_tab_bar_item(self.tab_bar_item) if self.tab_bar_item
|
68
68
|
end
|
69
69
|
|
70
|
-
def add_nav_bar
|
70
|
+
def add_nav_bar(args = {})
|
71
71
|
self.navigation_controller ||= begin
|
72
72
|
self.first_screen = true if self.respond_to?(:first_screen=)
|
73
|
-
NavigationController.alloc.initWithRootViewController(self)
|
73
|
+
nav = NavigationController.alloc.initWithRootViewController(self)
|
74
|
+
nav.setModalTransitionStyle(args[:transition_style]) if args[:transition_style]
|
75
|
+
nav.setModalPresentationStyle(args[:presentation_style]) if args[:presentation_style]
|
76
|
+
nav
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
@@ -87,7 +87,7 @@ module ProMotion
|
|
87
87
|
|
88
88
|
def set_data_cell_defaults(data_cell)
|
89
89
|
data_cell[:cell_style] ||= UITableViewCellStyleDefault
|
90
|
-
data_cell[:cell_identifier] ||=
|
90
|
+
data_cell[:cell_identifier] ||= build_cell_identifier(data_cell)
|
91
91
|
data_cell[:cell_class] ||= ProMotion::TableViewCell
|
92
92
|
data_cell
|
93
93
|
end
|
@@ -129,6 +129,16 @@ module ProMotion
|
|
129
129
|
data_cell[:styles][:label] = data_cell[:styles][:textLabel]
|
130
130
|
end
|
131
131
|
|
132
|
+
# Fix the accessory view if needed
|
133
|
+
# Legacy Support < 0.7.4
|
134
|
+
data_cell[:accessory] ||= data_cell[:accessory_view]
|
135
|
+
data_cell[:accessory] = {
|
136
|
+
view: data_cell[:accessory],
|
137
|
+
value: data_cell[:accessory_value],
|
138
|
+
action: data_cell[:accessory_action],
|
139
|
+
arguments: data_cell[:accessory_arguments]
|
140
|
+
} unless data_cell[:accessory].is_a? Hash
|
141
|
+
|
132
142
|
data_cell
|
133
143
|
end
|
134
144
|
|
@@ -146,5 +156,20 @@ module ProMotion
|
|
146
156
|
table_cell
|
147
157
|
end
|
148
158
|
|
159
|
+
def build_cell_identifier(data_cell)
|
160
|
+
ident = "Cell"
|
161
|
+
unless data_cell[:accessory].nil?
|
162
|
+
if data_cell[:accessory][:view] == :switch
|
163
|
+
ident << "-switch"
|
164
|
+
elsif !data_cell[:accessory][:view].nil?
|
165
|
+
ident << "-accessory"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
ident << "-subtitle" if data_cell[:subtitle]
|
169
|
+
ident << "-remoteimage" if data_cell[:remote_image]
|
170
|
+
ident << "-image" if data_cell[:image]
|
171
|
+
ident
|
172
|
+
end
|
173
|
+
|
149
174
|
end
|
150
175
|
end
|
@@ -43,16 +43,6 @@ module ProMotion
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def set_accessory_view
|
46
|
-
# Legacy Support < 0.7.4
|
47
|
-
data_cell[:accessory] ||= data_cell[:accessory_view]
|
48
|
-
data_cell[:accessory] = {
|
49
|
-
view: data_cell[:accessory],
|
50
|
-
value: data_cell[:accessory_value],
|
51
|
-
action: data_cell[:accessory_action],
|
52
|
-
arguments: data_cell[:accessory_arguments]
|
53
|
-
} unless data_cell[:accessory].is_a? Hash
|
54
|
-
# End Legacy Support
|
55
|
-
|
56
46
|
if data_cell[:accessory][:view] == :switch
|
57
47
|
switch_view = UISwitch.alloc.initWithFrame(CGRectZero)
|
58
48
|
switch_view.setAccessibilityLabel(data_cell[:accessory][:accessibility_label]) if data_cell[:accessory][:accessibility_label]
|
data/lib/ProMotion/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
describe "Searchable table spec" do
|
2
2
|
tests TableScreenSearchable
|
3
|
-
|
3
|
+
|
4
4
|
# Override controller to properly instantiate
|
5
5
|
def controller
|
6
6
|
@controller ||= TableScreenSearchable.new(nav_bar: true)
|
@@ -16,17 +16,17 @@ describe "Searchable table spec" do
|
|
16
16
|
it "should show all 50 states" do
|
17
17
|
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 50
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should allow searching for all the 'New' states" do
|
21
21
|
@controller.searchDisplayController(@controller, shouldReloadTableForSearchString:"New")
|
22
22
|
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 4
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should allow ending searches" do
|
26
26
|
@controller.searchDisplayController(@controller, shouldReloadTableForSearchString:"North")
|
27
27
|
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 2
|
28
28
|
@controller.searchDisplayControllerWillEndSearch(@controller)
|
29
29
|
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 50
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class FunctionalScreen < PM::Screen
|
2
2
|
attr_accessor :button_was_triggered
|
3
|
-
|
3
|
+
|
4
4
|
title "Functional"
|
5
|
-
|
5
|
+
|
6
6
|
def will_appear
|
7
7
|
self.button_was_triggered = false
|
8
8
|
add UILabel.alloc.initWithFrame([[ 10, 10 ], [ 300, 40 ]]),
|
9
9
|
text: "Label Here"
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def triggered_button
|
13
13
|
self.button_was_triggered = true
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/spec/unit/delegate_spec.rb
CHANGED
@@ -7,12 +7,12 @@ describe "PM::Delegate" do
|
|
7
7
|
options[:jamon].should.be.true
|
8
8
|
app.should.be.kind_of(UIApplication)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
@subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:{jamon: true})
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should handle push notifications" do
|
15
|
-
|
15
|
+
|
16
16
|
@subject.mock!(:on_push_notification) do |notification|
|
17
17
|
notification.should.be.kind_of(PM::PushNotification)
|
18
18
|
notification.alert.should == "Eating Bacon"
|
@@ -20,10 +20,10 @@ describe "PM::Delegate" do
|
|
20
20
|
notification.sound.should == "jamon"
|
21
21
|
@subject.aps_notification.should == notification
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification(alert: "Eating Bacon", badge: 42, sound: "jamon").notification }
|
25
25
|
@subject.application(nil, didFinishLaunchingWithOptions:launch_options )
|
26
|
-
|
26
|
+
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should set home_screen when opening a new screen" do
|
data/spec/unit/logger_spec.rb
CHANGED
@@ -34,11 +34,11 @@ describe "PM::TableViewCellModule" do
|
|
34
34
|
|
35
35
|
@screen.on_load
|
36
36
|
|
37
|
-
custom_ip = NSIndexPath.indexPathForRow(1, inSection: 1) # Cell "Crazy Full Featured Cell"
|
37
|
+
@custom_ip = NSIndexPath.indexPathForRow(1, inSection: 1) # Cell "Crazy Full Featured Cell"
|
38
38
|
|
39
39
|
@screen.update_table_data
|
40
40
|
|
41
|
-
@subject = @screen.tableView(@screen.table_view, cellForRowAtIndexPath: custom_ip)
|
41
|
+
@subject = @screen.tableView(@screen.table_view, cellForRowAtIndexPath: @custom_ip)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should be a PM::TableViewCell" do
|
@@ -53,9 +53,18 @@ describe "PM::TableViewCellModule" do
|
|
53
53
|
@subject.detailTextLabel.text.should == "This is way too huge..."
|
54
54
|
end
|
55
55
|
|
56
|
-
it "should have the right re-use identifier" do
|
56
|
+
it "should have the right custom re-use identifier" do
|
57
57
|
@subject.reuseIdentifier.should == "Cell"
|
58
58
|
end
|
59
|
+
it "should have the right generated re-use identifier" do
|
60
|
+
ip = NSIndexPath.indexPathForRow(2, inSection: 1)
|
61
|
+
subject = @screen.tableView(@screen.table_view, cellForRowAtIndexPath: ip)
|
62
|
+
subject.reuseIdentifier.should == "Cell-accessory"
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should have the correct height" do
|
66
|
+
@screen.tableView(@screen.table_view, heightForRowAtIndexPath: @custom_ip).should == 50
|
67
|
+
end
|
59
68
|
|
60
69
|
it "should set the layer.masksToBounds" do
|
61
70
|
@subject.layer.masksToBounds.should == true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-06-
|
14
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: motion-stump
|