Class: LaunchShortcutAction

Inherits:
ApplicationAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Applications

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(obj = nil) ⇒ LaunchShortcutAction

Returns a new instance of LaunchShortcutAction.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/ruby-macrodroid/actions.rb', line 161

def initialize(obj=nil)
  
  puts 'obj: ' + obj.inspect
  h = if obj.is_a? Hash then
    obj
  else
    obj[2] || {}
  end
  
  if h[:shortcut] and h[:shortcut] =~ /Ask Alexa/i then
    h = {
      :app_name=>"Amazon Alexa", :intent_encoded=>"#Intent;action=com." +   
        "amazon.alexa.action.WIDGET_SHORTCUT;launchFlags=0x10000000;" + 
        "component=com.amazon.dee.app/.ui.voice.LaunchAlexaActivity;end", 
        :name=>"Ask Alexa"
    }
  end    
  options = {
    :app_name=>"Amazon Alexa", :intent_encoded=>"", :name=>"Ask Alexa"
  }

  super(options.merge h)
  
  #@list = %w(appName intentEncoded name)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary



188
189
190
191
# File 'lib/ruby-macrodroid/actions.rb', line 188

def to_s(colour: false, indent: 0)
  @s = "Launch Shortcut: " + @h[:app_name] + "\n" + @h[:name]
  super()
end