mobile_workflow 0.9.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 948c45e0602fe9441f2cd0c79e4b4141c9ed357b9489ca7f3f1af599ea370c66
4
- data.tar.gz: c84792530d7b0c02a05cc6e6d253e1464e7edea71b4f00e66d290d3a45221ccd
3
+ metadata.gz: f468888276f739eb0ae572c2d726273b2848cecb81340e63f0808127ff83c917
4
+ data.tar.gz: 5bc7aff35b9be7f1938f3eabd2e01bf734608eca8db805cfa01b416508f60290
5
5
  SHA512:
6
- metadata.gz: 1ffd490ac6e267a073cf45c54eeb9226dbf9b2ddc0402a00c923f6e25b38cfdd8345805ed429a8aa1e5c09ee7c368869146387e45c7f3da336931d6f38db06ed
7
- data.tar.gz: 58fafb2c69f7562fe3ea2d09226e6459b0eaac2d3056a8f0590aa69b29a7078c22b6287266b283869b00adebbec790149d62f681a9ed64e26553ca0adbd53132
6
+ metadata.gz: 33f31ce284d0799276f6950c3b0ee6e820cb2107f1ad0de274b55c5fcc2d464b4f2304d6231201ef06419b2a621b85cfed8f8d42f546fc9a7ac47d5e7ea02559
7
+ data.tar.gz: a298610029408fced69d431c5ebc37d6473570205fadc25e5fa260ed1c9560ae67d3d6c74b163a7efbbbcc3b340c0f98b892a27f59ac580208a59b19054fb08e
data/README.md CHANGED
@@ -26,89 +26,6 @@ Or install it yourself as:
26
26
  $ gem install mobile_workflow
27
27
  ```
28
28
 
29
- ## Upgrade to version 0.7.7 or higher
30
- The following utility methods have changed their parameters:
31
-
32
- ```ruby
33
- # app/models/concerns/mobile_workflow/displayable/steps/styled_content/grid.rb#20
34
- def mw_grid_item(id: self.id, text:, detail_text: nil, preview_url: nil)
35
- raise 'Missing id' if id.nil?
36
- raise 'Missing text' if text.nil?
37
-
38
- { id: id, text: text, type: :item, detailText: detail_text, imageURL: preview_url }.compact
39
- end
40
-
41
- # app/models/concerns/mobile_workflow/displayable/steps/styled_content/stack.rb#20
42
- def mw_stack_list_item(id:, text:, detail_text: nil, preview_url: nil)
43
- raise 'Missing id' if id.nil?
44
- raise 'Missing text' if text.nil?
45
-
46
- { id: id.to_s, text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
47
- end
48
-
49
- # app/models/concerns/mobile_workflow/displayable/steps/list.rb#5
50
- def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, material_icon_name: nil, preview_url: nil)
51
- { id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name, imageURL: preview_url }.compact
52
- end
53
-
54
- # app/models/concerns/mobile_workflow/displayable/steps/stack.rb#26
55
- def mw_display_video(preview_url:, attachment_url:)
56
- {type: :video, previewURL: preview_url, url: attachment_url}
57
- end
58
-
59
- # app/models/concerns/mobile_workflow/displayable/steps/stack.rb#11
60
- def mw_display_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill)
61
- validate_content_mode!(content_mode)
62
-
63
- {type: :image, contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower), previewURL: preview_url, url: attachment_url}
64
- end
65
- ```
66
-
67
- All URLs MUST now be explicitly sent as arguments to the above methods, which means they must be previously set. If not, the methods will not work.
68
-
69
- In order to support projects using `ActiveStorage`, there is a new model concern `MobileWorkflow::Attachable` that provides a few helpers. This is what you can do to upgrade if you use ActiveStorage (otherwise the helpers must be manually created):
70
-
71
- 1. Include the concern in the `ApplicationRecord` class, together with `MobileWorkflow::Displayable`:
72
-
73
- ```ruby
74
- class ApplicationRecord < ActiveRecord::Base
75
- include MobileWorkflow::Attachable
76
- include MobileWorkflow::Displayable
77
- end
78
- ```
79
-
80
- 2. Once included, the following helpers will be available, so use them to generate the intended URLs:
81
-
82
- ```ruby
83
- def preview_url(attachment, options: { resize_to_fill: [200, 200] })
84
- return nil unless attachment.attached?
85
-
86
- if attachment.image?
87
- rails_representation_url(attachment.variant(options), host: heroku_attachment_host)
88
- elsif attachment.previewable?
89
- rails_representation_url(attachment.preview(options), host: heroku_attachment_host)
90
- else
91
- return nil
92
- end
93
- end
94
-
95
- def attachment_url(attachment)
96
- return nil unless attachment.attached?
97
-
98
- rails_blob_url(attachment, host: heroku_attachment_host)
99
- end
100
- ```
101
-
102
- Example of use:
103
- ```ruby
104
- # Old method call
105
- mw_list_item(text: 'John Doe', detail_text: 'Company Name', image_attachment: <ActiveStorage::Attached::One>, image_url: 'https://test.org/preview')
106
-
107
- # New method call
108
- preview_url = preview_url(<ActiveStorage::Attached::One>, options: { resize_to_fill: [200, 200] }) || 'https://test.org/preview'
109
- mw_list_item(text: 'John Doe', detail_text: 'Company Name', preview_url: preview_url)
110
- ```
111
-
112
29
  ## Contributing
113
30
  Contribution directions go here.
114
31
 
@@ -17,12 +17,16 @@ module MobileWorkflow
17
17
 
18
18
  def attachment_url(attachment)
19
19
  return nil unless attachment.attached?
20
-
21
- rails_blob_url(attachment, host: heroku_attachment_host)
20
+
21
+ rails_blob_url(attachment, host: attachment_host)
22
22
  end
23
23
 
24
24
  private
25
25
 
26
+ def attachment_host
27
+ ENV.fetch('ATTACHMENTS_HOST', heroku_attachment_host)
28
+ end
29
+
26
30
  def heroku_attachment_host
27
31
  # TODO: MBS - move this to a configuration property
28
32
  app_name = Rails.env.test? ? 'test-app' : ENV.fetch('HEROKU_APP_NAME')
@@ -35,12 +35,12 @@ module MobileWorkflow
35
35
  placeholder: placeholder, optional: optional, symbol_position: symbol_position, default_text_answer: default_text_answer, hint: hint }
36
36
  end
37
37
 
38
- def mw_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil)
38
+ def mw_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil, hint: nil)
39
39
  raise 'Missing label' if label.nil?
40
40
  raise 'Missing id' if id.nil?
41
41
 
42
42
  { item_type: :text, id: id, label: label, placeholder: placeholder,
43
- optional: optional, multiline: multiline, default_text_answer: default_text_answer }
43
+ optional: optional, multiline: multiline, default_text_answer: default_text_answer, hint: hint }
44
44
  end
45
45
 
46
46
  def mw_form_date(label:, id:, optional: false, default_text_answer: nil)
@@ -1,14 +1,12 @@
1
+ require 'app_rail/steps'
2
+
1
3
  module MobileWorkflow
2
4
  module Displayable
3
5
  module Steps
4
6
  module List
5
- def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, material_icon_name: nil, preview_url: nil)
6
- { id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name, imageURL: preview_url }.compact
7
- end
8
-
9
- def mw_list_search_suggestion(id: self.id, text:, section_name:, sf_symbol_name: nil)
10
- {id: id.to_s, text: text, sectionName: section_name, sfSymbolName: sf_symbol_name}.compact
11
- end
7
+ include AppRail::Steps::Core::List
8
+ alias_method :mw_list_item, :ar_core_list_item
9
+ alias_method :mw_list_search_suggestion, :ar_core_list_search_suggestion
12
10
  end
13
11
  end
14
12
  end
@@ -1,41 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MobileWorkflow
2
4
  module Displayable
3
5
  module Steps
4
6
  module StyledContent
5
7
  module Stack
6
- def mw_stack_title(id:, title:)
7
- raise 'Missing id' if id.nil?
8
+ def mw_stack_title(title:)
8
9
  raise 'Missing title' if title.nil?
9
-
10
+
10
11
  { id: id, title: title, type: :title }
11
12
  end
12
-
13
- def mw_stack_text(id:, text:)
14
- raise 'Missing id' if id.nil?
13
+
14
+ def mw_stack_text(text:)
15
15
  raise 'Missing text' if text.nil?
16
-
17
- { id: id, text: text, type: :text }
16
+
17
+ { text: text, type: :text }
18
18
  end
19
-
20
- def mw_stack_list_item(id:, text:, detail_text: nil, preview_url: nil)
21
- raise 'Missing id' if id.nil?
19
+
20
+ def mw_stack_list_item(text:, detail_text: nil, preview_url: nil)
22
21
  raise 'Missing text' if text.nil?
23
-
24
- { id: id.to_s, text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
22
+
23
+ { text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
25
24
  end
26
25
 
27
26
  # Remove `modal_workflow_name` argument once V1 is no longer being used
28
- def mw_stack_button(id:, label:, url: nil, method: :nil, on_success: :none, style: :primary, modal_workflow_name: nil, link_id: nil, link_url: nil, sf_symbol_name: nil, apple_system_url: nil, android_deep_link: nil, confirm_title: nil, confirm_text: nil, share_text: nil, share_image_url: nil)
29
- raise 'Missing id' if id.nil?
27
+ def mw_stack_button(label:, url: nil, method: :nil, on_success: :none, style: :primary, modal_workflow_name: nil, link_id: nil, link_url: nil, sf_symbol_name: nil, apple_system_url: nil, android_deep_link: nil, confirm_title: nil, confirm_text: nil, share_text: nil, share_image_url: nil)
30
28
  raise 'Missing label' if label.nil?
31
-
29
+
32
30
  validate_on_success!(on_success)
33
31
  validate_button_style!(style)
34
-
35
- { id: id, type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style, modalWorkflow: modal_workflow_name, linkId: link_id, linkURL: link_url, sfSymbolName: sf_symbol_name, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, confirmTitle: confirm_title, confirmText: confirm_text, shareText: share_text, shareImageURL: share_image_url }.compact
32
+
33
+ { type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style,
34
+ modalWorkflow: modal_workflow_name, linkId: link_id, linkURL: link_url, sfSymbolName: sf_symbol_name, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, confirmTitle: confirm_title, confirmText: confirm_text, shareText: share_text, shareImageURL: share_image_url }.compact
36
35
  end
37
36
  end
38
37
  end
39
38
  end
40
39
  end
41
- end
40
+ end
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.9.0'
2
+ VERSION = '0.10.2'
3
3
  RUBY_VERSION = '2.7.3'
4
4
  RAILS_VERSION = '6.1.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -51,6 +51,9 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 6.1.3.1
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '7'
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,6 +61,23 @@ dependencies:
58
61
  - - ">="
59
62
  - !ruby/object:Gem::Version
60
63
  version: 6.1.3.1
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '7'
67
+ - !ruby/object:Gem::Dependency
68
+ name: app_rail-steps
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
61
81
  - !ruby/object:Gem::Dependency
62
82
  name: sqlite3
63
83
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +134,7 @@ dependencies:
114
134
  - - ">="
115
135
  - !ruby/object:Gem::Version
116
136
  version: '0'
117
- description:
137
+ description:
118
138
  email:
119
139
  - matt@futureworkshops.com
120
140
  executables:
@@ -192,7 +212,7 @@ homepage: https://github.com/futureworkshops/mobile_workflow
192
212
  licenses:
193
213
  - MIT
194
214
  metadata: {}
195
- post_install_message:
215
+ post_install_message:
196
216
  rdoc_options: []
197
217
  require_paths:
198
218
  - lib
@@ -207,8 +227,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
227
  - !ruby/object:Gem::Version
208
228
  version: '0'
209
229
  requirements: []
210
- rubygems_version: 3.3.6
211
- signing_key:
230
+ rubygems_version: 3.1.6
231
+ signing_key:
212
232
  specification_version: 4
213
233
  summary: A Rails engine to provide API support for Mobile Workflow Apps.
214
234
  test_files: []