class Fastlane::Actions::ImessageAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 24
def self.authors
  ["Alexander Ignition"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 28
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :text,
                                 env_name: "FL_IMESSAGE_TEXT",
                                 description: "Text of the message to be sent",
                                 verify_block: proc do |value|
                                   UI.user_error!("No text") if value.to_s.length == 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :to,
                                 env_name: "FL_IMESSAGE_BUDDY",
                                 description: "message buddy",
                                 verify_block: proc do |value|
                                   UI.user_error!("No to buddy") if value.to_s.length == 0
                                 end)
  ]
end
category() click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 58
def self.category
  :notifications
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 20
def self.description
  "send imessage"
end
example_code() click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 49
def self.example_code
  [
    'imessage(
      to: "123456"
      text: "App successfully released!"
    )'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 45
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File lib/fastlane/plugin/imessage/actions/imessage_action.rb, line 4
def self.run(params)
  Fastlane::Actions.sh "open --background -a Messages"
  Helper::ImessageHelper.delay

  apple_script =  %{tell application "Messages" }
  apple_script << %{to send "#{params[:text]}" }
  apple_script << %{to buddy "#{params[:to]}" }
  apple_script << %{of (1st service whose service type = iMessage)}

  Fastlane::Actions.sh "osascript -e '#{apple_script}'"
end