ruby-macrodroid 0.9.16 → 0.9.17
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/actions.rb +81 -10
- data/lib/ruby-macrodroid/actionsnlp.rb +27 -8
- data/lib/ruby-macrodroid/base.rb +1 -0
- 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: d2a2688ed5b9d38f47749aa2f3e2d08002d7250d2690189f6034dec81b5d2ee5
|
4
|
+
data.tar.gz: 95d917dc64a5322caeacd5abd64f2b1cb9013e34908536860424f9cc47de6d1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0765669d573b157239bdb0ecfde3f34f1717160976e38e870fa1d20b105af0e5919370812e16e81232cb627bf32b2b833a732cf8ec4647ab2445e9aba0767014'
|
7
|
+
data.tar.gz: e1317255ded299969e64fef30d7f67b8706c1163202b032e190969f275b23524fa5ad81a1481eefc3c786153cd00a04d409a414316d3022674ae6e9fa5b7514a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -100,19 +100,28 @@ class LaunchActivityAction < ApplicationAction
|
|
100
100
|
|
101
101
|
def initialize(h={})
|
102
102
|
|
103
|
+
# option 0 is by application name, 1 is launch by package name
|
104
|
+
#
|
103
105
|
options = {
|
104
106
|
application_name: 'Chrome',
|
105
107
|
package_to_launch: 'com.android.chrome',
|
106
108
|
exclude_from_recents: false,
|
107
|
-
start_new: false
|
109
|
+
start_new: false,
|
110
|
+
option: 0,
|
111
|
+
launch_by_package_name: ''
|
108
112
|
}
|
109
113
|
|
110
114
|
super(options.merge h)
|
115
|
+
|
116
|
+
@list = %w(option launchByPackageName)
|
111
117
|
|
112
118
|
end
|
113
119
|
|
114
120
|
def to_s(colour: false, indent: 0)
|
115
|
-
|
121
|
+
option = @h[:option] == 0 ? @h[:application_name] : \
|
122
|
+
@h[:launch_by_package_name]
|
123
|
+
@s = 'Launch ' + option
|
124
|
+
super()
|
116
125
|
end
|
117
126
|
|
118
127
|
end
|
@@ -404,6 +413,61 @@ class TakePictureAction < CameraAction
|
|
404
413
|
end
|
405
414
|
|
406
415
|
|
416
|
+
class TakeScreenshotAction < CameraAction
|
417
|
+
|
418
|
+
def initialize(obj=nil)
|
419
|
+
|
420
|
+
h = if obj.is_a? Hash then
|
421
|
+
obj
|
422
|
+
elsif obj.is_a? Array
|
423
|
+
|
424
|
+
e, macro = obj
|
425
|
+
|
426
|
+
a = [
|
427
|
+
'Save to device',
|
428
|
+
'Send via email',
|
429
|
+
'Share via intent'
|
430
|
+
]
|
431
|
+
|
432
|
+
s = e.text('item/description').to_s
|
433
|
+
index = a.map(&:downcase).index s.downcase
|
434
|
+
|
435
|
+
{option: index}
|
436
|
+
|
437
|
+
end
|
438
|
+
|
439
|
+
options = {
|
440
|
+
option: 0,
|
441
|
+
use_smtp_email: false,
|
442
|
+
mechanism_option: 0,
|
443
|
+
save_to_jpeg: false
|
444
|
+
}
|
445
|
+
|
446
|
+
super(options.merge h)
|
447
|
+
|
448
|
+
end
|
449
|
+
|
450
|
+
def to_s(colour: false, indent: 0)
|
451
|
+
|
452
|
+
@s = 'Take Screenshot' #+ @h.inspect
|
453
|
+
|
454
|
+
options = [
|
455
|
+
'Save to device',
|
456
|
+
'Send via email',
|
457
|
+
'Share via intent'
|
458
|
+
]
|
459
|
+
|
460
|
+
option = options[@h[:option]]
|
461
|
+
|
462
|
+
@s += "\n" + option
|
463
|
+
super()
|
464
|
+
|
465
|
+
end
|
466
|
+
|
467
|
+
alias to_summary to_s
|
468
|
+
end
|
469
|
+
|
470
|
+
|
407
471
|
# Conditions/Loops
|
408
472
|
#
|
409
473
|
class IfConfirmedThenAction < Action
|
@@ -1084,7 +1148,7 @@ class UIInteractionAction < DeviceAction
|
|
1084
1148
|
e, macro = obj
|
1085
1149
|
s = e.text('item/description').to_s
|
1086
1150
|
|
1087
|
-
r = s.match(/^(Click|Long Click) \[(
|
1151
|
+
r = s.match(/^(Click|Long Click) \[(.*)\]$/)
|
1088
1152
|
|
1089
1153
|
# [Current focus] # Current focus
|
1090
1154
|
# [0,0] # x,y location
|
@@ -1092,10 +1156,11 @@ class UIInteractionAction < DeviceAction
|
|
1092
1156
|
# [fooo] # Text content
|
1093
1157
|
|
1094
1158
|
h = {
|
1095
|
-
ui_interaction_configuration: {
|
1096
|
-
|
1159
|
+
ui_interaction_configuration: {
|
1160
|
+
:xy_point=>{:x=>0, :y=>0},
|
1161
|
+
:type=>"Click"}
|
1097
1162
|
}
|
1098
|
-
h2 =
|
1163
|
+
h2 = h[:ui_interaction_configuration]
|
1099
1164
|
|
1100
1165
|
if r then
|
1101
1166
|
|
@@ -1105,7 +1170,7 @@ class UIInteractionAction < DeviceAction
|
|
1105
1170
|
h2[:long_click] = false if click.downcase.to_sym == :click
|
1106
1171
|
|
1107
1172
|
if detail == 'Current focus' then
|
1108
|
-
h2[:click_option] =
|
1173
|
+
h2[:click_option] = 0
|
1109
1174
|
elsif detail =~ /\d+,\d+/
|
1110
1175
|
# to-do
|
1111
1176
|
else
|
@@ -1114,7 +1179,7 @@ class UIInteractionAction < DeviceAction
|
|
1114
1179
|
h2[:text_content] = detail
|
1115
1180
|
end
|
1116
1181
|
|
1117
|
-
h[:ui_interaction_configuration] = h2
|
1182
|
+
#h[:ui_interaction_configuration] = h2
|
1118
1183
|
end
|
1119
1184
|
|
1120
1185
|
end
|
@@ -1126,6 +1191,8 @@ class UIInteractionAction < DeviceAction
|
|
1126
1191
|
|
1127
1192
|
|
1128
1193
|
super(options.merge h)
|
1194
|
+
|
1195
|
+
@list = %w(uiInteractionConfiguration action xyPoint textContent clickOption type longClick)
|
1129
1196
|
|
1130
1197
|
end
|
1131
1198
|
|
@@ -1165,7 +1232,8 @@ class UIInteractionAction < DeviceAction
|
|
1165
1232
|
"Gesture [%s]" % detail
|
1166
1233
|
end
|
1167
1234
|
|
1168
|
-
'UI Interaction' + "\n
|
1235
|
+
@s = 'UI Interaction' + "\n" + s #+ ' ' + @h.inspect
|
1236
|
+
super()
|
1169
1237
|
end
|
1170
1238
|
|
1171
1239
|
alias to_summary to_s
|
@@ -1185,7 +1253,10 @@ class VoiceSearchAction < DeviceAction
|
|
1185
1253
|
end
|
1186
1254
|
|
1187
1255
|
def to_s(colour: false, indent: 0)
|
1188
|
-
|
1256
|
+
|
1257
|
+
@s = 'Voice Search' # + @h.inspect
|
1258
|
+
super()
|
1259
|
+
|
1189
1260
|
end
|
1190
1261
|
|
1191
1262
|
alias to_summary to_s
|
@@ -86,7 +86,11 @@ class ActionsNlp
|
|
86
86
|
|
87
87
|
get /^take_picture/i do
|
88
88
|
[TakePictureAction, {}]
|
89
|
-
end
|
89
|
+
end
|
90
|
+
|
91
|
+
get /^Take Screenshot/i do
|
92
|
+
[TakeScreenshotAction, {}]
|
93
|
+
end
|
90
94
|
|
91
95
|
# -- DEVICE ACTIONS ------------------------------------------------------
|
92
96
|
|
@@ -114,6 +118,11 @@ class ActionsNlp
|
|
114
118
|
get /^Vibrate$/i do |pattern|
|
115
119
|
[VibrateAction, {pattern: 'short buzz'}]
|
116
120
|
end
|
121
|
+
|
122
|
+
get /^Voice Search$/i do
|
123
|
+
[VoiceSearchAction, {}]
|
124
|
+
end
|
125
|
+
|
117
126
|
|
118
127
|
# e.g. Display Notification: Hi there: This is the body of the message
|
119
128
|
get /^Display Notification: ([^:]+): [^$]+$/i do |subject, text|
|
@@ -141,14 +150,24 @@ class ActionsNlp
|
|
141
150
|
end
|
142
151
|
|
143
152
|
# e.g. Launch Settings
|
144
|
-
get /^Launch (.*)$/i do |
|
153
|
+
get /^Launch (.*)$/i do |s|
|
145
154
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
155
|
+
h = {}
|
156
|
+
|
157
|
+
if s[0] == '[' then
|
158
|
+
|
159
|
+
h[:launch_by_package_name] = s
|
160
|
+
h[:option] = 1
|
161
|
+
|
162
|
+
else
|
163
|
+
application = s
|
164
|
+
h[:application_name] = application
|
165
|
+
h[:package_to_launch] = APPS[application] || 'com.android.' +
|
166
|
+
application.downcase.split().join('.')
|
167
|
+
h[:option] = 0
|
168
|
+
|
169
|
+
end
|
170
|
+
|
152
171
|
[LaunchActivityAction, h]
|
153
172
|
|
154
173
|
end
|
data/lib/ruby-macrodroid/base.rb
CHANGED
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.17
|
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-24 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: glw
|
metadata.gz.sig
CHANGED
Binary file
|