Skip to content

Commit 668faac

Browse files
authored
feat(android): Make SentryNavEffect API public for sample app purposes (#6137)
Make SentryNavEffect and related APIs (technically) public so they can be called from the Nav3 sample app. For now, keep them marked as @ApiStatus.Internal until we actually release Nav3 support (at which point we'll include an appropriate CHANGELOG entry).
1 parent f11a94d commit 668faac

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
@@ -50,8 +50,9 @@ import org.jetbrains.annotations.ApiStatus
5050
* [RouteArgumentsExtractor].
5151
*/
5252
@ApiStatus.Experimental
53-
internal fun interface RouteNameExtractor<T : Any> {
54-
fun extract(backStackEntry: T): String
53+
@ApiStatus.Internal
54+
public fun interface RouteNameExtractor<T : Any> {
55+
public fun extract(backStackEntry: T): String
5556
}
5657

5758
/**
@@ -114,8 +115,9 @@ internal fun interface RouteNameExtractor<T : Any> {
114115
* ```
115116
*/
116117
@ApiStatus.Experimental
117-
internal fun interface RouteArgumentsExtractor<T : Any> {
118-
fun extract(backStackEntry: T): Map<String, Any?>
118+
@ApiStatus.Internal
119+
public fun interface RouteArgumentsExtractor<T : Any> {
120+
public fun extract(backStackEntry: T): Map<String, Any?>
119121
}
120122

121123
/**

‎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,
@@ -115,6 +116,6 @@ private constructor(
115116
* ```
116117
*/
117118
@ApiStatus.Experimental
118-
internal fun SentryNavOptions(
119-
configure: SentryNavOptions.Builder.() -> Unit = {}
120-
): SentryNavOptions = SentryNavOptions.Builder().apply(configure).build()
119+
@ApiStatus.Internal
120+
public fun SentryNavOptions(configure: SentryNavOptions.Builder.() -> Unit = {}): SentryNavOptions =
121+
SentryNavOptions.Builder().apply(configure).build()

0 commit comments

Comments
 (0)