mobile_workflow 0.6.13 → 0.6.14

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: db9e697a2d4bc53ea4b9a231248f9d32c21199d030a75826e0c006055e9828ed
4
- data.tar.gz: 7658139e3a461174483e4adde83327da338b73a84ef4e9e6f9423903b8e3b2d2
3
+ metadata.gz: 799110824fce9c1897c4418e504215c23e19a29107dc3833d3b44ef633ffd695
4
+ data.tar.gz: a8606dc9b5b382ffff495fb7eecd20b17b737f4c5234821318402222f677c419
5
5
  SHA512:
6
- metadata.gz: 3c5ca58a42c0634029ce8d7b43e04b1383c930d673ca6c2418911767227bc4ae2bebaab3afed5bc3981085ede273ab242253c7be2560eef92df71533fb88bd8c
7
- data.tar.gz: '018017ea7b7d4baeb4372c0159267bb632fc33a14eeb9c67d0de117f27372cebb8df8e09f9f90604fdea5842093a93966a1e3f24a4102c40e0aa65638e7f4ecd'
6
+ metadata.gz: 611d110892aa6a03b97c6aa7d0ce9ba3e7aaa810eaf05b313ca7db18b8260b76cadfb3ac64f9af972b8f12759eb10ce21cc65258b8047226155e2238da14cc3d
7
+ data.tar.gz: fa196418587eae7166549b881cfea04b89b9539738c39c0f6c159e4de450c480d5a8d14c88530c0527ec4b135fd0c803622ae367a235299314d2826da084bddd
@@ -5,6 +5,7 @@ module MobileWorkflow
5
5
 
6
6
  ON_SUCCESS_OPTIONS = [:none, :reload, :backward, :forward]
7
7
  BUTTON_STYLES = [:primary, :outline, :danger]
8
+ CONTENT_MODE_OPTIONS = [:scale_aspect_fill, :scale_aspect_fit]
8
9
 
9
10
  def mw_list_item(id: self.id, text:, detail_text: nil, sf_symbol_name: nil, image_attachment: nil)
10
11
  mw_list_item = {id: id, text: text, detailText: detail_text, sfSymbolName: sf_symbol_name}
@@ -20,8 +21,10 @@ module MobileWorkflow
20
21
  {type: :text, label: label, text: text.to_s}.compact
21
22
  end
22
23
 
23
- def mw_display_image(attachment, options: { resize_to_fill: [600, 1200] })
24
- {type: :image, previewURL: preview_url(attachment, options: options), url: attachment_url(attachment)}
24
+ def mw_display_image(attachment, content_mode: :scale_aspect_fill, options: { resize_to_fill: [600, 1200] })
25
+ validate_content_mode!(content_mode)
26
+
27
+ {type: :image, contentMode: content_mode.to_s.camelize(:lower), previewURL: preview_url(attachment, options: options), url: attachment_url(attachment)}
25
28
  end
26
29
 
27
30
  def mw_display_unsplash_image(image_url)
@@ -58,11 +61,11 @@ module MobileWorkflow
58
61
  {type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}
59
62
  end
60
63
 
61
- def mw_display_button_for_system_url(label:, apple_system_url:, android_system_url:, method: :put, style: :primary, on_success: :none)
64
+ def mw_display_button_for_system_url(label:, apple_system_url:, method: :put, style: :primary, on_success: :none)
62
65
  validate_on_success!(on_success)
63
66
  validate_button_style!(style)
64
67
 
65
- {type: :button, label: label, appleSystemURL: apple_system_url, androidSystemURL: android_system_url, method: method, style: style, onSuccess: on_success}
68
+ {type: :button, label: label, appleSystemURL: apple_system_url, method: method, style: style, onSuccess: on_success}
66
69
  end
67
70
 
68
71
  def mw_display_button_for_modal_workflow(label:, modal_workflow_name:, style: :primary, on_success: :none)
@@ -77,6 +80,10 @@ module MobileWorkflow
77
80
  raise 'Unknown on_success action' unless ON_SUCCESS_OPTIONS.include?(on_success)
78
81
  end
79
82
 
83
+ def validate_content_mode!(on_success)
84
+ raise 'Unknown content_mode' unless CONTENT_MODE_OPTIONS.include?(on_success)
85
+ end
86
+
80
87
  def validate_button_style!(style)
81
88
  raise 'Unknown style' unless BUTTON_STYLES.include?(style)
82
89
  end
@@ -1,5 +1,5 @@
1
1
  module MobileWorkflow
2
- VERSION = '0.6.13'
2
+ VERSION = '0.6.14'
3
3
  RUBY_VERSION = '2.7.2'
4
4
  RAILS_VERSION = '6.1.0'
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.6.13
4
+ version: 0.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails