ruby_native 0.3.1 → 0.3.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3edb27d0146c40d03a5a5e460d35d8c1790e632d0db30d38ca5d714c436d55ed
|
|
4
|
+
data.tar.gz: 1eb68feb7476a73447724a05793b76d112e0e606f1fec83a4a16c36679b224e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f2ae974c958b92172621e090547ebdeb0eb3e9175d0c622a44e59447c5f328bcda5fddf1f955fc8d18bf8ea6f32626c55cf0ca2e04008c9063e06ef6e163fab
|
|
7
|
+
data.tar.gz: f08c4ae514b7df44aecf6fbe2718a66b0b979f6356ff78808eb8c394e7f74f9874d19cc9535111d127320e99d9e12c08d7c6c0cb40b8235b0f81daa6ab964ce4
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BridgeComponent } from "@hotwired/hotwire-native-bridge"
|
|
2
|
+
|
|
3
|
+
export default class extends BridgeComponent {
|
|
4
|
+
static component = "badge"
|
|
5
|
+
static values = { home: Number, tab: Number }
|
|
6
|
+
|
|
7
|
+
connect() {
|
|
8
|
+
super.connect()
|
|
9
|
+
this.#update()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
homeValueChanged() { this.#update() }
|
|
13
|
+
tabValueChanged() { this.#update() }
|
|
14
|
+
|
|
15
|
+
#update() {
|
|
16
|
+
const data = {}
|
|
17
|
+
if (this.hasHomeValue) data.home = this.homeValue
|
|
18
|
+
if (this.hasTabValue) data.tab = this.tabValue
|
|
19
|
+
this.send("connect", data)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -6,6 +6,7 @@ import MenuController from "ruby_native/bridge/menu_controller"
|
|
|
6
6
|
import SearchController from "ruby_native/bridge/search_controller"
|
|
7
7
|
import ButtonController from "ruby_native/bridge/button_controller"
|
|
8
8
|
import HapticController from "ruby_native/bridge/haptic_controller"
|
|
9
|
+
import BadgeController from "ruby_native/bridge/badge_controller"
|
|
9
10
|
|
|
10
11
|
application.register("bridge--tabs", TabsController)
|
|
11
12
|
application.register("bridge--form", FormController)
|
|
@@ -14,3 +15,4 @@ application.register("bridge--menu", MenuController)
|
|
|
14
15
|
application.register("bridge--search", SearchController)
|
|
15
16
|
application.register("bridge--button", ButtonController)
|
|
16
17
|
application.register("bridge--haptic", HapticController)
|
|
18
|
+
application.register("bridge--badge", BadgeController)
|
data/lib/ruby_native/helper.rb
CHANGED
|
@@ -59,6 +59,24 @@ module RubyNative
|
|
|
59
59
|
}) { builder.to_html }
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
def native_badge_tag(count = nil, home: nil, tab: nil)
|
|
63
|
+
home = count if count && home.nil?
|
|
64
|
+
tab = count if count && tab.nil?
|
|
65
|
+
|
|
66
|
+
signal_data = { native_badge: "" }
|
|
67
|
+
signal_data[:native_badge_home] = home unless home.nil?
|
|
68
|
+
signal_data[:native_badge_tab] = tab unless tab.nil?
|
|
69
|
+
|
|
70
|
+
bridge_data = { controller: "bridge--badge" }
|
|
71
|
+
bridge_data[:bridge__badge_home_value] = home unless home.nil?
|
|
72
|
+
bridge_data[:bridge__badge_tab_value] = tab unless tab.nil?
|
|
73
|
+
|
|
74
|
+
safe_join([
|
|
75
|
+
tag.div(data: signal_data, hidden: true),
|
|
76
|
+
tag.div(data: bridge_data)
|
|
77
|
+
])
|
|
78
|
+
end
|
|
79
|
+
|
|
62
80
|
def native_haptic_data(feedback = :success, **data)
|
|
63
81
|
feedback = feedback.to_s
|
|
64
82
|
feedback = "success" if feedback.empty?
|
data/lib/ruby_native/version.rb
CHANGED
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.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joe Masilotti
|
|
@@ -54,6 +54,7 @@ files:
|
|
|
54
54
|
- app/controllers/ruby_native/config_controller.rb
|
|
55
55
|
- app/controllers/ruby_native/push/devices_controller.rb
|
|
56
56
|
- app/javascript/ruby_native/back.js
|
|
57
|
+
- app/javascript/ruby_native/bridge/badge_controller.js
|
|
57
58
|
- app/javascript/ruby_native/bridge/button_controller.js
|
|
58
59
|
- app/javascript/ruby_native/bridge/form_controller.js
|
|
59
60
|
- app/javascript/ruby_native/bridge/haptic_controller.js
|