ruby_native 0.10.8 → 0.10.9

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: a84e26b885c93151197f1ae505a45b9cb99d8f3049df4b89dce036c431411a51
4
- data.tar.gz: cba347806df4afc1f3e21c1b0201e616148633632c712eb44c432166b43f1115
3
+ metadata.gz: 1020516eb9b684247d40d16d00153a75691082fbe9a3e769d552826d7a217135
4
+ data.tar.gz: cf8a1600e15ae4a7b26767b14543c763d13421aa96187e75a0608734e9780cab
5
5
  SHA512:
6
- metadata.gz: 7add53e3f05dc87ff5688b0b5714cb627c0a60facc70dde3322cf898d7d5128ffef60b64eca922fefee35441775e1b0ee18108499a795603081cd841ff4e0d70
7
- data.tar.gz: 91bc86d031b25887d4c321ce50dbc10227ecc89f84c9fc2b695091289c1d128a10cecd398e19d5f0928ac40a03c6fac4884d815a21319b370ebe670684dfe561
6
+ metadata.gz: 7dceda118ad0c65f7508a1d77ce5f9a77b0fbbd59d1137673d4076b987ccadc7311135dc0003cbe873747ecfea8b1a4838c69828364b3b56d724b71e3d236dee
7
+ data.tar.gz: '0528af6b54e2bc22abc87c6f24d5b1d470872c5abb3d0bb3f0ad8ce93fe0d4657514938e322a5cec578b7982fb827ac0c500fedbac0037fb32bfc047899597d1'
@@ -126,6 +126,22 @@ module RubyNative
126
126
  end
127
127
  end
128
128
 
129
+ # Adds a native share button to the nav bar. Tapping it opens the
130
+ # platform share sheet for `url:` (defaults to the current page on the
131
+ # web side) so it works even where embedded web views don't support
132
+ # `navigator.share`. Icons follow the same rules as the other navbar
133
+ # buttons: `icon:` applies to every platform and `icons:` ({ ios:,
134
+ # android: }) overrides per platform.
135
+ def share_button(url: nil, title: "Share", icon: "square.and.arrow.up", icons: nil, position: :trailing)
136
+ resolved = RubyNative::Helper.resolve_icon(icon: icon, icons: icons, platform: @context.try(:native_platform))
137
+ data = { native_button: "", native_share: "" }
138
+ data[:native_title] = title if title
139
+ data[:native_icon] = resolved if resolved
140
+ data[:native_position] = position.to_s
141
+ data[:native_share_url] = url if url
142
+ @items << @context.tag.div(data: data)
143
+ end
144
+
129
145
  def submit_button(title: "Save", click: "[type='submit']")
130
146
  @items << @context.tag.div(data: {
131
147
  native_submit_button: "",
@@ -155,6 +171,19 @@ module RubyNative
155
171
  @items << @context.tag.div(data: data)
156
172
  end
157
173
 
174
+ # Adds a share entry to a navbar button's dropdown menu. Selecting it
175
+ # opens the platform share sheet for `url:` (defaults to the current
176
+ # page on the web side). Icons follow the same `icon:`/`icons:` rules
177
+ # as the other menu items.
178
+ def share_item(title = "Share", url: nil, icon: "square.and.arrow.up", icons: nil, selected: false)
179
+ resolved = RubyNative::Helper.resolve_icon(icon: icon, icons: icons, platform: @context.try(:native_platform))
180
+ data = { native_menu_item: "", native_title: title, native_share: "" }
181
+ data[:native_share_url] = url if url
182
+ data[:native_icon] = resolved if resolved
183
+ data[:native_selected] = "" if selected
184
+ @items << @context.tag.div(data: data)
185
+ end
186
+
158
187
  def to_html
159
188
  @context.safe_join(@items)
160
189
  end
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.10.8"
2
+ VERSION = "0.10.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.8
4
+ version: 0.10.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti