Class: FastlaneCore::AppIdentifierGuesser
- Inherits:
-
Object
- Object
- FastlaneCore::AppIdentifierGuesser
- Defined in:
- fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#args ⇒ Object
Returns the value of attribute args.
-
#gem_name ⇒ Object
Returns the value of attribute gem_name.
-
#p_hash ⇒ Object
Returns the value of attribute p_hash.
-
#platform ⇒ Object
Returns the value of attribute platform.
Instance Method Summary collapse
-
#android_app_identifier(args, gem_name) ⇒ Object
(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.
-
#generate_p_hash(app_id) ⇒ Object
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.
-
#initialize(args: nil, gem_name: 'fastlane') ⇒ AppIdentifierGuesser
constructor
A new instance of AppIdentifierGuesser.
-
#ios_app_identifier(args) ⇒ Object
(optional) Returns the app identifier for the current tool.
Constructor Details
#initialize(args: nil, gem_name: 'fastlane') ⇒ AppIdentifierGuesser
Returns a new instance of AppIdentifierGuesser.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
11 12 13 |
# File 'fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb', line 11 def app_id @app_id end |
#args ⇒ Object
Returns the value of attribute args.
7 8 9 |
# File 'fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb', line 7 def args @args end |
#gem_name ⇒ Object
Returns the value of attribute gem_name.
8 9 10 |
# File 'fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb', line 8 def gem_name @gem_name end |
#p_hash ⇒ Object
Returns the value of attribute p_hash.
10 11 12 |
# File 'fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb', line 10 def p_hash @p_hash end |
#platform ⇒ Object
Returns the value of attribute platform.
9 10 11 |
# File 'fastlane_core/lib/fastlane_core/analytics/app_identifier_guesser.rb', line 9 def platform @platform end |
Instance Method Details
#android_app_identifier(args, gem_name) ⇒ Object
(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
55 56 57 58 59 60 61 62 |
# 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) ⇒ Object
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
33 34 35 36 37 38 39 40 41 |
# 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) ⇒ Object
(optional) Returns the app identifier for the current tool
44 45 46 47 48 |
# 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 |