diff --git a/.gitea/workflows/pr-iphone-deploy.yml b/.gitea/workflows/pr-iphone-deploy.yml index 9f32556..a55b22d 100644 --- a/.gitea/workflows/pr-iphone-deploy.yml +++ b/.gitea/workflows/pr-iphone-deploy.yml @@ -36,6 +36,14 @@ jobs: - name: Setup PATH run: echo "/opt/homebrew/bin" >> $GITHUB_PATH + - name: Clean ALL caches + run: | + rm -rf ~/Library/Developer/Xcode/DerivedData + rm -rf ~/Library/Caches/org.swift.swiftpm + rm -rf ~/Library/org.swift.swiftpm + rm -rf .build + rm -rf ~/.cache/act/*/hostexecutor/tabatago-swift/build + - name: Install tools (xcodegen, node, firebase) run: | brew install xcodegen node || true @@ -63,6 +71,7 @@ jobs: -allowProvisioningUpdates \ -skipPackagePluginValidation \ SWIFT_ENABLE_EXPLICIT_MODULES=NO \ + ONLY_ACTIVE_ARCH=NO \ CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=2MJF39L8VY - name: Package IPA diff --git a/.gitignore b/.gitignore index 9113d6f..15e1f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,8 @@ Config/Secrets.xcconfig _Users_* swift-generated-sources/ tabatago-swift/build/ + +# Swift Package Manager +Package.resolved +.build/ +DerivedData/ diff --git a/tabatago-swift/TabataGo/Services/AnalyticsService.swift b/tabatago-swift/TabataGo/Services/AnalyticsService.swift index bd04448..e7259d8 100644 --- a/tabatago-swift/TabataGo/Services/AnalyticsService.swift +++ b/tabatago-swift/TabataGo/Services/AnalyticsService.swift @@ -1,30 +1,38 @@ import Foundation +#if canImport(PostHog) import PostHog +#endif /// PostHog analytics — mirrors the event taxonomy from the Expo app. final class AnalyticsService: @unchecked Sendable { static let shared = AnalyticsService() +#if canImport(PostHog) private let apiKey: String = Bundle.main.infoDictionary?["POSTHOG_API_KEY"] as? String ?? "" private let host = "https://eu.posthog.com" +#endif private init() {} func initialize() { +#if canImport(PostHog) guard !apiKey.isEmpty else { return } let config = PostHogConfig(apiKey: apiKey, host: host) config.captureApplicationLifecycleEvents = true config.captureScreenViews = false // manual tracking PostHogSDK.shared.setup(config) +#endif } // ─── Screens ──────────────────────────────────────────────── func screen(_ name: String, properties: [String: Any] = [:]) { +#if canImport(PostHog) PostHogSDK.shared.screen(name, properties: properties) +#endif } // ─── Onboarding ───────────────────────────────────────────── @@ -100,6 +108,8 @@ final class AnalyticsService: @unchecked Sendable { // ─── Private ───────────────────────────────────────────────── private func capture(_ event: String, properties: [String: Any] = [:]) { +#if canImport(PostHog) PostHogSDK.shared.capture(event, properties: properties.isEmpty ? nil : properties) +#endif } } diff --git a/tabatago-swift/project.yml b/tabatago-swift/project.yml index 16e11b2..0526c48 100644 --- a/tabatago-swift/project.yml +++ b/tabatago-swift/project.yml @@ -30,7 +30,7 @@ packages: from: "5.0.0" PostHog: url: https://github.com/PostHog/posthog-ios - exactVersion: "3.62.0" + revision: "3.62.0" targets: TabataGo: