diff --git a/App.tsx b/App.tsx index 50d7b465..6e65f737 100644 --- a/App.tsx +++ b/App.tsx @@ -6,6 +6,11 @@ import { StatusBar } from 'expo-status-bar'; import { Navigation } from './src/Navigation'; import { View } from 'react-native'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; +import analytics from '@react-native-firebase/analytics'; + +if (process.env.EXPO_PUBLIC_FIREBASE_ANALYTICS == "false") { + analytics().setAnalyticsCollectionEnabled(false); +} export default function App() { return ( diff --git a/eas.json b/eas.json index 475c5260..372ab96e 100644 --- a/eas.json +++ b/eas.json @@ -11,7 +11,8 @@ "simulator": true }, "env": { - "APP_VARIANT": "development" + "APP_VARIANT": "development", + "EXPO_PUBLIC_FIREBASE_ANALYTICS": "false" } }, "development": { @@ -21,7 +22,8 @@ "resourceClass": "m-medium" }, "env": { - "APP_VARIANT": "development" + "APP_VARIANT": "development", + "EXPO_PUBLIC_FIREBASE_ANALYTICS": "false" } }, "preview": { @@ -31,7 +33,8 @@ }, "channel": "preview", "env": { - "APP_VARIANT": "preview" + "APP_VARIANT": "preview", + "EXPO_PUBLIC_FIREBASE_ANALYTICS": "false" } }, "production": { @@ -48,4 +51,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/screens/AppInfoScreen.tsx b/src/screens/AppInfoScreen.tsx index 99742491..fdb4a8bc 100644 --- a/src/screens/AppInfoScreen.tsx +++ b/src/screens/AppInfoScreen.tsx @@ -26,7 +26,8 @@ const AppInfoScreen: React.FunctionComponent = ({ navigation }) => { const alertWithVersion = async () => { Alert.alert(`ScorePad with Rounds\n` + `v${appVersion} (${buildNumber})\n` + - `${Platform.OS} ${Platform.Version}` + `${Platform.OS} ${Platform.Version}\n` + + (process.env.EXPO_PUBLIC_FIREBASE_ANALYTICS) ); await analytics().logEvent('view_version'); };