ruby-macrodroid 0.9.16 → 0.9.21
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 +162 -52
- data/lib/ruby-macrodroid/actionsnlp.rb +81 -8
- data/lib/ruby-macrodroid/base.rb +1 -0
- data/lib/ruby-macrodroid/triggers.rb +4 -0
- data/lib/ruby-macrodroid/triggersnlp.rb +5 -1
- metadata +24 -24
- 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: 4d144e7f32f39b31ce40a38835232d55a38204b2539427c968362c4686e676a4
         | 
| 4 | 
            +
              data.tar.gz: 38d60358f2bc2655424216ec0245206ddf5a5c736dd7ea6e0884dc62bcd764a5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c4cc2a4a27158ada5bdc3db7c9c406e3a3307ad1f07089b25e070d571f4c81a1ba74f8a8389cc57d6c7ef82c4b51524e45457d532b0a1768affcc7ddd5119ee1
         | 
| 7 | 
            +
              data.tar.gz: 69be2ef6fe08ad6b37ba57d74f80f8c787ee3cc2b9bb0ed31448df24bbb096c7e0e97f6701b2ff1d2f0b1b772382703aca90eaef36cad1c9539f4d9815437471
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
| @@ -36,18 +36,24 @@ APPS = { | |
| 36 36 | 
             
              'AutoBoy' => 'com.happyconz.blackbox',
         | 
| 37 37 | 
             
              'Amazon Alexa' => 'com.amazon.dee.app',
         | 
| 38 38 | 
             
              'Brave' => 'com.brave.browser',
         | 
| 39 | 
            -
              'Camera' => 'com. | 
| 39 | 
            +
              'Camera' => 'com.mediatek.camera',
         | 
| 40 40 | 
             
              'Cast to TV' => 'cast.video.screenmirroring.casttotv',
         | 
| 41 | 
            +
              'Calculator' => 'com.android.pri.calculator',
         | 
| 42 | 
            +
              'Calendar' => 'com.google.android.calendar',
         | 
| 43 | 
            +
              'Clock' => 'com.android.deskclock',
         | 
| 41 44 | 
             
              'File Manager' => 'com.alphainventor.filemanager',
         | 
| 42 45 | 
             
              'Firefox' => 'org.mozilla.firefox',
         | 
| 43 46 | 
             
              'Google Chrome' => 'com.google.android.chrome',
         | 
| 47 | 
            +
              'Google Calendar' => 'com.google.android.calendar',
         | 
| 44 48 | 
             
              'Chrome' => 'com.google.android.chrome',
         | 
| 49 | 
            +
              'Earth' => 'com.google.earth',
         | 
| 45 50 | 
             
              'Google Home' => 'com.google.android.apps.chromecast.app',  
         | 
| 46 51 | 
             
              'Google Play Music' => 'com.google.android.music',
         | 
| 47 52 | 
             
              'MacroDroid' => 'com.arlosoft.macrodroid',
         | 
| 48 53 | 
             
              'QuickEdit Text Editor Pro' => 'com.rhmsoft.edit.pro',
         | 
| 49 54 | 
             
              'QR & Barcode Reader' => 'com.teacapps.barcodescanner',
         | 
| 50 | 
            -
              'Settings' => 'com. | 
| 55 | 
            +
              'Settings' => 'com.android.settings',
         | 
| 56 | 
            +
              'Chrome' => 'com.google.android.street',
         | 
| 51 57 | 
             
              'tinyCam PRO' => 'com.alexvas.dvr.pro',
         | 
| 52 58 | 
             
              'Tor Browser' => 'org.torproject.torbrowser',
         | 
| 53 59 | 
             
              'VLC' => 'org.videolan.vlc',
         | 
| @@ -99,20 +105,29 @@ end | |
| 99 105 | 
             
            class LaunchActivityAction < ApplicationAction
         | 
| 100 106 |  | 
| 101 107 | 
             
              def initialize(h={})
         | 
| 102 | 
            -
             | 
| 108 | 
            +
             
         | 
| 109 | 
            +
                # option 0 is by application name, 1 is launch by package name
         | 
| 110 | 
            +
                #
         | 
| 103 111 | 
             
                options = {
         | 
| 104 112 | 
             
                  application_name: 'Chrome',
         | 
| 105 113 | 
             
                  package_to_launch: 'com.android.chrome',
         | 
| 106 114 | 
             
                  exclude_from_recents: false,
         | 
| 107 | 
            -
                  start_new: false
         | 
| 115 | 
            +
                  start_new: false,
         | 
| 116 | 
            +
                  option: 0,
         | 
| 117 | 
            +
                  launch_by_package_name: ''
         | 
| 108 118 | 
             
                }
         | 
| 109 119 |  | 
| 110 120 | 
             
                super(options.merge h)
         | 
| 121 | 
            +
                
         | 
| 122 | 
            +
                @list = %w(option launchByPackageName)
         | 
| 111 123 |  | 
| 112 124 | 
             
              end
         | 
| 113 125 |  | 
| 114 126 | 
             
              def to_s(colour: false, indent: 0)
         | 
| 115 | 
            -
                 | 
| 127 | 
            +
                option = @h[:option] == 0 ? @h[:application_name] : \
         | 
| 128 | 
            +
                    @h[:launch_by_package_name]
         | 
| 129 | 
            +
                @s = 'Launch ' + option
         | 
| 130 | 
            +
                super()
         | 
| 116 131 | 
             
              end
         | 
| 117 132 |  | 
| 118 133 | 
             
            end
         | 
| @@ -143,13 +158,30 @@ end | |
| 143 158 | 
             
            #
         | 
| 144 159 | 
             
            class LaunchShortcutAction < ApplicationAction
         | 
| 145 160 |  | 
| 146 | 
            -
              def initialize( | 
| 161 | 
            +
              def initialize(obj=nil)
         | 
| 162 | 
            +
                
         | 
| 163 | 
            +
                puts 'obj: ' + obj.inspect
         | 
| 164 | 
            +
                h = if obj.is_a? Hash then
         | 
| 165 | 
            +
                  obj
         | 
| 166 | 
            +
                else
         | 
| 167 | 
            +
                  obj[2] || {}
         | 
| 168 | 
            +
                end
         | 
| 147 169 |  | 
| 170 | 
            +
                if h[:shortcut] and h[:shortcut] =~ /Ask Alexa/i then
         | 
| 171 | 
            +
                  h = {
         | 
| 172 | 
            +
                    :app_name=>"Amazon Alexa", :intent_encoded=>"#Intent;action=com." +   
         | 
| 173 | 
            +
                      "amazon.alexa.action.WIDGET_SHORTCUT;launchFlags=0x10000000;" + 
         | 
| 174 | 
            +
                      "component=com.amazon.dee.app/.ui.voice.LaunchAlexaActivity;end", 
         | 
| 175 | 
            +
                      :name=>"Ask Alexa"
         | 
| 176 | 
            +
                  }
         | 
| 177 | 
            +
                end    
         | 
| 148 178 | 
             
                options = {
         | 
| 149 179 | 
             
                  :app_name=>"Amazon Alexa", :intent_encoded=>"", :name=>"Ask Alexa"
         | 
| 150 180 | 
             
                }
         | 
| 151 181 |  | 
| 152 182 | 
             
                super(options.merge h)
         | 
| 183 | 
            +
                
         | 
| 184 | 
            +
                #@list = %w(appName intentEncoded name)
         | 
| 153 185 |  | 
| 154 186 | 
             
              end
         | 
| 155 187 |  | 
| @@ -192,8 +224,12 @@ class OpenWebPageAction < ApplicationAction | |
| 192 224 |  | 
| 193 225 | 
             
                    a.map do |node|
         | 
| 194 226 |  | 
| 195 | 
            -
                      if node.name == 'description'  | 
| 196 | 
            -
                        node.text.to_s | 
| 227 | 
            +
                      if node.name == 'description' then
         | 
| 228 | 
            +
                        if node.text.to_s =~ /: / then
         | 
| 229 | 
            +
                          node.text.to_s.split(/: +/,2).map(&:strip)
         | 
| 230 | 
            +
                        else
         | 
| 231 | 
            +
                          [:url, node.text.to_s]
         | 
| 232 | 
            +
                        end
         | 
| 197 233 | 
             
                      else
         | 
| 198 234 | 
             
                        [node.name.to_sym, node.text.to_s.strip]
         | 
| 199 235 | 
             
                      end
         | 
| @@ -263,7 +299,8 @@ class OpenWebPageAction < ApplicationAction | |
| 263 299 | 
             
              end
         | 
| 264 300 |  | 
| 265 301 | 
             
              def invoke()
         | 
| 266 | 
            -
                 | 
| 302 | 
            +
                serverside = @h[:serverside].to_s.downcase == 'true'
         | 
| 303 | 
            +
                super(url_to_open: @h[:url_to_open], serverside: serverside)
         | 
| 267 304 | 
             
              end
         | 
| 268 305 |  | 
| 269 306 | 
             
              def to_s(colour: false, indent: 0)
         | 
| @@ -404,6 +441,61 @@ class TakePictureAction < CameraAction | |
| 404 441 | 
             
            end
         | 
| 405 442 |  | 
| 406 443 |  | 
| 444 | 
            +
            class TakeScreenshotAction < CameraAction
         | 
| 445 | 
            +
             | 
| 446 | 
            +
              def initialize(obj=nil)
         | 
| 447 | 
            +
                
         | 
| 448 | 
            +
                h = if obj.is_a? Hash then
         | 
| 449 | 
            +
                  obj
         | 
| 450 | 
            +
                elsif obj.is_a? Array
         | 
| 451 | 
            +
                  
         | 
| 452 | 
            +
                  e, macro = obj      
         | 
| 453 | 
            +
                  
         | 
| 454 | 
            +
                  a = [
         | 
| 455 | 
            +
                    'Save to device', 
         | 
| 456 | 
            +
                    'Send via email', 
         | 
| 457 | 
            +
                    'Share via intent'
         | 
| 458 | 
            +
                  ]
         | 
| 459 | 
            +
                  
         | 
| 460 | 
            +
                  s = e.text('item/description').to_s
         | 
| 461 | 
            +
                  index = a.map(&:downcase).index s.downcase
         | 
| 462 | 
            +
                
         | 
| 463 | 
            +
                  {option: index}
         | 
| 464 | 
            +
                  
         | 
| 465 | 
            +
                end 
         | 
| 466 | 
            +
                
         | 
| 467 | 
            +
                options = {
         | 
| 468 | 
            +
                  option: 0, 
         | 
| 469 | 
            +
                  use_smtp_email: false, 
         | 
| 470 | 
            +
                  mechanism_option: 0, 
         | 
| 471 | 
            +
                  save_to_jpeg: false
         | 
| 472 | 
            +
                }
         | 
| 473 | 
            +
             | 
| 474 | 
            +
                super(options.merge h)
         | 
| 475 | 
            +
             | 
| 476 | 
            +
              end
         | 
| 477 | 
            +
             | 
| 478 | 
            +
              def to_s(colour: false, indent: 0)
         | 
| 479 | 
            +
                
         | 
| 480 | 
            +
                @s = 'Take Screenshot' #+ @h.inspect
         | 
| 481 | 
            +
                
         | 
| 482 | 
            +
                options = [
         | 
| 483 | 
            +
                  'Save to device', 
         | 
| 484 | 
            +
                  'Send via email', 
         | 
| 485 | 
            +
                  'Share via intent'
         | 
| 486 | 
            +
                ]
         | 
| 487 | 
            +
                
         | 
| 488 | 
            +
                option = options[@h[:option]]
         | 
| 489 | 
            +
                
         | 
| 490 | 
            +
                @s += "\n" + option
         | 
| 491 | 
            +
                super()
         | 
| 492 | 
            +
                
         | 
| 493 | 
            +
              end
         | 
| 494 | 
            +
             | 
| 495 | 
            +
              alias to_summary to_s
         | 
| 496 | 
            +
            end
         | 
| 497 | 
            +
             | 
| 498 | 
            +
             | 
| 407 499 | 
             
            # Conditions/Loops
         | 
| 408 500 | 
             
            #
         | 
| 409 501 | 
             
            class IfConfirmedThenAction < Action
         | 
| @@ -710,7 +802,7 @@ class SetAirplaneModeAction < ConnectivityAction | |
| 710 802 |  | 
| 711 803 | 
             
                state = ['On', 'Off', 'Toggle'][@h[:state]]
         | 
| 712 804 | 
             
                @s = 'Airplane Mode ' + state
         | 
| 713 | 
            -
                super( | 
| 805 | 
            +
                super()
         | 
| 714 806 |  | 
| 715 807 | 
             
              end
         | 
| 716 808 |  | 
| @@ -732,34 +824,20 @@ class SetWifiAction < ConnectivityAction | |
| 732 824 |  | 
| 733 825 | 
             
              end
         | 
| 734 826 |  | 
| 735 | 
            -
              def to_s(colour: false, indent: 0)
         | 
| 736 | 
            -
                 | 
| 737 | 
            -
                 | 
| 827 | 
            +
              def to_s(colour: false, indent: 0)    
         | 
| 828 | 
            +
                
         | 
| 829 | 
            +
                @s = if @h[:state] <= 2 then
         | 
| 830 | 
            +
                  state = %w(Enable Disable Toggle)[@h[:state]]      
         | 
| 831 | 
            +
                  state + ' Wifi'
         | 
| 832 | 
            +
                else
         | 
| 833 | 
            +
                  "Connected to Network\n%s" % @h[:ssid]
         | 
| 834 | 
            +
                end
         | 
| 835 | 
            +
                
         | 
| 836 | 
            +
                super()
         | 
| 738 837 | 
             
              end
         | 
| 739 838 |  | 
| 740 839 | 
             
            end
         | 
| 741 840 |  | 
| 742 | 
            -
            # Category: Connectivity
         | 
| 743 | 
            -
            #
         | 
| 744 | 
            -
            class SetBluetoothAction < ConnectivityAction
         | 
| 745 | 
            -
             | 
| 746 | 
            -
              def initialize(h={})
         | 
| 747 | 
            -
             | 
| 748 | 
            -
                options = {
         | 
| 749 | 
            -
                  device_name: '',
         | 
| 750 | 
            -
                  state: 0
         | 
| 751 | 
            -
                }
         | 
| 752 | 
            -
             | 
| 753 | 
            -
                super(options.merge h)
         | 
| 754 | 
            -
             | 
| 755 | 
            -
              end
         | 
| 756 | 
            -
             | 
| 757 | 
            -
              def to_s(colour: false, indent: 0)
         | 
| 758 | 
            -
                'SetBluetoothAction ' + @h.inspect
         | 
| 759 | 
            -
              end
         | 
| 760 | 
            -
             | 
| 761 | 
            -
              alias to_summary to_s
         | 
| 762 | 
            -
            end
         | 
| 763 841 |  | 
| 764 842 | 
             
            # Category: Connectivity
         | 
| 765 843 | 
             
            #
         | 
| @@ -768,6 +846,8 @@ class SetBluetoothAction < ConnectivityAction | |
| 768 846 | 
             
              def initialize(h={})
         | 
| 769 847 |  | 
| 770 848 | 
             
                options = {
         | 
| 849 | 
            +
                  
         | 
| 850 | 
            +
                  device_address: '',
         | 
| 771 851 | 
             
                  device_name: '',
         | 
| 772 852 | 
             
                  state: 1
         | 
| 773 853 | 
             
                }
         | 
| @@ -777,7 +857,21 @@ class SetBluetoothAction < ConnectivityAction | |
| 777 857 | 
             
              end
         | 
| 778 858 |  | 
| 779 859 | 
             
              def to_s(colour: false, indent: 0)
         | 
| 780 | 
            -
                 | 
| 860 | 
            +
                
         | 
| 861 | 
            +
                @s = if @h[:state] <= 2 then
         | 
| 862 | 
            +
                
         | 
| 863 | 
            +
                  state = %w(Enable Disable Toggle)[@h[:state]]
         | 
| 864 | 
            +
                  state + ' Bluetooth'
         | 
| 865 | 
            +
                  
         | 
| 866 | 
            +
                else
         | 
| 867 | 
            +
                  
         | 
| 868 | 
            +
                  state = @h[:state] == 3 ? 'Connect' : 'Disconnect'
         | 
| 869 | 
            +
                  state + ' Audio Device' + "\n" + @h[:device_name]
         | 
| 870 | 
            +
                  
         | 
| 871 | 
            +
                end
         | 
| 872 | 
            +
             | 
| 873 | 
            +
                super()
         | 
| 874 | 
            +
                
         | 
| 781 875 | 
             
              end
         | 
| 782 876 |  | 
| 783 877 | 
             
              alias to_summary to_s
         | 
| @@ -1084,7 +1178,7 @@ class UIInteractionAction < DeviceAction | |
| 1084 1178 | 
             
                  e, macro = obj
         | 
| 1085 1179 | 
             
                  s = e.text('item/description').to_s
         | 
| 1086 1180 |  | 
| 1087 | 
            -
                  r = s.match(/^(Click|Long Click) \[( | 
| 1181 | 
            +
                  r = s.match(/^(Click|Long Click) \[(.*)\]$/)
         | 
| 1088 1182 |  | 
| 1089 1183 | 
             
                  # [Current focus] # Current focus
         | 
| 1090 1184 | 
             
                  # [0,0] # x,y location
         | 
| @@ -1092,10 +1186,11 @@ class UIInteractionAction < DeviceAction | |
| 1092 1186 | 
             
                  # [fooo] # Text content
         | 
| 1093 1187 |  | 
| 1094 1188 | 
             
                  h = {
         | 
| 1095 | 
            -
                    ui_interaction_configuration: { | 
| 1096 | 
            -
             | 
| 1189 | 
            +
                    ui_interaction_configuration: {
         | 
| 1190 | 
            +
                                                   :xy_point=>{:x=>0, :y=>0},
         | 
| 1191 | 
            +
                                                   :type=>"Click"} 
         | 
| 1097 1192 | 
             
                  }
         | 
| 1098 | 
            -
                  h2 =  | 
| 1193 | 
            +
                  h2 = h[:ui_interaction_configuration]
         | 
| 1099 1194 |  | 
| 1100 1195 | 
             
                  if r then
         | 
| 1101 1196 |  | 
| @@ -1105,7 +1200,7 @@ class UIInteractionAction < DeviceAction | |
| 1105 1200 | 
             
                    h2[:long_click] = false if click.downcase.to_sym == :click
         | 
| 1106 1201 |  | 
| 1107 1202 | 
             
                    if detail == 'Current focus' then          
         | 
| 1108 | 
            -
                      h2[:click_option] =  | 
| 1203 | 
            +
                      h2[:click_option] = 0
         | 
| 1109 1204 | 
             
                    elsif detail =~ /\d+,\d+/
         | 
| 1110 1205 | 
             
                      # to-do   
         | 
| 1111 1206 | 
             
                    else
         | 
| @@ -1114,7 +1209,7 @@ class UIInteractionAction < DeviceAction | |
| 1114 1209 | 
             
                      h2[:text_content] = detail
         | 
| 1115 1210 | 
             
                    end
         | 
| 1116 1211 |  | 
| 1117 | 
            -
                    h[:ui_interaction_configuration] = h2
         | 
| 1212 | 
            +
                    #h[:ui_interaction_configuration] = h2
         | 
| 1118 1213 | 
             
                  end
         | 
| 1119 1214 |  | 
| 1120 1215 | 
             
                end   
         | 
| @@ -1126,6 +1221,8 @@ class UIInteractionAction < DeviceAction | |
| 1126 1221 |  | 
| 1127 1222 |  | 
| 1128 1223 | 
             
                super(options.merge h) 
         | 
| 1224 | 
            +
                
         | 
| 1225 | 
            +
                @list = %w(uiInteractionConfiguration action xyPoint textContent  clickOption type longClick)
         | 
| 1129 1226 |  | 
| 1130 1227 | 
             
              end
         | 
| 1131 1228 |  | 
| @@ -1165,7 +1262,8 @@ class UIInteractionAction < DeviceAction | |
| 1165 1262 | 
             
                  "Gesture [%s]" % detail
         | 
| 1166 1263 | 
             
                end
         | 
| 1167 1264 |  | 
| 1168 | 
            -
                'UI Interaction' + "\n | 
| 1265 | 
            +
                @s = 'UI Interaction' + "\n" + s #+ ' ' + @h.inspect
         | 
| 1266 | 
            +
                super()
         | 
| 1169 1267 | 
             
              end
         | 
| 1170 1268 |  | 
| 1171 1269 | 
             
              alias to_summary to_s
         | 
| @@ -1185,7 +1283,10 @@ class VoiceSearchAction < DeviceAction | |
| 1185 1283 | 
             
              end
         | 
| 1186 1284 |  | 
| 1187 1285 | 
             
              def to_s(colour: false, indent: 0)
         | 
| 1188 | 
            -
                 | 
| 1286 | 
            +
                
         | 
| 1287 | 
            +
                @s = 'Voice Search' # + @h.inspect
         | 
| 1288 | 
            +
                super()
         | 
| 1289 | 
            +
                
         | 
| 1189 1290 | 
             
              end
         | 
| 1190 1291 |  | 
| 1191 1292 | 
             
              alias to_summary to_s
         | 
| @@ -1327,7 +1428,11 @@ class SetAutoRotateAction < DeviceSettingsAction | |
| 1327 1428 | 
             
              end
         | 
| 1328 1429 |  | 
| 1329 1430 | 
             
              def to_s(colour: false, indent: 0)
         | 
| 1330 | 
            -
             | 
| 1431 | 
            +
                    
         | 
| 1432 | 
            +
                #'SetAutoRotateAction ' + @h.inspect
         | 
| 1433 | 
            +
                @s = 'Auto Rotate ' + %w(On Off Toggle)[@h[:state]]
         | 
| 1434 | 
            +
                super()
         | 
| 1435 | 
            +
                
         | 
| 1331 1436 | 
             
              end
         | 
| 1332 1437 |  | 
| 1333 1438 | 
             
              alias to_summary to_s
         | 
| @@ -2113,7 +2218,7 @@ class ControlMediaAction < MediaAction | |
| 2113 2218 | 
             
                  obj
         | 
| 2114 2219 | 
             
                elsif obj.is_a? Array
         | 
| 2115 2220 |  | 
| 2116 | 
            -
                  e, macro = obj      
         | 
| 2221 | 
            +
                  e, macro, h2 = obj      
         | 
| 2117 2222 | 
             
                  s = e.text('item/description').to_s
         | 
| 2118 2223 | 
             
                  app = s[/Simulate Media Button \(([^\)]+)/,1]
         | 
| 2119 2224 |  | 
| @@ -2122,18 +2227,21 @@ class ControlMediaAction < MediaAction | |
| 2122 2227 | 
             
                    {
         | 
| 2123 2228 | 
             
                      application_name: app,  package_name: APPS[app], 
         | 
| 2124 2229 | 
             
                      simulate_media_button: true
         | 
| 2125 | 
            -
                    }
         | 
| 2230 | 
            +
                    }.merge h2
         | 
| 2126 2231 |  | 
| 2127 2232 | 
             
                  else
         | 
| 2128 | 
            -
                    { | 
| 2233 | 
            +
                    {
         | 
| 2234 | 
            +
                      send_media_player_commands: true, 
         | 
| 2235 | 
            +
                      simulate_media_button: false
         | 
| 2236 | 
            +
                    }
         | 
| 2129 2237 | 
             
                  end
         | 
| 2130 | 
            -
                end | 
| 2238 | 
            +
                end
         | 
| 2239 | 
            +
                #puts 'h: ' + h.inspect
         | 
| 2131 2240 |  | 
| 2132 2241 | 
             
                options = {
         | 
| 2133 | 
            -
                   | 
| 2134 | 
            -
                   | 
| 2135 | 
            -
                   | 
| 2136 | 
            -
                  simulate_media_button: true,
         | 
| 2242 | 
            +
                  option: "Play/Pause", 
         | 
| 2243 | 
            +
                  send_media_player_commands: true, 
         | 
| 2244 | 
            +
                  simulate_media_button: false,
         | 
| 2137 2245 | 
             
                }
         | 
| 2138 2246 |  | 
| 2139 2247 | 
             
                super(options.merge h)
         | 
| @@ -2146,6 +2254,8 @@ class ControlMediaAction < MediaAction | |
| 2146 2254 |  | 
| 2147 2255 | 
             
                if @h[:simulate_media_button] then
         | 
| 2148 2256 | 
             
                  @s +=  "\nSimulate Media Button (%s)" % @h[:application_name]
         | 
| 2257 | 
            +
                else
         | 
| 2258 | 
            +
                  @s +=  "\nSimulate Audio Button"
         | 
| 2149 2259 | 
             
                end
         | 
| 2150 2260 |  | 
| 2151 2261 | 
             
                super()
         | 
| @@ -41,6 +41,27 @@ class ActionsNlp | |
| 41 41 |  | 
| 42 42 | 
             
                # -- Connectivity ------------------------------------------------------
         | 
| 43 43 |  | 
| 44 | 
            +
                get /^Airplane Mode (On|Off|Toggle)/i do |state|
         | 
| 45 | 
            +
                  
         | 
| 46 | 
            +
                  index = %w(on off toggle).index state.downcase
         | 
| 47 | 
            +
                  [SetAirplaneModeAction, {state: index }]
         | 
| 48 | 
            +
                  
         | 
| 49 | 
            +
                end       
         | 
| 50 | 
            +
                
         | 
| 51 | 
            +
                get /^(Enable|Disable|Toggle) Bluetooth/i do |state|
         | 
| 52 | 
            +
                  
         | 
| 53 | 
            +
                  index = %w(enable disable toggle).index state.downcase
         | 
| 54 | 
            +
                  [SetBluetoothAction, {state: index }]
         | 
| 55 | 
            +
                  
         | 
| 56 | 
            +
                end    
         | 
| 57 | 
            +
                
         | 
| 58 | 
            +
                get /^(Connect|Disconnect) Audio Device/i do |state|
         | 
| 59 | 
            +
                  
         | 
| 60 | 
            +
                  index = %w(connect disconnect).index(state.downcase) + 3
         | 
| 61 | 
            +
                  [SetBluetoothAction, {state: index }]
         | 
| 62 | 
            +
                  
         | 
| 63 | 
            +
                end    
         | 
| 64 | 
            +
                
         | 
| 44 65 | 
             
                get /^(Enable|Disable) HotSpot/i do |state|
         | 
| 45 66 | 
             
                  enable, state = if state.downcase == 'enable' then
         | 
| 46 67 | 
             
                    [true, 0]
         | 
| @@ -50,6 +71,19 @@ class ActionsNlp | |
| 50 71 | 
             
                  [SetHotspotAction, {turn_wifi_on: enable, state: state }]
         | 
| 51 72 | 
             
                end   
         | 
| 52 73 |  | 
| 74 | 
            +
                get /^(Enable|Disable|Toggle) Wifi/i do |state|
         | 
| 75 | 
            +
                  
         | 
| 76 | 
            +
                  index = %w(enable disable toggle).index state.downcase
         | 
| 77 | 
            +
                  [SetWifiAction, {state: index }]
         | 
| 78 | 
            +
                  
         | 
| 79 | 
            +
                end       
         | 
| 80 | 
            +
                
         | 
| 81 | 
            +
                get /^Connect to Network$/i do
         | 
| 82 | 
            +
                  
         | 
| 83 | 
            +
                  [SetWifiAction, {state: 4 }]
         | 
| 84 | 
            +
                  
         | 
| 85 | 
            +
                end    
         | 
| 86 | 
            +
                
         | 
| 53 87 | 
             
                # e.g. message popup: hello world!
         | 
| 54 88 | 
             
                get /^(?:message popup|popup message): (.*)/i do |msg|
         | 
| 55 89 | 
             
                  [ToastAction, {msg: msg}]
         | 
| @@ -86,7 +120,11 @@ class ActionsNlp | |
| 86 120 |  | 
| 87 121 | 
             
                get /^take_picture/i do
         | 
| 88 122 | 
             
                  [TakePictureAction, {}]
         | 
| 89 | 
            -
                end | 
| 123 | 
            +
                end
         | 
| 124 | 
            +
                
         | 
| 125 | 
            +
                get /^Take Screenshot/i do
         | 
| 126 | 
            +
                  [TakeScreenshotAction, {}]
         | 
| 127 | 
            +
                end               
         | 
| 90 128 |  | 
| 91 129 | 
             
                # -- DEVICE ACTIONS ------------------------------------------------------
         | 
| 92 130 |  | 
| @@ -114,6 +152,19 @@ class ActionsNlp | |
| 114 152 | 
             
                get /^Vibrate$/i do |pattern|
         | 
| 115 153 | 
             
                  [VibrateAction, {pattern: 'short buzz'}]
         | 
| 116 154 | 
             
                end       
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                get /^Voice Search$/i do
         | 
| 157 | 
            +
                  [VoiceSearchAction, {}]
         | 
| 158 | 
            +
                end           
         | 
| 159 | 
            +
                
         | 
| 160 | 
            +
                # -- Device settings ---------------------------------------
         | 
| 161 | 
            +
                
         | 
| 162 | 
            +
                get /^Auto Rotate (On|Off|Toggle)$/i do |state|
         | 
| 163 | 
            +
                  
         | 
| 164 | 
            +
                  a = %w(on off toggle)
         | 
| 165 | 
            +
                  
         | 
| 166 | 
            +
                  [SetAutoRotateAction, {state: a.map(&:downcase).index(state.downcase)}]
         | 
| 167 | 
            +
                end               
         | 
| 117 168 |  | 
| 118 169 | 
             
                # e.g. Display Notification: Hi there: This is the body of the message
         | 
| 119 170 | 
             
                get /^Display Notification: ([^:]+): [^$]+$/i do |subject, text|
         | 
| @@ -139,16 +190,34 @@ class ActionsNlp | |
| 139 190 | 
             
                  [PlaySoundAction, {file_path: name}]
         | 
| 140 191 |  | 
| 141 192 | 
             
                end     
         | 
| 193 | 
            +
             | 
| 194 | 
            +
                get /^Launch Shortcut:? (?:Amazon|Ask) Alexa$/i do
         | 
| 195 | 
            +
                  [LaunchShortcutAction, {shortcut: 'Ask Alexa'}]      
         | 
| 196 | 
            +
                end
         | 
| 197 | 
            +
                
         | 
| 198 | 
            +
                get /^Shortcut:? (?:Amazon|Ask) Alexa$/i do
         | 
| 199 | 
            +
                  [LaunchShortcutAction, {shortcut: 'Ask Alexa'}]      
         | 
| 200 | 
            +
                end    
         | 
| 142 201 |  | 
| 143 202 | 
             
                # e.g. Launch Settings
         | 
| 144 | 
            -
                get /^Launch (.*)$/i do | | 
| 203 | 
            +
                get /^Launch (.*)$/i do |s|
         | 
| 145 204 |  | 
| 146 | 
            -
                   | 
| 147 | 
            -
             | 
| 148 | 
            -
                   | 
| 149 | 
            -
                     | 
| 150 | 
            -
                     | 
| 151 | 
            -
             | 
| 205 | 
            +
                  h = {}
         | 
| 206 | 
            +
                  
         | 
| 207 | 
            +
                  if s[0] == '[' then
         | 
| 208 | 
            +
                    
         | 
| 209 | 
            +
                    h[:launch_by_package_name] = s
         | 
| 210 | 
            +
                    h[:option] = 1
         | 
| 211 | 
            +
                    
         | 
| 212 | 
            +
                  else
         | 
| 213 | 
            +
                    application = s
         | 
| 214 | 
            +
                    h[:application_name] = application
         | 
| 215 | 
            +
                    h[:package_to_launch] = APPS[application] || 'com.android.' + 
         | 
| 216 | 
            +
                        application.downcase.split().join('.')
         | 
| 217 | 
            +
                    h[:option] = 0
         | 
| 218 | 
            +
                    
         | 
| 219 | 
            +
                  end
         | 
| 220 | 
            +
                  
         | 
| 152 221 | 
             
                  [LaunchActivityAction, h]
         | 
| 153 222 |  | 
| 154 223 | 
             
                end
         | 
| @@ -186,6 +255,10 @@ class ActionsNlp | |
| 186 255 | 
             
                  [OpenWebPageAction, {key => s}]
         | 
| 187 256 | 
             
                end
         | 
| 188 257 |  | 
| 258 | 
            +
                get /(https?:\/\/[^$]+)$/i do |url|
         | 
| 259 | 
            +
                  [OpenWebPageAction, {url_to_open: url}]
         | 
| 260 | 
            +
                end
         | 
| 261 | 
            +
                
         | 
| 189 262 | 
             
                #
         | 
| 190 263 | 
             
                get /^WebHook \(Url\)/i do
         | 
| 191 264 | 
             
                  [OpenWebPageAction, {}]
         | 
    
        data/lib/ruby-macrodroid/base.rb
    CHANGED
    
    
| @@ -215,6 +215,10 @@ class PowerButtonToggleTrigger < Trigger | |
| 215 215 | 
             
                super(options.merge h)
         | 
| 216 216 |  | 
| 217 217 | 
             
              end
         | 
| 218 | 
            +
              
         | 
| 219 | 
            +
              def match?(detail={}, model=nil)
         | 
| 220 | 
            +
                @h[:num_toggles] == detail[:num_toggles].to_i
         | 
| 221 | 
            +
              end
         | 
| 218 222 |  | 
| 219 223 | 
             
              def to_s(colour: false)
         | 
| 220 224 | 
             
                "Power Button Toggle (%s)" % @h[:num_toggles] #+ @h.inspect
         | 
| @@ -19,10 +19,14 @@ class TriggersNlp | |
| 19 19 |  | 
| 20 20 | 
             
                # -- Battery/Power ---------------------------------------------
         | 
| 21 21 |  | 
| 22 | 
            -
                get  | 
| 22 | 
            +
                get /^Power Button Toggle \((\d)\)/i do |num|
         | 
| 23 23 | 
             
                  [PowerButtonToggleTrigger, {num_toggles: num.to_i}]
         | 
| 24 24 | 
             
                end    
         | 
| 25 25 |  | 
| 26 | 
            +
                get /^Power Button (\d) times$/i do |num|
         | 
| 27 | 
            +
                  [PowerButtonToggleTrigger, {num_toggles: num.to_i}]
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 26 30 | 
             
                get /^Power Connected: (Wired \([^\)]+\))/i do |s|
         | 
| 27 31 |  | 
| 28 32 | 
             
                  h = {
         | 
    
        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.21
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -11,31 +11,31 @@ cert_chain: | |
| 11 11 | 
             
            - |
         | 
| 12 12 | 
             
              -----BEGIN CERTIFICATE-----
         | 
| 13 13 | 
             
              MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
         | 
| 14 | 
            -
               | 
| 15 | 
            -
               | 
| 16 | 
            -
               | 
| 17 | 
            -
               | 
| 18 | 
            -
               | 
| 19 | 
            -
               | 
| 20 | 
            -
               | 
| 21 | 
            -
               | 
| 22 | 
            -
               | 
| 23 | 
            -
               | 
| 24 | 
            -
               | 
| 25 | 
            -
               | 
| 26 | 
            -
               | 
| 14 | 
            +
              YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAxMDI2MjIxOTU3WhcN
         | 
| 15 | 
            +
              MjExMDI2MjIxOTU3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
         | 
| 16 | 
            +
              cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDoaG+o
         | 
| 17 | 
            +
              lMHEAZHl1nsdoJXwq0LC+quj5tNVCWZh4YQbBElxPfqL/+37lEwiJm9DC2ITVit1
         | 
| 18 | 
            +
              H/PAJipSJrOlnX5gBs2xZuKDChGBPLaquioK4ZyTNzMHNTEZiWz3NAGNO+bJuWQd
         | 
| 19 | 
            +
              Ho9+C+/BhCgG85XbDrmFdEnYnep3qntkgB860+9NRQNQ53cFn8nBOfGSpvN3Fsqp
         | 
| 20 | 
            +
              Ja7FyW59mlLkYccWZrVR+ZAdLYZQLNQ8yobSINKLOkXA9cqExF/pxMjxZpREM1S4
         | 
| 21 | 
            +
              qY8Oo4YUw6I2TH3mUkACRdQMmyY/GRR0hDKAFwpsXajz+jmztQ3+dONsqPt+crJB
         | 
| 22 | 
            +
              Mk7vSJbCXpVovljhSB3fAGOB0x9hd43AwijgkaW/8lm4N7jajalwXbckaV5C7nnS
         | 
| 23 | 
            +
              uMDoU1TBdSKlP3f1VhFVdDBEh8KaqTzyrV8QvJKPirW8BrgpdXB7xYafHBXBSMxo
         | 
| 24 | 
            +
              MiafxZoXRxY9cQc7UY9RjFLyKDipubSWhiHfHURnBYgNMJit0mdNGtVBpj8CAwEA
         | 
| 25 | 
            +
              AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUuSf+7NQJ
         | 
| 26 | 
            +
              u1oQ39UyDRyono+FMTYwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
         | 
| 27 27 | 
             
              c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
         | 
| 28 | 
            -
               | 
| 29 | 
            -
               | 
| 30 | 
            -
               | 
| 31 | 
            -
               | 
| 32 | 
            -
               | 
| 33 | 
            -
               | 
| 34 | 
            -
               | 
| 35 | 
            -
               | 
| 36 | 
            -
               | 
| 28 | 
            +
              BgkqhkiG9w0BAQsFAAOCAYEAcb48mw7R7DM/tkRsqJ3xARYEsqswd6RIcUEQlk+N
         | 
| 29 | 
            +
              wl6h9Ep5XXZRiWkjl7LvIwixLsLYJpnr4HrJSMBJ3fOKWO19r+LgxS98BRnIR/ig
         | 
| 30 | 
            +
              hkvDTENgc3rCM+1D40IDUVVNOITDO9sJgBGoFCPqySwvqD3k8ZBSsgEUvHCnX0mU
         | 
| 31 | 
            +
              7KPih5gG+3xgOKy+OYP9KT68nqJk0MOZa0wf+7Mdi0yfCQ35OWU6k4MLhVlPn3rs
         | 
| 32 | 
            +
              KTWiZmv8DTY/GD7UmsU9PyWo4mRL/HStHKOJpayJ+hzdezD1gIKCViUJVQLaNpV4
         | 
| 33 | 
            +
              a1xyM49vQ8wAk4hd+36Hs+te+24tUgisk5YF/m5/xHLPzCwU/dzghzyqurY1CcdZ
         | 
| 34 | 
            +
              AP47l82yywwqaxpCXBvlpPZ81LOozzu7JOmr/ziys4ube7PbUYN6uiwfoE2/N8Ol
         | 
| 35 | 
            +
              cu2W9lmvKJ505bT8+KLouVOtLlxYZknIB/uIea9r5rrGEJDMdYEYl4ZySFmkvJR4
         | 
| 36 | 
            +
              tf7VMFcAy1q1HMyemsBUJk5h
         | 
| 37 37 | 
             
              -----END CERTIFICATE-----
         | 
| 38 | 
            -
            date: 2020- | 
| 38 | 
            +
            date: 2020-11-01 00:00:00.000000000 Z
         | 
| 39 39 | 
             
            dependencies:
         | 
| 40 40 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 41 41 | 
             
              name: glw
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |