Skip to content

Commit

Permalink
Merge pull request #341 from wyne/SCORE-84-disable-analytics-on-dev-a…
Browse files Browse the repository at this point in the history
…nd-preview-builds-by-def

Score 84 disable analytics on dev and preview builds by def
  • Loading branch information
wyne authored Nov 15, 2023
2 parents 6f7dd68 + 3f5bf74 commit bfc7d28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
11 changes: 7 additions & 4 deletions eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"simulator": true
},
"env": {
"APP_VARIANT": "development"
"APP_VARIANT": "development",
"EXPO_PUBLIC_FIREBASE_ANALYTICS": "false"
}
},
"development": {
Expand All @@ -21,7 +22,8 @@
"resourceClass": "m-medium"
},
"env": {
"APP_VARIANT": "development"
"APP_VARIANT": "development",
"EXPO_PUBLIC_FIREBASE_ANALYTICS": "false"
}
},
"preview": {
Expand All @@ -31,7 +33,8 @@
},
"channel": "preview",
"env": {
"APP_VARIANT": "preview"
"APP_VARIANT": "preview",
"EXPO_PUBLIC_FIREBASE_ANALYTICS": "false"
}
},
"production": {
Expand All @@ -48,4 +51,4 @@
}
}
}
}
}
3 changes: 2 additions & 1 deletion src/screens/AppInfoScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const AppInfoScreen: React.FunctionComponent<Props> = ({ 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');
};
Expand Down

0 comments on commit bfc7d28

Please sign in to comment.