From 6ff934769dad4dcd1bdac10807b5a737c50662a4 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:32:50 +0100 Subject: [PATCH] chore: Expose sdk name and version to be set on Flutter (#94) --- PostHog/PostHogApi.swift | 2 +- PostHog/PostHogContext.swift | 2 +- PostHog/PostHogVersion.swift | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/PostHog/PostHogApi.swift b/PostHog/PostHogApi.swift index 9a96f0c0a..51aad1dcd 100644 --- a/PostHog/PostHogApi.swift +++ b/PostHog/PostHogApi.swift @@ -19,7 +19,7 @@ class PostHogApi { config.httpAdditionalHeaders = [ "Content-Type": "application/json; charset=utf-8", - "User-Agent": "posthog-ios/\(postHogVersion)", + "User-Agent": "\(postHogSdkName)/\(postHogVersion)", ] return config diff --git a/PostHog/PostHogContext.swift b/PostHog/PostHogContext.swift index 0ea10b306..239b6c0c2 100644 --- a/PostHog/PostHogContext.swift +++ b/PostHog/PostHogContext.swift @@ -96,7 +96,7 @@ class PostHogContext { properties["$screen_height"] = Float(UIScreen.main.bounds.height) #endif - properties["$lib"] = "posthog-ios" + properties["$lib"] = postHogSdkName properties["$lib_version"] = postHogVersion if Locale.current.languageCode != nil { diff --git a/PostHog/PostHogVersion.swift b/PostHog/PostHogVersion.swift index 952acd317..829e927b1 100644 --- a/PostHog/PostHogVersion.swift +++ b/PostHog/PostHogVersion.swift @@ -8,4 +8,8 @@ import Foundation // if you change this, make sure to also change it in the podspec and check if the script scripts/bump-version.sh still works -let postHogVersion = "3.0.0-beta.1" +// This property is internal only +public var postHogVersion = "3.0.0-beta.1" + +// This property is internal only +public var postHogSdkName = "posthog-ios"