Skip to content

Commit

Permalink
chore: Expose sdk name and version to be set on Flutter
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Jan 8, 2024
1 parent be9ac55 commit 55c8d8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PostHog/PostHogApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PostHogApi {

config.httpAdditionalHeaders = [
"Content-Type": "application/json; charset=utf-8",
"User-Agent": "posthog-ios/\(postHogVersion)",
"User-Agent": "\(PostHogVersion.postHogSdkName)/\(PostHogVersion.postHogVersion)",
]

return config
Expand Down
4 changes: 2 additions & 2 deletions PostHog/PostHogContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class PostHogContext {
properties["$screen_height"] = Float(UIScreen.main.bounds.height)
#endif

properties["$lib"] = "posthog-ios"
properties["$lib_version"] = postHogVersion
properties["$lib"] = PostHogVersion.postHogSdkName
properties["$lib_version"] = PostHogVersion.postHogVersion

if Locale.current.languageCode != nil {
properties["$locale"] = Locale.current.languageCode
Expand Down
9 changes: 7 additions & 2 deletions PostHog/PostHogVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@

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 class is internal only
public class PostHogVersion {
// if you change this, make sure to also change it in the podspec and check if the script scripts/bump-version.sh still works
public static var postHogVersion = "3.0.0-beta.1"

public static var postHogSdkName = "posthog-ios"
}

0 comments on commit 55c8d8a

Please sign in to comment.