Skip to content

Commit 3f85ec3

Browse files
committed
feat(android): Make SentryNavEffect API public for sample app purposes
Make SentryNavEffect and related APIs public so they can be called from the Nav3 sample app. For now, keep them marked as @ApiStatus.Internal until we publicly released + include a CHANGELOG entry.
1 parent 8751079 commit 3f85ec3

4 files changed

Lines changed: 65 additions & 19 deletions

File tree

‎sentry-android-navigation3/api/sentry-android-navigation3.api‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,45 @@ public final class io/sentry/compose/navigation3/BuildConfig {
66
public fun <init> ()V
77
}
88

9+
public abstract interface class io/sentry/compose/navigation3/RouteArgumentsExtractor {
10+
public abstract fun extract (Ljava/lang/Object;)Ljava/util/Map;
11+
}
12+
13+
public abstract interface class io/sentry/compose/navigation3/RouteNameExtractor {
14+
public abstract fun extract (Ljava/lang/Object;)Ljava/lang/String;
15+
}
16+
17+
public final class io/sentry/compose/navigation3/SentryNavEffectKt {
18+
public static final fun SentryNavEffect (Ljava/util/List;Lio/sentry/compose/navigation3/RouteNameExtractor;Lio/sentry/compose/navigation3/RouteArgumentsExtractor;Lio/sentry/compose/navigation3/SentryNavOptions;Landroidx/compose/runtime/Composer;II)V
19+
}
20+
21+
public final class io/sentry/compose/navigation3/SentryNavOptions {
22+
public static final field $stable I
23+
public synthetic fun <init> (ZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
24+
public fun equals (Ljava/lang/Object;)Z
25+
public final fun getCaptureBackStack ()Z
26+
public final fun getEnableNavigationBreadcrumbs ()Z
27+
public final fun getEnableNavigationTransactions ()Z
28+
public final fun getMaxCapturedBackStackEntries ()I
29+
public fun hashCode ()I
30+
}
31+
32+
public final class io/sentry/compose/navigation3/SentryNavOptions$Builder {
33+
public static final field $stable I
34+
public fun <init> ()V
35+
public final fun build ()Lio/sentry/compose/navigation3/SentryNavOptions;
36+
public final fun getCaptureBackStack ()Z
37+
public final fun getEnableNavigationBreadcrumbs ()Z
38+
public final fun getEnableNavigationTransactions ()Z
39+
public final fun getMaxCapturedBackStackEntries ()I
40+
public final fun setCaptureBackStack (Z)V
41+
public final fun setEnableNavigationBreadcrumbs (Z)V
42+
public final fun setEnableNavigationTransactions (Z)V
43+
public final fun setMaxCapturedBackStackEntries (I)V
44+
}
45+
46+
public final class io/sentry/compose/navigation3/SentryNavOptionsKt {
47+
public static final fun SentryNavOptions (Lkotlin/jvm/functions/Function1;)Lio/sentry/compose/navigation3/SentryNavOptions;
48+
public static synthetic fun SentryNavOptions$default (Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lio/sentry/compose/navigation3/SentryNavOptions;
49+
}
50+

‎sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/RouteExtractors.kt‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ import org.jetbrains.annotations.ApiStatus
4747
* [RouteArgumentsExtractor].
4848
*/
4949
@ApiStatus.Experimental
50-
internal fun interface RouteNameExtractor<T : Any> {
51-
fun extract(backStackEntry: T): String
50+
@ApiStatus.Internal
51+
public fun interface RouteNameExtractor<T : Any> {
52+
public fun extract(backStackEntry: T): String
5253
}
5354

5455
/**
@@ -110,8 +111,9 @@ internal fun interface RouteNameExtractor<T : Any> {
110111
* ```
111112
*/
112113
@ApiStatus.Experimental
113-
internal fun interface RouteArgumentsExtractor<T : Any> {
114-
fun extract(backStackEntry: T): Map<String, Any?>
114+
@ApiStatus.Internal
115+
public fun interface RouteArgumentsExtractor<T : Any> {
116+
public fun extract(backStackEntry: T): Map<String, Any?>
115117
}
116118

117119
/**

‎sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/SentryNavEffect.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ import org.jetbrains.annotations.ApiStatus
7171
* @param options The kinds of navigation info this effect should record.
7272
*/
7373
@ApiStatus.Experimental
74+
@ApiStatus.Internal
7475
@Composable
7576
@Suppress("FunctionNaming")
76-
internal fun <T : Any> SentryNavEffect(
77+
public fun <T : Any> SentryNavEffect(
7778
backStack: List<T>,
7879
nameExtractor: RouteNameExtractor<T>,
7980
argumentsExtractor: RouteArgumentsExtractor<T>? = null,

‎sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/SentryNavOptions.kt‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ private const val DEFAULT_MAX_CAPTURED_BACK_STACK_ENTRIES = 10
1919
* ```
2020
*/
2121
@ApiStatus.Experimental
22+
@ApiStatus.Internal
2223
@Immutable
23-
internal class SentryNavOptions
24+
public class SentryNavOptions
2425
private constructor(
25-
val enableNavigationBreadcrumbs: Boolean,
26-
val enableNavigationTransactions: Boolean,
27-
val captureBackStack: Boolean,
28-
val maxCapturedBackStackEntries: Int,
26+
public val enableNavigationBreadcrumbs: Boolean,
27+
public val enableNavigationTransactions: Boolean,
28+
public val captureBackStack: Boolean,
29+
public val maxCapturedBackStackEntries: Int,
2930
) {
3031

3132
init {
@@ -41,26 +42,26 @@ private constructor(
4142
* Lets us keep the resulting instance [Immutable] while preserving binary compatibility, should
4243
* new properties be added in the future.
4344
*/
44-
class Builder {
45+
public class Builder {
4546

4647
/**
4748
* Whether navigation should produce Sentry breadcrumbs. If `true`, a new nav destination
4849
* generates a breadcrumb like `from=/Home` and `to=/Profile`.
4950
*/
50-
var enableNavigationBreadcrumbs: Boolean = true
51+
public var enableNavigationBreadcrumbs: Boolean = true
5152

5253
/**
5354
* Whether navigation should start a Sentry transaction. If `true`, navigating from `/Home` to
5455
* `/Profile` starts a `/Profile` transaction and finishes the current `/Home` transaction.
5556
*/
56-
var enableNavigationTransactions: Boolean = true
57+
public var enableNavigationTransactions: Boolean = true
5758

5859
/**
5960
* Whether Sentry should record back stack information for inclusion with crashes, errors, and
6061
* other captured events. If `true`, a stack like `/Home -> /Profile` is recorded alongside the
6162
* event, ordered with the current/top entry first.
6263
*/
63-
var captureBackStack: Boolean = true
64+
public var captureBackStack: Boolean = true
6465

6566
/**
6667
* Maximum number of entries Sentry should record per captured back stack (starting with the
@@ -70,9 +71,9 @@ private constructor(
7071
* whenever your back stack changes. Keep name and argument extractors lightweight, and reduce
7172
* the max captured count if extractor work is unusually expensive.
7273
*/
73-
var maxCapturedBackStackEntries: Int = DEFAULT_MAX_CAPTURED_BACK_STACK_ENTRIES
74+
public var maxCapturedBackStackEntries: Int = DEFAULT_MAX_CAPTURED_BACK_STACK_ENTRIES
7475

75-
fun build(): SentryNavOptions =
76+
public fun build(): SentryNavOptions =
7677
SentryNavOptions(
7778
enableNavigationBreadcrumbs = enableNavigationBreadcrumbs,
7879
enableNavigationTransactions = enableNavigationTransactions,
@@ -100,6 +101,6 @@ private constructor(
100101

101102
/** Creates [SentryNavOptions]. Optionally configure it via [configure]. */
102103
@ApiStatus.Experimental
103-
internal fun SentryNavOptions(
104-
configure: SentryNavOptions.Builder.() -> Unit = {}
105-
): SentryNavOptions = SentryNavOptions.Builder().apply(configure).build()
104+
@ApiStatus.Internal
105+
public fun SentryNavOptions(configure: SentryNavOptions.Builder.() -> Unit = {}): SentryNavOptions =
106+
SentryNavOptions.Builder().apply(configure).build()

0 commit comments

Comments
 (0)