ProMotion 0.7.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.travis.yml +1 -1
- data/ProMotion.gemspec +2 -0
- data/README.md +51 -449
- data/Rakefile +11 -1
- data/app/screens/basic_screen.rb +0 -24
- data/lib/ProMotion/cocoatouch/{NavigationController.rb → navigation_controller.rb} +0 -0
- data/lib/ProMotion/cocoatouch/split_view_controller.rb +29 -0
- data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +43 -0
- data/lib/ProMotion/cocoatouch/{TableViewCell.rb → table_view_cell.rb} +0 -1
- data/lib/ProMotion/cocoatouch/{TableViewController.rb → table_view_controller.rb} +0 -0
- data/lib/ProMotion/cocoatouch/{ViewController.rb → view_controller.rb} +6 -1
- data/lib/ProMotion/{screen_helpers → containers}/split_screen.rb +0 -2
- data/lib/ProMotion/containers/tabs.rb +95 -0
- data/lib/ProMotion/delegate/delegate.rb +2 -13
- data/lib/ProMotion/delegate/{delegate_helper.rb → delegate_module.rb} +29 -16
- data/lib/ProMotion/delegate/delegate_notifications.rb +17 -8
- data/lib/ProMotion/delegate/delegate_parent.rb +11 -0
- data/lib/ProMotion/extensions/conversions.rb +20 -0
- data/lib/ProMotion/{helpers/logger.rb → logger.rb} +0 -0
- data/lib/ProMotion/map/map_screen.rb +6 -0
- data/lib/ProMotion/map/map_screen_annotation.rb +56 -0
- data/lib/ProMotion/map/map_screen_module.rb +207 -0
- data/lib/ProMotion/{push_notifications → push_notification}/push_notification.rb +13 -6
- data/lib/ProMotion/{screens → screen}/screen.rb +1 -1
- data/lib/ProMotion/{screens/_screen_module.rb → screen/screen_module.rb} +76 -51
- data/lib/ProMotion/{screen_helpers → screen}/screen_navigation.rb +8 -12
- data/lib/ProMotion/{screens/_tables → table/cell}/table_view_cell_module.rb +18 -27
- data/lib/ProMotion/table/data/table_data.rb +98 -0
- data/lib/ProMotion/table/extensions/indexable.rb +9 -0
- data/lib/ProMotion/table/extensions/refreshable.rb +45 -0
- data/lib/ProMotion/table/extensions/searchable.rb +61 -0
- data/lib/ProMotion/table/grouped_table.rb +9 -0
- data/lib/ProMotion/table/grouped_table_screen.rb +6 -0
- data/lib/ProMotion/table/table.rb +312 -0
- data/lib/ProMotion/table/table_screen.rb +6 -0
- data/lib/ProMotion/{screens/_compatibility → thirdparty}/formotion_screen.rb +18 -5
- data/lib/ProMotion/version.rb +1 -1
- data/lib/ProMotion/view/styling.rb +137 -0
- data/lib/ProMotion/web/web_screen.rb +6 -0
- data/lib/ProMotion/web/web_screen_module.rb +155 -0
- data/resources/WebScreen.html +6 -0
- data/resources/test.jpeg +0 -0
- data/spec/functional/func_map_screen_spec.rb +105 -0
- data/spec/functional/func_screen_spec.rb +54 -7
- data/spec/functional/func_searchable_table_spec.rb +1 -1
- data/spec/functional/func_tab_bar_spec.rb +78 -0
- data/spec/functional/func_table_screen_spec.rb +61 -14
- data/spec/functional/func_web_screen_spec.rb +51 -0
- data/spec/helpers/map_screen.rb +51 -0
- data/spec/helpers/present_screen.rb +26 -0
- data/spec/helpers/tab_screen.rb +4 -0
- data/spec/helpers/table_screen.rb +12 -3
- data/spec/helpers/table_screen_formotion.rb +25 -0
- data/spec/helpers/table_screen_indexable.rb +13 -0
- data/spec/helpers/test_delegate.rb +28 -0
- data/spec/helpers/web_screen.rb +22 -0
- data/spec/unit/delegate_spec.rb +53 -4
- data/spec/unit/map_spec.rb +48 -0
- data/spec/unit/screen_helpers_spec.rb +24 -16
- data/spec/unit/screen_spec.rb +22 -18
- data/spec/unit/split_screen_in_tab_bar_spec.rb +2 -2
- data/spec/unit/split_screen_open_screen_spec.rb +15 -10
- data/spec/unit/split_screen_spec.rb +2 -2
- data/spec/unit/tab_spec.rb +41 -0
- data/spec/unit/tables/formotion_screen_spec.rb +16 -0
- data/spec/unit/tables/table_indexable_spec.rb +12 -0
- data/spec/unit/tables/table_module_spec.rb +24 -9
- data/spec/unit/tables/table_screen_spec.rb +1 -1
- data/spec/unit/tables/table_view_cell_spec.rb +9 -8
- data/spec/unit/view_helper_spec.rb +2 -2
- data/spec/unit/web_spec.rb +106 -0
- metadata +96 -35
- data/lib/ProMotion/cocoatouch/SplitViewController.rb +0 -23
- data/lib/ProMotion/helpers/console.rb +0 -29
- data/lib/ProMotion/helpers/measure_helper.rb +0 -20
- data/lib/ProMotion/helpers/system_helper.rb +0 -29
- data/lib/ProMotion/helpers/view_helper.rb +0 -82
- data/lib/ProMotion/screen_helpers/screen_elements.rb +0 -36
- data/lib/ProMotion/screen_helpers/screen_tabs.rb +0 -95
- data/lib/ProMotion/screens/_table_screen_module.rb +0 -47
- data/lib/ProMotion/screens/_tables/_refreshable_table.rb +0 -45
- data/lib/ProMotion/screens/_tables/_searchable_table.rb +0 -60
- data/lib/ProMotion/screens/_tables/_sectioned_table.rb +0 -5
- data/lib/ProMotion/screens/_tables/_table.rb +0 -169
- data/lib/ProMotion/screens/_tables/grouped_table.rb +0 -16
- data/lib/ProMotion/screens/_tables/plain_table.rb +0 -17
- data/lib/ProMotion/screens/_tables/table_data.rb +0 -175
- data/lib/ProMotion/screens/behaves_like_screen.rb +0 -10
- data/lib/ProMotion/screens/table_screen.rb +0 -16
- data/spec/unit/ios_version_spec.rb +0 -28
@@ -5,11 +5,13 @@ describe "ProMotion::Screen functional" do
|
|
5
5
|
def controller
|
6
6
|
rotate_device to: :portrait, button: :bottom
|
7
7
|
@controller ||= FunctionalScreen.new(nav_bar: true)
|
8
|
-
@controller
|
8
|
+
@root_screen = @controller
|
9
|
+
@controller.navigation_controller
|
9
10
|
end
|
10
11
|
|
11
12
|
after do
|
12
13
|
@controller = nil
|
14
|
+
@root_screen = nil
|
13
15
|
end
|
14
16
|
|
15
17
|
it "should have a navigation bar" do
|
@@ -17,19 +19,19 @@ describe "ProMotion::Screen functional" do
|
|
17
19
|
end
|
18
20
|
|
19
21
|
it "should allow setting a left nav bar button" do
|
20
|
-
@
|
22
|
+
@root_screen.set_nav_bar_button :left, title: "Cool", action: :triggered_button
|
21
23
|
tap("Cool")
|
22
|
-
@
|
24
|
+
@root_screen.button_was_triggered.should.be.true
|
23
25
|
end
|
24
26
|
|
25
27
|
it "should allow setting a right nav bar button" do
|
26
|
-
@
|
28
|
+
@root_screen.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
|
27
29
|
tap("Cool2")
|
28
|
-
@
|
30
|
+
@root_screen.button_was_triggered.should.be.true
|
29
31
|
end
|
30
32
|
|
31
33
|
it "should allow opening another screen in the same nav bar and have a back button that is operational" do
|
32
|
-
@
|
34
|
+
@root_screen.open BasicScreen
|
33
35
|
|
34
36
|
wait 0.5 do
|
35
37
|
|
@@ -47,7 +49,7 @@ describe "ProMotion::Screen functional" do
|
|
47
49
|
it "should allow opening and closing a modal screen" do
|
48
50
|
@basic = BasicScreen.new(nav_bar: true)
|
49
51
|
wait 0.1 do
|
50
|
-
@
|
52
|
+
@root_screen.open_modal @basic
|
51
53
|
|
52
54
|
wait 0.6 do
|
53
55
|
|
@@ -63,4 +65,49 @@ describe "ProMotion::Screen functional" do
|
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
68
|
+
it "should fire the will_present, on_present, will_dismiss, and on_dismiss_methods" do
|
69
|
+
@presented_screen = PresentScreen.new
|
70
|
+
@root_screen.open @presented_screen
|
71
|
+
wait 0.6 do
|
72
|
+
@presented_screen.will_present_fired.should == true
|
73
|
+
@presented_screen.on_present_fired.should == true
|
74
|
+
|
75
|
+
@presented_screen.will_dismiss_fired.should.not == true
|
76
|
+
@presented_screen.on_dismiss_fired.should.not == true
|
77
|
+
|
78
|
+
@presented_screen.reset
|
79
|
+
|
80
|
+
@presented_screen.close
|
81
|
+
wait 0.6 do
|
82
|
+
@presented_screen.will_dismiss_fired.should == true
|
83
|
+
@presented_screen.on_dismiss_fired.should == true
|
84
|
+
|
85
|
+
@presented_screen.will_present_fired.should.not == true
|
86
|
+
@presented_screen.on_present_fired.should.not == true
|
87
|
+
|
88
|
+
@presented_screen = nil
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should pop to the root view controller" do
|
94
|
+
@root_vc = @controller.navigation_controller.visibleViewController
|
95
|
+
@controller.navigation_controller.viewControllers.count.should == 1
|
96
|
+
@controller.open BasicScreen.new
|
97
|
+
wait 0.6 do
|
98
|
+
@controller.open BasicScreen.new
|
99
|
+
wait 0.6 do
|
100
|
+
@controller.open BasicScreen.new
|
101
|
+
wait 0.6 do
|
102
|
+
@controller.navigation_controller.viewControllers.count.should == 4
|
103
|
+
@controller.close to_screen: :root
|
104
|
+
wait 0.6 do
|
105
|
+
@controller.navigation_controller.viewControllers.count.should == 1
|
106
|
+
@controller.navigation_controller.topViewController.should == @root_vc
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
66
113
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
describe "PM::Tabs" do
|
2
|
+
tests PM::Tabs
|
3
|
+
|
4
|
+
# Override controller to properly instantiate
|
5
|
+
def controller
|
6
|
+
@app ||= TestDelegate.new
|
7
|
+
|
8
|
+
@screen1 = BasicScreen.new(nav_bar: true, title: "Screen 1")
|
9
|
+
@screen2 = BasicScreen.new(nav_bar: true, title: "Screen 2")
|
10
|
+
@screen3 = BasicScreen.new(title: "Screen 3")
|
11
|
+
@screen4 = BasicScreen.new(title: "Screen 4")
|
12
|
+
|
13
|
+
@controller ||= @app.open_tab_bar(@screen1, @screen2, @screen3, @screen4)
|
14
|
+
@tab_bar = @controller
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should create a UITabBarController" do
|
18
|
+
@app.window.rootViewController.should.be.kind_of UITabBarController
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have four tabs" do
|
22
|
+
@tab_bar.viewControllers.length.should == 4
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have the right screens in the right places" do
|
26
|
+
@tab_bar.viewControllers[0].should == @screen1.navigationController
|
27
|
+
@tab_bar.viewControllers[1].should == @screen2.navigationController
|
28
|
+
@tab_bar.viewControllers[2].should == @screen3
|
29
|
+
@tab_bar.viewControllers[3].should == @screen4
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should allow opening a tab by the name from any screen" do
|
33
|
+
@screen1.open_tab "Screen 2"
|
34
|
+
@tab_bar.selectedIndex.should == 1
|
35
|
+
@screen2.open_tab "Screen 3"
|
36
|
+
@tab_bar.selectedIndex.should == 2
|
37
|
+
@screen3.open_tab "Screen 4"
|
38
|
+
@tab_bar.selectedIndex.should == 3
|
39
|
+
@screen4.open_tab "Screen 1"
|
40
|
+
@tab_bar.selectedIndex.should == 0
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should allow opening a tab by the index from any screen" do
|
44
|
+
@screen1.open_tab 1
|
45
|
+
@tab_bar.selectedIndex.should == 1
|
46
|
+
@screen2.open_tab 2
|
47
|
+
@tab_bar.selectedIndex.should == 2
|
48
|
+
@screen3.open_tab 3
|
49
|
+
@tab_bar.selectedIndex.should == 3
|
50
|
+
@screen4.open_tab 0
|
51
|
+
@tab_bar.selectedIndex.should == 0
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should allow opening a tab from the app_delegate" do
|
55
|
+
@app.open_tab "Screen 2"
|
56
|
+
@tab_bar.selectedIndex.should == 1
|
57
|
+
@app.open_tab "Screen 3"
|
58
|
+
@tab_bar.selectedIndex.should == 2
|
59
|
+
@app.open_tab "Screen 4"
|
60
|
+
@tab_bar.selectedIndex.should == 3
|
61
|
+
@app.open_tab "Screen 1"
|
62
|
+
@tab_bar.selectedIndex.should == 0
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should allow opening a tab by accessing the tab bar directly" do
|
66
|
+
@tab_bar.open_tab "Screen 2"
|
67
|
+
@tab_bar.selectedIndex.should == 1
|
68
|
+
@tab_bar.open_tab "Screen 3"
|
69
|
+
@tab_bar.selectedIndex.should == 2
|
70
|
+
@tab_bar.open_tab "Screen 4"
|
71
|
+
@tab_bar.selectedIndex.should == 3
|
72
|
+
@tab_bar.open_tab "Screen 1"
|
73
|
+
@tab_bar.selectedIndex.should == 0
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
end
|
@@ -6,11 +6,7 @@ describe "ProMotion::TestTableScreen functionality" do
|
|
6
6
|
rotate_device to: :portrait, button: :bottom
|
7
7
|
@controller ||= TestTableScreen.new(nav_bar: true)
|
8
8
|
@controller.on_load
|
9
|
-
@controller.
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
@controller = nil
|
9
|
+
@controller.navigation_controller
|
14
10
|
end
|
15
11
|
|
16
12
|
it "should have a navigation bar" do
|
@@ -38,36 +34,87 @@ describe "ProMotion::TestTableScreen functionality" do
|
|
38
34
|
end
|
39
35
|
|
40
36
|
it "should delete the specified row from the table view on tap" do
|
41
|
-
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should ==
|
37
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
|
42
38
|
tap("Delete the row below")
|
43
|
-
|
39
|
+
wait 0.3 do
|
40
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
|
41
|
+
end
|
44
42
|
end
|
45
43
|
|
46
44
|
it "should delete the specified row from the table view on tap with an animation" do
|
47
|
-
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should ==
|
45
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
|
48
46
|
tap("Delete the row below with an animation")
|
49
|
-
|
47
|
+
wait 0.3 do
|
48
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# TODO: Why is it so complicated to find the delete button??
|
53
|
+
it "should use editing_style to delete the table row" do
|
54
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
|
55
|
+
@controller.cell_was_deleted.should != true
|
56
|
+
flick("Just another deletable blank row", :to => :left)
|
57
|
+
|
58
|
+
wait 0.25 do
|
59
|
+
# Tap the delete button
|
60
|
+
view('Just another deletable blank row').superview.superview.subviews.each do |subview|
|
61
|
+
if subview.class == UITableViewCellDeleteConfirmationControl
|
62
|
+
tap subview
|
63
|
+
wait 0.25 do
|
64
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
|
65
|
+
@controller.cell_was_deleted.should == true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should not allow deleting if on_cell_delete returns `false`" do
|
73
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
|
74
|
+
@controller.cell_was_deleted.should != true
|
75
|
+
flick("A non-deletable blank row", :to => :left)
|
76
|
+
|
77
|
+
wait 0.25 do
|
78
|
+
# Tap the delete button
|
79
|
+
view('A non-deletable blank row').superview.superview.subviews.each do |subview|
|
80
|
+
if subview.class == UITableViewCellDeleteConfirmationControl
|
81
|
+
tap subview
|
82
|
+
wait 0.25 do
|
83
|
+
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 7
|
84
|
+
@controller.cell_was_deleted.should != false
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
50
89
|
end
|
51
90
|
|
52
91
|
it "should call a method when the switch is flipped" do
|
53
92
|
@controller.scroll_to_bottom
|
54
93
|
tap "switch_1"
|
55
|
-
|
94
|
+
wait 0.3 do
|
95
|
+
@controller.tap_counter.should == 1
|
96
|
+
end
|
56
97
|
end
|
57
98
|
|
58
99
|
it "should call the method with arguments when the switch is flipped and when the cell is tapped" do
|
59
100
|
@controller.scroll_to_bottom
|
60
101
|
tap "switch_3"
|
61
|
-
|
102
|
+
wait 0.3 do
|
103
|
+
@controller.tap_counter.should == 3
|
62
104
|
|
63
|
-
|
64
|
-
|
105
|
+
tap "Switch With Cell Tap, Switch Action And Parameters"
|
106
|
+
wait 0.3 do
|
107
|
+
@controller.tap_counter.should == 13
|
108
|
+
end
|
109
|
+
end
|
65
110
|
end
|
66
111
|
|
67
112
|
it "should call the method with arguments when the switch is flipped" do
|
68
113
|
@controller.scroll_to_bottom
|
69
114
|
tap "switch_2"
|
70
|
-
|
115
|
+
wait 0.3 do
|
116
|
+
@controller.tap_counter.should == 3
|
117
|
+
end
|
71
118
|
end
|
72
119
|
|
73
120
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
describe "ProMotion::TestWebScreen functionality" do
|
2
|
+
extend WebStub::SpecHelpers
|
3
|
+
|
4
|
+
before { disable_network_access! }
|
5
|
+
after { enable_network_access! }
|
6
|
+
|
7
|
+
tests PM::TestWebScreen
|
8
|
+
|
9
|
+
# Override controller to properly instantiate
|
10
|
+
def controller
|
11
|
+
rotate_device to: :portrait, button: :bottom
|
12
|
+
@webscreen ||= TestWebScreen.new(nav_bar: true)
|
13
|
+
@webscreen.navigation_controller
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
@webscreen = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have the proper html content" do
|
21
|
+
file_name = "WebScreen.html"
|
22
|
+
|
23
|
+
@webscreen.set_content(file_name)
|
24
|
+
|
25
|
+
@loaded_file = File.read(File.join(NSBundle.mainBundle.resourcePath, file_name))
|
26
|
+
wait_for_change @webscreen, 'load_finished' do
|
27
|
+
@webscreen.html.delete("\n").should == @loaded_file.delete("\n")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should allow you to navigate to a website" do
|
32
|
+
stub_request(:get, "https://www.google.com/").
|
33
|
+
to_return(body: %q{Google! <form action="/search">%}, content_type: "text/html")
|
34
|
+
|
35
|
+
@webscreen.open_url(NSURL.URLWithString("https://www.google.com/"))
|
36
|
+
wait_for_change @webscreen, 'load_finished' do
|
37
|
+
@webscreen.html.include?('<form action="/search"').should == true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should manipulate the webscreen contents with javascript" do
|
42
|
+
@webscreen.set_content('<h1 id="cool">Something Cool</h1>')
|
43
|
+
|
44
|
+
wait_for_change @webscreen, 'load_finished' do
|
45
|
+
@webscreen.evaluate('document.getElementById("cool").innerHTML = "Changed"')
|
46
|
+
@webscreen.html.should =~ /<h1 id="cool">Changed<\/h1>/
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class TestMapScreen < PM::MapScreen
|
2
|
+
|
3
|
+
attr_accessor :infinite_loop_points
|
4
|
+
|
5
|
+
start_position latitude: 35.090648651123, longitude: -82.965972900391, radius: 4
|
6
|
+
title "Gorges State Park, NC"
|
7
|
+
|
8
|
+
def get_title
|
9
|
+
self.title
|
10
|
+
end
|
11
|
+
|
12
|
+
def promotion_annotation_data
|
13
|
+
@promotion_annotation_data
|
14
|
+
end
|
15
|
+
|
16
|
+
def annotation_data
|
17
|
+
# Partial set of data from "GPS Map of Gorges State Park": http://www.hikewnc.info/maps/gorges-state-park/gps-map
|
18
|
+
@data ||= [{
|
19
|
+
longitude: -82.965972900391,
|
20
|
+
latitude: 35.090648651123,
|
21
|
+
title: "Rainbow Falls",
|
22
|
+
subtitle: "Nantahala National Forest",
|
23
|
+
},{
|
24
|
+
longitude: -82.966093558105,
|
25
|
+
latitude: 35.092520895652,
|
26
|
+
title: "Turtleback Falls",
|
27
|
+
subtitle: "Nantahala National Forest",
|
28
|
+
},{
|
29
|
+
longitude: -82.95916,
|
30
|
+
latitude: 35.07496,
|
31
|
+
title: "Windy Falls"
|
32
|
+
},{
|
33
|
+
longitude: -82.943031505056,
|
34
|
+
latitude: 35.102516828489,
|
35
|
+
title: "Upper Bearwallow Falls",
|
36
|
+
subtitle: "Gorges State Park",
|
37
|
+
},{
|
38
|
+
longitude: -82.956244328014,
|
39
|
+
latitude: 35.085548421623,
|
40
|
+
title: "Stairway Falls",
|
41
|
+
subtitle: "Gorges State Park",
|
42
|
+
}]
|
43
|
+
end
|
44
|
+
|
45
|
+
def lookup_infinite_loop
|
46
|
+
look_up_address address: "1 Infinite Loop" do |points, error|
|
47
|
+
self.infinite_loop_points = points
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class PresentScreen < PM::Screen
|
2
|
+
attr_accessor :will_present_fired, :on_present_fired, :will_dismiss_fired, :on_dismiss_fired
|
3
|
+
|
4
|
+
def will_present
|
5
|
+
self.will_present_fired = true
|
6
|
+
end
|
7
|
+
|
8
|
+
def on_present
|
9
|
+
self.on_present_fired = true
|
10
|
+
end
|
11
|
+
|
12
|
+
def will_dismiss
|
13
|
+
self.will_dismiss_fired = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_dismiss
|
17
|
+
self.on_dismiss_fired = true
|
18
|
+
end
|
19
|
+
|
20
|
+
def reset
|
21
|
+
self.will_present_fired = false
|
22
|
+
self.on_present_fired = false
|
23
|
+
self.will_dismiss_fired = false
|
24
|
+
self.on_dismiss_fired = false
|
25
|
+
end
|
26
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class TestTableScreen < ProMotion::
|
1
|
+
class TestTableScreen < ProMotion::TableScreen
|
2
2
|
|
3
|
-
attr_accessor :tap_counter
|
3
|
+
attr_accessor :tap_counter, :cell_was_deleted
|
4
4
|
|
5
5
|
def promotion_table_data
|
6
6
|
@promotion_table_data
|
@@ -17,7 +17,8 @@ class TestTableScreen < ProMotion::SectionedTableScreen
|
|
17
17
|
{ title: "Increment", action: :increment_counter_by, arguments: {number: 3} },
|
18
18
|
{ title: "Add New Row", action: :add_tableview_row },
|
19
19
|
{ title: "Delete the row below", action: :delete_cell, arguments: {section: 0, row:3} },
|
20
|
-
{ title: "Just another blank row" },
|
20
|
+
{ title: "Just another deletable blank row", editing_style: :delete },
|
21
|
+
{ title: "A non-deletable blank row", editing_style: :delete },
|
21
22
|
{ title: "Delete the row below with an animation", action: :delete_cell, arguments: {animated: true, section: 0, row:5 } },
|
22
23
|
{ title: "Just another blank row" }
|
23
24
|
]
|
@@ -86,6 +87,14 @@ class TestTableScreen < ProMotion::SectionedTableScreen
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
90
|
+
def on_cell_deleted(cell)
|
91
|
+
if cell[:title] == "A non-deletable blank row"
|
92
|
+
false
|
93
|
+
else
|
94
|
+
self.cell_was_deleted = true
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
89
98
|
def increment_counter
|
90
99
|
self.tap_counter = self.tap_counter + 1
|
91
100
|
end
|