Skip to content

Commit fb46c6b

Browse files
committed
ref(android): Remove Nav3 Breadcrumb TypeCheckHint
Commit removes our Nav3 TypeCheckHint for breadcrumbs, which was cargo-culted from Nav2. We don't need it because - unlike Nav2 - developers can scrub Nav3 data before it's recorded. Our public KDocs instruct them to do so for *all* Sentry Nav3 data, not just breadcrumbs. Supporting a mechanism for after-the-fact access to just breadcrumb data (and not other Nav3 data) would be both asymmetrical and superfluous.
1 parent dc803d2 commit fb46c6b

4 files changed

Lines changed: 2 additions & 22 deletions

File tree

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import io.sentry.SentryLevel.INFO
1212
import io.sentry.SpanStatus
1313
import io.sentry.TransactionContext
1414
import io.sentry.TransactionOptions
15-
import io.sentry.TypeCheckHint
1615
import io.sentry.compose.navigation3.BackStackConverter.RetentionPolicy
1716
import io.sentry.compose.navigation3.PreparedChange.BackStackHasNewTop
1817
import io.sentry.compose.navigation3.PreparedChange.BackStackHasSameTop
@@ -199,11 +198,7 @@ internal class BackStackObserver<T : Any>(
199198
}
200199

201200
if (options.enableNavigationBreadcrumbs) {
202-
navBreadcrumbs.emit(
203-
fromEntry = previousTop,
204-
toEntry = currentBackStack.topEntryNormalized,
205-
toRawEntry = currentBackStack.topEntry,
206-
)
201+
navBreadcrumbs.emit(fromEntry = previousTop, toEntry = currentBackStack.topEntryNormalized)
207202
}
208203

209204
navTransaction.stop(scope)
@@ -454,11 +449,7 @@ private class NavScreen {
454449
/** A helper class for generating nav breadcrumbs. */
455450
private class NavBreadcrumbs(private val scopes: IScopes) {
456451

457-
fun <T : Any> emit(
458-
fromEntry: NormalizedSentryBackStackEntry?,
459-
toEntry: NormalizedSentryBackStackEntry,
460-
toRawEntry: T,
461-
) {
452+
fun emit(fromEntry: NormalizedSentryBackStackEntry?, toEntry: NormalizedSentryBackStackEntry) {
462453
val breadcrumb =
463454
Breadcrumb().apply {
464455
type = NAVIGATION_OP
@@ -480,7 +471,6 @@ private class NavBreadcrumbs(private val scopes: IScopes) {
480471
}
481472

482473
val hint = Hint()
483-
hint.set(TypeCheckHint.ANDROID_NAV3_DESTINATION, toRawEntry)
484474
scopes.addBreadcrumb(breadcrumb, hint)
485475
}
486476
}

‎sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import io.sentry.SentryOptions
1515
import io.sentry.SentryTracer
1616
import io.sentry.TransactionContext
1717
import io.sentry.TransactionOptions
18-
import io.sentry.TypeCheckHint
1918
import io.sentry.protocol.App
2019
import io.sentry.protocol.TransactionNameSource
2120
import org.junit.Test
@@ -153,8 +152,6 @@ class BackStackObserverTest {
153152
"to_arguments",
154153
mapOf("userId" to "123"),
155154
)
156-
assertThat(fixture.breadcrumbHints.last().get(TypeCheckHint.ANDROID_NAV3_DESTINATION))
157-
.isSameInstanceAs(profile)
158155
}
159156

160157
@Test
@@ -320,8 +317,6 @@ class BackStackObserverTest {
320317
assertThat(fixture.breadcrumbs).hasSize(2)
321318
assertThat(fixture.breadcrumbs.last().data["from"]).isEqualTo("/ProfileScreen")
322319
assertThat(fixture.breadcrumbs.last().data["to"]).isEqualTo("/ProfileScreen")
323-
assertThat(fixture.breadcrumbHints.last().get(TypeCheckHint.ANDROID_NAV3_DESTINATION))
324-
.isSameInstanceAs(replacementProfile)
325320
assertThat(fixture.startedTransactions).hasSize(2)
326321
assertThat(fixture.startedTransactions.last().name).isEqualTo("/ProfileScreen")
327322
assertThat(fixture.startedTransactions.first().isFinished).isTrue()

‎sentry/api/sentry.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4824,7 +4824,6 @@ public final class io/sentry/TypeCheckHint {
48244824
public static final field ANDROID_FRAGMENT Ljava/lang/String;
48254825
public static final field ANDROID_INTENT Ljava/lang/String;
48264826
public static final field ANDROID_MOTION_EVENT Ljava/lang/String;
4827-
public static final field ANDROID_NAV3_DESTINATION Ljava/lang/String;
48284827
public static final field ANDROID_NAV_DESTINATION Ljava/lang/String;
48294828
public static final field ANDROID_NETWORK_CAPABILITIES Ljava/lang/String;
48304829
public static final field ANDROID_SENSOR_EVENT Ljava/lang/String;

‎sentry/src/main/java/io/sentry/TypeCheckHint.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ public final class TypeCheckHint {
5151
/** Used for Navigation breadrcrumbs. */
5252
public static final String ANDROID_NAV_DESTINATION = "android:navigationDestination";
5353

54-
/** Used for Navigation 3 breadcrumbs. */
55-
@ApiStatus.Experimental @ApiStatus.Internal
56-
public static final String ANDROID_NAV3_DESTINATION = "android:nav3Destination";
57-
5854
/** Used for Network breadrcrumbs. */
5955
public static final String ANDROID_NETWORK_CAPABILITIES = "android:networkCapabilities";
6056

0 commit comments

Comments
 (0)