Class: Fastlane::Actions::ImessageAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/imessage/actions/imessage_action.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



24
25
26
# File 'lib/fastlane/plugin/imessage/actions/imessage_action.rb', line 24

def self.authors
  ["Alexander Ignition"]
end

.available_optionsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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

.categoryObject



58
59
60
# File 'lib/fastlane/plugin/imessage/actions/imessage_action.rb', line 58

def self.category
  :notifications
end

.descriptionObject



20
21
22
# File 'lib/fastlane/plugin/imessage/actions/imessage_action.rb', line 20

def self.description
  "send imessage"
end

.example_codeObject



49
50
51
52
53
54
55
56
# 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) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fastlane/plugin/imessage/actions/imessage_action.rb', line 45

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# 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