Class: NotificationTrigger

Inherits:
DeviceEventsTrigger show all
Defined in:
lib/ruby-macrodroid/triggers.rb

Overview

Category: Device Events

Instance Attribute Summary

Attributes inherited from Trigger

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ NotificationTrigger

Returns a new instance of NotificationTrigger.



1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
# File 'lib/ruby-macrodroid/triggers.rb', line 1160

def initialize(h={})

  options = {
    text_content: '',
    package_name_list: ["Any Application"],
    application_name_list: ["Any Application"],
    exclude_apps: false,
    ignore_ongoing: true,
    option: 0,
    exact_match: false,
    excludes: false,
    sound_option: 0,
    supress_multiples: true,
    enable_regex: false
  }

  super(options.merge h)

end

Instance Method Details

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



1180
1181
1182
1183
# File 'lib/ruby-macrodroid/triggers.rb', line 1180

def to_s(colour: false)
  s = (@h[:package_name_list] + @h[:application_name_list]).uniq.join(', ')
  'Notification Received ' + "\n  Any Content (%s)" % s
end