Rebrand from Casera/MyCrib to honeyDue
Total rebrand across KMM project: - Kotlin package: com.example.casera -> com.tt.honeyDue (dirs + declarations) - Gradle: rootProject.name, namespace, applicationId - Android: manifest, strings.xml (all languages), widget resources - iOS: pbxproj bundle IDs, Info.plist, entitlements, xcconfig - iOS directories: Casera/ -> HoneyDue/, CaseraTests/ -> HoneyDueTests/, etc. - Swift source: all class/struct/enum renames - Deep links: casera:// -> honeydue://, .casera -> .honeydue - App icons replaced with honeyDue honeycomb icon - Domains: casera.treytartt.com -> honeyDue.treytartt.com - Bundle IDs: com.tt.casera -> com.tt.honeyDue - Database table names preserved Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
package com.tt.honeyDue.analytics
|
||||
|
||||
import android.app.Application
|
||||
import com.posthog.PostHog
|
||||
import com.posthog.android.PostHogAndroid
|
||||
import com.posthog.android.PostHogAndroidConfig
|
||||
|
||||
/**
|
||||
* Android implementation of PostHog Analytics.
|
||||
*/
|
||||
actual object PostHogAnalytics {
|
||||
// TODO: Replace with your actual PostHog API key
|
||||
private const val API_KEY = "YOUR_POSTHOG_API_KEY"
|
||||
private const val HOST = "https://us.i.posthog.com"
|
||||
|
||||
private var isInitialized = false
|
||||
private var application: Application? = null
|
||||
|
||||
/**
|
||||
* Initialize PostHog SDK with Application context.
|
||||
* Call this in MainActivity.onCreate() before using other methods.
|
||||
*/
|
||||
fun initialize(application: Application, debug: Boolean = false) {
|
||||
if (isInitialized) return
|
||||
this.application = application
|
||||
|
||||
val config = PostHogAndroidConfig(API_KEY, HOST).apply {
|
||||
captureScreenViews = false // We'll track screens manually
|
||||
captureApplicationLifecycleEvents = true
|
||||
captureDeepLinks = true
|
||||
this.debug = debug
|
||||
|
||||
// Session Replay
|
||||
sessionReplay = true
|
||||
sessionReplayConfig.maskAllTextInputs = true
|
||||
sessionReplayConfig.maskAllImages = false
|
||||
}
|
||||
|
||||
PostHogAndroid.setup(application, config)
|
||||
isInitialized = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize from common code (no-op on Android, use initialize(Application) instead)
|
||||
*/
|
||||
actual fun initialize() {
|
||||
// No-op - Android requires Application context, use initialize(Application) instead
|
||||
}
|
||||
|
||||
actual fun identify(userId: String, properties: Map<String, Any>?) {
|
||||
if (!isInitialized) return
|
||||
PostHog.identify(userId, userProperties = properties)
|
||||
}
|
||||
|
||||
actual fun capture(event: String, properties: Map<String, Any>?) {
|
||||
if (!isInitialized) return
|
||||
PostHog.capture(event, properties = properties)
|
||||
}
|
||||
|
||||
actual fun screen(screenName: String, properties: Map<String, Any>?) {
|
||||
if (!isInitialized) return
|
||||
PostHog.screen(screenName, properties = properties)
|
||||
}
|
||||
|
||||
actual fun reset() {
|
||||
if (!isInitialized) return
|
||||
PostHog.reset()
|
||||
}
|
||||
|
||||
actual fun flush() {
|
||||
if (!isInitialized) return
|
||||
PostHog.flush()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user