class FastlaneCore::AppIdentifierGuesser

Attributes

app_id[RW]
args[RW]
gem_name[RW]
p_hash[RW]
platform[RW]

Public Class Methods

new(args: nil, gem_name: 'fastlane') click to toggle source
# File fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb, line 13
def initialize(args: nil, gem_name: 'fastlane')
  @args = args
  @gem_name = gem_name

  @app_id = android_app_identifier(args, gem_name)
  @platform = nil # since have a state in-between runs
  if @app_id
    @platform = :android
  else
    @app_id = ios_app_identifier(args)
    @platform = :ios if @app_id
  end

  @p_hash = generate_p_hash(@app_id)
end

Public Instance Methods

android_app_identifier(args, gem_name) click to toggle source

(optional) Returns the app identifier for the current tool supply and screengrab use different param names and env variable patterns so we have to special case here example:

fastlane supply --skip_upload_screenshots -a beta -p com.test.app should return com.test.app
screengrab -a com.test.app should return com.test.app
# File fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb, line 55
def android_app_identifier(args, gem_name)
  app_identifier = FastlaneCore::AndroidPackageNameGuesser.guess_package_name(gem_name, args)

  # Add Android prefix to prevent collisions if there is an iOS app with the same identifier
  app_identifier ? "android_project_#{app_identifier}" : nil
rescue
  nil # we don't want this method to cause a crash
end
generate_p_hash(app_id) click to toggle source

To not count the same projects multiple time for the number of launches Learn more at docs.fastlane.tools/#metrics Use the `FASTLANE_OPT_OUT_USAGE` variable to opt out The resulting value is e.g. ce12f8371df11ef6097a83bdf2303e4357d6f5040acc4f76019489fa5deeae0d

# File fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb, line 33
def generate_p_hash(app_id)
  if app_id.nil?
    return nil
  end

  return Digest::SHA256.hexdigest("p#{app_id}fastlan3_SAlt") # hashed + salted the bundle identifier
rescue
  return nil # we don't want this method to cause a crash
end
ios_app_identifier(args) click to toggle source

(optional) Returns the app identifier for the current tool

# File fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb, line 44
def ios_app_identifier(args)
  return FastlaneCore::IOSAppIdentifierGuesser.guess_app_identifier(args)
rescue
  nil # we don't want this method to cause a crash
end