ProMotion 2.7.0 → 2.7.1

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: 3b3a0f91e4bc6d09696a8ccb696202025c9adeeb
4
- data.tar.gz: 68b66d3740172a53ecfc45624212d370035f6626
3
+ metadata.gz: 0ff30153aea5024d65f20bfacc4de9b03237997c
4
+ data.tar.gz: 85cfd76f2fbd7ded2051be9b6ccdc816b26e60ea
5
5
  SHA512:
6
- metadata.gz: 7d827e3214b752ce5ddaecb6ecba7a0b249b4d98911bd29ee528047c4ab5bf8b03726886287623f5995ab745b46e959c3c53baab0d8004e65482294cb13a54df
7
- data.tar.gz: 5f534e77735df0403e98862027ba9ce41e8d4ac30aff0d1d55c6821a7dd68606761d7df2e2f35a53b49153ca73b735eda0122882424f8d4a09e94cad6961d205
6
+ metadata.gz: 9956829eb6dc692feca9a05fb8d913ccf27ef04a46c2b8cd8645e09638aa56f6a6f05dfe5b317a5a66c95bfce55383c2b0a1a9fe4d08df7c1dd03424810f9184
7
+ data.tar.gz: b6eef1cc874010a91ef179597209b04a58d9c3bd70e43d9ba47be44322d79c5f1a389332e7de6e54f2e755548d9f61f9ecacbb940832c23aa88f686f3f3f79c8
data/README.md CHANGED
@@ -65,7 +65,7 @@ class HelpScreen < PM::TableScreen
65
65
  end
66
66
  ```
67
67
 
68
- # Features
68
+ ## Features
69
69
 
70
70
  |Screens|Navigation Bars|Tab Bars|
71
71
  |---|---|---|
@@ -84,44 +84,18 @@ end
84
84
 
85
85
  #### ...and much more.
86
86
 
87
- # Getting Started
87
+ ## Getting Started
88
88
 
89
89
  1. Check out the [Getting Started Guide](https://github.com/infinitered/ProMotion/blob/master/docs/Guides/Getting%20Started.md)
90
90
  2. Watch the excellent [MotionInMotion screencast about ProMotion](https://motioninmotion.tv/screencasts/8) (very reasonably priced subscription required)
91
91
  3. Follow a tutorial: [Building an ESPN app using RubyMotion, ProMotion, and TDD](http://jamonholmgren.com/building-an-espn-app-using-rubymotion-promotion-and-tdd)
92
92
  4. Read the [Documentation](https://github.com/infinitered/ProMotion/blob/master/docs)
93
93
 
94
- # Changelog
94
+ ## Changelog
95
95
 
96
- ## Version 2.6.1
96
+ [See Releases page](https://github.com/infinitered/ProMotion/releases)
97
97
 
98
- This release includes a few new features and bugfixes and is backwards compatible with all 2.x releases.
99
-
100
- * PR #777 New Feature: Add ability to register live reload plugins
101
- * PR #778 Bugfix: Only update search results table data if possible
102
- * PR #779 Fix bug where remote images are not shown on first load of table screen
103
- * PR #787 Fix Travis CI build from failing when RubyMotion is up-to-date
104
- * PR #796 Fix iOS 10 from crashing when determining supportedInterfaceOrientations for UIImagePickerController
105
- * Other minor bugfixes and documentation updates
106
-
107
- ## Version 2.6.0
108
-
109
- This release includes a few new features and bugfixes and is backwards compatible with all 2.x releases.
110
-
111
- * PR #773 Add a `on_continue_user_activity` delegate method
112
- * PR #766 Fix nav_bar_button class method
113
- * Other minor bugfixes and documentation updates
114
-
115
- ## Version 2.5.0
116
-
117
- This release includes some new features and bugfixes and is backwards compatible with all 2.x releases.
118
-
119
- * PR #763 Adds footer_view to TableScreens
120
- * PR #705 Adds split-screen support for large iPhones
121
- * PR #736 Adds the index path when deleting a cell
122
- * Several other bugfix PRs
123
-
124
- # Apps built on ProMotion
98
+ ## Apps built on ProMotion
125
99
 
126
100
  [Apps built on ProMotion](http://promotion.readthedocs.org/en/master/ProMotion%20Apps/)
127
101
 
@@ -129,31 +103,31 @@ This release includes some new features and bugfixes and is backwards compatible
129
103
 
130
104
  Open a pull request! We love adding new ProMotion-built apps.
131
105
 
132
- # API Reference
106
+ ## API Reference
133
107
 
134
- We've created a comprehensive and always updated wiki with code examples, usage examples, and API reference.
108
+ We have comprehensive documentation with code examples, usage examples, and API reference.
135
109
 
136
110
  ### [ProMotion Documentation](https://github.com/infinitered/ProMotion/blob/master/docs)
137
111
 
138
- # Screencasts
112
+ ## Screencasts
139
113
 
140
114
  * Watch Jamon Holmgren give a talk about ProMotion at [RubyMotion #inspect2014](http://confreaks.com/videos/3813-inspect-going-pro-with-promotion-from-prototype-to-production) (video)
141
115
  * Watch the [September 2013 Motion Meetup](http://www.youtube.com/watch?v=rf7h-3AiMRQ) where Gant Laborde
142
116
  interviews Jamon Holmgren about ProMotion
143
117
 
144
- # Help
118
+ ## Help
145
119
 
146
120
  ProMotion is not only an easy DSL to get started. The community is very helpful and
147
121
  welcoming to new RubyMotion developers. We don't mind newbie questions.
148
122
 
149
123
  The quickest way to get help is to join the [Motioneers Slack Group](http://motioneers.herokuapp.com). If you still need help, feel free to open an issue on GitHub. If we don't respond within a day, tweet us a link to the issue -- sometimes we get busy.
150
124
 
151
- ## Premium Support
125
+ ### Premium Support
152
126
 
153
127
  [ProMotion](https://github.com/infinitered/ProMotion), as an open source project, is free to use and always will be. [Infinite Red](https://infinite.red/) offers premium ProMotion support and general mobile app design/development services. Email us at [hello@infinite.red](mailto:hello@infinite.red) to get in touch with us for more details.
154
128
 
155
129
 
156
- # Contributing
130
+ ## Contributing
157
131
 
158
132
  See [CONTRIBUTING.md](https://github.com/infinitered/ProMotion/blob/master/CONTRIBUTING.md).
159
133
 
@@ -3,7 +3,7 @@ module ProMotion
3
3
  include ProMotion::Table::Utils
4
4
  include ProMotion::TableDataBuilder
5
5
 
6
- attr_accessor :data, :filtered_data, :search_string, :original_search_string, :filtered, :table_view, :search_params
6
+ attr_accessor :data, :filtered_data, :table_view
7
7
 
8
8
  def initialize(data, table_view, search_action = nil)
9
9
  @search_action ||= search_action
@@ -27,7 +27,7 @@ module ProMotion
27
27
  end
28
28
 
29
29
  def sections
30
- self.filtered ? self.filtered_data : self.data
30
+ filtered? ? self.filtered_data : self.data
31
31
  end
32
32
 
33
33
  def section_length(index)
@@ -55,8 +55,13 @@ module ProMotion
55
55
  cell[:searchable] != false && "#{cell[:title]}\n#{cell[:search_text]}".downcase.strip.include?(search_string.downcase.strip)
56
56
  end
57
57
 
58
+ def filtered?
59
+ @filtered == true
60
+ end
61
+
58
62
  def search(search_string)
59
- start_searching(search_string) # update the search string
63
+ @filtered = true
64
+ self.filtered_data = []
60
65
 
61
66
  self.data.compact.each do |section|
62
67
  new_section = {}
@@ -74,22 +79,10 @@ module ProMotion
74
79
  self.filtered_data << new_section
75
80
  end
76
81
  end
77
-
78
- self.filtered_data
79
82
  end
80
83
 
81
- def start_searching(search_string = '')
82
- self.filtered_data = []
83
- self.filtered = true
84
- self.search_string = search_string.downcase.strip
85
- self.original_search_string = search_string
86
- end
87
-
88
- def stop_searching
89
- self.filtered_data = []
90
- self.filtered = false
91
- self.search_string = false
92
- self.original_search_string = false
84
+ def clear_filter
85
+ @filtered = false
93
86
  end
94
87
  end
95
88
  end
@@ -2,7 +2,7 @@ module ProMotion
2
2
  module Table
3
3
  module Indexable
4
4
  def table_data_index
5
- return nil if self.promotion_table_data.filtered || !self.class.get_indexable
5
+ return nil if self.promotion_table_data.filtered? || !self.class.get_indexable
6
6
 
7
7
  index = self.promotion_table_data.sections.collect{ |section| (section[:title] || " ")[0] } || []
8
8
  index.unshift("{search}") if self.class.get_searchable
@@ -26,7 +26,7 @@ module ProMotion
26
26
  private
27
27
 
28
28
  def pressed_table_view
29
- searching? ? @table_search_display_controller.searchResultsTableView : table_view
29
+ table_view
30
30
  end
31
31
 
32
32
  end
@@ -2,51 +2,56 @@ module ProMotion
2
2
  module Table
3
3
  module Searchable
4
4
 
5
- def search_controller
6
- @search_controller ||= UISearchController.alloc.initWithSearchResultsController(nil)
7
- end
8
-
9
- def make_searchable(params = {})
10
- params = set_searchable_param_defaults(params)
5
+ def make_searchable(params = nil) # params argument is deprecated. No longer need to use it.
6
+ params = get_searchable_params
11
7
 
12
8
  self.definesPresentationContext = true
9
+ search_controller = UISearchController.alloc.initWithSearchResultsController(nil)
13
10
  search_controller.delegate = params[:delegate]
14
11
  search_controller.searchResultsUpdater = params[:search_results_updater]
15
- search_controller.hidesNavigationBarDuringPresentation = params[:hidesNavigationBarDuringPresentation]
16
- search_controller.dimsBackgroundDuringPresentation = params[:obscuresBackgroundDuringPresentation] # iOS 8+ (not deprecated yet)
17
- # search_controller.obscuresBackgroundDuringPresentation = params[:obscuresBackgroundDuringPresentation] # iOS 9.1+ recommends using this instead of dimsBackgroundDuringPresentation
12
+ search_controller.hidesNavigationBarDuringPresentation = params[:hides_nav_bar]
13
+ search_controller.dimsBackgroundDuringPresentation = params[:obscures_background] # iOS 8+ (not deprecated yet)
14
+ # search_controller.obscuresBackgroundDuringPresentation = params[:obscures_background] # iOS 9.1+ recommends using this instead of dimsBackgroundDuringPresentation
18
15
 
19
16
  search_bar = search_controller.searchBar
20
17
  search_bar.delegate = params[:search_bar_delegate]
21
- search_bar.autoresizingMask = UIViewAutoresizingFlexibleWidth
22
18
  search_bar.placeholder = NSLocalizedString(params[:placeholder], nil) if params[:placeholder]
23
19
  if params[:scopes]
24
20
  @scopes = params[:scopes]
25
21
  search_bar.scopeButtonTitles = @scopes
26
22
  end
27
- tableView.tableHeaderView = search_bar
28
- search_bar.sizeToFit
29
23
 
30
- if params[:hide_initially]
31
- tableView.contentOffset = CGPointMake(0, search_bar.frame.size.height)
24
+ if navigationItem && navigationItem.respond_to?(:setSearchController)
25
+ # For iOS 11 and later, we place the search bar in the navigation bar.
26
+ navigationItem.searchController = search_controller
27
+ navigationItem.hidesSearchBarWhenScrolling = params[:hides_search_bar_when_scrolling]
28
+ else
29
+ # For iOS 10 and earlier, we place the search bar in the table view's header.
30
+ search_bar.autoresizingMask = UIViewAutoresizingFlexibleWidth
31
+ tableView.tableHeaderView = search_bar
32
+ if params[:hide_initially]
33
+ tableView.contentOffset = CGPointMake(0, search_bar.frame.size.height)
34
+ end
32
35
  end
36
+
37
+ @search_controller = search_controller
33
38
  end
34
39
 
35
- def set_searchable_param_defaults(params)
40
+ def get_searchable_params
41
+ params = self.class.get_searchable_params.dup
42
+
36
43
  # support camelCase params
37
44
  params[:search_results_updater] ||= params[:searchResultsUpdater]
45
+ params[:hides_nav_bar] = params[:hidesNavigationBarDuringPresentation] if params[:hides_nav_bar].nil?
46
+ params[:obscures_background] = params[:obscuresBackgroundDuringPresentation] if params[:obscures_background].nil?
47
+ params[:hides_search_bar_when_scrolling] = params[:hidesSearchBarWhenScrolling] if params[:hides_search_bar_when_scrolling].nil?
38
48
 
39
49
  params[:delegate] ||= self
40
50
  params[:search_results_updater] ||= self
41
51
  params[:search_bar_delegate] ||= self
42
-
43
- if params[:hidesNavigationBarDuringPresentation].nil?
44
- params[:hidesNavigationBarDuringPresentation] = true
45
- end
46
-
47
- if params[:obscuresBackgroundDuringPresentation].nil?
48
- params[:obscuresBackgroundDuringPresentation] = false
49
- end
52
+ params[:hides_nav_bar] = true if params[:hides_nav_bar].nil?
53
+ params[:obscures_background] = false if params[:obscures_background].nil?
54
+ params[:hides_search_bar_when_scrolling] = false if params[:hides_search_bar_when_scrolling].nil?
50
55
 
51
56
  params
52
57
  end
@@ -54,21 +59,23 @@ module ProMotion
54
59
  ######### UISearchControllerDelegate methods #######
55
60
 
56
61
  def willPresentSearchController(search_controller)
57
- promotion_table_data.start_searching
58
62
  search_controller.delegate.will_begin_search if search_controller.delegate.respond_to? "will_begin_search"
59
63
  end
60
64
 
61
65
  def willDismissSearchController(search_controller)
62
- promotion_table_data.stop_searching
63
- table_view.reloadData
64
66
  search_controller.delegate.will_end_search if search_controller.delegate.respond_to? "will_end_search"
65
67
  end
66
68
 
67
- # UISearchResultsUpdating protocol method
69
+ ######### UISearchResultsUpdating protocol methods #########
70
+
68
71
  def updateSearchResultsForSearchController(search_controller)
69
- search_string = search_controller.searchBar.text
70
- promotion_table_data.search(search_string) if searching?
71
- update_table_data
72
+ search_text = search_controller.searchBar.text
73
+ if search_text.empty?
74
+ promotion_table_data.clear_filter
75
+ else
76
+ promotion_table_data.search(search_text)
77
+ end
78
+ table_view.reloadData
72
79
  end
73
80
 
74
81
  def searchBar(search_bar, selectedScopeButtonIndexDidChange: selected_scope_index)
@@ -92,15 +92,7 @@ module ProMotion
92
92
  end
93
93
 
94
94
  def searching?
95
- self.promotion_table_data.filtered
96
- end
97
-
98
- def original_search_string
99
- self.promotion_table_data.original_search_string
100
- end
101
-
102
- def search_string
103
- self.promotion_table_data.search_string
95
+ self.promotion_table_data.filtered?
104
96
  end
105
97
 
106
98
  def update_table_view_data(data, args = {})
@@ -114,10 +106,6 @@ module ProMotion
114
106
  else
115
107
  table_view.reloadData
116
108
  end
117
-
118
- if searching? && @table_search_display_controller.respond_to?(:searchResultsTableView)
119
- @table_search_display_controller.searchResultsTableView.reloadData
120
- end
121
109
  end
122
110
 
123
111
  def accessory_toggled_switch(switch)
@@ -193,7 +181,7 @@ module ProMotion
193
181
 
194
182
  # Set table_data_index if you want the right hand index column (jumplist)
195
183
  def sectionIndexTitlesForTableView(_)
196
- return if self.promotion_table_data.filtered
184
+ return if searching?
197
185
  return self.table_data_index if self.respond_to?(:table_data_index)
198
186
  nil
199
187
  end
@@ -1,3 +1,3 @@
1
1
  module ProMotion
2
- VERSION = "2.7.0" unless defined?(ProMotion::VERSION)
2
+ VERSION = "2.7.1" unless defined?(ProMotion::VERSION)
3
3
  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.7.0
4
+ version: 2.7.1
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: 2018-04-04 00:00:00.000000000 Z
13
+ date: 2018-04-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: methadone