ProMotion 1.2.1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -10
  3. data/lib/ProMotion.rb +11 -2
  4. data/lib/ProMotion/cocoatouch/ns_string.rb +5 -0
  5. data/lib/ProMotion/cocoatouch/ns_url.rb +5 -0
  6. data/lib/ProMotion/cocoatouch/tab_bar_controller.rb +5 -7
  7. data/lib/ProMotion/cocoatouch/table_view_cell.rb +0 -16
  8. data/lib/ProMotion/cocoatouch/table_view_controller.rb +2 -3
  9. data/lib/ProMotion/cocoatouch/view_controller.rb +3 -6
  10. data/lib/ProMotion/delegate/delegate.rb +0 -3
  11. data/lib/ProMotion/delegate/delegate_module.rb +24 -20
  12. data/lib/ProMotion/{containers → ipad}/split_screen.rb +30 -32
  13. data/lib/ProMotion/{logger.rb → logger/logger.rb} +6 -5
  14. data/lib/ProMotion/screen/nav_bar_module.rb +126 -0
  15. data/lib/ProMotion/screen/screen.rb +0 -3
  16. data/lib/ProMotion/screen/screen_module.rb +54 -177
  17. data/lib/ProMotion/screen/screen_navigation.rb +29 -40
  18. data/lib/ProMotion/{view → styling}/styling.rb +17 -47
  19. data/lib/ProMotion/table/cell/table_view_cell_module.rb +76 -123
  20. data/lib/ProMotion/table/data/table_data.rb +1 -1
  21. data/lib/ProMotion/table/extensions/longpressable.rb +24 -0
  22. data/lib/ProMotion/table/extensions/refreshable.rb +1 -0
  23. data/lib/ProMotion/table/grouped_table_screen.rb +0 -5
  24. data/lib/ProMotion/table/table.rb +63 -83
  25. data/lib/ProMotion/table/table_screen.rb +0 -4
  26. data/lib/ProMotion/{containers → tabs}/tabs.rb +20 -21
  27. data/lib/ProMotion/version.rb +1 -1
  28. data/lib/ProMotion/web/web_screen.rb +0 -4
  29. data/lib/ProMotion/web/web_screen_module.rb +8 -5
  30. data/spec/functional/func_screen_spec.rb +14 -18
  31. data/spec/functional/func_split_screen_spec.rb +2 -2
  32. data/spec/functional/func_table_screen_spec.rb +54 -40
  33. data/spec/functional/func_web_screen_spec.rb +12 -17
  34. data/spec/helpers/test_helper.rb +27 -0
  35. data/spec/unit/delegate_spec.rb +4 -67
  36. data/spec/unit/image_title_screen.rb +9 -0
  37. data/spec/unit/image_view_title_screen.rb +9 -0
  38. data/spec/unit/load_view_spec.rb +27 -0
  39. data/spec/unit/main_spec.rb +0 -6
  40. data/spec/unit/screen_helpers_spec.rb +23 -17
  41. data/spec/unit/screen_spec.rb +21 -17
  42. data/spec/unit/searchable_table_spec.rb +55 -0
  43. data/spec/unit/split_screen_in_tab_bar_spec.rb +5 -5
  44. data/spec/unit/split_screen_spec.rb +4 -4
  45. data/spec/unit/tab_bar_spec.rb +79 -0
  46. data/spec/unit/tab_spec.rb +11 -5
  47. data/spec/unit/tables/table_module_spec.rb +22 -8
  48. data/spec/unit/tables/table_screen_spec.rb +1 -1
  49. data/spec/unit/tables/table_view_cell_spec.rb +16 -16
  50. data/spec/unit/view_helper_spec.rb +6 -81
  51. data/spec/unit/view_title_screen.rb +10 -0
  52. data/spec/unit/web_spec.rb +31 -37
  53. metadata +37 -111
  54. data/.gitignore +0 -33
  55. data/.travis.yml +0 -4
  56. data/CONTRIBUTING.md +0 -20
  57. data/Gemfile +0 -5
  58. data/LICENSE +0 -22
  59. data/ProMotion.gemspec +0 -30
  60. data/Rakefile +0 -66
  61. data/app/app_delegate.rb +0 -7
  62. data/app/screens/basic_screen.rb +0 -15
  63. data/lib/ProMotion/delegate/delegate_notifications.rb +0 -70
  64. data/lib/ProMotion/extensions/conversions.rb +0 -20
  65. data/lib/ProMotion/map/map_screen.rb +0 -10
  66. data/lib/ProMotion/map/map_screen_annotation.rb +0 -65
  67. data/lib/ProMotion/map/map_screen_module.rb +0 -212
  68. data/lib/ProMotion/push_notification/push_notification.rb +0 -58
  69. data/resources/WebScreen.html +0 -6
  70. data/resources/list.png +0 -0
  71. data/resources/test.png +0 -0
  72. data/spec/functional/func_image_title_screen.rb +0 -20
  73. data/spec/functional/func_image_view_title_screen.rb +0 -20
  74. data/spec/functional/func_map_screen_spec.rb +0 -162
  75. data/spec/functional/func_searchable_table_spec.rb +0 -56
  76. data/spec/functional/func_tab_bar_spec.rb +0 -78
  77. data/spec/functional/func_view_title_screen.rb +0 -21
  78. data/spec/helpers/basic_screen.rb +0 -3
  79. data/spec/helpers/custom_title_view.rb +0 -4
  80. data/spec/helpers/detail_screen.rb +0 -3
  81. data/spec/helpers/dummy_class.rb +0 -3
  82. data/spec/helpers/functional_screen.rb +0 -15
  83. data/spec/helpers/home_screen.rb +0 -19
  84. data/spec/helpers/image_title_screen.rb +0 -15
  85. data/spec/helpers/image_view_title_screen.rb +0 -15
  86. data/spec/helpers/map_screen.rb +0 -53
  87. data/spec/helpers/master_screen.rb +0 -3
  88. data/spec/helpers/present_screen.rb +0 -26
  89. data/spec/helpers/screen_module_view_controller.rb +0 -55
  90. data/spec/helpers/tab_screen.rb +0 -4
  91. data/spec/helpers/table_screen.rb +0 -117
  92. data/spec/helpers/table_screen_indexable.rb +0 -18
  93. data/spec/helpers/table_screen_refreshable.rb +0 -11
  94. data/spec/helpers/table_screen_searchable.rb +0 -72
  95. data/spec/helpers/test_delegate.rb +0 -34
  96. data/spec/helpers/test_delegate_colors.rb +0 -17
  97. data/spec/helpers/view_title_screen.rb +0 -15
  98. data/spec/helpers/web_screen.rb +0 -23
  99. data/spec/unit/map_spec.rb +0 -71
@@ -1,3 +0,0 @@
1
- class DetailScreen < PM::Screen
2
- title "Detail"
3
- end
@@ -1,3 +0,0 @@
1
- class DummyClass
2
- # will dynamically do things with this thing
3
- end
@@ -1,15 +0,0 @@
1
- class FunctionalScreen < PM::Screen
2
- attr_accessor :button_was_triggered
3
-
4
- title "Functional"
5
-
6
- def will_appear
7
- self.button_was_triggered = false
8
- add UILabel.alloc.initWithFrame([[ 10, 10 ], [ 300, 40 ]]),
9
- text: "Label Here"
10
- end
11
-
12
- def triggered_button
13
- self.button_was_triggered = true
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- class HomeScreen < ProMotion::Screen
2
-
3
- title "Home"
4
-
5
- def on_load
6
- set_nav_bar_right_button "Save", action: :save_something, type: UIBarButtonItemStyleDone
7
- set_nav_bar_left_button UIImage.imageNamed("list.png"), action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
8
- end
9
-
10
- def on_return(args={})
11
- end
12
-
13
- def subview_styles
14
- {
15
- backgroundColor: UIColor.greenColor
16
- }
17
- end
18
-
19
- end
@@ -1,15 +0,0 @@
1
- class ImageTitleScreen < PM::Screen
2
- attr_accessor :button_was_triggered
3
-
4
- title UIImage.imageNamed('test.png')
5
-
6
- def will_appear
7
- self.button_was_triggered = false
8
- add UILabel.alloc.initWithFrame([[ 10, 10 ], [ 300, 40 ]]),
9
- text: "Label Here"
10
- end
11
-
12
- def triggered_button
13
- self.button_was_triggered = true
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- class ImageViewTitleScreen < PM::Screen
2
- attr_accessor :button_was_triggered
3
-
4
- title UIImageView.alloc.initWithImage(UIImage.imageNamed('test.png'))
5
-
6
- def will_appear
7
- self.button_was_triggered = false
8
- add UILabel.alloc.initWithFrame([[ 10, 10 ], [ 300, 40 ]]),
9
- text: "Label Here"
10
- end
11
-
12
- def triggered_button
13
- self.button_was_triggered = true
14
- end
15
- end
@@ -1,53 +0,0 @@
1
- class TestMapScreen < PM::MapScreen
2
-
3
- attr_accessor :infinite_loop_points, :request_complete
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
- self.request_complete = false
47
- self.look_up_address address: "1 Infinite Loop" do |points, error|
48
- self.request_complete = true
49
- self.infinite_loop_points = points
50
- end
51
- end
52
-
53
- end
@@ -1,3 +0,0 @@
1
- class MasterScreen < PM::Screen
2
- title "Master"
3
- end
@@ -1,26 +0,0 @@
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,55 +0,0 @@
1
- class ScreenModuleViewController < UIViewController
2
- include PM::ScreenModule
3
- title 'Test Title'
4
-
5
- # Get rid of such hackiness when RubyMotion bug is fixed...
6
-
7
- def self.new(args = {})
8
- s = self.alloc.initWithNibName(nil, bundle:nil)
9
- s.on_create(args) if s.respond_to?(:on_create)
10
- s
11
- end
12
-
13
- def viewDidLoad
14
- super
15
- self.view_did_load if self.respond_to?(:view_did_load)
16
- end
17
-
18
- def viewWillAppear(animated)
19
- super
20
- self.view_will_appear(animated) if self.respond_to?("view_will_appear:")
21
- end
22
-
23
- def viewDidAppear(animated)
24
- super
25
- self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
26
- end
27
-
28
- def viewWillDisappear(animated)
29
- self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
30
- super
31
- end
32
-
33
- def viewDidDisappear(animated)
34
- if self.respond_to?("view_did_disappear:")
35
- self.view_did_disappear(animated)
36
- end
37
- super
38
- end
39
-
40
- def shouldAutorotateToInterfaceOrientation(orientation)
41
- self.should_rotate(orientation)
42
- end
43
-
44
- def shouldAutorotate
45
- self.should_autorotate
46
- end
47
-
48
- def willRotateToInterfaceOrientation(orientation, duration:duration)
49
- self.will_rotate(orientation, duration)
50
- end
51
-
52
- def didRotateFromInterfaceOrientation(orientation)
53
- self.on_rotate
54
- end
55
- end
@@ -1,4 +0,0 @@
1
- class TabScreen < PM::Screen
2
- title "Tab"
3
- tab_bar_item title: "Tab Item", icon: "list"
4
- end
@@ -1,117 +0,0 @@
1
- class TestTableScreen < ProMotion::TableScreen
2
-
3
- attr_accessor :tap_counter, :cell_was_deleted
4
-
5
- def on_load
6
- self.tap_counter = 0
7
- set_attributes self.view, { backgroundView: nil, backgroundColor: UIColor.whiteColor }
8
- set_nav_bar_right_button UIImage.imageNamed("list.png"), action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
9
- end
10
-
11
- def table_data
12
- @data ||= [{
13
- title: "Your Account",
14
- cells: [
15
- { title: "Increment", action: :increment_counter_by, arguments: {number: 3} },
16
- { title: "Add New Row", action: :add_tableview_row },
17
- { title: "Delete the row below", action: :delete_cell, arguments: {section: 0, row:3} },
18
- { title: "Just another deletable blank row", editing_style: :delete },
19
- { title: "A non-deletable blank row", editing_style: :delete },
20
- { title: "Delete the row below with an animation", action: :delete_cell, arguments: {animated: true, section: 0, row:5 } },
21
- { title: "Just another blank row" }
22
- ]
23
- }, {
24
- title: "App Stuff",
25
- cells: [
26
- { title: "Increment One", action: :increment_counter },
27
- { title: "Feedback", cell_identifier: "ImagedCell", remote_image: { url: "http://placekitten.com/100/100", placeholder: "some-local-image", size: 50, radius: 15 } }
28
- ]
29
- }, {
30
- title: "Image Tests",
31
- cells: [
32
- { title: "Image Test 1", cell_identifier: "ImagedCell", image: {image: UIImage.imageNamed("list.png"), radius: 10} },
33
- { title: "Image Test 2", cell_identifier: "ImagedCell", image: {image: "list.png"} },
34
- { title: "Image Test 3", cell_identifier: "ImagedCell", cell_identifier: "ImagedCell", image: UIImage.imageNamed("list.png") },
35
- { title: "Image Test 4", image: "list.png" },
36
- ]
37
- }, {
38
- title: "Cell Accessory Tests",
39
- cells: [{
40
- title: "Switch With Action",
41
- accessory: {
42
- view: :switch,
43
- action: :increment_counter,
44
- accessibility_label: "switch_1"
45
- } ,
46
- }, {
47
- title: "Switch With Action And Parameters",
48
- accessory: {
49
- view: :switch,
50
- action: :increment_counter_by,
51
- arguments: { number: 3 },
52
- accessibility_label: "switch_2"
53
- } ,
54
- }, {
55
- title: "Switch With Cell Tap, Switch Action And Parameters",
56
- accessory:{
57
- view: :switch,
58
- action: :increment_counter_by,
59
- arguments: { number: 3 },
60
- accessibility_label: "switch_3"
61
- },
62
- action: :increment_counter_by,
63
- arguments: { number: 10 }
64
- }]
65
- }]
66
- end
67
-
68
- def edit_profile(args={})
69
- args[:id]
70
- end
71
-
72
- def add_tableview_row(args={})
73
- @data[0][:cells] << {
74
- title: "Dynamically Added"
75
- }
76
- update_table_data
77
- end
78
-
79
- def delete_cell(args={})
80
- if args[:animated]
81
- delete_row(NSIndexPath.indexPathForRow(args[:row], inSection:args[:section]))
82
- else
83
- @data[args[:section]][:cells].delete_at args[:row]
84
- update_table_data
85
- end
86
- end
87
-
88
- def on_cell_deleted(cell)
89
- if cell[:title] == "A non-deletable blank row"
90
- false
91
- else
92
- self.cell_was_deleted = true
93
- end
94
- end
95
-
96
- def increment_counter
97
- self.tap_counter = self.tap_counter + 1
98
- end
99
-
100
- def increment_counter_by(args={})
101
- self.tap_counter = self.tap_counter + args[:number]
102
- end
103
-
104
- def custom_accessory_view
105
- set_attributes UIView.new, {
106
- background_color: UIColor.orangeColor
107
- }
108
- end
109
-
110
- def scroll_to_bottom
111
- if table_view.contentSize.height > table_view.frame.size.height
112
- offset = CGPointMake(0, table_view.contentSize.height - table_view.frame.size.height)
113
- table_view.setContentOffset(offset, animated:false)
114
- end
115
- end
116
-
117
- end
@@ -1,18 +0,0 @@
1
- class TableScreenIndexable < PM::TableScreen
2
- indexable
3
-
4
- def table_data
5
- %w{ Apple Google Microsoft Oracle Sun UNIX }.map do |group_name|
6
- {
7
- title: "#{group_name} Group",
8
- cells: [{ title: "Single cell for group #{group_name}" }]
9
- }
10
- end
11
- end
12
-
13
- end
14
-
15
- class TableScreenIndexableSearchable < TableScreenIndexable
16
- indexable
17
- searchable
18
- end
@@ -1,11 +0,0 @@
1
- class TableScreenRefreshable < TestTableScreen
2
- attr_accessor :on_refresh_called
3
-
4
- refreshable
5
-
6
- def on_refresh
7
- self.on_refresh_called = true
8
- end_refreshing
9
- end
10
-
11
- end
@@ -1,72 +0,0 @@
1
- class TableScreenSearchable < TestTableScreen
2
-
3
- searchable
4
-
5
- attr_accessor :will_end_search_called, :will_begin_search_called
6
-
7
- def table_data
8
- @search_table_data ||= [{
9
- cells: [
10
- { title: "Alabama" },
11
- { title: "Alaska" },
12
- { title: "Arizona" },
13
- { title: "Arkansas" },
14
- { title: "California" },
15
- { title: "Colorado" },
16
- { title: "Connecticut" },
17
- { title: "Delaware" },
18
- { title: "Florida" },
19
- { title: "Georgia" },
20
- { title: "Hawaii" },
21
- { title: "Idaho" },
22
- { title: "Illinois" },
23
- { title: "Indiana" },
24
- { title: "Iowa" },
25
- { title: "Kansas" },
26
- { title: "Kentucky" },
27
- { title: "Louisiana" },
28
- { title: "Maine" },
29
- { title: "Maryland" },
30
- { title: "Massachusetts" },
31
- { title: "Michigan" },
32
- { title: "Minnesota" },
33
- { title: "Mississippi" },
34
- { title: "Missouri" },
35
- { title: "Montana" },
36
- { title: "Nebraska" },
37
- { title: "Nevada" },
38
- { title: "New Hampshire" },
39
- { title: "New Jersey" },
40
- { title: "New Mexico" },
41
- { title: "New York" },
42
- { title: "North Carolina" },
43
- { title: "North Dakota" },
44
- { title: "Ohio" },
45
- { title: "Oklahoma" },
46
- { title: "Oregon" },
47
- { title: "Pennsylvania" },
48
- { title: "Rhode Island" },
49
- { title: "South Carolina" },
50
- { title: "South Dakota" },
51
- { title: "Tennessee" },
52
- { title: "Texas" },
53
- { title: "Utah" },
54
- { title: "Vermont" },
55
- { title: "Virginia" },
56
- { title: "Washington" },
57
- { title: "West Virginia" },
58
- { title: "Wisconsin" },
59
- { title: "Wyoming" }
60
- ]
61
- }]
62
- end
63
-
64
- def will_begin_search
65
- self.will_begin_search_called = true
66
- end
67
-
68
- def will_end_search
69
- self.will_end_search_called = true
70
- end
71
-
72
- end