ruby-clash-systray 1.0.8 → 2.0.0

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: 8093deb182d902aa25bd2802758daabfc41f9e408a74a2fc6d5a3e1df4b18e9c
4
- data.tar.gz: e749a374c7b5c6ad1cc8adfa82e3a7408e554825f051fc2938e0077074557733
3
+ metadata.gz: cc7c16ff0e0524a3cf3fab3dd0d673f09f7c79fbf8f4787e5e79e941670e650b
4
+ data.tar.gz: 38a76bd7b9fb6a87e087d5f72f1d3a7e72bdb1626d7a18991206db5cb4e4ba5e
5
5
  SHA512:
6
- metadata.gz: c5327e5245b7c0131892708da76d53206ba15633d7bc61d7ecaae58b92d6bcc036f07c13067b79718fe09ed47699bb6e95f769f5582d3ff090f5a0491a0a8f3b
7
- data.tar.gz: a5aa9e4adaa4a4d6ee38cf7ea008a78641927ebc6525ddee5b16350e9ff50bfeba33342d5402bf9c176ebfb5002ee1c108dbe44b8e33488e75468403cdb4d257
6
+ metadata.gz: ddd065ccadc4facd6a4eba05b49b6451522975ab05ee8f7145df2fff51727c307da35dbeb6d9368b18db813a6f95d517c6ab7cdaa9e2efd8aa0ba4520ca0c9a5
7
+ data.tar.gz: 9d4e5c1f660fe30986d367c584c74ca2bd4db296901572111ee88b872e8f8908afd24c4a41175eeaae2988bd08a0d73f85abe6ca774d35d396eae3865bd2def6
@@ -1,11 +1,11 @@
1
1
  class Systray < RubyQt6::Bando::QWidget
2
- module Helpers
3
- def self.extract_proxy_name(str)
4
- str.to_s.split(" | ")[0].strip
5
- end
2
+ private
6
3
 
7
- def self.inject_proxy_name(*arr)
8
- arr.join(" | ")
9
- end
4
+ def hlpr_extract_proxy_name(str)
5
+ str.to_s.split(" | ")[0].strip
6
+ end
7
+
8
+ def hlpr_inject_proxy_name(*arr)
9
+ arr.join(" | ")
10
10
  end
11
11
  end
@@ -1,6 +1,12 @@
1
1
  class Systray < RubyQt6::Bando::QWidget
2
2
  private
3
3
 
4
+ def initialize_ui
5
+ initialize_actions
6
+ initialize_menu
7
+ initialize_tray
8
+ end
9
+
4
10
  def initialize_actions
5
11
  @open_dashboard_action = QAction.new("Dashboard", self)
6
12
  @open_dashboard_action.triggered.connect(self, :_on_open_dashboard_action_triggered)
@@ -61,18 +67,18 @@ class Systray < RubyQt6::Bando::QWidget
61
67
 
62
68
  def update_proxies_actions_delayinfo
63
69
  @proxies_actions.each do |proxy_action|
64
- proxy_name = Helpers.extract_proxy_name(proxy_action.text)
70
+ proxy_name = hlpr_extract_proxy_name(proxy_action.text)
65
71
  proxy_action.set_text(proxy_name)
66
72
  end
67
73
 
68
74
  @selectors_actions.each do |action|
69
75
  Clash.api.GET_group_delay(action.text, on_success: ->(data) {
70
76
  @proxies_actions.each do |proxy_action|
71
- proxy_name = Helpers.extract_proxy_name(proxy_action.text)
77
+ proxy_name = hlpr_extract_proxy_name(proxy_action.text)
72
78
  proxy_delay = data[proxy_name]
73
79
  next unless proxy_delay
74
80
 
75
- text = Helpers.inject_proxy_name(proxy_name, "#{proxy_delay} ms")
81
+ text = hlpr_inject_proxy_name(proxy_name, "#{proxy_delay} ms")
76
82
  proxy_action.set_text(text)
77
83
  end
78
84
  })
@@ -12,9 +12,7 @@ class Systray < RubyQt6::Bando::QWidget
12
12
  def initialize
13
13
  super
14
14
 
15
- initialize_actions
16
- initialize_menu
17
- initialize_tray
15
+ initialize_ui
18
16
  end
19
17
 
20
18
  def show
@@ -41,7 +39,7 @@ class Systray < RubyQt6::Bando::QWidget
41
39
  return unless checked
42
40
 
43
41
  group = sender.parent.menu_action.text
44
- proxy = Helpers.extract_proxy_name(sender.text)
42
+ proxy = hlpr_extract_proxy_name(sender.text)
45
43
  Clash.api.PUT_proxies(group, proxy, on_success: ->(_) {})
46
44
  end
47
45
  end
@@ -1,3 +1,3 @@
1
1
  module ClashSystray
2
- VERSION = "1.0.8"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-clash-systray
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Doe