Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/android-v4-major.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'posthog': major
'posthog-android': major
---

- **Breaking:** remove the deprecated `apiKey` property and the `PostHogConfig(apiKey = …)` and `PostHogAndroidConfig(apiKey = …)` factories; use `projectToken` instead
- **Breaking:** remove the deprecated `propertiesSanitizer` config option and the `PostHogPropertiesSanitizer` interface; use `addBeforeSend` instead
- **Breaking:** remove the deprecated `evaluationEnvironments` config option; use `evaluationContexts` instead
- **Breaking:** remove the deprecated `getFeatureFlagPayload()`; use `getFeatureFlagResult(key)?.payload` instead
- **Breaking:** remove the deprecated `PostHogSessionReplayConfig.debouncerDelayMs`; use `throttleDelayMs` instead
13 changes: 2 additions & 11 deletions posthog-android/api/posthog-android.api
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public final class com/posthog/android/PostHogAndroid$Companion {
}

public class com/posthog/android/PostHogAndroidConfig : com/posthog/PostHogConfig {
public static final field Companion Lcom/posthog/android/PostHogAndroidConfig$Companion;
public fun <init> (Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Z)V
Expand Down Expand Up @@ -47,11 +46,6 @@ public class com/posthog/android/PostHogAndroidConfig : com/posthog/PostHogConfi
public final fun setSessionReplayConfig (Lcom/posthog/android/replay/PostHogSessionReplayConfig;)V
}

public final class com/posthog/android/PostHogAndroidConfig$Companion {
public final synthetic fun invoke (Ljava/lang/String;Ljava/lang/String;ZZZLcom/posthog/android/replay/PostHogSessionReplayConfig;ZZ)Lcom/posthog/android/PostHogAndroidConfig;
public static synthetic fun invoke$default (Lcom/posthog/android/PostHogAndroidConfig$Companion;Ljava/lang/String;Ljava/lang/String;ZZZLcom/posthog/android/replay/PostHogSessionReplayConfig;ZZILjava/lang/Object;)Lcom/posthog/android/PostHogAndroidConfig;
}

public final class com/posthog/android/PostHogAutocaptureModifierKt {
public static final fun postHogAutocaptureNoCapture (Landroidx/compose/ui/Modifier;Z)Landroidx/compose/ui/Modifier;
public static synthetic fun postHogAutocaptureNoCapture$default (Landroidx/compose/ui/Modifier;ZILjava/lang/Object;)Landroidx/compose/ui/Modifier;
Expand Down Expand Up @@ -130,12 +124,10 @@ public final class com/posthog/android/replay/PostHogSessionReplayConfig {
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;)V
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;Z)V
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJ)V
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJJ)V
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJJLjava/lang/Double;)V
public synthetic fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJJLjava/lang/Double;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJLjava/lang/Double;)V
public synthetic fun <init> (ZZZLcom/posthog/android/replay/PostHogDrawableConverter;ZJLjava/lang/Double;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getCaptureLogcat ()Z
public final fun getCaptureTouches ()Z
public final fun getDebouncerDelayMs ()J
public final fun getDrawableConverter ()Lcom/posthog/android/replay/PostHogDrawableConverter;
public final fun getMaskAllImages ()Z
public final fun getMaskAllTextInputs ()Z
Expand All @@ -148,7 +140,6 @@ public final class com/posthog/android/replay/PostHogSessionReplayConfig {
public final fun getVerifyScreenshotMaskAlignment ()Z
public final fun setCaptureLogcat (Z)V
public final fun setCaptureTouches (Z)V
public final fun setDebouncerDelayMs (J)V
public final fun setDrawableConverter (Lcom/posthog/android/replay/PostHogDrawableConverter;)V
public final fun setMaskAllImages (Z)V
public final fun setMaskAllTextInputs (Z)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,40 +96,4 @@ public open class PostHogAndroidConfig
public var captureDeadClicks: Boolean = false

internal var replayQueueHolder: PostHogReplayQueue? = null

public companion object {
/**
* Deprecated form of the [PostHogAndroidConfig] constructor that takes `apiKey` instead
* of `projectToken`, kept so Kotlin calls such as `PostHogAndroidConfig(apiKey = "phc_...")`
* still compile. Every other parameter and default matches the constructor.
*
* ```kotlin
* val config = PostHogAndroidConfig(projectToken = "phc_your_project_token") // instead of apiKey =
* ```
*/
@Deprecated(
"Deprecated in favor of projectToken. This will be removed in the next major version.",
)
@JvmSynthetic
public operator fun invoke(
apiKey: String,
host: String = PostHogConfig.DEFAULT_HOST,
captureApplicationLifecycleEvents: Boolean = true,
captureDeepLinks: Boolean = true,
captureScreenViews: Boolean = true,
sessionReplayConfig: PostHogSessionReplayConfig = PostHogSessionReplayConfig(),
capturePushNotificationSubscriptions: Boolean = true,
capturePushNotificationOpened: Boolean = true,
): PostHogAndroidConfig =
PostHogAndroidConfig(
projectToken = apiKey,
host = host,
captureApplicationLifecycleEvents = captureApplicationLifecycleEvents,
captureDeepLinks = captureDeepLinks,
captureScreenViews = captureScreenViews,
sessionReplayConfig = sessionReplayConfig,
capturePushNotificationSubscriptions = capturePushNotificationSubscriptions,
capturePushNotificationOpened = capturePushNotificationOpened,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ public class PostHogSessionReplayConfig
* The screenshot may contain sensitive information, use with caution.
*/
public var screenshot: Boolean = false,
/**
* Debouncer delay used to reduce the number of snapshots captured and reduce performance impact.
* This is used for capturing the view as a wireframe or screenshot.
* The lower the number, the more snapshots are captured and the higher the performance impact.
* Defaults to 1000ms = 1s.
* Ps: it was 500ms by default until version 3.8.2.
*/
@Deprecated("Use throttleDelayMs instead")
public var debouncerDelayMs: Long = 1000,
/**
* Throttling delay used to reduce the number of snapshots captured and reduce performance impact.
* This is used for capturing the view as a wireframe or screenshot.
Expand Down Expand Up @@ -118,12 +109,4 @@ public class PostHogSessionReplayConfig
@PostHogExperimental
@Volatile
public var screenshotColorMode: PostHogScreenshotColorMode = PostHogScreenshotColorMode.ARGB_8888

init {
// for keeping back compatibility
@Suppress("DEPRECATION")
if (debouncerDelayMs != 1000L) {
throttleDelayMs = debouncerDelayMs
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ internal class PostHogAndroidConfigTest {
assertEquals(PROJECT_TOKEN, config.projectToken)
}

@Suppress("DEPRECATION")
@Test
fun `deprecated apiKey factory and getter alias projectToken`() {
val config = PostHogAndroidConfig(apiKey = " $PROJECT_TOKEN ", captureDeepLinks = false, capturePushNotificationOpened = false)

assertEquals(PROJECT_TOKEN, config.projectToken)
assertEquals(PROJECT_TOKEN, config.apiKey)
assertFalse(config.captureDeepLinks)
assertFalse(config.capturePushNotificationOpened)
assertTrue(config.captureScreenViews)
}

@Test
fun `captureApplicationLifecycleEvents should be enabled by default`() {
assertTrue(config.captureApplicationLifecycleEvents)
Expand Down
20 changes: 2 additions & 18 deletions posthog/api/posthog.api
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public final class com/posthog/PostHog : com/posthog/PostHogStateless, com/posth
public fun getConfig ()Lcom/posthog/PostHogConfig;
public fun getDeviceId ()Ljava/lang/String;
public fun getFeatureFlag (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Boolean;)Ljava/lang/Object;
public fun getFeatureFlagPayload (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
public fun getFeatureFlagResult (Ljava/lang/String;Ljava/lang/Boolean;)Lcom/posthog/FeatureFlagResult;
public fun getLogger ()Lcom/posthog/logs/PostHogLogger;
public fun getSessionId ()Ljava/util/UUID;
Expand Down Expand Up @@ -88,7 +87,6 @@ public final class com/posthog/PostHog$Companion : com/posthog/PostHogInterface
public fun getConfig ()Lcom/posthog/PostHogConfig;
public fun getDeviceId ()Ljava/lang/String;
public fun getFeatureFlag (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Boolean;)Ljava/lang/Object;
public fun getFeatureFlagPayload (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
public fun getFeatureFlagResult (Ljava/lang/String;Ljava/lang/Boolean;)Lcom/posthog/FeatureFlagResult;
public fun getLogger ()Lcom/posthog/logs/PostHogLogger;
public fun getSessionId ()Ljava/util/UUID;
Expand Down Expand Up @@ -158,11 +156,10 @@ public class com/posthog/PostHogConfig {
public static final field DEFAULT_MAX_QUEUE_SIZE I
public static final field DEFAULT_US_ASSETS_HOST Ljava/lang/String;
public static final field DEFAULT_US_HOST Ljava/lang/String;
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLcom/posthog/PostHogPropertiesSanitizer;Lkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLcom/posthog/PostHogPropertiesSanitizer;Lkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addBeforeSend (Lcom/posthog/PostHogBeforeSend;)V
public final fun addIntegration (Lcom/posthog/PostHogIntegration;)V
public final fun getApiKey ()Ljava/lang/String;
public final fun getBeforeSendList ()Ljava/util/List;
public final fun getBootstrap ()Lcom/posthog/PostHogBootstrapConfig;
public final fun getCachePreferences ()Lcom/posthog/internal/PostHogPreferences;
Expand All @@ -173,7 +170,6 @@ public class com/posthog/PostHogConfig {
public final fun getEncryption ()Lcom/posthog/PostHogEncryption;
public final fun getErrorTrackingConfig ()Lcom/posthog/errortracking/PostHogErrorTrackingConfig;
public final fun getEvaluationContexts ()Ljava/util/List;
public final fun getEvaluationEnvironments ()Ljava/util/List;
public final fun getFeatureFlagCalledCacheSize ()I
public final fun getFeatureFlagRequestMaxRetries ()I
public final fun getFlushAt ()I
Expand All @@ -196,7 +192,6 @@ public class com/posthog/PostHogConfig {
public final fun getPersonProfiles ()Lcom/posthog/PersonProfiles;
public final fun getPreloadFeatureFlags ()Z
public final fun getProjectToken ()Ljava/lang/String;
public final fun getPropertiesSanitizer ()Lcom/posthog/PostHogPropertiesSanitizer;
public final fun getProxy ()Ljava/net/Proxy;
public final fun getPushIdentityProvider ()Lkotlin/jvm/functions/Function3;
public final fun getQueueProvider ()Lkotlin/jvm/functions/Function5;
Expand Down Expand Up @@ -229,7 +224,6 @@ public class com/posthog/PostHogConfig {
public final fun setDebug (Z)V
public final fun setEncryption (Lcom/posthog/PostHogEncryption;)V
public final fun setEvaluationContexts (Ljava/util/List;)V
public final fun setEvaluationEnvironments (Ljava/util/List;)V
public final fun setFeatureFlagCalledCacheSize (I)V
public final fun setFeatureFlagRequestMaxRetries (I)V
public final fun setFlushAt (I)V
Expand All @@ -249,7 +243,6 @@ public class com/posthog/PostHogConfig {
public final fun setPersistOptOut (Z)V
public final fun setPersonProfiles (Lcom/posthog/PersonProfiles;)V
public final fun setPreloadFeatureFlags (Z)V
public final fun setPropertiesSanitizer (Lcom/posthog/PostHogPropertiesSanitizer;)V
public final fun setProxy (Ljava/net/Proxy;)V
public final fun setPushIdentityProvider (Lkotlin/jvm/functions/Function3;)V
public final fun setReleaseIdentifier (Ljava/lang/String;)V
Expand All @@ -272,8 +265,6 @@ public class com/posthog/PostHogConfig {
}

public final class com/posthog/PostHogConfig$Companion {
public final synthetic fun invoke (Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLcom/posthog/PostHogPropertiesSanitizer;Lkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;)Lcom/posthog/PostHogConfig;
public static synthetic fun invoke$default (Lcom/posthog/PostHogConfig$Companion;Ljava/lang/String;Ljava/lang/String;ZZZIZLjava/util/List;ZZIIIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;ZLcom/posthog/PostHogPropertiesSanitizer;Lkotlin/jvm/functions/Function1;ZLcom/posthog/PersonProfiles;ZLjava/net/Proxy;Lcom/posthog/surveys/PostHogSurveysConfig;Lcom/posthog/logs/PostHogLogsConfig;Lkotlin/jvm/functions/Function6;Lkotlin/jvm/functions/Function5;Lcom/posthog/errortracking/PostHogErrorTrackingConfig;Ljava/lang/String;Lcom/posthog/PostHogBootstrapConfig;Lkotlin/jvm/functions/Function3;IILjava/lang/Object;)Lcom/posthog/PostHogConfig;
}

public abstract interface class com/posthog/PostHogCoreInterface {
Expand Down Expand Up @@ -395,8 +386,6 @@ public abstract interface class com/posthog/PostHogInterface : com/posthog/PostH
public abstract fun getDeviceId ()Ljava/lang/String;
public abstract fun getFeatureFlag (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Boolean;)Ljava/lang/Object;
public static synthetic fun getFeatureFlag$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Boolean;ILjava/lang/Object;)Ljava/lang/Object;
public abstract fun getFeatureFlagPayload (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
public static synthetic fun getFeatureFlagPayload$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
public abstract fun getFeatureFlagResult (Ljava/lang/String;Ljava/lang/Boolean;)Lcom/posthog/FeatureFlagResult;
public static synthetic fun getFeatureFlagResult$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Boolean;ILjava/lang/Object;)Lcom/posthog/FeatureFlagResult;
public abstract fun getLogger ()Lcom/posthog/logs/PostHogLogger;
Expand Down Expand Up @@ -441,7 +430,6 @@ public final class com/posthog/PostHogInterface$DefaultImpls {
public static synthetic fun captureLog$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Lcom/posthog/logs/PostHogLogSeverity;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;ILjava/lang/Object;)V
public static synthetic fun capturePushNotificationOpened$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;ILjava/lang/Object;)V
public static synthetic fun getFeatureFlag$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Boolean;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun getFeatureFlagPayload$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun getFeatureFlagResult$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/Boolean;ILjava/lang/Object;)Lcom/posthog/FeatureFlagResult;
public static synthetic fun group$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)V
public static synthetic fun isFeatureEnabled$default (Lcom/posthog/PostHogInterface;Ljava/lang/String;ZLjava/lang/Boolean;ILjava/lang/Object;)Z
Expand Down Expand Up @@ -475,10 +463,6 @@ public abstract interface class com/posthog/PostHogOptInReceiver {
public abstract fun onOptIn ()V
}

public abstract interface class com/posthog/PostHogPropertiesSanitizer {
public abstract fun sanitize (Ljava/util/Map;)Ljava/util/Map;
}

public class com/posthog/PostHogStateless : com/posthog/PostHogStatelessInterface {
public static final field Companion Lcom/posthog/PostHogStateless$Companion;
protected field config Lcom/posthog/PostHogConfig;
Expand Down
22 changes: 0 additions & 22 deletions posthog/src/main/java/com/posthog/PostHog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2101,18 +2101,6 @@ public class PostHog private constructor(
return results
}

@Deprecated(
message = "Use getFeatureFlagResult() instead; note it sends the \$feature_flag_called event by default.",
replaceWith = ReplaceWith("getFeatureFlagResult(key)?.payload"),
)
public override fun getFeatureFlagPayload(
key: String,
defaultValue: Any?,
): Any? {
if (!isEnabled()) return defaultValue
return getFeatureFlagResult(key, sendFeatureFlagEvent = false)?.payload ?: defaultValue
}

public override fun getFeatureFlagResult(
key: String,
sendFeatureFlagEvent: Boolean?,
Expand Down Expand Up @@ -2749,16 +2737,6 @@ public class PostHog private constructor(
return shared.getAllFeatureFlags()
}

@Deprecated(
message = "Use getFeatureFlagResult() instead; note it sends the \$feature_flag_called event by default.",
replaceWith = ReplaceWith("getFeatureFlagResult(key)?.payload"),
)
@Suppress("DEPRECATION")
public override fun getFeatureFlagPayload(
key: String,
defaultValue: Any?,
): Any? = shared.getFeatureFlagPayload(key, defaultValue = defaultValue)

public override fun getFeatureFlagResult(
key: String,
sendFeatureFlagEvent: Boolean?,
Expand Down
Loading
Loading