Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload withSentryObservableEffect to provide compose instrumentation hook #2320

Merged
merged 7 commits into from Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions sentry-compose/api/android/sentry-compose.api
Expand Up @@ -7,6 +7,7 @@ public final class io/sentry/compose/BuildConfig {
}

public final class io/sentry/compose/SentryNavigationIntegrationKt {
public static final fun rememberNavController ([Landroidx/navigation/Navigator;Landroidx/compose/runtime/Composer;I)Landroidx/navigation/NavHostController;
public static final fun withSentryObservableEffect (Landroidx/navigation/NavHostController;ZZLandroidx/compose/runtime/Composer;II)Landroidx/navigation/NavHostController;
}

Expand Up @@ -10,7 +10,9 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import androidx.navigation.NavHostController
import androidx.navigation.Navigator
import io.sentry.Breadcrumb
import io.sentry.ITransaction
import io.sentry.SentryOptions
Expand Down Expand Up @@ -73,3 +75,9 @@ public fun NavHostController.withSentryObservableEffect(
}
return this
}

@Composable
public fun rememberNavController(vararg navigators: Navigator<out NavDestination>): NavHostController {
romtsn marked this conversation as resolved.
Show resolved Hide resolved
return androidx.navigation.compose.rememberNavController(navigators = navigators)
.withSentryObservableEffect()
}