<commit_before>// @flow

import * as Sentry from '@sentry/react-native'
import {type NavigationState} from 'react-navigation'

// gets the current screen from navigation state
function getCurrentRouteName(navigationState: NavigationState): ?string {
	if (!navigationState) {
		return null
	}
	let route = navigationState.routes[navigationState.index]
	// dive into nested navigators
	if (route.routes) {
		return getCurrentRouteName(route)
	}
	return route.routeName
}

export function trackScreenChanges(
	prevState: NavigationState,
	currentState: NavigationState,
) {
	let currentScreen = getCurrentRouteName(currentState)
	let prevScreen = getCurrentRouteName(prevState)

	if (!currentScreen) {
		return
	}

	if (currentScreen !== prevScreen) {
		Sentry.captureBreadcrumb({
			message: `Navigated to ${currentScreen}`,
			category: 'navigation',
			data: {
				prev: prevScreen,
			},
		})
	}
}<commit_msg>rename sentry method to fix breadcrumbs<commit_after>// @flow

import * as Sentry from '@sentry/react-native'
import {type NavigationState} from 'react-navigation'

// gets the current screen from navigation state
function getCurrentRouteName(navigationState: NavigationState): ?string {
	if (!navigationState) {
		return null
	}
	let route = navigationState.routes[navigationState.index]
	// dive into nested navigators
	if (route.routes) {
		return getCurrentRouteName(route)
	}
	return route.routeName
}

export function trackScreenChanges(
	prevState: NavigationState,
	currentState: NavigationState,
) {
	let currentScreen = getCurrentRouteName(currentState)
	let prevScreen = getCurrentRouteName(prevState)

	if (!currentScreen) {
		return
	}

	if (currentScreen !== prevScreen) {
		Sentry.addBreadcrumb({
			message: `Navigated to ${currentScreen}`,
			category: 'navigation',
			data: {
				prev: prevScreen,
			},
		})
	}
}
{'fraction_non_alphanumeric': 0.10206297502714441, 'fraction_numerical': 0.0, 'mean_word_length': 4.983766233766234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '211001', 'n_tokens_mistral': 593, 'n_tokens_neox': 551, 'n_words': 143}