Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

675 B
Raw Blame
import Foundation

enum AppGroup {
    private static let extensionSuffix = ".HedgehogWidget"

    // app.config.ts names the App Group "group." plus the app's bundle id, and this extension's bundle id is the
    // app's id plus ".HedgehogWidget", so each app variant reads its own store.
    static func appId(fromExtensionBundleId widgetId: String) -> String {
        widgetId.hasSuffix(extensionSuffix) ? String(widgetId.dropLast(extensionSuffix.count)) : widgetId
    }

    static let appId: String = appId(
        fromExtensionBundleId: Bundle.main.bundleIdentifier ?? "com.posthog.code.mobile\(extensionSuffix)"
    )

    static let suiteName = "group.\(appId)"
}