Skip to content

Commit

Permalink
Add Mixpanel (#28)
Browse files Browse the repository at this point in the history
* add Mixpanel Package

* add Mixpanel initialize

* change to let
  • Loading branch information
zunda-pixel authored Aug 23, 2024
1 parent 282581c commit 91f1fe3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "7427ce8326bf1498f4ee61ddc7de7cb06c16eee3bfdbe2b47d03976c2a2bac4d",
"originHash" : "1baf1343e357c84b3b2dac1446d02734ae215c681f8d413b4e767abdf9bc2d5e",
"pins" : [
{
"identity" : "licenseprovider",
Expand All @@ -10,6 +10,15 @@
"version" : "1.3.1"
}
},
{
"identity" : "mixpanel-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mixpanel/mixpanel-swift",
"state" : {
"revision" : "48d6668ceaaefc338f94e2b084c3cf77b90182f8",
"version" : "4.3.0"
}
},
{
"identity" : "nuke",
"kind" : "remoteSourceControl",
Expand Down
2 changes: 2 additions & 0 deletions NiaBisKit/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let package = Package(
.package(url: "https://github.com/danielsaidi/SystemNotification", from: "1.1.1"),
.package(url: "https://github.com/zunda-pixel/selene", from: "1.3.0"),
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.35.0"),
.package(url: "https://github.com/mixpanel/mixpanel-swift", from: "4.3.0"),
],
targets: [
.target(
Expand All @@ -43,6 +44,7 @@ let package = Package(
.product(name: "SwiftUIIntrospect", package: "swiftui-introspect"),
.product(name: "SystemNotification", package: "SystemNotification"),
.product(name: "Sentry", package: "sentry-cocoa"),
.product(name: "Mixpanel", package: "mixpanel-swift"),
],
plugins: [
.plugin(name: "LicenseProviderPlugin", package: "LicenseProvider"),
Expand Down
5 changes: 5 additions & 0 deletions NiaBisKit/Sources/NiaBisUI/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import SwiftUI
import MetricKit
import Sentry
import Mixpanel

public final class AppDelegate: NSObject, UIApplicationDelegate {
public func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
Mixpanel.initialize(
token: SecretConstants.mixpanelApiToken,
trackAutomaticEvents: true
)
MXMetricManager.shared.add(self)
let options = Sentry.Options()
options.dsn = URL(string: SecretConstants.sentryDsnUrlString)!.absoluteString
Expand Down
7 changes: 4 additions & 3 deletions NiaBisKit/Sources/NiaBisUI/Others/SecretConstants.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
public enum SecretConstants {
static public var cloudflareImagesAccountHashId: String = <#CLOUDFLARE_IMAGES_ACCOUNT_HASH_ID#>
static public var niabisAPIToken: String = <#NIABIA_API_TOKEN#>
static public var sentryDsnUrlString: String = <#SECRET_DSN_URL#>
static public let cloudflareImagesAccountHashId: String = <#CLOUDFLARE_IMAGES_ACCOUNT_HASH_ID#>
static public let niabisAPIToken: String = <#NIABIA_API_TOKEN#>
static public let sentryDsnUrlString: String = <#SECRET_DSN_URL#>
static public let mixpanelApiToken: String = <#MIXPANEL_API_TOKEN#>
}
1 change: 1 addition & 0 deletions ci_scripts/ci_post_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cat > $env_file <<EOL
niabisAPIToken=${NIABIS_API_TOKEN}
cloudflareImagesAccountHashId=${CLOUDFLARE_IMAGES_ACCOUNT_HASH_ID}
sentryDsnUrlString=${SENTRY_DSN_URL}
mixpanelApiToken=${MIXPANEL_API_TOKEN}
EOL

cd NiaBisKit
Expand Down

0 comments on commit 91f1fe3

Please sign in to comment.