ruby-macrodroid 0.9.13 → 0.9.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid/actions.rb +68 -7
- data/lib/ruby-macrodroid/actionsnlp.rb +8 -0
- data/lib/ruby-macrodroid/base.rb +2 -1
- data/lib/ruby-macrodroid/macro.rb +1 -1
- data/lib/ruby-macrodroid/triggers.rb +32 -0
- data/lib/ruby-macrodroid/triggersnlp.rb +21 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2421b1c983ef4223a4e461f70a37be3fa3d2200141ada22a535813b8b9ea94d
|
4
|
+
data.tar.gz: cf6a20994ba0a24ca544a1b8bfb75ffab22b6022be1a1f71e4e73b3a344b39e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b88c007520adab8bf80f1c0723d803ac2561092c450aee86f2d0e8e26a322646f15dc5df5d9419d1524f8339f0e85a332b603c65124bdb1eebf66b741ca7b1aa
|
7
|
+
data.tar.gz: 9ab6f2170600df9813114f9513b1e490496db70a82d432c2e3a3bad2768a67dfe27d7bb0ce84a38c80e28bf4e3a26ed4f8e92f788b1a2bc4c23884fc816a3571
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -1667,9 +1667,18 @@ class ClearLogAction < LoggingAction
|
|
1667
1667
|
end
|
1668
1668
|
|
1669
1669
|
|
1670
|
+
class MacroDroidAction < Action
|
1671
|
+
|
1672
|
+
def initialize(h={})
|
1673
|
+
super(h)
|
1674
|
+
@group = 'macrodroid'
|
1675
|
+
end
|
1676
|
+
|
1677
|
+
end
|
1678
|
+
|
1670
1679
|
# MacroDroid Specific
|
1671
1680
|
#
|
1672
|
-
class CancelActiveMacroAction <
|
1681
|
+
class CancelActiveMacroAction < MacroDroidAction
|
1673
1682
|
|
1674
1683
|
def initialize(h={})
|
1675
1684
|
|
@@ -1693,7 +1702,7 @@ end
|
|
1693
1702
|
|
1694
1703
|
# MacroDroid Specific
|
1695
1704
|
#
|
1696
|
-
class ConfirmNextAction <
|
1705
|
+
class ConfirmNextAction < MacroDroidAction
|
1697
1706
|
|
1698
1707
|
def initialize(h={})
|
1699
1708
|
|
@@ -1717,7 +1726,7 @@ class ConfirmNextAction < Action
|
|
1717
1726
|
|
1718
1727
|
end
|
1719
1728
|
|
1720
|
-
class DisableMacroAction <
|
1729
|
+
class DisableMacroAction < MacroDroidAction
|
1721
1730
|
|
1722
1731
|
def initialize(obj=nil)
|
1723
1732
|
|
@@ -1764,7 +1773,7 @@ end
|
|
1764
1773
|
|
1765
1774
|
# MacroDroid Specific
|
1766
1775
|
#
|
1767
|
-
class ExportMacrosAction <
|
1776
|
+
class ExportMacrosAction < MacroDroidAction
|
1768
1777
|
|
1769
1778
|
def initialize(h={})
|
1770
1779
|
|
@@ -1786,9 +1795,61 @@ class ExportMacrosAction < Action
|
|
1786
1795
|
end
|
1787
1796
|
|
1788
1797
|
|
1798
|
+
|
1799
|
+
class ForceMacroRunAction < MacroDroidAction
|
1800
|
+
|
1801
|
+
def initialize(obj=nil)
|
1802
|
+
|
1803
|
+
h = if obj.is_a? Hash then
|
1804
|
+
|
1805
|
+
obj
|
1806
|
+
|
1807
|
+
elsif obj.is_a? Array
|
1808
|
+
|
1809
|
+
e, macro, h2 = obj
|
1810
|
+
|
1811
|
+
# find the macro guid for the given name
|
1812
|
+
name = e.text('item/description').to_s
|
1813
|
+
found = macro.parent.macros.find {|macro| macro.title =~ /#{name}/ }
|
1814
|
+
|
1815
|
+
h3 = if found then
|
1816
|
+
{macro_name: found.title, GUID: found.guid}
|
1817
|
+
else
|
1818
|
+
{macro_name: name}
|
1819
|
+
end
|
1820
|
+
|
1821
|
+
h3.merge h2
|
1822
|
+
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
options = {
|
1826
|
+
guid: nil, ignore_constraints: true,
|
1827
|
+
macro_name: "", use_off_status: false,
|
1828
|
+
user_prompt_title: "Run Macro"
|
1829
|
+
}
|
1830
|
+
super(options.merge h)
|
1831
|
+
|
1832
|
+
end
|
1833
|
+
|
1834
|
+
def invoke()
|
1835
|
+
super(macro_name: @h[:macro_name])
|
1836
|
+
end
|
1837
|
+
|
1838
|
+
def to_s(colour: false, indent: 0)
|
1839
|
+
|
1840
|
+
@s = 'Macro Run'# + @h.inspect
|
1841
|
+
@s += "\n" + @h[:macro_name]
|
1842
|
+
super()
|
1843
|
+
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
alias to_summary to_s
|
1847
|
+
|
1848
|
+
end
|
1849
|
+
|
1789
1850
|
# MacroDroid Specific
|
1790
1851
|
#
|
1791
|
-
class SetVariableAction <
|
1852
|
+
class SetVariableAction < MacroDroidAction
|
1792
1853
|
using ColouredText
|
1793
1854
|
|
1794
1855
|
def initialize(obj=nil)
|
@@ -1878,7 +1939,7 @@ end
|
|
1878
1939
|
|
1879
1940
|
# MacroDroid Specific
|
1880
1941
|
#
|
1881
|
-
class TextManipulationAction <
|
1942
|
+
class TextManipulationAction < MacroDroidAction
|
1882
1943
|
|
1883
1944
|
def initialize(h={})
|
1884
1945
|
|
@@ -1921,7 +1982,7 @@ end
|
|
1921
1982
|
|
1922
1983
|
|
1923
1984
|
|
1924
|
-
class PauseAction <
|
1985
|
+
class PauseAction < MacroDroidAction
|
1925
1986
|
|
1926
1987
|
def initialize(h={})
|
1927
1988
|
|
@@ -221,6 +221,14 @@ class ActionsNlp
|
|
221
221
|
state = %w(enable disable toggle).index(rawstate.downcase)
|
222
222
|
[DisableMacroAction, {state: state}]
|
223
223
|
end
|
224
|
+
|
225
|
+
get /^Macro Run$/i do
|
226
|
+
[ForceMacroRunAction, {}]
|
227
|
+
end
|
228
|
+
|
229
|
+
get /^Run Macro$/i do
|
230
|
+
[ForceMacroRunAction, {}]
|
231
|
+
end
|
224
232
|
|
225
233
|
get /^Set Variable$/i do
|
226
234
|
[SetVariableAction, {}]
|
data/lib/ruby-macrodroid/base.rb
CHANGED
@@ -1416,6 +1416,10 @@ class ActivityRecognitionTrigger < SensorsTrigger
|
|
1416
1416
|
|
1417
1417
|
end
|
1418
1418
|
|
1419
|
+
def match?(detail={})
|
1420
|
+
@h[:selected_index] == detail[:selected_index]
|
1421
|
+
end
|
1422
|
+
|
1419
1423
|
def to_s(colour: false)
|
1420
1424
|
|
1421
1425
|
activity = @activity[@h[:selected_index]]
|
@@ -1540,6 +1544,19 @@ class FlipDeviceTrigger < SensorsTrigger
|
|
1540
1544
|
|
1541
1545
|
end
|
1542
1546
|
|
1547
|
+
def match?(detail={})
|
1548
|
+
|
1549
|
+
fd = detail[:face_down]
|
1550
|
+
|
1551
|
+
b = if fd.is_a? String then
|
1552
|
+
fd.downcase == 'true'
|
1553
|
+
else
|
1554
|
+
fd
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
@h[:face_down] == b
|
1558
|
+
end
|
1559
|
+
|
1543
1560
|
def to_pc()
|
1544
1561
|
@h[:face_down] ? 'flip_device_down?' : 'flip_device_up?'
|
1545
1562
|
end
|
@@ -1771,6 +1788,21 @@ class SwipeTrigger < Trigger
|
|
1771
1788
|
super(options.merge h)
|
1772
1789
|
|
1773
1790
|
end
|
1791
|
+
|
1792
|
+
def match?(detail={}, model=nil)
|
1793
|
+
|
1794
|
+
puts 'detail : ' + detail.inspect
|
1795
|
+
|
1796
|
+
return false if detail.empty?
|
1797
|
+
|
1798
|
+
detail[:swipe_start_area] = detail[:start]
|
1799
|
+
detail[:swipe_motion] = detail[:motion]
|
1800
|
+
return unless detail[:swipe_start_area] and detail[:swipe_motion]
|
1801
|
+
|
1802
|
+
@h[:swipe_start_area] == detail[:swipe_start_area].to_i and \
|
1803
|
+
@h[:swipe_motion] == detail[:swipe_motion].to_i
|
1804
|
+
|
1805
|
+
end
|
1774
1806
|
|
1775
1807
|
def to_s(colour: false)
|
1776
1808
|
|
@@ -185,7 +185,27 @@ class TriggersNlp
|
|
185
185
|
|
186
186
|
get /^Swipe Screen$/i do
|
187
187
|
[SwipeTrigger, {}]
|
188
|
-
end
|
188
|
+
end
|
189
|
+
|
190
|
+
get /^Swipe (top left) (across|diagonal|down)$/i do |start, motion|
|
191
|
+
|
192
|
+
swipe_motion = case motion.downcase.to_sym
|
193
|
+
when :across
|
194
|
+
0
|
195
|
+
when :diagonal
|
196
|
+
1
|
197
|
+
when :down
|
198
|
+
2
|
199
|
+
end
|
200
|
+
|
201
|
+
h = {
|
202
|
+
swipe_start_area: (start.downcase == 'top left' ? 0 : 1),
|
203
|
+
swipe_motion: swipe_motion
|
204
|
+
}
|
205
|
+
|
206
|
+
[SwipeTrigger, h]
|
207
|
+
|
208
|
+
end
|
189
209
|
|
190
210
|
end
|
191
211
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-macrodroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
NZ2kdBIUDnAM24e0/wXdVxg4HnsZbdymxyzMQ4P5pKYcpI6oisBxI37p/Xy+wAg3
|
36
36
|
SBHno3GEuuD8ZWj24IMJpfbp
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-10-
|
38
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|