Class: FastlaneCore::AnalyticsSession
- Inherits:
-
Object
- Object
- FastlaneCore::AnalyticsSession
- Defined in:
- fastlane_core/lib/fastlane_core/analytics/analytics_session.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
Instance Method Summary collapse
- #action_completed(completion_context: nil) ⇒ Object
- #action_launched(launch_context: nil) ⇒ Object
- #did_show_message? ⇒ Boolean
- #finalize_session ⇒ Object
-
#initialize(analytics_ingester_client: AnalyticsIngesterClient.new(GA_TRACKING)) ⇒ AnalyticsSession
constructor
A new instance of AnalyticsSession.
- #show_message ⇒ Object
Constructor Details
#initialize(analytics_ingester_client: AnalyticsIngesterClient.new(GA_TRACKING)) ⇒ AnalyticsSession
Returns a new instance of AnalyticsSession.
13 14 15 16 17 18 19 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 13 def initialize(analytics_ingester_client: AnalyticsIngesterClient.new(GA_TRACKING)) require 'securerandom' @session_id = SecureRandom.uuid @client = analytics_ingester_client @threads = [] @launch_event_sent = false end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
11 12 13 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 11 def client @client end |
#session_id ⇒ Object
Returns the value of attribute session_id.
10 11 12 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 10 def session_id @session_id end |
Instance Method Details
#action_completed(completion_context: nil) ⇒ Object
45 46 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 45 def action_completed(completion_context: nil) end |
#action_launched(launch_context: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 21 def action_launched(launch_context: nil) unless end if @launch_event_sent || launch_context.p_hash.nil? return end @launch_event_sent = true builder = AnalyticsEventBuilder.new( p_hash: launch_context.p_hash, session_id: session_id, action_name: nil, fastlane_client_language: launch_context.fastlane_client_language ) launch_event = builder.new_event(:launch) post_thread = client.post_event(launch_event) unless post_thread.nil? @threads << post_thread end end |
#did_show_message? ⇒ Boolean
55 56 57 58 59 60 61 62 63 64 65 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 55 def file_name = ".did_show_opt_info" new_path = File.join(FastlaneCore.fastlane_user_dir, file_name) did_show = File.exist?(new_path) return did_show if did_show File.write(new_path, '1') false end |
#finalize_session ⇒ Object
67 68 69 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 67 def finalize_session @threads.map(&:join) end |
#show_message ⇒ Object
48 49 50 51 52 53 |
# File 'fastlane_core/lib/fastlane_core/analytics/analytics_session.rb', line 48 def UI.("Sending anonymous analytics information") UI.("Learn more at https://docs.fastlane.tools/#metrics") UI.("No personal or sensitive data is sent.") UI.("You can disable this by adding `opt_out_usage` at the top of your Fastfile") end |