class Fastlane::Actions::AndroidChangeAppNameRevertAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 104
def self.authors
  ["MaximusMcCann"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 116
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :manifest,
                            env_name: "",
                         description: "Optional custom location for AndroidManifest.xml",
                            optional: false,
                                type: String,
                       default_value: "app/src/main/AndroidManifest.xml")
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 100
def self.description
  "Reverts the manifest's label attribute (appName) from ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME"
end
details() click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 112
def self.details
  "Reverts the manifest's label attribute (appName) from ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 127
def self.is_supported?(platform)
  platform == :android
end
return_value() click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 108
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb, line 76
def self.run(params)
  require 'nokogiri'

  oldName = Actions.lane_context[SharedValues::ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME]

  if oldName.to_s.strip.length != 0
    manifest = params[:manifest]
  else
    UI.error("no string for ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME.  Have you run android_change_app_name?")
  end

  doc = File.open(manifest) { |f|
    @doc = Nokogiri::XML(f)

    @doc.css("application").each do |response_node|
      response_node["android:label"] = oldName
      UI.message("Reverting app name to: #{oldName}")
    end

    File.write(manifest, @doc.to_xml)
  }

end