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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24d851b05dbc6ecfd52b146846a6bbe935a06d30bfdf523c0550bd18c701b93b
|
4
|
+
data.tar.gz: 97171c71818bc1d0ce3ed70dc790f3464170e18f8ff62b5b3ff47b66f40c49d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9187782e93e70a758e50a07c49812d5bb915dab37bb108d174157a76d76cc2b625b766665ad5ac3f47c7d12d3ac8082b291966aa36c114d4d573ddf38e567b3
|
7
|
+
data.tar.gz: 7514ffbe6a9b4c063fe278c685ce0a860b4d28a1945d4819faa65b081395b701b5dab657a3d7764b87689f230c74d7c14051e563ad4360937ade7f78466ac3a3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby-macrodroid.rb
CHANGED
@@ -154,6 +154,16 @@ class ActionsNlp
|
|
154
154
|
[ToastAction, {msg: msg}]
|
155
155
|
end
|
156
156
|
|
157
|
+
# e.g. Popup Message\n hello world!
|
158
|
+
get /^Popup Message\n\s+(.*)/im do |msg|
|
159
|
+
[ToastAction, {msg: msg}]
|
160
|
+
end
|
161
|
+
|
162
|
+
# e.g. Popup Message
|
163
|
+
get /^Popup Message$/i do
|
164
|
+
[ToastAction, {}]
|
165
|
+
end
|
166
|
+
|
157
167
|
# e.g. say current time
|
158
168
|
get /^say current[ _]time/i do
|
159
169
|
[SayTimeAction, {}]
|
@@ -243,16 +253,17 @@ class ActionsNlp
|
|
243
253
|
[KeepAwakeAction, {enabled: false, screen_option: 0}]
|
244
254
|
end
|
245
255
|
|
256
|
+
#a: Disable Keep Awake
|
257
|
+
#
|
258
|
+
get /if (.*)/i do
|
259
|
+
[IfConditionAction, {}]
|
260
|
+
end
|
246
261
|
|
247
262
|
end
|
248
263
|
|
249
264
|
alias find_action run_route
|
250
265
|
|
251
|
-
def to_s(colour: false)
|
252
|
-
'ActionsNlp ' + @h.inspect
|
253
|
-
end
|
254
266
|
|
255
|
-
alias to_summary to_s
|
256
267
|
end
|
257
268
|
|
258
269
|
class ConstraintsNlp
|
@@ -333,6 +344,7 @@ module Params
|
|
333
344
|
end
|
334
345
|
|
335
346
|
|
347
|
+
|
336
348
|
class Macro
|
337
349
|
using ColouredText
|
338
350
|
using Params
|
@@ -379,6 +391,7 @@ class Macro
|
|
379
391
|
local_variables: @local_variables,
|
380
392
|
m_trigger_list: @triggers.map(&:to_h),
|
381
393
|
m_action_list: @actions.map(&:to_h),
|
394
|
+
m_category: @category,
|
382
395
|
m_constraint_list: @constraints.map(&:to_h),
|
383
396
|
m_description: '',
|
384
397
|
m_name: title(),
|
@@ -402,11 +415,30 @@ class Macro
|
|
402
415
|
puts 'h:' + h.inspect
|
403
416
|
end
|
404
417
|
|
418
|
+
@category = h[:category]
|
405
419
|
@title = h[:name]
|
406
420
|
@description = h[:description]
|
407
421
|
|
408
422
|
# fetch the local variables
|
409
|
-
|
423
|
+
if h[:local_variables].any? and h[:local_variables].first.any? then
|
424
|
+
|
425
|
+
@local_variables = h[:local_variables].map do |var|
|
426
|
+
|
427
|
+
val = case var[:type]
|
428
|
+
when 0 # boolean
|
429
|
+
var[:boolean_value]
|
430
|
+
when 1 # integer
|
431
|
+
var[:int_value]
|
432
|
+
when 2 # string
|
433
|
+
var[:string_value]
|
434
|
+
when 3 # decimal
|
435
|
+
var[:decimal_Value]
|
436
|
+
end
|
437
|
+
|
438
|
+
[var[:name], val]
|
439
|
+
|
440
|
+
end.to_h
|
441
|
+
end
|
410
442
|
|
411
443
|
# fetch the triggers
|
412
444
|
@triggers = h[:trigger_list].map do |trigger|
|
@@ -419,17 +451,17 @@ class Macro
|
|
419
451
|
@actions = h[:action_list].map do |action|
|
420
452
|
object(action.to_snake_case)
|
421
453
|
end
|
422
|
-
|
454
|
+
puts 'before fetch constraints' if @debug
|
423
455
|
# fetch the constraints
|
424
456
|
@constraints = h[:constraint_list].map do |constraint|
|
425
457
|
object(constraint.to_snake_case)
|
426
458
|
end
|
427
|
-
|
459
|
+
puts 'after fetch constraints' if @debug
|
428
460
|
@h = h
|
429
461
|
|
430
462
|
%i(local_variables m_trigger_list m_action_list m_constraint_list)\
|
431
463
|
.each {|x| @h[x] = [] }
|
432
|
-
|
464
|
+
puts 'after @h set' if @debug
|
433
465
|
@h
|
434
466
|
|
435
467
|
end
|
@@ -446,6 +478,7 @@ class Macro
|
|
446
478
|
# level 2
|
447
479
|
|
448
480
|
@title = node.attributes[:name]
|
481
|
+
@category = node.attributes[:category]
|
449
482
|
@description = node.attributes[:description]
|
450
483
|
|
451
484
|
|
@@ -513,20 +546,42 @@ class Macro
|
|
513
546
|
@actions = node.xpath('action').map do |e|
|
514
547
|
|
515
548
|
puts 'action e: ' + e.xml.inspect if @debug
|
516
|
-
|
549
|
+
puts 'e.text ' + e.text if @debug
|
550
|
+
|
551
|
+
inner_lines = e.xpath('item/description/text()')
|
552
|
+
|
553
|
+
action = if e.text.to_s.strip.empty? then
|
554
|
+
inner_lines.shift
|
555
|
+
else
|
556
|
+
e.text.strip
|
557
|
+
end
|
558
|
+
|
559
|
+
r = ap.find_action action
|
517
560
|
puts 'found action ' + r.inspect if @debug
|
518
561
|
|
519
562
|
if r then
|
520
563
|
|
521
|
-
|
564
|
+
loose = inner_lines.shift
|
565
|
+
|
566
|
+
raw_attributes = if loose then
|
522
567
|
|
523
|
-
|
524
|
-
|
568
|
+
puts 'do something ' + loose.to_s if @debug
|
569
|
+
loose.to_s
|
570
|
+
|
525
571
|
else
|
526
|
-
|
572
|
+
|
573
|
+
a = e.xpath('item/*')
|
574
|
+
|
575
|
+
h = if a.any? then
|
576
|
+
a.map {|node| [node.name.to_sym, node.text.to_s]}.to_h
|
577
|
+
else
|
578
|
+
{}
|
579
|
+
end
|
580
|
+
|
581
|
+
r[1].merge(h)
|
582
|
+
|
527
583
|
end
|
528
|
-
|
529
|
-
r[0].new(r[1].merge(h))
|
584
|
+
r[0].new(raw_attributes)
|
530
585
|
end
|
531
586
|
|
532
587
|
end
|
@@ -634,7 +689,7 @@ EOF
|
|
634
689
|
|
635
690
|
end
|
636
691
|
|
637
|
-
if s =~ /^If/i then
|
692
|
+
if s =~ /^(?:If|DO \/ WHILE)/i then
|
638
693
|
|
639
694
|
if indent < 1 then
|
640
695
|
|
@@ -655,13 +710,32 @@ EOF
|
|
655
710
|
r
|
656
711
|
|
657
712
|
end.join("\n")
|
713
|
+
|
714
|
+
a = []
|
715
|
+
a << '# ' + @category + "\n" if @category
|
716
|
+
a << (colour ? "m".bg_cyan.gray.bold : 'm') + ': ' + @title
|
717
|
+
|
718
|
+
|
719
|
+
if @description and @description.length >= 1 then
|
720
|
+
a << (colour ? "d".bg_gray.gray.bold : 'd') + ': ' \
|
721
|
+
+ @description.gsub(/\n/,"\n ")
|
722
|
+
end
|
723
|
+
|
724
|
+
if @local_variables.length >= 1 then
|
725
|
+
|
726
|
+
vars = @local_variables.map do |k,v|
|
727
|
+
label = colour ? 'v'.bg_magenta : 'v'
|
728
|
+
label += ': '
|
729
|
+
label + "%s: %s" % [k,v]
|
730
|
+
end
|
731
|
+
|
732
|
+
a << vars.join("\n")
|
733
|
+
end
|
658
734
|
|
659
|
-
a
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
actions
|
664
|
-
]
|
735
|
+
a << @triggers.map {|x| (colour ? "t".bg_red.gray.bold : 't') \
|
736
|
+
+ ": %s" % x}.join("\n")
|
737
|
+
a << actions
|
738
|
+
|
665
739
|
|
666
740
|
if @constraints.any? then
|
667
741
|
a << @constraints.map do |x|
|
@@ -669,10 +743,9 @@ EOF
|
|
669
743
|
end.join("\n")
|
670
744
|
end
|
671
745
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
end
|
746
|
+
|
747
|
+
|
748
|
+
|
676
749
|
|
677
750
|
a.join("\n") + "\n"
|
678
751
|
|
@@ -735,7 +808,7 @@ EOF
|
|
735
808
|
h2 = h.merge( macro: self)
|
736
809
|
puts 'h2: ' + h2.inspect
|
737
810
|
r = klass.new h2
|
738
|
-
|
811
|
+
puts 'r:' + r.inspect
|
739
812
|
r
|
740
813
|
|
741
814
|
end
|
@@ -745,8 +818,6 @@ EOF
|
|
745
818
|
end
|
746
819
|
|
747
820
|
|
748
|
-
|
749
|
-
|
750
821
|
class MacroDroidError < Exception
|
751
822
|
end
|
752
823
|
|
@@ -775,6 +846,7 @@ class MacroDroid
|
|
775
846
|
if s[0] == '{' then
|
776
847
|
|
777
848
|
import_json(s)
|
849
|
+
puts 'after import_json' if @debug
|
778
850
|
|
779
851
|
elsif s[0] == '<'
|
780
852
|
|
@@ -867,7 +939,7 @@ class MacroDroid
|
|
867
939
|
end
|
868
940
|
|
869
941
|
alias to_json export_json
|
870
|
-
|
942
|
+
|
871
943
|
|
872
944
|
def to_h()
|
873
945
|
|
@@ -53,14 +53,14 @@ class Action < MacroObject
|
|
53
53
|
"%s/%s: %s" % [@group, @type, s]
|
54
54
|
end
|
55
55
|
|
56
|
-
def to_s(colour: false)
|
56
|
+
def to_s(colour: false, indent: 0)
|
57
57
|
|
58
58
|
h = @h.clone
|
59
59
|
h.delete :macro
|
60
60
|
@s ||= "#<%s %s>" % [self.class, h.inspect]
|
61
61
|
operator = @h[:is_or_condition] ? 'OR' : 'AND'
|
62
62
|
constraints = @constraints.map \
|
63
|
-
{|x| x.to_summary(colour: colour)}.join(" %s " % operator)
|
63
|
+
{|x| ' ' * indent + x.to_summary(colour: colour)}.join(" %s " % operator)
|
64
64
|
|
65
65
|
@s + constraints
|
66
66
|
|
@@ -69,43 +69,6 @@ class Action < MacroObject
|
|
69
69
|
end
|
70
70
|
|
71
71
|
|
72
|
-
class LocationAction < Action
|
73
|
-
|
74
|
-
def initialize(h={})
|
75
|
-
super(h)
|
76
|
-
@group = 'location'
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
# Category: Location
|
82
|
-
#
|
83
|
-
class ShareLocationAction < LocationAction
|
84
|
-
|
85
|
-
def initialize(h={})
|
86
|
-
|
87
|
-
super()
|
88
|
-
|
89
|
-
options = {
|
90
|
-
email: '',
|
91
|
-
variable: {:m_stringValue=>"", :m_name=>"",
|
92
|
-
:m_decimalValue=>0.0, :isLocal=>true, :m_booleanValue=>false,
|
93
|
-
:excludeFromLog=>false, :m_intValue=>0, :m_type=>2},
|
94
|
-
sim_id: 0,
|
95
|
-
output_channel: 5,
|
96
|
-
old_variable_format: true
|
97
|
-
}
|
98
|
-
|
99
|
-
super(options.merge h)
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
def to_s(colour: false)
|
104
|
-
'ShareLocationAction ' + @h.inspect
|
105
|
-
end
|
106
|
-
|
107
|
-
alias to_summary to_s
|
108
|
-
end
|
109
72
|
|
110
73
|
|
111
74
|
class ApplicationAction < Action
|
@@ -134,7 +97,7 @@ class LaunchActivityAction < ApplicationAction
|
|
134
97
|
|
135
98
|
end
|
136
99
|
|
137
|
-
def to_s(colour: false)
|
100
|
+
def to_s(colour: false, indent: 0)
|
138
101
|
'Launch ' + @h[:application_name]
|
139
102
|
end
|
140
103
|
|
@@ -155,7 +118,7 @@ class KillBackgroundAppAction < ApplicationAction
|
|
155
118
|
|
156
119
|
end
|
157
120
|
|
158
|
-
def to_s(colour: false)
|
121
|
+
def to_s(colour: false, indent: 0)
|
159
122
|
'KillBackgroundAppAction ' + @h.inspect
|
160
123
|
end
|
161
124
|
|
@@ -176,7 +139,7 @@ class LaunchShortcutAction < ApplicationAction
|
|
176
139
|
|
177
140
|
end
|
178
141
|
|
179
|
-
def to_s(colour: false)
|
142
|
+
def to_s(colour: false, indent: 0)
|
180
143
|
@s = "Launch Shortcut: " + @h[:app_name] + "\n " + @h[:name]
|
181
144
|
super()
|
182
145
|
end
|
@@ -205,7 +168,7 @@ class OpenWebPageAction < ApplicationAction
|
|
205
168
|
|
206
169
|
end
|
207
170
|
|
208
|
-
def to_s(colour: false)
|
171
|
+
def to_s(colour: false, indent: 0)
|
209
172
|
"HTTP GET\n url: " + @h[:url_to_open]
|
210
173
|
end
|
211
174
|
|
@@ -236,7 +199,7 @@ class UploadPhotoAction < CameraAction
|
|
236
199
|
|
237
200
|
end
|
238
201
|
|
239
|
-
def to_s(colour: false)
|
202
|
+
def to_s(colour: false, indent: 0)
|
240
203
|
'UploadPhotoAction ' + @h.inspect
|
241
204
|
end
|
242
205
|
|
@@ -266,13 +229,16 @@ class TakePictureAction < CameraAction
|
|
266
229
|
'take_photo :' + camera.to_s
|
267
230
|
end
|
268
231
|
|
269
|
-
def to_s(colour: false)
|
232
|
+
def to_s(colour: false, indent: 0)
|
270
233
|
'Take Picture'
|
271
234
|
end
|
272
235
|
|
273
236
|
end
|
274
237
|
|
275
|
-
|
238
|
+
|
239
|
+
# Conditions/Loops
|
240
|
+
#
|
241
|
+
class IfConfirmedThenAction < Action
|
276
242
|
|
277
243
|
def initialize(h={})
|
278
244
|
|
@@ -286,11 +252,97 @@ class IfConditionAction < Action
|
|
286
252
|
|
287
253
|
super(h2)
|
288
254
|
|
255
|
+
@label = 'If Confirmed Then '
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
def to_s(colour: false, indent: 0)
|
260
|
+
|
261
|
+
@s = "If Confirmed Then " #+ @constraints.map(&:to_s).join(" %s " % operator)
|
262
|
+
super(colour: colour)
|
263
|
+
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# Conditions/Loops
|
268
|
+
#
|
269
|
+
class LoopAction < Action
|
270
|
+
|
271
|
+
def initialize(h={})
|
272
|
+
|
273
|
+
options = {
|
274
|
+
|
275
|
+
}
|
276
|
+
|
277
|
+
h2 = options.merge(h)
|
278
|
+
|
279
|
+
super(h2)
|
280
|
+
|
281
|
+
@label = 'DO / WHILE '
|
282
|
+
|
283
|
+
end
|
284
|
+
|
285
|
+
def to_s(colour: false, indent: 0)
|
286
|
+
|
287
|
+
@s = 'DO / WHILE '
|
288
|
+
super()
|
289
|
+
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# Conditions/Loops
|
294
|
+
#
|
295
|
+
class EndLoopAction < Action
|
296
|
+
|
297
|
+
def initialize(h={})
|
298
|
+
|
299
|
+
options = {
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
h2 = options.merge(h)
|
304
|
+
|
305
|
+
super(h2)
|
306
|
+
|
307
|
+
@label = 'End Loop '
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
def to_s(colour: false, indent: 0)
|
312
|
+
|
313
|
+
'End Loop '
|
314
|
+
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# Conditions/Loops
|
319
|
+
#
|
320
|
+
class IfConditionAction < Action
|
321
|
+
|
322
|
+
def initialize(obj=nil)
|
323
|
+
|
324
|
+
h = if obj.is_a? Hash then
|
325
|
+
obj
|
326
|
+
else
|
327
|
+
# get the constraints
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
options = {
|
332
|
+
a: true,
|
333
|
+
constraint_list: ''
|
334
|
+
}
|
335
|
+
|
336
|
+
macro = h[:macro]
|
337
|
+
h2 = options.merge(filter(options,h).merge(macro: macro))
|
338
|
+
|
339
|
+
super(h2)
|
340
|
+
|
289
341
|
@label = 'If '
|
290
342
|
|
291
343
|
end
|
292
344
|
|
293
|
-
def to_s(colour: false)
|
345
|
+
def to_s(colour: false, indent: 0)
|
294
346
|
|
295
347
|
@s = "If " #+ @constraints.map(&:to_s).join(" %s " % operator)
|
296
348
|
super(colour: colour)
|
@@ -311,13 +363,13 @@ class ElseAction < Action
|
|
311
363
|
|
312
364
|
end
|
313
365
|
|
314
|
-
def to_s(colour: false)
|
366
|
+
def to_s(colour: false, indent: 0)
|
315
367
|
'Else'
|
316
368
|
end
|
317
369
|
|
318
370
|
end
|
319
371
|
|
320
|
-
class ElseIfConditionAction <
|
372
|
+
class ElseIfConditionAction < Action
|
321
373
|
|
322
374
|
def initialize(h={})
|
323
375
|
|
@@ -326,9 +378,14 @@ class ElseIfConditionAction < IfConditionAction
|
|
326
378
|
}
|
327
379
|
|
328
380
|
super(options.merge h)
|
329
|
-
@label = '
|
381
|
+
@label = 'Else If '
|
330
382
|
|
331
383
|
end
|
384
|
+
|
385
|
+
def to_s(colour: false, indent: 0)
|
386
|
+
@s = 'Else If '
|
387
|
+
super()
|
388
|
+
end
|
332
389
|
|
333
390
|
|
334
391
|
end
|
@@ -346,7 +403,7 @@ class EndIfAction < Action
|
|
346
403
|
|
347
404
|
end
|
348
405
|
|
349
|
-
def to_s(colour: false)
|
406
|
+
def to_s(colour: false, indent: 0)
|
350
407
|
'End If'
|
351
408
|
end
|
352
409
|
|
@@ -376,7 +433,7 @@ class SetAirplaneModeAction < ConnectivityAction
|
|
376
433
|
|
377
434
|
end
|
378
435
|
|
379
|
-
def to_s(colour: false)
|
436
|
+
def to_s(colour: false, indent: 0)
|
380
437
|
|
381
438
|
state = ['On', 'Off', 'Toggle'][@h[:state]]
|
382
439
|
@s = 'Airplane Mode ' + state + "\n"
|
@@ -402,7 +459,7 @@ class SetWifiAction < ConnectivityAction
|
|
402
459
|
|
403
460
|
end
|
404
461
|
|
405
|
-
def to_s(colour: false)
|
462
|
+
def to_s(colour: false, indent: 0)
|
406
463
|
action = @h[:state] == 0 ? 'Enable' : 'Disable'
|
407
464
|
action + ' Wifi'
|
408
465
|
end
|
@@ -424,7 +481,7 @@ class SetBluetoothAction < ConnectivityAction
|
|
424
481
|
|
425
482
|
end
|
426
483
|
|
427
|
-
def to_s(colour: false)
|
484
|
+
def to_s(colour: false, indent: 0)
|
428
485
|
'SetBluetoothAction ' + @h.inspect
|
429
486
|
end
|
430
487
|
|
@@ -446,7 +503,7 @@ class SetBluetoothAction < ConnectivityAction
|
|
446
503
|
|
447
504
|
end
|
448
505
|
|
449
|
-
def to_s(colour: false)
|
506
|
+
def to_s(colour: false, indent: 0)
|
450
507
|
'SetBluetoothAction ' + @h.inspect
|
451
508
|
end
|
452
509
|
|
@@ -466,7 +523,7 @@ class SetHotspotAction < ConnectivityAction
|
|
466
523
|
|
467
524
|
end
|
468
525
|
|
469
|
-
def to_s(colour: false)
|
526
|
+
def to_s(colour: false, indent: 0)
|
470
527
|
action = @h[:turn_wifi_on] ? 'Enable' : 'Disable'
|
471
528
|
action + ' HotSpot'
|
472
529
|
end
|
@@ -498,7 +555,7 @@ class SendIntentAction < ConnectivityAction
|
|
498
555
|
|
499
556
|
end
|
500
557
|
|
501
|
-
def to_s(colour: false)
|
558
|
+
def to_s(colour: false, indent: 0)
|
502
559
|
'Send Intent ' + "\n " + @h[:action]
|
503
560
|
end
|
504
561
|
|
@@ -538,7 +595,7 @@ class SetAlarmClockAction < DateTimeAction
|
|
538
595
|
|
539
596
|
end
|
540
597
|
|
541
|
-
def to_s(colour: false)
|
598
|
+
def to_s(colour: false, indent: 0)
|
542
599
|
'SetAlarmClockAction ' + @h.inspect
|
543
600
|
end
|
544
601
|
|
@@ -560,7 +617,7 @@ class StopWatchAction < DateTimeAction
|
|
560
617
|
|
561
618
|
end
|
562
619
|
|
563
|
-
def to_s(colour: false)
|
620
|
+
def to_s(colour: false, indent: 0)
|
564
621
|
'StopWatchAction ' + @h.inspect
|
565
622
|
end
|
566
623
|
|
@@ -591,7 +648,7 @@ class SayTimeAction < DateTimeAction
|
|
591
648
|
'say current_time()'
|
592
649
|
end
|
593
650
|
|
594
|
-
def to_s(colour: false)
|
651
|
+
def to_s(colour: false, indent: 0)
|
595
652
|
'Say Current Time'
|
596
653
|
end
|
597
654
|
|
@@ -621,7 +678,7 @@ class AndroidShortcutsAction < DeviceAction
|
|
621
678
|
|
622
679
|
end
|
623
680
|
|
624
|
-
def to_s(colour: false)
|
681
|
+
def to_s(colour: false, indent: 0)
|
625
682
|
'AndroidShortcutsAction ' + @h.inspect
|
626
683
|
end
|
627
684
|
|
@@ -642,8 +699,8 @@ class ClipboardAction < DeviceAction
|
|
642
699
|
|
643
700
|
end
|
644
701
|
|
645
|
-
def to_s(colour: false)
|
646
|
-
'
|
702
|
+
def to_s(colour: false, indent: 0)
|
703
|
+
'Fill Clipboard' + "\n " + @h[:clipboard_text] #+ @h.inspect
|
647
704
|
end
|
648
705
|
|
649
706
|
alias to_summary to_s
|
@@ -662,7 +719,7 @@ class PressBackAction < DeviceAction
|
|
662
719
|
|
663
720
|
end
|
664
721
|
|
665
|
-
def to_s(colour: false)
|
722
|
+
def to_s(colour: false, indent: 0)
|
666
723
|
'PressBackAction ' + @h.inspect
|
667
724
|
end
|
668
725
|
|
@@ -690,7 +747,7 @@ class SpeakTextAction < DeviceAction
|
|
690
747
|
|
691
748
|
end
|
692
749
|
|
693
|
-
def to_s(colour: false)
|
750
|
+
def to_s(colour: false, indent: 0)
|
694
751
|
"Speak Text (%s)" % @h[:text_to_say]
|
695
752
|
end
|
696
753
|
|
@@ -711,8 +768,43 @@ class UIInteractionAction < DeviceAction
|
|
711
768
|
|
712
769
|
end
|
713
770
|
|
714
|
-
def to_s(colour: false)
|
715
|
-
|
771
|
+
def to_s(colour: false, indent: 0)
|
772
|
+
|
773
|
+
ui = @h[:ui_interaction_configuration]
|
774
|
+
|
775
|
+
option = -> do
|
776
|
+
detail = case ui[:click_option]
|
777
|
+
when 0 # 'Current focus'
|
778
|
+
'Current focus'
|
779
|
+
when 1 # 'Text content'
|
780
|
+
ui[:text_content]
|
781
|
+
when 2 # 'X, Y location'
|
782
|
+
"%s" % ui[:xy_point].values.join(',')
|
783
|
+
when 3 # 'Identify in app'
|
784
|
+
"id:%s" % ui[:view_id]
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
s = case @h[:action]
|
789
|
+
when 0 # 'Click'
|
790
|
+
'Click' + " [%s]" % option.call
|
791
|
+
when 1 # 'Long Click'
|
792
|
+
'Long Click' + " [%s]" % option.call
|
793
|
+
when 2 # 'Copy'
|
794
|
+
'Copy'
|
795
|
+
when 3 # 'Cut'
|
796
|
+
'Cut'
|
797
|
+
when 4 # 'Paste'
|
798
|
+
"Paste [%s]" % (ui[:use_clipboard] ? 'Clipboard text' : ui[:text])
|
799
|
+
when 5 # 'Clear selection'
|
800
|
+
'Clear selection'
|
801
|
+
when 6 # 'Gesture'
|
802
|
+
detail = "%d ms: %d,%d -> %d,%d" % [ui[:duration_ms], ui[:start_x],
|
803
|
+
ui[:start_y], ui[:end_x], ui[:end_y]]
|
804
|
+
"Gesture [%s]" % detail
|
805
|
+
end
|
806
|
+
|
807
|
+
'UI Interaction' + "\n " + s #+ ' ' + @h.inspect
|
716
808
|
end
|
717
809
|
|
718
810
|
alias to_summary to_s
|
@@ -731,7 +823,7 @@ class VoiceSearchAction < DeviceAction
|
|
731
823
|
|
732
824
|
end
|
733
825
|
|
734
|
-
def to_s(colour: false)
|
826
|
+
def to_s(colour: false, indent: 0)
|
735
827
|
'VoiceSearchAction ' + @h.inspect
|
736
828
|
end
|
737
829
|
|
@@ -762,7 +854,7 @@ class ExpandCollapseStatusBarAction < DeviceSettingsAction
|
|
762
854
|
|
763
855
|
end
|
764
856
|
|
765
|
-
def to_s(colour: false)
|
857
|
+
def to_s(colour: false, indent: 0)
|
766
858
|
'ExpandCollapseStatusBarAction ' + @h.inspect
|
767
859
|
end
|
768
860
|
|
@@ -782,7 +874,7 @@ class LaunchHomeScreenAction < DeviceSettingsAction
|
|
782
874
|
|
783
875
|
end
|
784
876
|
|
785
|
-
def to_s(colour: false)
|
877
|
+
def to_s(colour: false, indent: 0)
|
786
878
|
'LaunchHomeScreenAction ' + @h.inspect
|
787
879
|
end
|
788
880
|
|
@@ -793,6 +885,11 @@ end
|
|
793
885
|
#
|
794
886
|
class CameraFlashLightAction < DeviceSettingsAction
|
795
887
|
|
888
|
+
# options
|
889
|
+
# 0 Toch On
|
890
|
+
# 1 Torch Off
|
891
|
+
# 2 Torch Toggle
|
892
|
+
#
|
796
893
|
def initialize(h={})
|
797
894
|
|
798
895
|
options = {
|
@@ -808,7 +905,7 @@ class CameraFlashLightAction < DeviceSettingsAction
|
|
808
905
|
['torch :on', 'torch :off', 'torch :toggle'][@h[:state]]
|
809
906
|
end
|
810
907
|
|
811
|
-
def to_s(colour: false)
|
908
|
+
def to_s(colour: false, indent: 0)
|
812
909
|
['Torch On', 'Torch Off', 'Torch Toggle'][@h[:state]]
|
813
910
|
end
|
814
911
|
|
@@ -828,7 +925,7 @@ class VibrateAction < DeviceSettingsAction
|
|
828
925
|
|
829
926
|
end
|
830
927
|
|
831
|
-
def to_s(colour: false)
|
928
|
+
def to_s(colour: false, indent: 0)
|
832
929
|
|
833
930
|
pattern = [
|
834
931
|
'Blip', 'Short Buzz', 'Long Buzz', 'Rapid', 'Slow', 'Increasing',
|
@@ -855,7 +952,7 @@ class SetAutoRotateAction < DeviceSettingsAction
|
|
855
952
|
|
856
953
|
end
|
857
954
|
|
858
|
-
def to_s(colour: false)
|
955
|
+
def to_s(colour: false, indent: 0)
|
859
956
|
'SetAutoRotateAction ' + @h.inspect
|
860
957
|
end
|
861
958
|
|
@@ -875,7 +972,7 @@ class DayDreamAction < DeviceSettingsAction
|
|
875
972
|
|
876
973
|
end
|
877
974
|
|
878
|
-
def to_s(colour: false)
|
975
|
+
def to_s(colour: false, indent: 0)
|
879
976
|
'DayDreamAction ' + @h.inspect
|
880
977
|
end
|
881
978
|
|
@@ -895,7 +992,7 @@ class SetKeyboardAction < DeviceSettingsAction
|
|
895
992
|
|
896
993
|
end
|
897
994
|
|
898
|
-
def to_s(colour: false)
|
995
|
+
def to_s(colour: false, indent: 0)
|
899
996
|
'SetKeyboardAction ' + @h.inspect
|
900
997
|
end
|
901
998
|
|
@@ -916,7 +1013,7 @@ class SetKeyguardAction < DeviceSettingsAction
|
|
916
1013
|
|
917
1014
|
end
|
918
1015
|
|
919
|
-
def to_s(colour: false)
|
1016
|
+
def to_s(colour: false, indent: 0)
|
920
1017
|
'SetKeyguardAction ' + @h.inspect
|
921
1018
|
end
|
922
1019
|
|
@@ -937,7 +1034,7 @@ class CarModeAction < DeviceSettingsAction
|
|
937
1034
|
|
938
1035
|
end
|
939
1036
|
|
940
|
-
def to_s(colour: false)
|
1037
|
+
def to_s(colour: false, indent: 0)
|
941
1038
|
'CarModeAction ' + @h.inspect
|
942
1039
|
end
|
943
1040
|
|
@@ -959,7 +1056,7 @@ class ChangeKeyboardAction < DeviceSettingsAction
|
|
959
1056
|
|
960
1057
|
end
|
961
1058
|
|
962
|
-
def to_s(colour: false)
|
1059
|
+
def to_s(colour: false, indent: 0)
|
963
1060
|
'ChangeKeyboardAction ' + @h.inspect
|
964
1061
|
end
|
965
1062
|
|
@@ -985,7 +1082,7 @@ class SetWallpaperAction < DeviceSettingsAction
|
|
985
1082
|
|
986
1083
|
end
|
987
1084
|
|
988
|
-
def to_s(colour: false)
|
1085
|
+
def to_s(colour: false, indent: 0)
|
989
1086
|
'SetWallpaperAction ' + @h.inspect
|
990
1087
|
end
|
991
1088
|
|
@@ -1001,6 +1098,40 @@ class FileAction < Action
|
|
1001
1098
|
|
1002
1099
|
end
|
1003
1100
|
|
1101
|
+
|
1102
|
+
|
1103
|
+
# Category: Files
|
1104
|
+
#
|
1105
|
+
class FileOperationV21Action < FileAction
|
1106
|
+
|
1107
|
+
def initialize(h={})
|
1108
|
+
|
1109
|
+
options = {
|
1110
|
+
:app_name=>"", :class_name=>"", :package_name=>"", :file_path=>"",
|
1111
|
+
:file_extensions=>["jpg", "jpeg", "png", "raw", "bmp", "tif", "tiff",
|
1112
|
+
"gif"], :file_option=>2, :from_name=>"Sent",
|
1113
|
+
:from_uri_string=>"", :option=>2
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
super(options.merge h)
|
1117
|
+
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
def to_s(colour: false, indent: 0)
|
1121
|
+
|
1122
|
+
operation = ['Copy', 'Move', 'Delete', 'Create Folder']
|
1123
|
+
file = ['All Files', 'All Media Files', 'Images', 'Audio', 'Videos', 'Specify File Pattern', 'Folder']
|
1124
|
+
|
1125
|
+
detail = @h[:from_name]
|
1126
|
+
detail += ' to: ' + @h[:to_name] if @h[:option] == 1
|
1127
|
+
@s = "%s %s" % [operation[@h[:option]], file[@h[:file_option]]] \
|
1128
|
+
+ "\n " + detail #+ @h.inspect
|
1129
|
+
super()
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
alias to_summary to_s
|
1133
|
+
end
|
1134
|
+
|
1004
1135
|
# Category: Files
|
1005
1136
|
#
|
1006
1137
|
class OpenFileAction < FileAction
|
@@ -1018,7 +1149,7 @@ class OpenFileAction < FileAction
|
|
1018
1149
|
|
1019
1150
|
end
|
1020
1151
|
|
1021
|
-
def to_s(colour: false)
|
1152
|
+
def to_s(colour: false, indent: 0)
|
1022
1153
|
'OpenFileAction ' + @h.inspect
|
1023
1154
|
end
|
1024
1155
|
|
@@ -1026,6 +1157,30 @@ class OpenFileAction < FileAction
|
|
1026
1157
|
end
|
1027
1158
|
|
1028
1159
|
|
1160
|
+
# Category: Files
|
1161
|
+
#
|
1162
|
+
class WriteToFileAction < FileAction
|
1163
|
+
|
1164
|
+
def initialize(h={})
|
1165
|
+
|
1166
|
+
options = {
|
1167
|
+
app_name: '',
|
1168
|
+
class_name: '',
|
1169
|
+
package_name: '',
|
1170
|
+
file_path: ''
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
super(options.merge h)
|
1174
|
+
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
def to_s(colour: false, indent: 0)
|
1178
|
+
'Write To File' + "\n " + @h[:filename] #+ @h.inspect
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
alias to_summary to_s
|
1182
|
+
end
|
1183
|
+
|
1029
1184
|
class LocationAction < Action
|
1030
1185
|
|
1031
1186
|
def initialize(h={})
|
@@ -1048,22 +1203,37 @@ class ForceLocationUpdateAction < LocationAction
|
|
1048
1203
|
|
1049
1204
|
end
|
1050
1205
|
|
1051
|
-
def to_s(colour: false)
|
1206
|
+
def to_s(colour: false, indent: 0)
|
1052
1207
|
'ForceLocationUpdateAction ' + @h.inspect
|
1053
1208
|
end
|
1054
1209
|
|
1055
1210
|
alias to_summary to_s
|
1056
1211
|
end
|
1057
1212
|
|
1213
|
+
# Category: Location
|
1214
|
+
#
|
1215
|
+
class LocationAction < Action
|
1216
|
+
|
1217
|
+
def initialize(h={})
|
1218
|
+
super(h)
|
1219
|
+
@group = 'location'
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
end
|
1223
|
+
|
1058
1224
|
# Category: Location
|
1059
1225
|
#
|
1060
1226
|
class ShareLocationAction < LocationAction
|
1061
1227
|
|
1062
1228
|
def initialize(h={})
|
1229
|
+
|
1230
|
+
super()
|
1063
1231
|
|
1064
1232
|
options = {
|
1065
1233
|
email: '',
|
1066
|
-
variable: {:m_stringValue=>"", :m_name=>"",
|
1234
|
+
variable: {:m_stringValue=>"", :m_name=>"",
|
1235
|
+
:m_decimalValue=>0.0, :isLocal=>true, :m_booleanValue=>false,
|
1236
|
+
:excludeFromLog=>false, :m_intValue=>0, :m_type=>2},
|
1067
1237
|
sim_id: 0,
|
1068
1238
|
output_channel: 5,
|
1069
1239
|
old_variable_format: true
|
@@ -1073,13 +1243,15 @@ class ShareLocationAction < LocationAction
|
|
1073
1243
|
|
1074
1244
|
end
|
1075
1245
|
|
1076
|
-
def to_s(colour: false)
|
1077
|
-
'
|
1246
|
+
def to_s(colour: false, indent: 0)
|
1247
|
+
@s = 'Share Location' + "\n GPS" # + @h.inspect
|
1248
|
+
super()
|
1078
1249
|
end
|
1079
1250
|
|
1080
1251
|
alias to_summary to_s
|
1081
1252
|
end
|
1082
1253
|
|
1254
|
+
|
1083
1255
|
# Category: Location
|
1084
1256
|
#
|
1085
1257
|
class SetLocationUpdateRateAction < LocationAction
|
@@ -1095,7 +1267,7 @@ class SetLocationUpdateRateAction < LocationAction
|
|
1095
1267
|
|
1096
1268
|
end
|
1097
1269
|
|
1098
|
-
def to_s(colour: false)
|
1270
|
+
def to_s(colour: false, indent: 0)
|
1099
1271
|
'SetLocationUpdateRateAction ' + @h.inspect
|
1100
1272
|
end
|
1101
1273
|
|
@@ -1138,7 +1310,7 @@ class AddCalendarEntryAction < LoggingAction
|
|
1138
1310
|
|
1139
1311
|
end
|
1140
1312
|
|
1141
|
-
def to_s(colour: false)
|
1313
|
+
def to_s(colour: false, indent: 0)
|
1142
1314
|
'AddCalendarEntryAction ' + @h.inspect
|
1143
1315
|
end
|
1144
1316
|
|
@@ -1160,7 +1332,7 @@ class LogAction < LoggingAction
|
|
1160
1332
|
|
1161
1333
|
end
|
1162
1334
|
|
1163
|
-
def to_s(colour: false)
|
1335
|
+
def to_s(colour: false, indent: 0)
|
1164
1336
|
'LogAction ' + @h.inspect
|
1165
1337
|
end
|
1166
1338
|
|
@@ -1181,13 +1353,39 @@ class ClearLogAction < LoggingAction
|
|
1181
1353
|
|
1182
1354
|
end
|
1183
1355
|
|
1184
|
-
def to_s(colour: false)
|
1356
|
+
def to_s(colour: false, indent: 0)
|
1185
1357
|
'ClearLogAction ' + @h.inspect
|
1186
1358
|
end
|
1187
1359
|
|
1188
1360
|
alias to_summary to_s
|
1189
1361
|
end
|
1190
1362
|
|
1363
|
+
# MacroDroid Specific
|
1364
|
+
#
|
1365
|
+
class ConfirmNextAction < Action
|
1366
|
+
|
1367
|
+
def initialize(h={})
|
1368
|
+
|
1369
|
+
options = {
|
1370
|
+
:message=>"Do you want to fill the clipboard? ", :title=>"Fill clipboard? ", :negative_text=>"NO", :positive_text=>"YES", :class_type=>"ConfirmNextAction"
|
1371
|
+
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
super(h)
|
1375
|
+
|
1376
|
+
end
|
1377
|
+
|
1378
|
+
def to_s(colour: false, indent: 0)
|
1379
|
+
|
1380
|
+
@s = 'Confirm Next' + "\n %s: %s" % [@h[:title], @h[:message]]
|
1381
|
+
super()
|
1382
|
+
|
1383
|
+
end
|
1384
|
+
|
1385
|
+
alias to_summary to_s
|
1386
|
+
|
1387
|
+
end
|
1388
|
+
|
1191
1389
|
# MacroDroid Specific
|
1192
1390
|
#
|
1193
1391
|
class ExportMacrosAction < Action
|
@@ -1201,7 +1399,7 @@ class ExportMacrosAction < Action
|
|
1201
1399
|
|
1202
1400
|
end
|
1203
1401
|
|
1204
|
-
def to_s(colour: false)
|
1402
|
+
def to_s(colour: false, indent: 0)
|
1205
1403
|
|
1206
1404
|
'Export macros'
|
1207
1405
|
|
@@ -1211,6 +1409,114 @@ class ExportMacrosAction < Action
|
|
1211
1409
|
|
1212
1410
|
end
|
1213
1411
|
|
1412
|
+
|
1413
|
+
# MacroDroid Specific
|
1414
|
+
#
|
1415
|
+
class SetVariableAction < Action
|
1416
|
+
|
1417
|
+
def initialize(h={})
|
1418
|
+
|
1419
|
+
options = {
|
1420
|
+
:user_prompt=>true,
|
1421
|
+
:user_prompt_message=>"Please enter a word to see it reversed",
|
1422
|
+
:user_prompt_show_cancel=>true,
|
1423
|
+
:user_prompt_stop_after_cancel=>true,
|
1424
|
+
:user_prompt_title=>"Word reverse",
|
1425
|
+
:name => 'word'
|
1426
|
+
}
|
1427
|
+
super(h)
|
1428
|
+
|
1429
|
+
end
|
1430
|
+
|
1431
|
+
def to_s(colour: false, indent: 0)
|
1432
|
+
|
1433
|
+
input = if @h[:user_prompt] then
|
1434
|
+
'[User Prompt]'
|
1435
|
+
elsif @h[:expression]
|
1436
|
+
@h[:expression]
|
1437
|
+
elsif @h[:int_value_increment]
|
1438
|
+
'(+1)'
|
1439
|
+
elsif @h[:int_value_decrement]
|
1440
|
+
'(-1)'
|
1441
|
+
elsif @h[:int_random]
|
1442
|
+
"Random %d -> %d" % [@h[:int_random_min], @h[:int_random_max]]
|
1443
|
+
else
|
1444
|
+
|
1445
|
+
=begin
|
1446
|
+
sym = case @h[:variable][:type]
|
1447
|
+
when 0 # boolean
|
1448
|
+
:new_boolean_value
|
1449
|
+
when 1 # integer
|
1450
|
+
:new_int_value
|
1451
|
+
when 2 # string
|
1452
|
+
:new_string_value
|
1453
|
+
when 3 # decimal
|
1454
|
+
:new_double_value
|
1455
|
+
end
|
1456
|
+
|
1457
|
+
@h[sym].to_s
|
1458
|
+
=end
|
1459
|
+
a = %i(new_boolean_value new_int_value new_string_value new_double_value)
|
1460
|
+
@h[a[@h[:variable][:type]]].to_s
|
1461
|
+
|
1462
|
+
end
|
1463
|
+
|
1464
|
+
@s = 'Set Variable' + ("\n %s: " % @h[:variable][:name]) + input #+ @h.inspect
|
1465
|
+
super()
|
1466
|
+
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
alias to_summary to_s
|
1470
|
+
|
1471
|
+
end
|
1472
|
+
|
1473
|
+
|
1474
|
+
|
1475
|
+
# MacroDroid Specific
|
1476
|
+
#
|
1477
|
+
class TextManipulationAction < Action
|
1478
|
+
|
1479
|
+
def initialize(h={})
|
1480
|
+
|
1481
|
+
options = {
|
1482
|
+
|
1483
|
+
}
|
1484
|
+
super(h)
|
1485
|
+
|
1486
|
+
end
|
1487
|
+
|
1488
|
+
def to_s(colour: false, indent: 0)
|
1489
|
+
|
1490
|
+
#tm = @h[:text_manipulation][:type]
|
1491
|
+
|
1492
|
+
#s = case tm[:type].to_sym
|
1493
|
+
s = case 3 # @h[:text_manipulation][:option].to_i
|
1494
|
+
when 0 # :SubstringManipulation
|
1495
|
+
"Substring(%s, %s)" % [@h[:text], tm[:params].join(', ')]
|
1496
|
+
when 1 # :ReplaceAllManipulation
|
1497
|
+
"Replace all(%s, %s, %s)" % [@h[:text], *tm[:params]]
|
1498
|
+
when 2 # :ExtractTextManipulation
|
1499
|
+
"Extract text(%s, %s)" % [@h[:text], tm[:params].join(', ')]
|
1500
|
+
when 3 # :UpperCaseManipulation
|
1501
|
+
"Upper case(%s)" % [@h[:text]]
|
1502
|
+
#'foo'
|
1503
|
+
when 4 # :LowerCaseManipulation
|
1504
|
+
"Lower case(%s)" % [@h[:text]]
|
1505
|
+
when 5 # :TrimWhitespaceManipulation
|
1506
|
+
"Trim whitespace(%s)" % [@h[:text]]
|
1507
|
+
end
|
1508
|
+
|
1509
|
+
'Text Manipulation' + "\n " + s.inspect #+ ' ' + @h.inspect
|
1510
|
+
|
1511
|
+
end
|
1512
|
+
|
1513
|
+
alias to_summary to_s
|
1514
|
+
|
1515
|
+
end
|
1516
|
+
|
1517
|
+
|
1518
|
+
|
1519
|
+
|
1214
1520
|
class PauseAction < Action
|
1215
1521
|
|
1216
1522
|
def initialize(h={})
|
@@ -1222,7 +1528,7 @@ class PauseAction < Action
|
|
1222
1528
|
|
1223
1529
|
end
|
1224
1530
|
|
1225
|
-
def to_s(colour: false)
|
1531
|
+
def to_s(colour: false, indent: 0)
|
1226
1532
|
|
1227
1533
|
su = Subunit.new(units={minutes:60, hours:60},
|
1228
1534
|
seconds: @h[:delay_in_seconds])
|
@@ -1266,7 +1572,7 @@ class RecordMicrophoneAction < MediaAction
|
|
1266
1572
|
|
1267
1573
|
end
|
1268
1574
|
|
1269
|
-
def to_s(colour: false)
|
1575
|
+
def to_s(colour: false, indent: 0)
|
1270
1576
|
'RecordMicrophoneAction ' + @h.inspect
|
1271
1577
|
end
|
1272
1578
|
|
@@ -1288,7 +1594,7 @@ class PlaySoundAction < MediaAction
|
|
1288
1594
|
|
1289
1595
|
end
|
1290
1596
|
|
1291
|
-
def to_s(colour: false)
|
1597
|
+
def to_s(colour: false, indent: 0)
|
1292
1598
|
'Play: ' + @h[:file_path]
|
1293
1599
|
end
|
1294
1600
|
|
@@ -1324,8 +1630,10 @@ class SendEmailAction < MessagingAction
|
|
1324
1630
|
|
1325
1631
|
end
|
1326
1632
|
|
1327
|
-
def to_s(colour: false)
|
1328
|
-
|
1633
|
+
def to_s(colour: false, indent: 0)
|
1634
|
+
recipient = @h[:email_address]
|
1635
|
+
@s = 'Send EmailAction' + "\n To: " + recipient #+ ' ' + @h.inspect
|
1636
|
+
super()
|
1329
1637
|
end
|
1330
1638
|
|
1331
1639
|
alias to_summary to_s
|
@@ -1350,7 +1658,7 @@ class SendSMSAction < MessagingAction
|
|
1350
1658
|
|
1351
1659
|
end
|
1352
1660
|
|
1353
|
-
def to_s(colour: false)
|
1661
|
+
def to_s(colour: false, indent: 0)
|
1354
1662
|
'SendSMSAction ' + @h.inspect
|
1355
1663
|
end
|
1356
1664
|
|
@@ -1373,7 +1681,7 @@ class UDPCommandAction < MessagingAction
|
|
1373
1681
|
|
1374
1682
|
end
|
1375
1683
|
|
1376
|
-
def to_s(colour: false)
|
1684
|
+
def to_s(colour: false, indent: 0)
|
1377
1685
|
'UDPCommandAction ' + @h.inspect
|
1378
1686
|
end
|
1379
1687
|
|
@@ -1412,7 +1720,7 @@ class ClearNotificationsAction < NotificationsAction
|
|
1412
1720
|
|
1413
1721
|
end
|
1414
1722
|
|
1415
|
-
def to_s(colour: false)
|
1723
|
+
def to_s(colour: false, indent: 0)
|
1416
1724
|
'ClearNotificationsAction ' + @h.inspect
|
1417
1725
|
end
|
1418
1726
|
|
@@ -1444,7 +1752,7 @@ class MessageDialogAction < NotificationsAction
|
|
1444
1752
|
|
1445
1753
|
end
|
1446
1754
|
|
1447
|
-
def to_s(colour: false)
|
1755
|
+
def to_s(colour: false, indent: 0)
|
1448
1756
|
'Display Dialog' + "\n Battery at: [battery]"
|
1449
1757
|
end
|
1450
1758
|
|
@@ -1464,7 +1772,7 @@ class AllowLEDNotificationLightAction < NotificationsAction
|
|
1464
1772
|
|
1465
1773
|
end
|
1466
1774
|
|
1467
|
-
def to_s(colour: false)
|
1775
|
+
def to_s(colour: false, indent: 0)
|
1468
1776
|
'AllowLEDNotificationLightAction ' + @h.inspect
|
1469
1777
|
end
|
1470
1778
|
|
@@ -1485,7 +1793,7 @@ class SetNotificationSoundAction < NotificationsAction
|
|
1485
1793
|
|
1486
1794
|
end
|
1487
1795
|
|
1488
|
-
def to_s(colour: false)
|
1796
|
+
def to_s(colour: false, indent: 0)
|
1489
1797
|
'SetNotificationSoundAction ' + @h.inspect
|
1490
1798
|
end
|
1491
1799
|
|
@@ -1506,7 +1814,7 @@ class SetNotificationSoundAction < NotificationsAction
|
|
1506
1814
|
|
1507
1815
|
end
|
1508
1816
|
|
1509
|
-
def to_s(colour: false)
|
1817
|
+
def to_s(colour: false, indent: 0)
|
1510
1818
|
'SetNotificationSoundAction ' + @h.inspect
|
1511
1819
|
end
|
1512
1820
|
|
@@ -1527,7 +1835,7 @@ class SetNotificationSoundAction < NotificationsAction
|
|
1527
1835
|
|
1528
1836
|
end
|
1529
1837
|
|
1530
|
-
def to_s(colour: false)
|
1838
|
+
def to_s(colour: false, indent: 0)
|
1531
1839
|
'SetNotificationSoundAction ' + @h.inspect
|
1532
1840
|
end
|
1533
1841
|
|
@@ -1561,7 +1869,7 @@ class NotificationAction < NotificationsAction
|
|
1561
1869
|
|
1562
1870
|
end
|
1563
1871
|
|
1564
|
-
def to_s(colour: false)
|
1872
|
+
def to_s(colour: false, indent: 0)
|
1565
1873
|
"Display Notification\n " + \
|
1566
1874
|
"%s: %s" % [@h[:notification_subject], @h[:notification_text]]
|
1567
1875
|
end
|
@@ -1572,7 +1880,13 @@ end
|
|
1572
1880
|
#
|
1573
1881
|
class ToastAction < NotificationsAction
|
1574
1882
|
|
1575
|
-
def initialize(
|
1883
|
+
def initialize(obj)
|
1884
|
+
|
1885
|
+
h = if obj.is_a? Hash then
|
1886
|
+
obj
|
1887
|
+
else
|
1888
|
+
{msg: obj}
|
1889
|
+
end
|
1576
1890
|
|
1577
1891
|
if h[:msg] then
|
1578
1892
|
h[:message_text] = h[:msg]
|
@@ -1602,8 +1916,8 @@ class ToastAction < NotificationsAction
|
|
1602
1916
|
"popup_message '%s'" % @h[:message_text]
|
1603
1917
|
end
|
1604
1918
|
|
1605
|
-
def to_s(colour: false)
|
1606
|
-
"Popup Message\n %s" % @h[:message_text]
|
1919
|
+
def to_s(colour: false, indent: 0)
|
1920
|
+
@s = "Popup Message\n %s" % @h[:message_text]
|
1607
1921
|
end
|
1608
1922
|
|
1609
1923
|
end
|
@@ -1632,7 +1946,7 @@ class AnswerCallAction < PhoneAction
|
|
1632
1946
|
|
1633
1947
|
end
|
1634
1948
|
|
1635
|
-
def to_s(colour: false)
|
1949
|
+
def to_s(colour: false, indent: 0)
|
1636
1950
|
@s = 'Answer Call' + "\n "
|
1637
1951
|
super()
|
1638
1952
|
end
|
@@ -1654,7 +1968,7 @@ class ClearCallLogAction < PhoneAction
|
|
1654
1968
|
|
1655
1969
|
end
|
1656
1970
|
|
1657
|
-
def to_s(colour: false)
|
1971
|
+
def to_s(colour: false, indent: 0)
|
1658
1972
|
'ClearCallLogAction ' + @h.inspect
|
1659
1973
|
end
|
1660
1974
|
|
@@ -1674,7 +1988,7 @@ class OpenCallLogAction < PhoneAction
|
|
1674
1988
|
|
1675
1989
|
end
|
1676
1990
|
|
1677
|
-
def to_s(colour: false)
|
1991
|
+
def to_s(colour: false, indent: 0)
|
1678
1992
|
'OpenCallLogAction ' + @h.inspect
|
1679
1993
|
end
|
1680
1994
|
|
@@ -1694,7 +2008,7 @@ class RejectCallAction < PhoneAction
|
|
1694
2008
|
|
1695
2009
|
end
|
1696
2010
|
|
1697
|
-
def to_s(colour: false)
|
2011
|
+
def to_s(colour: false, indent: 0)
|
1698
2012
|
@s = 'Call Reject' + "\n "
|
1699
2013
|
super()
|
1700
2014
|
end
|
@@ -1716,7 +2030,7 @@ class MakeCallAction < PhoneAction
|
|
1716
2030
|
|
1717
2031
|
end
|
1718
2032
|
|
1719
|
-
def to_s(colour: false)
|
2033
|
+
def to_s(colour: false, indent: 0)
|
1720
2034
|
'MakeCallAction ' + @h.inspect
|
1721
2035
|
end
|
1722
2036
|
|
@@ -1738,7 +2052,7 @@ class SetRingtoneAction < PhoneAction
|
|
1738
2052
|
|
1739
2053
|
end
|
1740
2054
|
|
1741
|
-
def to_s(colour: false)
|
2055
|
+
def to_s(colour: false, indent: 0)
|
1742
2056
|
'SetRingtoneAction ' + @h.inspect
|
1743
2057
|
end
|
1744
2058
|
|
@@ -1770,7 +2084,7 @@ class SetBrightnessAction < ScreenAction
|
|
1770
2084
|
|
1771
2085
|
end
|
1772
2086
|
|
1773
|
-
def to_s(colour: false)
|
2087
|
+
def to_s(colour: false, indent: 0)
|
1774
2088
|
'SetBrightnessAction ' + @h.inspect
|
1775
2089
|
end
|
1776
2090
|
|
@@ -1791,7 +2105,7 @@ class ForceScreenRotationAction < ScreenAction
|
|
1791
2105
|
|
1792
2106
|
end
|
1793
2107
|
|
1794
|
-
def to_s(colour: false)
|
2108
|
+
def to_s(colour: false, indent: 0)
|
1795
2109
|
'ForceScreenRotationAction ' + @h.inspect
|
1796
2110
|
end
|
1797
2111
|
|
@@ -1815,7 +2129,7 @@ class ScreenOnAction < ScreenAction
|
|
1815
2129
|
|
1816
2130
|
end
|
1817
2131
|
|
1818
|
-
def to_s(colour: false)
|
2132
|
+
def to_s(colour: false, indent: 0)
|
1819
2133
|
|
1820
2134
|
state = @h[:screen_off] ? 'Off' : 'On'
|
1821
2135
|
state += ' ' + 'No Lock (root only)' if @h[:screen_off_no_lock]
|
@@ -1843,7 +2157,7 @@ class DimScreenAction < ScreenAction
|
|
1843
2157
|
|
1844
2158
|
end
|
1845
2159
|
|
1846
|
-
def to_s(colour: false)
|
2160
|
+
def to_s(colour: false, indent: 0)
|
1847
2161
|
'DimScreenAction ' + @h.inspect
|
1848
2162
|
end
|
1849
2163
|
|
@@ -1871,7 +2185,7 @@ class KeepAwakeAction < ScreenAction
|
|
1871
2185
|
|
1872
2186
|
end
|
1873
2187
|
|
1874
|
-
def to_s(colour: false)
|
2188
|
+
def to_s(colour: false, indent: 0)
|
1875
2189
|
|
1876
2190
|
screen = @h[:screen_option] == 0 ? 'Screen On' : 'Screen Off'
|
1877
2191
|
|
@@ -1912,7 +2226,7 @@ class SetScreenTimeoutAction < ScreenAction
|
|
1912
2226
|
|
1913
2227
|
end
|
1914
2228
|
|
1915
|
-
def to_s(colour: false)
|
2229
|
+
def to_s(colour: false, indent: 0)
|
1916
2230
|
'SetScreenTimeoutAction ' + @h.inspect
|
1917
2231
|
end
|
1918
2232
|
|
@@ -1943,7 +2257,7 @@ class SilentModeVibrateOffAction < VolumeAction
|
|
1943
2257
|
|
1944
2258
|
end
|
1945
2259
|
|
1946
|
-
def to_s(colour: false)
|
2260
|
+
def to_s(colour: false, indent: 0)
|
1947
2261
|
'SilentModeVibrateOffAction ' + @h.inspect
|
1948
2262
|
end
|
1949
2263
|
|
@@ -1965,7 +2279,7 @@ class SetVibrateAction < VolumeAction
|
|
1965
2279
|
|
1966
2280
|
end
|
1967
2281
|
|
1968
|
-
def to_s(colour: false)
|
2282
|
+
def to_s(colour: false, indent: 0)
|
1969
2283
|
|
1970
2284
|
a = [
|
1971
2285
|
'Silent (Vibrate On)',
|
@@ -2002,7 +2316,7 @@ class VolumeIncrementDecrementAction < VolumeAction
|
|
2002
2316
|
|
2003
2317
|
end
|
2004
2318
|
|
2005
|
-
def to_s(colour: false)
|
2319
|
+
def to_s(colour: false, indent: 0)
|
2006
2320
|
'VolumeIncrementDecrementAction ' + @h.inspect
|
2007
2321
|
end
|
2008
2322
|
|
@@ -2024,7 +2338,7 @@ class SpeakerPhoneAction < VolumeAction
|
|
2024
2338
|
|
2025
2339
|
end
|
2026
2340
|
|
2027
|
-
def to_s(colour: false)
|
2341
|
+
def to_s(colour: false, indent: 0)
|
2028
2342
|
'SpeakerPhoneAction ' + @h.inspect
|
2029
2343
|
end
|
2030
2344
|
|
@@ -2049,7 +2363,7 @@ class SetVolumeAction < VolumeAction
|
|
2049
2363
|
|
2050
2364
|
end
|
2051
2365
|
|
2052
|
-
def to_s(colour: false)
|
2366
|
+
def to_s(colour: false, indent: 0)
|
2053
2367
|
volume = @h[:stream_index_array].zip(@h[:stream_volume_array]).to_h[true]
|
2054
2368
|
'Volume Change ' + "Notification = %s%%" % volume
|
2055
2369
|
end
|