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 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.0"
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
@@ -1,7 +1,7 @@
1
1
  class AppDelegate
2
-
2
+
3
3
  def on_load(app, options)
4
4
  open BasicScreen.new(nav_bar: true)
5
5
  end
6
-
6
+
7
7
  end
@@ -8,7 +8,7 @@ class BasicScreen < PM::Screen
8
8
  def on_load
9
9
  # Fires just before a screen is opened for the first time.
10
10
  end
11
-
11
+
12
12
  def will_appear
13
13
  # Fires every time the screen will appear
14
14
  end
@@ -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
@@ -19,7 +19,7 @@ module ProMotion
19
19
 
20
20
  s
21
21
  end
22
-
22
+
23
23
  # emulate the ProMotion table update for formotion
24
24
  def update_table_data
25
25
  self.form = table_data
@@ -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
 
@@ -28,7 +28,7 @@ module ProMotion
28
28
  @refresh_control.endRefreshing
29
29
  end
30
30
  alias :stop_refreshing :end_refreshing
31
-
31
+
32
32
  ######### iOS methods, headless camel case #######
33
33
 
34
34
  # UIRefreshControl Delegates
@@ -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] ||= "Cell"
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]
@@ -1,3 +1,3 @@
1
1
  module ProMotion
2
- VERSION = "0.7.4" unless defined?(ProMotion::VERSION)
2
+ VERSION = "0.7.5" unless defined?(ProMotion::VERSION)
3
3
  end
@@ -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
@@ -3,7 +3,7 @@ class ScreenModuleViewController < UIViewController
3
3
  title 'Test Title'
4
4
 
5
5
  # Get rid of such hackiness when RubyMotion bug is fixed...
6
-
6
+
7
7
  def self.new(args = {})
8
8
  s = self.alloc.initWithNibName(nil, bundle:nil)
9
9
  s.on_create(args) if s.respond_to?(:on_create)
@@ -1,7 +1,7 @@
1
1
  class TableScreenSearchable < TestTableScreen
2
2
 
3
3
  searchable
4
-
4
+
5
5
  def table_data
6
6
  @search_table_data ||= [{
7
7
  cells: [
@@ -1,6 +1,6 @@
1
1
  class TestDelegate < ProMotion::Delegate
2
2
  status_bar false
3
-
3
+
4
4
  def on_load(app, options)
5
5
  end
6
6
  end
@@ -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
@@ -4,7 +4,7 @@ describe "logger functionality" do
4
4
  it "should respond to PM.logger with a logger instance" do
5
5
  PM.logger.is_a?(PM::Logger).should == true
6
6
  end
7
-
7
+
8
8
  it "should allow setting the log level" do
9
9
  PM.logger.level = :warn
10
10
  PM.logger.level.should == :warn
@@ -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
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-08 00:00:00.000000000 Z
14
+ date: 2013-06-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: motion-stump