ProMotion 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64a321e5c84fb57549e6926cf53e2c1024a37b87
4
- data.tar.gz: b9a9fda8c8db70cda658faa046798fe47a01bcdf
3
+ metadata.gz: 18aba155900b900206601bcf9a0758bfce9408dd
4
+ data.tar.gz: 5bc594a3e0c965bfe2f15ebb88df5da5d7e88f94
5
5
  SHA512:
6
- metadata.gz: bda6e2a93b03f8e4e1e1153766e010b762dea1d7a4dae3c64b39defaa9124a0077c030312cf158e86c3fc289c20cb96a7ba6309b3e401b86d6773e8a87d7dce3
7
- data.tar.gz: 92d22300edaca3ad9d5f50c555c526b1e30c9ef5a76f783301eef55c09dd60c338449bc7e4e1059b97db357bbe810630f81c231bb101256ed35db83cbeb83970
6
+ metadata.gz: aac102a4899e41da994269077fba1a7a71659e35a8324981fdbb34f0d440e10d6db0a1888cfdde72131113824f7b1e988462ef6635ab1b331bd1935a20247214
7
+ data.tar.gz: 49a32c00365af4338df6d3bbae82caf60a14bd0208d9a8b28b89d418e2bbc9268257c46fb1944c5dfa917e351c422b3c230ba1fe1d3f61303cf7666f6ba12f84
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [![Build Status](https://img.shields.io/travis/infinitered/ProMotion.svg?style=flat)](https://travis-ci.org/infinitered/ProMotion)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/github/infinitered/ProMotion.svg?style=flat)](https://codeclimate.com/github/infinitered/ProMotion)
6
6
 
7
+ ProMotion is maintained by [Infinite Red](http://infinite.red), a web and mobile development company based in Portland, OR and San Francisco, CA.
8
+
7
9
  ## iPhone Apps, Ruby-style
8
10
 
9
11
  ProMotion is a RubyMotion gem that makes iOS development more like Ruby and less like Objective-C.
@@ -87,6 +89,14 @@ end
87
89
 
88
90
  # Changelog
89
91
 
92
+ ## Version 2.6.0
93
+
94
+ This release includes a few new features and bugfixes and is backwards compatible with all 2.x releases.
95
+
96
+ * PR #773 Add a `on_continue_user_activity` delegate method
97
+ * PR #766 Fix nav_bar_button class method
98
+ * Other minor bugfixes and documentation updates
99
+
90
100
  ## Version 2.5.0
91
101
 
92
102
  This release includes some new features and bugfixes and is backwards compatible with all 2.x releases.
@@ -96,16 +106,6 @@ This release includes some new features and bugfixes and is backwards compatible
96
106
  * PR #736 Adds the index path when deleting a cell
97
107
  * Several other bugfix PRs
98
108
 
99
- ## Version 2.4.0
100
-
101
- This release includes several new features and is backwards compatible with all 2.x releases.
102
-
103
- * PR #686 Adds :searchable to the whitelisted properties a cell can have so that a warning is not generated.
104
- * PR #688 Adds support for SDWebImage and takes preference over JMImageCache. _JMImageCache will still be supported till ProMotion 3.0 but we highly recommend you switch to SDWebImage._
105
- * PR #679 Extract methods from tablescreen for reuse in modules for [redpotion](https://github.com/infinitered/redpotion).
106
- * PR #677 Added `add_child_screen` and `remove_child_screen` methods to `PM::Screen`.
107
- * PR #687 Adds persisting tab order when changed by the user for tab bars over 5 screens.
108
-
109
109
  # Apps built on ProMotion
110
110
 
111
111
  [Apps built on ProMotion](http://promotion.readthedocs.org/en/master/ProMotion%20Apps/)
@@ -42,15 +42,17 @@ module ProMotion
42
42
  selected_tab_vc = viewControllers[tab]
43
43
  end
44
44
 
45
- if selected_tab_vc
46
- self.selectedViewController = selected_tab_vc
47
- on_tab_selected_try(selected_tab_vc)
48
-
49
- selected_tab_vc
50
- else
51
- mp "Unable to open tab #{tab.to_s} -- not found.", force_color: :red
52
- nil
45
+ unless selected_tab_vc
46
+ mp "Unable to open tab #{tab} -- not found.", force_color: :red
47
+ return
53
48
  end
49
+
50
+ return unless should_select_tab_try(selected_tab_vc)
51
+
52
+ self.selectedViewController = selected_tab_vc
53
+ on_tab_selected_try(selected_tab_vc)
54
+
55
+ selected_tab_vc
54
56
  end
55
57
 
56
58
  def find_tab(tab_title)
@@ -58,13 +60,17 @@ module ProMotion
58
60
  end
59
61
 
60
62
  # Cocoa touch methods below
63
+ def tabBarController(tbc, shouldSelectViewController: vc)
64
+ should_select_tab_try(vc)
65
+ end
66
+
61
67
  def tabBarController(tbc, didSelectViewController: vc)
62
68
  on_tab_selected_try(vc)
63
69
  end
64
70
 
65
71
  def tabBarController(tbc, didEndCustomizingViewControllers:vcs, changed:changed)
66
72
  if changed
67
- tab_order = vcs.map{ |vc| vc.tabBarItem.tag }
73
+ tab_order = vcs.map { |vc| vc.tabBarItem.tag }
68
74
  NSUserDefaults.standardUserDefaults.setObject(tab_order, forKey:"tab_bar_order_#{@name}")
69
75
  NSUserDefaults.standardUserDefaults.synchronize
70
76
  end
@@ -84,10 +90,19 @@ module ProMotion
84
90
 
85
91
  private
86
92
 
93
+ # Defaults to true if :should_select_tab tab is not implemented by the tab delegate.
94
+ def should_select_tab_try(vc)
95
+ method_name = :should_select_tab
96
+ return true unless can_send_method_to_delegate?(method_name)
97
+
98
+ pm_tab_delegate.send(method_name, vc)
99
+ end
100
+
87
101
  def on_tab_selected_try(vc)
88
- if pm_tab_delegate && pm_tab_delegate.respond_to?(:weakref_alive?) && pm_tab_delegate.weakref_alive? && pm_tab_delegate.respond_to?("on_tab_selected:")
89
- pm_tab_delegate.send(:on_tab_selected, vc)
90
- end
102
+ method_name = :on_tab_selected
103
+ return unless can_send_method_to_delegate?(method_name)
104
+
105
+ pm_tab_delegate.send(method_name, vc)
91
106
  end
92
107
 
93
108
  def current_view_controller
@@ -95,8 +110,16 @@ module ProMotion
95
110
  end
96
111
 
97
112
  def current_view_controller_try(method, *args)
98
- current_view_controller.send(method, *args) if current_view_controller.respond_to?(method)
113
+ return unless current_view_controller.respond_to?(method)
114
+
115
+ current_view_controller.send(method, *args)
99
116
  end
100
117
 
118
+ def can_send_method_to_delegate?(method)
119
+ pm_tab_delegate &&
120
+ pm_tab_delegate.respond_to?(:weakref_alive?) &&
121
+ pm_tab_delegate.weakref_alive? &&
122
+ pm_tab_delegate.respond_to?("#{method}:")
123
+ end
101
124
  end
102
125
  end
@@ -43,6 +43,10 @@ module ProMotion
43
43
  try :on_open_url, { url: url, source_app: source_app, annotation: annotation }
44
44
  end
45
45
 
46
+ def application(application, continueUserActivity:user_activity, restorationHandler:restoration_handler)
47
+ try :on_continue_user_activity, { user_activity: user_activity, restoration_handler: restoration_handler }
48
+ end
49
+
46
50
  def ui_window
47
51
  (defined?(Motion) && defined?(Motion::Xray) && defined?(Motion::Xray::XrayWindow)) ? Motion::Xray::XrayWindow : UIWindow
48
52
  end
@@ -198,7 +198,9 @@ module ProMotion
198
198
  end
199
199
 
200
200
  def add_nav_bar_buttons
201
- set_nav_bar_button(self.class.get_nav_bar_button[:side], self.class.get_nav_bar_button) if self.class.get_nav_bar_button
201
+ self.class.get_nav_bar_button.each do |button_args|
202
+ set_nav_bar_button(button_args[:side], button_args)
203
+ end
202
204
  end
203
205
 
204
206
  def status_bar_hidden(hidden)
@@ -276,12 +278,14 @@ module ProMotion
276
278
  end
277
279
 
278
280
  def nav_bar_button(side, args={})
279
- @nav_bar_button_args = args
280
- @nav_bar_button_args[:side] = side
281
+ button_args = args.merge(:side => side)
282
+
283
+ @nav_bar_button_args ||= []
284
+ @nav_bar_button_args << button_args
281
285
  end
282
286
 
283
287
  def get_nav_bar_button
284
- @nav_bar_button_args
288
+ @nav_bar_button_args ||= []
285
289
  end
286
290
  end
287
291
 
@@ -1,3 +1,3 @@
1
1
  module ProMotion
2
- VERSION = "2.5.0" unless defined?(ProMotion::VERSION)
2
+ VERSION = "2.6.0" unless defined?(ProMotion::VERSION)
3
3
  end
@@ -79,6 +79,24 @@ describe "PM::Delegate" do
79
79
 
80
80
  @subject.application(UIApplication.sharedApplication, openURL: url, sourceApplication:sourceApplication, annotation: annotation)
81
81
  end
82
+
83
+ describe "#on_continue_user_activity" do
84
+ before do
85
+ @subject.application(UIApplication.sharedApplication, continueUserActivity: {}, restorationHandler: [])
86
+ end
87
+
88
+ it "should call on_continue_user_activity when launching with a user activity" do
89
+ @subject.called_on_continue_user_activity.should == true
90
+ end
91
+
92
+ it "should pass the user activity" do
93
+ @subject.user_activity.should == {}
94
+ end
95
+
96
+ it "should pass the restoration_handler" do
97
+ @subject.restoration_handler.should == []
98
+ end
99
+ end
82
100
  end
83
101
 
84
102
  # iOS 7 ONLY tests
@@ -89,8 +89,13 @@ describe "screen helpers" do
89
89
 
90
90
  end
91
91
 
92
- it "allows setting a nav_bar_button with a class method" do
92
+ it "allows setting nav bar buttons via nav_bar_button class method" do
93
93
  screen = DetailScreen.new(nav_bar: true)
94
+
95
+ screen.navigationItem.leftBarButtonItem.title.should == 'Back'
96
+ screen.navigationItem.rightBarButtonItem.title.should == 'More'
97
+
98
+ screen.navigationItem.leftBarButtonItem.class.should == UIBarButtonItem
94
99
  screen.navigationItem.rightBarButtonItem.class.should == UIBarButtonItem
95
100
  end
96
101
  end
@@ -24,12 +24,42 @@ describe "PM::Tabs" do
24
24
  tab_bar.delegate.should.equal(tab_bar)
25
25
  end
26
26
 
27
+ it "should call should_select_tab before a tab is selected" do
28
+ tab_bar.pm_tab_delegate.called_should_select_tab = false
29
+ @screen1.open_tab "Screen 2"
30
+ tab_bar.pm_tab_delegate.called_should_select_tab.should.be.true
31
+ end
32
+
27
33
  it "should call on_tab_selected when a tab is selected" do
28
34
  tab_bar.pm_tab_delegate.called_on_tab_selected = false
29
35
  @screen1.open_tab "Screen 2"
30
36
  tab_bar.pm_tab_delegate.called_on_tab_selected.should.be.true
31
37
  end
32
38
 
39
+ it "should call on_tab_selected when delegate does not respond to should_select_tab" do
40
+ method_to_stub = :can_send_method_to_delegate?
41
+ tab_bar.pm_tab_delegate.stub!(method_to_stub) do |method|
42
+ method == :should_select_tab ? false : send("__original_#{method_to_stub}", method)
43
+ end
44
+
45
+ tab_bar.pm_tab_delegate.called_on_tab_selected = false
46
+ @screen1.open_tab "Screen 2"
47
+ tab_bar.pm_tab_delegate.called_on_tab_selected.should.be.true
48
+
49
+ tab_bar.pm_tab_delegate.reset(method_to_stub)
50
+ end
51
+
52
+ it "does not call on_tab_selected when should_select_tab returns false" do
53
+ method_to_stub = :should_select_tab
54
+ tab_bar.pm_tab_delegate.stub!(method_to_stub) { |_vc| false }
55
+
56
+ tab_bar.pm_tab_delegate.called_on_tab_selected = false
57
+ @screen1.open_tab "Screen 2"
58
+ tab_bar.pm_tab_delegate.called_on_tab_selected.should.be.false
59
+
60
+ tab_bar.pm_tab_delegate.reset(method_to_stub)
61
+ end
62
+
33
63
  it "should have four tabs" do
34
64
  tab_bar.viewControllers.length.should == 4
35
65
  end
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: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamon Holmgren
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-11-20 00:00:00.000000000 Z
13
+ date: 2016-03-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: methadone
@@ -96,11 +96,11 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
- description: ProMotion is a fast way to get started building RubyMotion iOS apps.
99
+ description: ProMotion gives RubyMotion iOS view controllers a more Ruby-like API.
100
100
  email:
101
- - jamon@clearsightstudio.com
102
- - mark@mohawkapps.com
103
- - silas@clearsightstudio.com
101
+ - jamon@infinite.red
102
+ - mark@infinite.red
103
+ - silas@infinite.red
104
104
  executables:
105
105
  - promotion
106
106
  extensions: []
@@ -193,7 +193,7 @@ files:
193
193
  - spec/unit/view_helper_spec.rb
194
194
  - spec/unit/view_title_screen_spec.rb
195
195
  - spec/unit/web_spec.rb
196
- homepage: https://github.com/clearsightstudio/ProMotion
196
+ homepage: https://github.com/infinitered/ProMotion
197
197
  licenses:
198
198
  - MIT
199
199
  metadata: {}
@@ -219,8 +219,8 @@ specification_version: 4
219
219
  summary: ProMotion is a fast way to get started building RubyMotion apps. Instead
220
220
  of dealing with UIViewControllers, UITableViewControllers, and the like, you work
221
221
  with Screens. We abstract the view controller boilerplate to make iOS development
222
- more like Ruby and less like Objective-C. With a memorable, concise syntax and a
223
- friendly, helpful community, ProMotion is a great way to get started with iOS development.
222
+ more like Ruby and less like Objective-C. With a memorable, concise API and a friendly,
223
+ helpful community, ProMotion is a great way to get started with iOS development.
224
224
  test_files:
225
225
  - spec/functional/func_screen_spec.rb
226
226
  - spec/functional/func_split_screen_spec.rb
@@ -255,3 +255,4 @@ test_files:
255
255
  - spec/unit/view_helper_spec.rb
256
256
  - spec/unit/view_title_screen_spec.rb
257
257
  - spec/unit/web_spec.rb
258
+ has_rdoc: