Skip to content

Commit

Permalink
🗑️ - Remove mixpanel (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
guytepper authored Apr 13, 2024
1 parent d07e514 commit 4098faa
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 48 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ android {
applicationId "com.betterrail"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 80
versionCode 81
versionName "2.3.0"
missingDimensionStrategy "store", "play"
}
Expand Down
12 changes: 1 addition & 11 deletions app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import { QueryClient, QueryClientProvider } from "react-query"
import { NavigationContainerRef } from "@react-navigation/native"
import { SafeAreaProvider, initialWindowMetrics } from "react-native-safe-area-context"
import { ActionSheetProvider } from "@expo/react-native-action-sheet"
import notifee, { EventType } from "@notifee/react-native"
import notifee from "@notifee/react-native"

import analytics from "@react-native-firebase/analytics"
import crashlytics from "@react-native-firebase/crashlytics"
import { Mixpanel, MixpanelType } from "mixpanel-react-native"

import { initFonts } from "./theme/fonts" // expo
import * as storage from "./utils/storage"
Expand All @@ -46,14 +45,6 @@ if (__DEV__) {
crashlytics().setCrashlyticsCollectionEnabled(false)
}

export let mixpanel: Mixpanel = null

if (!__DEV__) {
const trackAutomaticEvents = true
mixpanel = new Mixpanel("aee87333217b795f608e0a1ec50e979d", trackAutomaticEvents)
mixpanel.init()
}

// This puts screens in a native ViewController or Activity. If you want fully native
// stack navigation, use `createNativeStackNavigator` in place of `createStackNavigator`:
// https://github.com/kmagiera/react-native-screens#using-native-stack-navigator
Expand Down Expand Up @@ -143,7 +134,6 @@ function App() {
if (languageCode) {
setUserLanguage(languageCode)
setLocaleReady(true)
mixpanel.getPeople().set("app_locale", languageCode)
analytics().setUserProperty("user_locale", languageCode)
} else {
setInitialLanguage()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { observer } from "mobx-react-lite"
import { useEffect, useState } from "react"
import { useState } from "react"

import { Pressable, View } from "react-native"
import { StationListItem } from "./station-list-item"
Expand All @@ -15,7 +15,6 @@ import { useStations } from "../../data/stations"

import { FlashList } from "@shopify/flash-list"
import { toJS } from "mobx"
import { mixpanel } from "../../app"

export const NotificationsSelectStationsScreen = observer(function NotificationsSelectStationsScreen() {
const navigation = useNavigation()
Expand All @@ -34,18 +33,12 @@ export const NotificationsSelectStationsScreen = observer(function Notifications

if (stationsNotifications.includes(stationId)) {
settings.removeStationNotification(stationId)
mixpanel.track("Station Notification Deselected", { stationId })
return
}

mixpanel.track("Station Notification Selected", { stationId })
settings.addStationNotification(stationId)
}

useEffect(() => {
mixpanel.getPeople().set("Station Notifications", stationsNotifications)
}, [stationsNotifications])

return (
<View style={{ flex: 1, paddingHorizontal: spacing[3] }}>
<View
Expand Down
5 changes: 2 additions & 3 deletions app/screens/notifications/notifications-setup-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { translate, userLocale } from "../../i18n"
import { useStores } from "../../models"
import { StationListItem } from "./station-list-item"
import { useStations } from "../../data/stations"
import analytics from "@react-native-firebase/analytics"
import messaging from "@react-native-firebase/messaging"
import { useAppState } from "../../hooks"
import { mixpanel } from "../../app"

export const NotificationsSetupScreen = observer(function NotificationsSetupScreen({ navigation }: AnnouncementsScreenProps) {
const { settings } = useStores()
Expand All @@ -23,10 +23,9 @@ export const NotificationsSetupScreen = observer(function NotificationsSetupScre
const settings = await notifee.requestPermission()

if (settings.authorizationStatus === AuthorizationStatus.AUTHORIZED) {
mixpanel.track("Notification Permission Granted")
analytics().logEvent("notification_permission_granted")
setNotificationPermission(true)
} else {
mixpanel.track("Notification Permission Denied")
Alert.alert(
"Permission denied",
"You have denied the permission to receive notifications. You can enable it in the settings.",
Expand Down
1 change: 0 additions & 1 deletion app/screens/route-details/components/start-ride-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const StartRideButton = observer(function StartRideButton(props: StartRid
HapticFeedback.trigger("notificationSuccess")
ride.startRide(route)
analytics().logEvent("start_live_ride")
mixpanel.track("Start Live Ride")

// in reality the prompt would be shown on the 4th ride and not the 3rd, since the count
// will be increased only after the ride has been started successfully.
Expand Down
3 changes: 0 additions & 3 deletions app/screens/settings/settings-privacy-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { translate } from "../../i18n"
import { openLink } from "../../utils/helpers/open-link"
import { useIsBetaTester } from "../../hooks/use-is-beta-tester"
import crashlytics from "@react-native-firebase/crashlytics"
import { mixpanel } from "../../app"

const ROOT: ViewStyle = {
backgroundColor: color.background,
Expand All @@ -25,13 +24,11 @@ export const PrivacyScreen = observer(function SettingsLanguageScreen() {
const onTelemetryToggle = async (disableTelemetry: boolean) => {
if (disableTelemetry) {
analytics().logEvent("telemetry_disabled")
mixpanel.optOutTracking()
user.setDisableTelemetry(disableTelemetry)
await Promise.all([analytics().setAnalyticsCollectionEnabled(false), crashlytics().setCrashlyticsCollectionEnabled(false)])
} else {
analytics().logEvent("telemetry_enabled")
user.setDisableTelemetry(disableTelemetry)
mixpanel.optInTracking()
await Promise.all([analytics().setAnalyticsCollectionEnabled(true), crashlytics().setCrashlyticsCollectionEnabled(true)])
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"fuse.js": "^6.4.6",
"i18n-js": "3.8.0",
"lodash": "^4.17.21",
"mixpanel-react-native": "^3.0.0-beta.2",
"mobx": "6.3.2",
"mobx-react-lite": "3.4.3",
"mobx-state-tree": "5.1.8",
Expand Down
20 changes: 0 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2329,13 +2329,6 @@
dependencies:
merge-options "^3.0.4"

"@react-native-async-storage/async-storage@^1.21.0":
version "1.23.1"
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.23.1.tgz#cad3cd4fab7dacfe9838dce6ecb352f79150c883"
integrity sha512-Qd2kQ3yi6Y3+AcUlrHxSLlnBvpdCEMVGFlVBneVOjaFaPU61g1huc38g339ysXspwY1QZA2aNhrk/KlHGO+ewA==
dependencies:
merge-options "^3.0.4"

"@react-native-community/blur@^4.3.2":
version "4.3.2"
resolved "https://registry.yarnpkg.com/@react-native-community/blur/-/blur-4.3.2.tgz#185a2c7dd03ba168cc95069bc4742e9505fd6c6c"
Expand Down Expand Up @@ -12695,14 +12688,6 @@ mixin-object@^2.0.1:
for-in "^0.1.3"
is-extendable "^0.1.1"

mixpanel-react-native@^3.0.0-beta.2:
version "3.0.0-beta.2"
resolved "https://registry.yarnpkg.com/mixpanel-react-native/-/mixpanel-react-native-3.0.0-beta.2.tgz#fb9b92ddc0509f42b7587d7db91f227ed015eaa7"
integrity sha512-n+p98K0xDMc+vcAFS3WNOeTANTrtynbp+lzN5O/imS1j2YXEvuJEj1PqyvZ1O98/4S70wweP5EWxk4KNXgyZ+g==
dependencies:
"@react-native-async-storage/async-storage" "^1.21.0"
uuid "3.3.2"

mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
Expand Down Expand Up @@ -17768,11 +17753,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==

[email protected]:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==

uuid@^3.0.1, uuid@^3.3.2, uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
Expand Down

0 comments on commit 4098faa

Please sign in to comment.