ruby-macrodroid 0.8.2 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby-macrodroid.rb +102 -30
- data/lib/ruby-macrodroid/actions.rb +437 -123
- data/lib/ruby-macrodroid/base.rb +1 -0
- data/lib/ruby-macrodroid/triggers.rb +104 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
data/lib/ruby-macrodroid/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# file: ruby-macrodroid/
|
1
|
+
# file: ruby-macrodroid/triggers.rb
|
2
2
|
|
3
3
|
# This file contains the following classes:
|
4
4
|
#
|
@@ -26,6 +26,8 @@
|
|
26
26
|
#
|
27
27
|
|
28
28
|
|
29
|
+
|
30
|
+
|
29
31
|
class Trigger < MacroObject
|
30
32
|
using Params
|
31
33
|
|
@@ -48,6 +50,19 @@ class Trigger < MacroObject
|
|
48
50
|
detail.select {|k,v| @h.include? k }.all? {|key,value| @h[key] == value}
|
49
51
|
|
50
52
|
end
|
53
|
+
|
54
|
+
def to_s(colour: false)
|
55
|
+
|
56
|
+
h = @h.clone
|
57
|
+
h.delete :macro
|
58
|
+
@s ||= "#<%s %s>" % [self.class, h.inspect]
|
59
|
+
operator = @h[:is_or_condition] ? 'OR' : 'AND'
|
60
|
+
constraints = @constraints.map \
|
61
|
+
{|x| x.to_summary(colour: colour, indent: 1)}.join(" %s " % operator)
|
62
|
+
|
63
|
+
@constraints.any? ? @s + "\n " + constraints : @s
|
64
|
+
|
65
|
+
end
|
51
66
|
|
52
67
|
end
|
53
68
|
|
@@ -132,7 +147,9 @@ class ApplicationLaunchedTrigger < Trigger
|
|
132
147
|
end
|
133
148
|
|
134
149
|
def to_s(colour: false)
|
135
|
-
|
150
|
+
a = @h[:application_name_list]
|
151
|
+
apps = a.length > 1 ? "[%s]" % a.join(', ') : a.first
|
152
|
+
'Application Launched' + "\n " + apps
|
136
153
|
end
|
137
154
|
|
138
155
|
alias to_summary to_s
|
@@ -964,10 +981,39 @@ class MusicPlayingTrigger < DeviceEventsTrigger
|
|
964
981
|
end
|
965
982
|
|
966
983
|
def to_s(colour: false)
|
967
|
-
|
984
|
+
|
985
|
+
event = @h[:option] == 0 ? 'Started' : 'Stopped'
|
986
|
+
@s = 'Music/Sound Playing' + "\n %s" % event #+ @h.inspect
|
987
|
+
super()
|
988
|
+
|
968
989
|
end
|
969
990
|
|
991
|
+
def to_summary(colour: false)
|
992
|
+
event = @h[:option] == 0 ? 'Started' : 'Stopped'
|
993
|
+
@s = 'Music/Sound Playing' + " (%s)" % event #+ @h.inspect
|
994
|
+
end
|
995
|
+
end
|
996
|
+
|
997
|
+
|
998
|
+
# Category: Device Events
|
999
|
+
#
|
1000
|
+
class NFCTrigger < DeviceEventsTrigger
|
1001
|
+
|
1002
|
+
def initialize(h={})
|
1003
|
+
|
1004
|
+
options = {
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
super(options.merge h)
|
1008
|
+
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
def to_s(colour: false)
|
1012
|
+
'NFC Tag' + "\n " + @h[:tag_name]
|
1013
|
+
end
|
1014
|
+
|
970
1015
|
alias to_summary to_s
|
1016
|
+
|
971
1017
|
end
|
972
1018
|
|
973
1019
|
|
@@ -1254,6 +1300,28 @@ class SunriseSunsetTrigger < Trigger
|
|
1254
1300
|
end
|
1255
1301
|
|
1256
1302
|
|
1303
|
+
# Category: MacroDroid Specific
|
1304
|
+
#
|
1305
|
+
class EmptyTrigger < Trigger
|
1306
|
+
|
1307
|
+
def initialize(h={})
|
1308
|
+
|
1309
|
+
options = {
|
1310
|
+
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
super(options.merge h)
|
1314
|
+
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
def to_s(colour: false)
|
1318
|
+
'EmptyTrigger'
|
1319
|
+
end
|
1320
|
+
|
1321
|
+
alias to_summary to_s
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
|
1257
1325
|
class SensorsTrigger < Trigger
|
1258
1326
|
|
1259
1327
|
def initialize(h={})
|
@@ -1331,7 +1399,8 @@ class ProximityTrigger < SensorsTrigger
|
|
1331
1399
|
'Far'
|
1332
1400
|
end
|
1333
1401
|
|
1334
|
-
"Proximity Sensor (%s)" % distance
|
1402
|
+
@s = "Proximity Sensor (%s)" % distance
|
1403
|
+
super()
|
1335
1404
|
end
|
1336
1405
|
|
1337
1406
|
alias to_summary to_s
|
@@ -1556,3 +1625,34 @@ class SwipeTrigger < Trigger
|
|
1556
1625
|
|
1557
1626
|
alias to_summary to_s
|
1558
1627
|
end
|
1628
|
+
|
1629
|
+
|
1630
|
+
|
1631
|
+
|
1632
|
+
# Category: User Input
|
1633
|
+
#
|
1634
|
+
class WidgetPressedTrigger < Trigger
|
1635
|
+
|
1636
|
+
def initialize(h={})
|
1637
|
+
|
1638
|
+
options = {
|
1639
|
+
:swipe_start_area=>0, :swipe_motion=>0, :cleared=>true,
|
1640
|
+
:image_id=>2130968576, :image_package_name=>"com.android.providers.settings",
|
1641
|
+
:image_resource_name=>"com.android.providers.settings", :widget_label=>"",
|
1642
|
+
:widget_type=>4
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
super(options.merge h)
|
1646
|
+
|
1647
|
+
end
|
1648
|
+
|
1649
|
+
def to_s(colour: false)
|
1650
|
+
# 4 == cutom , 0 = green, 1 = blue, 2 = red, 3 = yellow
|
1651
|
+
style = %w(Green Blue Red Yellow Custom)[@h[:widget_type]]
|
1652
|
+
@s = "Widget Button (%s)" % [style] #+ @h.inspect
|
1653
|
+
super()
|
1654
|
+
end
|
1655
|
+
|
1656
|
+
alias to_summary to_s
|
1657
|
+
end
|
1658
|
+
|
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.8.
|
4
|
+
version: 0.8.8
|
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-09-
|
38
|
+
date: 2020-09-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
|