ProMotion 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +6 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +5 -1
  5. data/README.md +237 -138
  6. data/Rakefile +4 -9
  7. data/app/app_delegate.rb +3 -0
  8. data/app/screens/basic_screen.rb +27 -0
  9. data/lib/ProMotion.rb +3 -5
  10. data/lib/ProMotion/cocoatouch/SplitViewController.rb +25 -0
  11. data/lib/ProMotion/cocoatouch/TableViewController.rb +5 -5
  12. data/lib/ProMotion/cocoatouch/ViewController.rb +5 -5
  13. data/lib/ProMotion/{app_delegate.rb → delegate.rb} +23 -23
  14. data/lib/ProMotion/helpers/console.rb +6 -4
  15. data/lib/ProMotion/helpers/logger.rb +73 -0
  16. data/lib/ProMotion/helpers/view_helper.rb +45 -13
  17. data/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb +42 -0
  18. data/lib/ProMotion/screen_helpers/_tables/_searchable_table.rb +2 -2
  19. data/lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb +46 -41
  20. data/lib/ProMotion/screen_helpers/_tables/grouped_table.rb +2 -1
  21. data/lib/ProMotion/screen_helpers/_tables/plain_table.rb +1 -0
  22. data/lib/ProMotion/screen_helpers/screen_elements.rb +16 -11
  23. data/lib/ProMotion/screen_helpers/screen_navigation.rb +15 -16
  24. data/lib/ProMotion/screen_helpers/screen_tabs.rb +20 -16
  25. data/lib/ProMotion/screen_helpers/split_screen.rb +42 -0
  26. data/lib/ProMotion/screens/_screen_module.rb +44 -35
  27. data/lib/ProMotion/screens/_table_screen_module.rb +18 -1
  28. data/lib/ProMotion/screens/screen.rb +1 -1
  29. data/lib/ProMotion/version.rb +1 -1
  30. data/spec/helpers/table_screen.rb +48 -0
  31. data/spec/helpers/table_screen_refreshable.rb +11 -0
  32. data/spec/helpers/table_screen_searchable.rb +5 -0
  33. data/spec/helpers/test_delegate.rb +9 -0
  34. data/spec/ios_version_spec.rb +6 -6
  35. data/spec/logger_spec.rb +68 -0
  36. data/spec/main_spec.rb +1 -1
  37. data/spec/screen_helpers_spec.rb +35 -6
  38. data/spec/{view_controller_spec.rb → screen_spec.rb} +1 -1
  39. data/spec/split_screen_in_tab_bar_spec.rb +49 -0
  40. data/spec/split_screen_open_screen_spec.rb +46 -0
  41. data/spec/split_screen_spec.rb +35 -0
  42. data/spec/table_screen_spec.rb +72 -0
  43. data/spec/view_helper_spec.rb +112 -8
  44. metadata +29 -8
  45. data/lib/ProMotion/helpers/tab_bar.rb +0 -115
  46. data/spec/helpers/.gitkeep +0 -0
@@ -1,115 +0,0 @@
1
- # [DEPRECATED]
2
- # Replaced by ScreenTabs module.
3
- module ProMotion
4
- class TabBar
5
- class << self
6
- def create_tab_bar_controller_from_data(data)
7
- warn "[DEPRECATION] `create_tab_bar_controller_from_data` is deprecated. Use `open_tab_bar` instead."
8
-
9
- data = self.set_tags(data)
10
-
11
- tab_bar_controller = UITabBarController.alloc.init
12
- tab_bar_controller.viewControllers = self.tab_controllers_from_data(data)
13
-
14
- return tab_bar_controller
15
- end
16
-
17
- def set_tags(data)
18
- warn "[DEPRECATION] `set_tags` is deprecated."
19
- tag_number = 0
20
-
21
- data.each do |d|
22
- d[:tag] = tag_number
23
- tag_number += 1
24
- end
25
-
26
- return data
27
- end
28
-
29
- def tab_bar_icon(icon, tag)
30
- warn "[DEPRECATION] `TabBar.tab_bar_icon` is deprecated. Use `create_tab_bar_icon` in ScreenTabs instead."
31
- return UITabBarItem.alloc.initWithTabBarSystemItem(icon, tag: tag)
32
- end
33
-
34
- def tab_bar_icon_custom(title, image_name, tag)
35
- warn "[DEPRECATION] `TabBar.tab_bar_icon_custom` is deprecated. Use `create_tab_bar_icon_custom` in ScreenTabs instead."
36
- icon_image = UIImage.imageNamed(image_name)
37
- return UITabBarItem.alloc.initWithTitle(title, image:icon_image, tag:tag)
38
- end
39
-
40
- def tab_controllers_from_data(data)
41
- warn "[DEPRECATION] `tab_controllers_from_data` is deprecated. Use `open_tab_bar` instead."
42
- tab_controllers = []
43
-
44
- data.each do |tab|
45
- tab_controllers << self.controller_from_tab_data(tab)
46
- end
47
-
48
- return tab_controllers
49
- end
50
-
51
- def controller_from_tab_data(tab)
52
- warn "[DEPRECATION] `controller_from_tab_data` is deprecated. Use `open_tab_bar` instead."
53
- tab[:badge_number] ||= tab[:badgeNumber]
54
- tab[:navigation_controller] ||= tab[:navigationController]
55
-
56
- tab[:badge_number] = 0 unless tab[:badge_number]
57
- tab[:tag] = 0 unless tab[:tag]
58
-
59
- view_controller = tab[:view_controller]
60
- view_controller = tab[:view_controller].alloc.init if tab[:view_controller].respond_to?(:alloc)
61
-
62
- if tab[:navigation_controller]
63
- controller = UINavigationController.alloc.initWithRootViewController(view_controller)
64
- else
65
- controller = view_controller
66
- end
67
-
68
- view_controller.tabBarItem = self.tabBarItem(tab)
69
- view_controller.tabBarItem.title = view_controller.title unless tab[:title]
70
-
71
- return controller
72
- end
73
-
74
- def tab_bar_item(tab)
75
- warn "[DEPRECATION] `TabBar.tab_bar_item` is deprecated. Use `tab_bar_item` in ScreenTabs instead."
76
- title = "Untitled"
77
- title = tab[:title] if tab[:title]
78
- tab[:tag] ||= @current_tag ||= 0
79
- @current_tag = tab[:tag] + 1
80
-
81
- tab_bar_item = tab_bar_icon(tab[:system_icon], tab[:tag]) if tab[:system_icon]
82
- tab_bar_item = tab_bar_icon_custom(title, tab[:icon], tab[:tag]) if tab[:icon]
83
-
84
- tab_bar_item.badgeValue = tab[:badge_number].to_s unless tab[:badge_number].nil? || tab[:badge_number] <= 0
85
-
86
- return tab_bar_item
87
- end
88
-
89
- def select(tab_bar_controller, title: title)
90
- warn "[DEPRECATION] `TabBar.select` is deprecated. Use `open_tab` in ScreenTabs instead."
91
- root_controller = nil
92
- tab_bar_controller.viewControllers.each do |vc|
93
- if vc.tabBarItem.title == title
94
- tab_bar_controller.selectedViewController = vc
95
- root_controller = vc
96
- break
97
- end
98
- end
99
- root_controller
100
- end
101
-
102
- def select(tab_bar_controller, tag: tag)
103
- warn "[DEPRECATION] `TabBar.select:tag:` is deprecated. Use `open_tab` in ScreenTabs instead."
104
- tab_bar_controller.selectedIndex = tag
105
- end
106
-
107
- def replace_current_item(tab_bar_controller, view_controller: vc)
108
- warn "[DEPRECATION] `TabBar.replace_current_item` is deprecated. Use `replace_current_item` in ScreenTabs instead."
109
- controllers = NSMutableArray.arrayWithArray(tab_bar_controller.viewControllers)
110
- controllers.replaceObjectAtIndex(tab_bar_controller.selectedIndex, withObject: vc)
111
- tab_bar_controller.viewControllers = controllers
112
- end
113
- end
114
- end
115
- end
File without changes