ruby-macrodroid 0.8.7 → 0.8.8

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: e161537334457ba0da45d5058d8a7a75a1a845cb2e5b9aa7895ea224aac472c5
4
- data.tar.gz: 9503ca1e163739e18fba141a333e99fcf27eb3c34c34798f72099f723e63f3fb
3
+ metadata.gz: 24d851b05dbc6ecfd52b146846a6bbe935a06d30bfdf523c0550bd18c701b93b
4
+ data.tar.gz: 97171c71818bc1d0ce3ed70dc790f3464170e18f8ff62b5b3ff47b66f40c49d0
5
5
  SHA512:
6
- metadata.gz: 1035077a740b2308cde75c96da176d0dd616111bd9541b364ce2a9e3f13eb39a3ad49930222348a186fe1180bade2eb264e0a9cf4bf05ee5efd2802da27a3850
7
- data.tar.gz: 6f0919e4921f12d5c646484f56b8c5b459335d3997559226803e4da30ec5e96e007882a247c0a52ff9766702066f28df534c044792c557a40335079828458da0
6
+ metadata.gz: a9187782e93e70a758e50a07c49812d5bb915dab37bb108d174157a76d76cc2b625b766665ad5ac3f47c7d12d3ac8082b291966aa36c114d4d573ddf38e567b3
7
+ data.tar.gz: 7514ffbe6a9b4c063fe278c685ce0a860b4d28a1945d4819faa65b081395b701b5dab657a3d7764b87689f230c74d7c14051e563ad4360937ade7f78466ac3a3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -689,7 +689,7 @@ EOF
689
689
 
690
690
  end
691
691
 
692
- if s =~ /^(?:If|WHILE \/ DO)/i then
692
+ if s =~ /^(?:If|DO \/ WHILE)/i then
693
693
 
694
694
  if indent < 1 then
695
695
 
@@ -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
 
@@ -97,7 +97,7 @@ class LaunchActivityAction < ApplicationAction
97
97
 
98
98
  end
99
99
 
100
- def to_s(colour: false)
100
+ def to_s(colour: false, indent: 0)
101
101
  'Launch ' + @h[:application_name]
102
102
  end
103
103
 
@@ -118,7 +118,7 @@ class KillBackgroundAppAction < ApplicationAction
118
118
 
119
119
  end
120
120
 
121
- def to_s(colour: false)
121
+ def to_s(colour: false, indent: 0)
122
122
  'KillBackgroundAppAction ' + @h.inspect
123
123
  end
124
124
 
@@ -139,7 +139,7 @@ class LaunchShortcutAction < ApplicationAction
139
139
 
140
140
  end
141
141
 
142
- def to_s(colour: false)
142
+ def to_s(colour: false, indent: 0)
143
143
  @s = "Launch Shortcut: " + @h[:app_name] + "\n " + @h[:name]
144
144
  super()
145
145
  end
@@ -168,7 +168,7 @@ class OpenWebPageAction < ApplicationAction
168
168
 
169
169
  end
170
170
 
171
- def to_s(colour: false)
171
+ def to_s(colour: false, indent: 0)
172
172
  "HTTP GET\n url: " + @h[:url_to_open]
173
173
  end
174
174
 
@@ -199,7 +199,7 @@ class UploadPhotoAction < CameraAction
199
199
 
200
200
  end
201
201
 
202
- def to_s(colour: false)
202
+ def to_s(colour: false, indent: 0)
203
203
  'UploadPhotoAction ' + @h.inspect
204
204
  end
205
205
 
@@ -229,7 +229,7 @@ class TakePictureAction < CameraAction
229
229
  'take_photo :' + camera.to_s
230
230
  end
231
231
 
232
- def to_s(colour: false)
232
+ def to_s(colour: false, indent: 0)
233
233
  'Take Picture'
234
234
  end
235
235
 
@@ -256,7 +256,7 @@ class IfConfirmedThenAction < Action
256
256
 
257
257
  end
258
258
 
259
- def to_s(colour: false)
259
+ def to_s(colour: false, indent: 0)
260
260
 
261
261
  @s = "If Confirmed Then " #+ @constraints.map(&:to_s).join(" %s " % operator)
262
262
  super(colour: colour)
@@ -278,13 +278,13 @@ class LoopAction < Action
278
278
 
279
279
  super(h2)
280
280
 
281
- @label = 'WHILE / DO '
281
+ @label = 'DO / WHILE '
282
282
 
283
283
  end
284
284
 
285
- def to_s(colour: false)
285
+ def to_s(colour: false, indent: 0)
286
286
 
287
- @s = 'WHILE / DO '
287
+ @s = 'DO / WHILE '
288
288
  super()
289
289
 
290
290
  end
@@ -308,7 +308,7 @@ class EndLoopAction < Action
308
308
 
309
309
  end
310
310
 
311
- def to_s(colour: false)
311
+ def to_s(colour: false, indent: 0)
312
312
 
313
313
  'End Loop '
314
314
 
@@ -342,7 +342,7 @@ class IfConditionAction < Action
342
342
 
343
343
  end
344
344
 
345
- def to_s(colour: false)
345
+ def to_s(colour: false, indent: 0)
346
346
 
347
347
  @s = "If " #+ @constraints.map(&:to_s).join(" %s " % operator)
348
348
  super(colour: colour)
@@ -363,7 +363,7 @@ class ElseAction < Action
363
363
 
364
364
  end
365
365
 
366
- def to_s(colour: false)
366
+ def to_s(colour: false, indent: 0)
367
367
  'Else'
368
368
  end
369
369
 
@@ -382,7 +382,7 @@ class ElseIfConditionAction < Action
382
382
 
383
383
  end
384
384
 
385
- def to_s(colour: false)
385
+ def to_s(colour: false, indent: 0)
386
386
  @s = 'Else If '
387
387
  super()
388
388
  end
@@ -403,7 +403,7 @@ class EndIfAction < Action
403
403
 
404
404
  end
405
405
 
406
- def to_s(colour: false)
406
+ def to_s(colour: false, indent: 0)
407
407
  'End If'
408
408
  end
409
409
 
@@ -433,7 +433,7 @@ class SetAirplaneModeAction < ConnectivityAction
433
433
 
434
434
  end
435
435
 
436
- def to_s(colour: false)
436
+ def to_s(colour: false, indent: 0)
437
437
 
438
438
  state = ['On', 'Off', 'Toggle'][@h[:state]]
439
439
  @s = 'Airplane Mode ' + state + "\n"
@@ -459,7 +459,7 @@ class SetWifiAction < ConnectivityAction
459
459
 
460
460
  end
461
461
 
462
- def to_s(colour: false)
462
+ def to_s(colour: false, indent: 0)
463
463
  action = @h[:state] == 0 ? 'Enable' : 'Disable'
464
464
  action + ' Wifi'
465
465
  end
@@ -481,7 +481,7 @@ class SetBluetoothAction < ConnectivityAction
481
481
 
482
482
  end
483
483
 
484
- def to_s(colour: false)
484
+ def to_s(colour: false, indent: 0)
485
485
  'SetBluetoothAction ' + @h.inspect
486
486
  end
487
487
 
@@ -503,7 +503,7 @@ class SetBluetoothAction < ConnectivityAction
503
503
 
504
504
  end
505
505
 
506
- def to_s(colour: false)
506
+ def to_s(colour: false, indent: 0)
507
507
  'SetBluetoothAction ' + @h.inspect
508
508
  end
509
509
 
@@ -523,7 +523,7 @@ class SetHotspotAction < ConnectivityAction
523
523
 
524
524
  end
525
525
 
526
- def to_s(colour: false)
526
+ def to_s(colour: false, indent: 0)
527
527
  action = @h[:turn_wifi_on] ? 'Enable' : 'Disable'
528
528
  action + ' HotSpot'
529
529
  end
@@ -555,7 +555,7 @@ class SendIntentAction < ConnectivityAction
555
555
 
556
556
  end
557
557
 
558
- def to_s(colour: false)
558
+ def to_s(colour: false, indent: 0)
559
559
  'Send Intent ' + "\n " + @h[:action]
560
560
  end
561
561
 
@@ -595,7 +595,7 @@ class SetAlarmClockAction < DateTimeAction
595
595
 
596
596
  end
597
597
 
598
- def to_s(colour: false)
598
+ def to_s(colour: false, indent: 0)
599
599
  'SetAlarmClockAction ' + @h.inspect
600
600
  end
601
601
 
@@ -617,7 +617,7 @@ class StopWatchAction < DateTimeAction
617
617
 
618
618
  end
619
619
 
620
- def to_s(colour: false)
620
+ def to_s(colour: false, indent: 0)
621
621
  'StopWatchAction ' + @h.inspect
622
622
  end
623
623
 
@@ -648,7 +648,7 @@ class SayTimeAction < DateTimeAction
648
648
  'say current_time()'
649
649
  end
650
650
 
651
- def to_s(colour: false)
651
+ def to_s(colour: false, indent: 0)
652
652
  'Say Current Time'
653
653
  end
654
654
 
@@ -678,7 +678,7 @@ class AndroidShortcutsAction < DeviceAction
678
678
 
679
679
  end
680
680
 
681
- def to_s(colour: false)
681
+ def to_s(colour: false, indent: 0)
682
682
  'AndroidShortcutsAction ' + @h.inspect
683
683
  end
684
684
 
@@ -699,7 +699,7 @@ class ClipboardAction < DeviceAction
699
699
 
700
700
  end
701
701
 
702
- def to_s(colour: false)
702
+ def to_s(colour: false, indent: 0)
703
703
  'Fill Clipboard' + "\n " + @h[:clipboard_text] #+ @h.inspect
704
704
  end
705
705
 
@@ -719,7 +719,7 @@ class PressBackAction < DeviceAction
719
719
 
720
720
  end
721
721
 
722
- def to_s(colour: false)
722
+ def to_s(colour: false, indent: 0)
723
723
  'PressBackAction ' + @h.inspect
724
724
  end
725
725
 
@@ -747,7 +747,7 @@ class SpeakTextAction < DeviceAction
747
747
 
748
748
  end
749
749
 
750
- def to_s(colour: false)
750
+ def to_s(colour: false, indent: 0)
751
751
  "Speak Text (%s)" % @h[:text_to_say]
752
752
  end
753
753
 
@@ -768,8 +768,43 @@ class UIInteractionAction < DeviceAction
768
768
 
769
769
  end
770
770
 
771
- def to_s(colour: false)
772
- 'UIInteractionAction ' + @h.inspect
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
773
808
  end
774
809
 
775
810
  alias to_summary to_s
@@ -788,7 +823,7 @@ class VoiceSearchAction < DeviceAction
788
823
 
789
824
  end
790
825
 
791
- def to_s(colour: false)
826
+ def to_s(colour: false, indent: 0)
792
827
  'VoiceSearchAction ' + @h.inspect
793
828
  end
794
829
 
@@ -819,7 +854,7 @@ class ExpandCollapseStatusBarAction < DeviceSettingsAction
819
854
 
820
855
  end
821
856
 
822
- def to_s(colour: false)
857
+ def to_s(colour: false, indent: 0)
823
858
  'ExpandCollapseStatusBarAction ' + @h.inspect
824
859
  end
825
860
 
@@ -839,7 +874,7 @@ class LaunchHomeScreenAction < DeviceSettingsAction
839
874
 
840
875
  end
841
876
 
842
- def to_s(colour: false)
877
+ def to_s(colour: false, indent: 0)
843
878
  'LaunchHomeScreenAction ' + @h.inspect
844
879
  end
845
880
 
@@ -870,7 +905,7 @@ class CameraFlashLightAction < DeviceSettingsAction
870
905
  ['torch :on', 'torch :off', 'torch :toggle'][@h[:state]]
871
906
  end
872
907
 
873
- def to_s(colour: false)
908
+ def to_s(colour: false, indent: 0)
874
909
  ['Torch On', 'Torch Off', 'Torch Toggle'][@h[:state]]
875
910
  end
876
911
 
@@ -890,7 +925,7 @@ class VibrateAction < DeviceSettingsAction
890
925
 
891
926
  end
892
927
 
893
- def to_s(colour: false)
928
+ def to_s(colour: false, indent: 0)
894
929
 
895
930
  pattern = [
896
931
  'Blip', 'Short Buzz', 'Long Buzz', 'Rapid', 'Slow', 'Increasing',
@@ -917,7 +952,7 @@ class SetAutoRotateAction < DeviceSettingsAction
917
952
 
918
953
  end
919
954
 
920
- def to_s(colour: false)
955
+ def to_s(colour: false, indent: 0)
921
956
  'SetAutoRotateAction ' + @h.inspect
922
957
  end
923
958
 
@@ -937,7 +972,7 @@ class DayDreamAction < DeviceSettingsAction
937
972
 
938
973
  end
939
974
 
940
- def to_s(colour: false)
975
+ def to_s(colour: false, indent: 0)
941
976
  'DayDreamAction ' + @h.inspect
942
977
  end
943
978
 
@@ -957,7 +992,7 @@ class SetKeyboardAction < DeviceSettingsAction
957
992
 
958
993
  end
959
994
 
960
- def to_s(colour: false)
995
+ def to_s(colour: false, indent: 0)
961
996
  'SetKeyboardAction ' + @h.inspect
962
997
  end
963
998
 
@@ -978,7 +1013,7 @@ class SetKeyguardAction < DeviceSettingsAction
978
1013
 
979
1014
  end
980
1015
 
981
- def to_s(colour: false)
1016
+ def to_s(colour: false, indent: 0)
982
1017
  'SetKeyguardAction ' + @h.inspect
983
1018
  end
984
1019
 
@@ -999,7 +1034,7 @@ class CarModeAction < DeviceSettingsAction
999
1034
 
1000
1035
  end
1001
1036
 
1002
- def to_s(colour: false)
1037
+ def to_s(colour: false, indent: 0)
1003
1038
  'CarModeAction ' + @h.inspect
1004
1039
  end
1005
1040
 
@@ -1021,7 +1056,7 @@ class ChangeKeyboardAction < DeviceSettingsAction
1021
1056
 
1022
1057
  end
1023
1058
 
1024
- def to_s(colour: false)
1059
+ def to_s(colour: false, indent: 0)
1025
1060
  'ChangeKeyboardAction ' + @h.inspect
1026
1061
  end
1027
1062
 
@@ -1047,7 +1082,7 @@ class SetWallpaperAction < DeviceSettingsAction
1047
1082
 
1048
1083
  end
1049
1084
 
1050
- def to_s(colour: false)
1085
+ def to_s(colour: false, indent: 0)
1051
1086
  'SetWallpaperAction ' + @h.inspect
1052
1087
  end
1053
1088
 
@@ -1082,7 +1117,7 @@ class FileOperationV21Action < FileAction
1082
1117
 
1083
1118
  end
1084
1119
 
1085
- def to_s(colour: false)
1120
+ def to_s(colour: false, indent: 0)
1086
1121
 
1087
1122
  operation = ['Copy', 'Move', 'Delete', 'Create Folder']
1088
1123
  file = ['All Files', 'All Media Files', 'Images', 'Audio', 'Videos', 'Specify File Pattern', 'Folder']
@@ -1114,7 +1149,7 @@ class OpenFileAction < FileAction
1114
1149
 
1115
1150
  end
1116
1151
 
1117
- def to_s(colour: false)
1152
+ def to_s(colour: false, indent: 0)
1118
1153
  'OpenFileAction ' + @h.inspect
1119
1154
  end
1120
1155
 
@@ -1139,7 +1174,7 @@ class WriteToFileAction < FileAction
1139
1174
 
1140
1175
  end
1141
1176
 
1142
- def to_s(colour: false)
1177
+ def to_s(colour: false, indent: 0)
1143
1178
  'Write To File' + "\n " + @h[:filename] #+ @h.inspect
1144
1179
  end
1145
1180
 
@@ -1168,7 +1203,7 @@ class ForceLocationUpdateAction < LocationAction
1168
1203
 
1169
1204
  end
1170
1205
 
1171
- def to_s(colour: false)
1206
+ def to_s(colour: false, indent: 0)
1172
1207
  'ForceLocationUpdateAction ' + @h.inspect
1173
1208
  end
1174
1209
 
@@ -1208,7 +1243,7 @@ class ShareLocationAction < LocationAction
1208
1243
 
1209
1244
  end
1210
1245
 
1211
- def to_s(colour: false)
1246
+ def to_s(colour: false, indent: 0)
1212
1247
  @s = 'Share Location' + "\n GPS" # + @h.inspect
1213
1248
  super()
1214
1249
  end
@@ -1232,7 +1267,7 @@ class SetLocationUpdateRateAction < LocationAction
1232
1267
 
1233
1268
  end
1234
1269
 
1235
- def to_s(colour: false)
1270
+ def to_s(colour: false, indent: 0)
1236
1271
  'SetLocationUpdateRateAction ' + @h.inspect
1237
1272
  end
1238
1273
 
@@ -1275,7 +1310,7 @@ class AddCalendarEntryAction < LoggingAction
1275
1310
 
1276
1311
  end
1277
1312
 
1278
- def to_s(colour: false)
1313
+ def to_s(colour: false, indent: 0)
1279
1314
  'AddCalendarEntryAction ' + @h.inspect
1280
1315
  end
1281
1316
 
@@ -1297,7 +1332,7 @@ class LogAction < LoggingAction
1297
1332
 
1298
1333
  end
1299
1334
 
1300
- def to_s(colour: false)
1335
+ def to_s(colour: false, indent: 0)
1301
1336
  'LogAction ' + @h.inspect
1302
1337
  end
1303
1338
 
@@ -1318,7 +1353,7 @@ class ClearLogAction < LoggingAction
1318
1353
 
1319
1354
  end
1320
1355
 
1321
- def to_s(colour: false)
1356
+ def to_s(colour: false, indent: 0)
1322
1357
  'ClearLogAction ' + @h.inspect
1323
1358
  end
1324
1359
 
@@ -1340,7 +1375,7 @@ class ConfirmNextAction < Action
1340
1375
 
1341
1376
  end
1342
1377
 
1343
- def to_s(colour: false)
1378
+ def to_s(colour: false, indent: 0)
1344
1379
 
1345
1380
  @s = 'Confirm Next' + "\n %s: %s" % [@h[:title], @h[:message]]
1346
1381
  super()
@@ -1364,7 +1399,7 @@ class ExportMacrosAction < Action
1364
1399
 
1365
1400
  end
1366
1401
 
1367
- def to_s(colour: false)
1402
+ def to_s(colour: false, indent: 0)
1368
1403
 
1369
1404
  'Export macros'
1370
1405
 
@@ -1393,7 +1428,7 @@ class SetVariableAction < Action
1393
1428
 
1394
1429
  end
1395
1430
 
1396
- def to_s(colour: false)
1431
+ def to_s(colour: false, indent: 0)
1397
1432
 
1398
1433
  input = if @h[:user_prompt] then
1399
1434
  '[User Prompt]'
@@ -1450,7 +1485,7 @@ class TextManipulationAction < Action
1450
1485
 
1451
1486
  end
1452
1487
 
1453
- def to_s(colour: false)
1488
+ def to_s(colour: false, indent: 0)
1454
1489
 
1455
1490
  #tm = @h[:text_manipulation][:type]
1456
1491
 
@@ -1493,7 +1528,7 @@ class PauseAction < Action
1493
1528
 
1494
1529
  end
1495
1530
 
1496
- def to_s(colour: false)
1531
+ def to_s(colour: false, indent: 0)
1497
1532
 
1498
1533
  su = Subunit.new(units={minutes:60, hours:60},
1499
1534
  seconds: @h[:delay_in_seconds])
@@ -1537,7 +1572,7 @@ class RecordMicrophoneAction < MediaAction
1537
1572
 
1538
1573
  end
1539
1574
 
1540
- def to_s(colour: false)
1575
+ def to_s(colour: false, indent: 0)
1541
1576
  'RecordMicrophoneAction ' + @h.inspect
1542
1577
  end
1543
1578
 
@@ -1559,7 +1594,7 @@ class PlaySoundAction < MediaAction
1559
1594
 
1560
1595
  end
1561
1596
 
1562
- def to_s(colour: false)
1597
+ def to_s(colour: false, indent: 0)
1563
1598
  'Play: ' + @h[:file_path]
1564
1599
  end
1565
1600
 
@@ -1595,7 +1630,7 @@ class SendEmailAction < MessagingAction
1595
1630
 
1596
1631
  end
1597
1632
 
1598
- def to_s(colour: false)
1633
+ def to_s(colour: false, indent: 0)
1599
1634
  recipient = @h[:email_address]
1600
1635
  @s = 'Send EmailAction' + "\n To: " + recipient #+ ' ' + @h.inspect
1601
1636
  super()
@@ -1623,7 +1658,7 @@ class SendSMSAction < MessagingAction
1623
1658
 
1624
1659
  end
1625
1660
 
1626
- def to_s(colour: false)
1661
+ def to_s(colour: false, indent: 0)
1627
1662
  'SendSMSAction ' + @h.inspect
1628
1663
  end
1629
1664
 
@@ -1646,7 +1681,7 @@ class UDPCommandAction < MessagingAction
1646
1681
 
1647
1682
  end
1648
1683
 
1649
- def to_s(colour: false)
1684
+ def to_s(colour: false, indent: 0)
1650
1685
  'UDPCommandAction ' + @h.inspect
1651
1686
  end
1652
1687
 
@@ -1685,7 +1720,7 @@ class ClearNotificationsAction < NotificationsAction
1685
1720
 
1686
1721
  end
1687
1722
 
1688
- def to_s(colour: false)
1723
+ def to_s(colour: false, indent: 0)
1689
1724
  'ClearNotificationsAction ' + @h.inspect
1690
1725
  end
1691
1726
 
@@ -1717,7 +1752,7 @@ class MessageDialogAction < NotificationsAction
1717
1752
 
1718
1753
  end
1719
1754
 
1720
- def to_s(colour: false)
1755
+ def to_s(colour: false, indent: 0)
1721
1756
  'Display Dialog' + "\n Battery at: [battery]"
1722
1757
  end
1723
1758
 
@@ -1737,7 +1772,7 @@ class AllowLEDNotificationLightAction < NotificationsAction
1737
1772
 
1738
1773
  end
1739
1774
 
1740
- def to_s(colour: false)
1775
+ def to_s(colour: false, indent: 0)
1741
1776
  'AllowLEDNotificationLightAction ' + @h.inspect
1742
1777
  end
1743
1778
 
@@ -1758,7 +1793,7 @@ class SetNotificationSoundAction < NotificationsAction
1758
1793
 
1759
1794
  end
1760
1795
 
1761
- def to_s(colour: false)
1796
+ def to_s(colour: false, indent: 0)
1762
1797
  'SetNotificationSoundAction ' + @h.inspect
1763
1798
  end
1764
1799
 
@@ -1779,7 +1814,7 @@ class SetNotificationSoundAction < NotificationsAction
1779
1814
 
1780
1815
  end
1781
1816
 
1782
- def to_s(colour: false)
1817
+ def to_s(colour: false, indent: 0)
1783
1818
  'SetNotificationSoundAction ' + @h.inspect
1784
1819
  end
1785
1820
 
@@ -1800,7 +1835,7 @@ class SetNotificationSoundAction < NotificationsAction
1800
1835
 
1801
1836
  end
1802
1837
 
1803
- def to_s(colour: false)
1838
+ def to_s(colour: false, indent: 0)
1804
1839
  'SetNotificationSoundAction ' + @h.inspect
1805
1840
  end
1806
1841
 
@@ -1834,7 +1869,7 @@ class NotificationAction < NotificationsAction
1834
1869
 
1835
1870
  end
1836
1871
 
1837
- def to_s(colour: false)
1872
+ def to_s(colour: false, indent: 0)
1838
1873
  "Display Notification\n " + \
1839
1874
  "%s: %s" % [@h[:notification_subject], @h[:notification_text]]
1840
1875
  end
@@ -1881,7 +1916,7 @@ class ToastAction < NotificationsAction
1881
1916
  "popup_message '%s'" % @h[:message_text]
1882
1917
  end
1883
1918
 
1884
- def to_s(colour: false)
1919
+ def to_s(colour: false, indent: 0)
1885
1920
  @s = "Popup Message\n %s" % @h[:message_text]
1886
1921
  end
1887
1922
 
@@ -1911,7 +1946,7 @@ class AnswerCallAction < PhoneAction
1911
1946
 
1912
1947
  end
1913
1948
 
1914
- def to_s(colour: false)
1949
+ def to_s(colour: false, indent: 0)
1915
1950
  @s = 'Answer Call' + "\n "
1916
1951
  super()
1917
1952
  end
@@ -1933,7 +1968,7 @@ class ClearCallLogAction < PhoneAction
1933
1968
 
1934
1969
  end
1935
1970
 
1936
- def to_s(colour: false)
1971
+ def to_s(colour: false, indent: 0)
1937
1972
  'ClearCallLogAction ' + @h.inspect
1938
1973
  end
1939
1974
 
@@ -1953,7 +1988,7 @@ class OpenCallLogAction < PhoneAction
1953
1988
 
1954
1989
  end
1955
1990
 
1956
- def to_s(colour: false)
1991
+ def to_s(colour: false, indent: 0)
1957
1992
  'OpenCallLogAction ' + @h.inspect
1958
1993
  end
1959
1994
 
@@ -1973,7 +2008,7 @@ class RejectCallAction < PhoneAction
1973
2008
 
1974
2009
  end
1975
2010
 
1976
- def to_s(colour: false)
2011
+ def to_s(colour: false, indent: 0)
1977
2012
  @s = 'Call Reject' + "\n "
1978
2013
  super()
1979
2014
  end
@@ -1995,7 +2030,7 @@ class MakeCallAction < PhoneAction
1995
2030
 
1996
2031
  end
1997
2032
 
1998
- def to_s(colour: false)
2033
+ def to_s(colour: false, indent: 0)
1999
2034
  'MakeCallAction ' + @h.inspect
2000
2035
  end
2001
2036
 
@@ -2017,7 +2052,7 @@ class SetRingtoneAction < PhoneAction
2017
2052
 
2018
2053
  end
2019
2054
 
2020
- def to_s(colour: false)
2055
+ def to_s(colour: false, indent: 0)
2021
2056
  'SetRingtoneAction ' + @h.inspect
2022
2057
  end
2023
2058
 
@@ -2049,7 +2084,7 @@ class SetBrightnessAction < ScreenAction
2049
2084
 
2050
2085
  end
2051
2086
 
2052
- def to_s(colour: false)
2087
+ def to_s(colour: false, indent: 0)
2053
2088
  'SetBrightnessAction ' + @h.inspect
2054
2089
  end
2055
2090
 
@@ -2070,7 +2105,7 @@ class ForceScreenRotationAction < ScreenAction
2070
2105
 
2071
2106
  end
2072
2107
 
2073
- def to_s(colour: false)
2108
+ def to_s(colour: false, indent: 0)
2074
2109
  'ForceScreenRotationAction ' + @h.inspect
2075
2110
  end
2076
2111
 
@@ -2094,7 +2129,7 @@ class ScreenOnAction < ScreenAction
2094
2129
 
2095
2130
  end
2096
2131
 
2097
- def to_s(colour: false)
2132
+ def to_s(colour: false, indent: 0)
2098
2133
 
2099
2134
  state = @h[:screen_off] ? 'Off' : 'On'
2100
2135
  state += ' ' + 'No Lock (root only)' if @h[:screen_off_no_lock]
@@ -2122,7 +2157,7 @@ class DimScreenAction < ScreenAction
2122
2157
 
2123
2158
  end
2124
2159
 
2125
- def to_s(colour: false)
2160
+ def to_s(colour: false, indent: 0)
2126
2161
  'DimScreenAction ' + @h.inspect
2127
2162
  end
2128
2163
 
@@ -2150,7 +2185,7 @@ class KeepAwakeAction < ScreenAction
2150
2185
 
2151
2186
  end
2152
2187
 
2153
- def to_s(colour: false)
2188
+ def to_s(colour: false, indent: 0)
2154
2189
 
2155
2190
  screen = @h[:screen_option] == 0 ? 'Screen On' : 'Screen Off'
2156
2191
 
@@ -2191,7 +2226,7 @@ class SetScreenTimeoutAction < ScreenAction
2191
2226
 
2192
2227
  end
2193
2228
 
2194
- def to_s(colour: false)
2229
+ def to_s(colour: false, indent: 0)
2195
2230
  'SetScreenTimeoutAction ' + @h.inspect
2196
2231
  end
2197
2232
 
@@ -2222,7 +2257,7 @@ class SilentModeVibrateOffAction < VolumeAction
2222
2257
 
2223
2258
  end
2224
2259
 
2225
- def to_s(colour: false)
2260
+ def to_s(colour: false, indent: 0)
2226
2261
  'SilentModeVibrateOffAction ' + @h.inspect
2227
2262
  end
2228
2263
 
@@ -2244,7 +2279,7 @@ class SetVibrateAction < VolumeAction
2244
2279
 
2245
2280
  end
2246
2281
 
2247
- def to_s(colour: false)
2282
+ def to_s(colour: false, indent: 0)
2248
2283
 
2249
2284
  a = [
2250
2285
  'Silent (Vibrate On)',
@@ -2281,7 +2316,7 @@ class VolumeIncrementDecrementAction < VolumeAction
2281
2316
 
2282
2317
  end
2283
2318
 
2284
- def to_s(colour: false)
2319
+ def to_s(colour: false, indent: 0)
2285
2320
  'VolumeIncrementDecrementAction ' + @h.inspect
2286
2321
  end
2287
2322
 
@@ -2303,7 +2338,7 @@ class SpeakerPhoneAction < VolumeAction
2303
2338
 
2304
2339
  end
2305
2340
 
2306
- def to_s(colour: false)
2341
+ def to_s(colour: false, indent: 0)
2307
2342
  'SpeakerPhoneAction ' + @h.inspect
2308
2343
  end
2309
2344
 
@@ -2328,7 +2363,7 @@ class SetVolumeAction < VolumeAction
2328
2363
 
2329
2364
  end
2330
2365
 
2331
- def to_s(colour: false)
2366
+ def to_s(colour: false, indent: 0)
2332
2367
  volume = @h[:stream_index_array].zip(@h[:stream_volume_array]).to_h[true]
2333
2368
  'Volume Change ' + "Notification = %s%%" % volume
2334
2369
  end
@@ -50,6 +50,19 @@ class Trigger < MacroObject
50
50
  detail.select {|k,v| @h.include? k }.all? {|key,value| @h[key] == value}
51
51
 
52
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
53
66
 
54
67
  end
55
68
 
@@ -968,10 +981,17 @@ class MusicPlayingTrigger < DeviceEventsTrigger
968
981
  end
969
982
 
970
983
  def to_s(colour: false)
971
- 'MusicPlayingTrigger ' + @h.inspect
984
+
985
+ event = @h[:option] == 0 ? 'Started' : 'Stopped'
986
+ @s = 'Music/Sound Playing' + "\n %s" % event #+ @h.inspect
987
+ super()
988
+
972
989
  end
973
990
 
974
- alias to_summary to_s
991
+ def to_summary(colour: false)
992
+ event = @h[:option] == 0 ? 'Started' : 'Stopped'
993
+ @s = 'Music/Sound Playing' + " (%s)" % event #+ @h.inspect
994
+ end
975
995
  end
976
996
 
977
997
 
@@ -1379,7 +1399,8 @@ class ProximityTrigger < SensorsTrigger
1379
1399
  'Far'
1380
1400
  end
1381
1401
 
1382
- "Proximity Sensor (%s)" % distance
1402
+ @s = "Proximity Sensor (%s)" % distance
1403
+ super()
1383
1404
  end
1384
1405
 
1385
1406
  alias to_summary to_s
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.7
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-20 00:00:00.000000000 Z
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