ProMotion 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +3 -4
- data/Rakefile +2 -3
- data/lib/ProMotion/cocoatouch/SplitViewController.rb +2 -4
- data/lib/ProMotion/delegate.rb +1 -1
- data/lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb +1 -1
- data/lib/ProMotion/screen_helpers/screen_navigation.rb +2 -4
- data/lib/ProMotion/screen_helpers/screen_tabs.rb +1 -2
- data/lib/ProMotion/screens/_screen_module.rb +0 -4
- data/lib/ProMotion/screens/behaves_like_screen.rb +10 -0
- data/lib/ProMotion/version.rb +1 -1
- data/spec/screen_spec.rb +15 -0
- data/spec/split_screen_in_tab_bar_spec.rb +2 -2
- data/spec/split_screen_open_screen_spec.rb +5 -5
- data/spec/split_screen_spec.rb +2 -2
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -92,13 +92,12 @@ Create a new RubyMotion project.
|
|
92
92
|
|
93
93
|
`motion create myapp`
|
94
94
|
|
95
|
-
Open it in your favorite editor, then go into your Rakefile and
|
95
|
+
Open it in your favorite editor, then go into your Rakefile and modify the top to look like the following:
|
96
96
|
|
97
97
|
```ruby
|
98
98
|
# -*- coding: utf-8 -*-
|
99
99
|
$:.unshift("/Library/RubyMotion/lib")
|
100
|
-
require 'motion/project'
|
101
|
-
require "rubygems"
|
100
|
+
require 'motion/project/template/ios'
|
102
101
|
require 'bundler'
|
103
102
|
Bundler.require
|
104
103
|
```
|
@@ -108,7 +107,7 @@ Create a Gemfile and add the following lines:
|
|
108
107
|
|
109
108
|
```ruby
|
110
109
|
source 'https://rubygems.org'
|
111
|
-
gem "ProMotion", "~> 0.6.
|
110
|
+
gem "ProMotion", "~> 0.6.2"
|
112
111
|
```
|
113
112
|
|
114
113
|
Run `bundle install` in Terminal to install ProMotion.
|
data/Rakefile
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
$:.unshift("/Library/RubyMotion/lib")
|
2
2
|
require 'motion/project/template/ios'
|
3
|
-
require 'bundler
|
4
|
-
Bundler.setup
|
3
|
+
require 'bundler'
|
5
4
|
Bundler.require
|
6
5
|
|
7
6
|
Motion::Project::App.setup do |app|
|
8
7
|
app.name = 'ProMotionTest'
|
9
|
-
app.version = "0.99.0"
|
8
|
+
app.version = "0.99.0"
|
10
9
|
app.redgreen_style = :focused # :focused, :full
|
11
10
|
|
12
11
|
# Devices
|
@@ -8,16 +8,14 @@ class SplitViewController < UISplitViewController
|
|
8
8
|
s.respond_to?(:visibleViewController) ? s.visibleViewController : s
|
9
9
|
end
|
10
10
|
def master_screen=(s)
|
11
|
-
self.viewControllers = [s.
|
11
|
+
self.viewControllers = [s.pm_main_controller, self.viewControllers.last]
|
12
12
|
end
|
13
13
|
def detail_screen=(s)
|
14
14
|
# set the button from the old detail screen to the new one
|
15
15
|
button = detail_screen.navigationItem.leftBarButtonItem
|
16
16
|
s.navigationItem.leftBarButtonItem = button
|
17
|
-
|
18
|
-
vc = s.respond_to?(:main_controller) ? s.main_controller : s
|
19
17
|
|
20
|
-
self.viewControllers = [self.viewControllers.first,
|
18
|
+
self.viewControllers = [self.viewControllers.first, s.pm_main_controller]
|
21
19
|
end
|
22
20
|
def screens=(s_array)
|
23
21
|
self.viewControllers = s_array
|
data/lib/ProMotion/delegate.rb
CHANGED
@@ -28,7 +28,7 @@ module ProMotion
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def load_root_screen(new_screen)
|
31
|
-
new_screen = new_screen.
|
31
|
+
new_screen = new_screen.pm_main_controller
|
32
32
|
|
33
33
|
self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
34
34
|
self.window.rootViewController = new_screen
|
@@ -178,7 +178,7 @@ module ProMotion::MotionTable
|
|
178
178
|
table_cell.accessoryView = switch_view
|
179
179
|
end
|
180
180
|
|
181
|
-
if data_cell[:subtitle]
|
181
|
+
if data_cell[:subtitle] and table_cell.detailTextLabel
|
182
182
|
table_cell.detailTextLabel.text = data_cell[:subtitle]
|
183
183
|
table_cell.detailTextLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth
|
184
184
|
end
|
@@ -29,7 +29,7 @@ module ProMotion
|
|
29
29
|
push_view_controller screen
|
30
30
|
|
31
31
|
else
|
32
|
-
open_root_screen screen
|
32
|
+
open_root_screen screen.pm_main_controller
|
33
33
|
|
34
34
|
end
|
35
35
|
|
@@ -117,9 +117,7 @@ module ProMotion
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def present_modal_view_controller(screen, animated)
|
120
|
-
|
121
|
-
vc = screen.main_controller if screen.respond_to?(:main_controller)
|
122
|
-
self.presentModalViewController(vc, animated:animated)
|
120
|
+
self.presentModalViewController(screen.pm_main_controller, animated:animated)
|
123
121
|
end
|
124
122
|
|
125
123
|
def present_view_controller_in_tab_bar_controller(screen, tab_name)
|
@@ -16,8 +16,7 @@ module ProMotion
|
|
16
16
|
s.parent_screen = self if self.is_a?(UIViewController) && s.respond_to?("parent_screen=")
|
17
17
|
s.tab_bar = tab_bar_controller if s.respond_to?("tab_bar=")
|
18
18
|
|
19
|
-
|
20
|
-
view_controllers << vc
|
19
|
+
view_controllers << s.pm_main_controller
|
21
20
|
|
22
21
|
tag_index += 1
|
23
22
|
|
@@ -140,10 +140,6 @@ module ProMotion
|
|
140
140
|
end
|
141
141
|
def on_disappear; end
|
142
142
|
|
143
|
-
def main_controller
|
144
|
-
self.navigation_controller || self
|
145
|
-
end
|
146
|
-
|
147
143
|
def view_controller
|
148
144
|
warn "[DEPRECATION] `view_controller` is deprecated, as screens are now UIViewController subclasses."
|
149
145
|
self
|
data/lib/ProMotion/version.rb
CHANGED
data/spec/screen_spec.rb
CHANGED
@@ -97,6 +97,21 @@ describe "screen properties" do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
|
100
|
+
describe "pm_main_controller" do
|
101
|
+
|
102
|
+
it "should return the navigation controller wrapper" do
|
103
|
+
@screen.pm_main_controller.should.be.instance_of ProMotion::NavigationController
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should return itself when screen is a plain UIViewController" do
|
107
|
+
vc = UIViewController.alloc.initWithNibName(nil, bundle: nil)
|
108
|
+
vc.respond_to?(:pm_main_controller).should == true
|
109
|
+
vc.pm_main_controller.should == vc
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
100
115
|
describe "navigation controller behavior" do
|
101
116
|
|
102
117
|
it "should have a nav bar" do
|
@@ -38,12 +38,12 @@ describe "split screen in tab bar functionality" do
|
|
38
38
|
|
39
39
|
it "should set the first viewController to HomeScreen's main controller" do
|
40
40
|
@split_screen.master_screen.should == @master_screen
|
41
|
-
@split_screen.viewControllers.first.should == @master_screen.
|
41
|
+
@split_screen.viewControllers.first.should == @master_screen.pm_main_controller
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should set the second viewController to BasicScreen's main controller" do
|
45
45
|
@split_screen.detail_screen.should == @detail_screen
|
46
|
-
@split_screen.viewControllers.last.should == @detail_screen.
|
46
|
+
@split_screen.viewControllers.last.should == @detail_screen.pm_main_controller
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should set the tab bar first viewController to the split screen" do
|
@@ -17,15 +17,15 @@ describe "split screen `open` functionality" do
|
|
17
17
|
it "should open a new screen in the detail view" do
|
18
18
|
@master_screen.open @detail_screen_2, in_detail: true
|
19
19
|
@split_screen.detail_screen.should == @detail_screen_2
|
20
|
-
@split_screen.viewControllers.first.should == @master_screen.
|
21
|
-
@split_screen.viewControllers.last.should == @detail_screen_2.
|
20
|
+
@split_screen.viewControllers.first.should == @master_screen.pm_main_controller
|
21
|
+
@split_screen.viewControllers.last.should == @detail_screen_2.pm_main_controller
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should open a new screen in the master view" do
|
25
25
|
@detail_screen_1.open @detail_screen_2, in_master: true
|
26
26
|
@split_screen.master_screen.should == @detail_screen_2
|
27
|
-
@split_screen.viewControllers.first.should == @detail_screen_2.
|
28
|
-
@split_screen.viewControllers.last.should == @detail_screen_1.
|
27
|
+
@split_screen.viewControllers.first.should == @detail_screen_2.pm_main_controller
|
28
|
+
@split_screen.viewControllers.last.should == @detail_screen_1.pm_main_controller
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should open a new screen in the master view's navigation controller" do
|
@@ -37,7 +37,7 @@ describe "split screen `open` functionality" do
|
|
37
37
|
it "should open a new modal screen in the detail view" do
|
38
38
|
@detail_screen_1.open @detail_screen_2, modal: true
|
39
39
|
@split_screen.detail_screen.should == @detail_screen_1
|
40
|
-
@detail_screen_1.presentedViewController.should == @detail_screen_2.
|
40
|
+
@detail_screen_1.presentedViewController.should == @detail_screen_2.pm_main_controller
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should not interfere with normal non-split screen navigation" do
|
data/spec/split_screen_spec.rb
CHANGED
@@ -28,12 +28,12 @@ describe "split screen functionality" do
|
|
28
28
|
|
29
29
|
it "should set the first viewController to MasterScreen" do
|
30
30
|
@split_screen.master_screen.should == @master_screen
|
31
|
-
@split_screen.viewControllers.first.should == @master_screen.
|
31
|
+
@split_screen.viewControllers.first.should == @master_screen.pm_main_controller
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set the second viewController to DetailScreen" do
|
35
35
|
@split_screen.detail_screen.should == @detail_screen
|
36
|
-
@split_screen.viewControllers.last.should == @detail_screen.
|
36
|
+
@split_screen.viewControllers.last.should == @detail_screen.pm_main_controller
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should set the title on both screens" do
|
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.6.
|
4
|
+
version: 0.6.3
|
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-05-
|
14
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: ProMotion is a new way to easily build RubyMotion iOS apps.
|
17
17
|
email:
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/ProMotion/screen_helpers/split_screen.rb
|
60
60
|
- lib/ProMotion/screens/_screen_module.rb
|
61
61
|
- lib/ProMotion/screens/_table_screen_module.rb
|
62
|
+
- lib/ProMotion/screens/behaves_like_screen.rb
|
62
63
|
- lib/ProMotion/screens/screen.rb
|
63
64
|
- lib/ProMotion/screens/table_screen.rb
|
64
65
|
- lib/ProMotion/version.rb
|