diff --git a/native/profile/build-info.react.js b/native/profile/build-info.react.js index 3cc3f29f6..3d096ccf6 100644 --- a/native/profile/build-info.react.js +++ b/native/profile/build-info.react.js @@ -1,78 +1,121 @@ // @flow import * as React from 'react'; import { View, Text, ScrollView } from 'react-native'; +import { useSelector } from 'react-redux'; + +import { isStaff } from 'lib/shared/user-utils'; import { persistConfig, codeVersion } from '../redux/persist'; +import { StaffContext } from '../staff/staff-context'; import { useStyles } from '../themes/colors'; +import { isStaffRelease, useStaffCanSee } from '../utils/staff-utils'; // eslint-disable-next-line no-unused-vars function BuildInfo(props: { ... }): React.Node { + const isCurrentUserStaff = useSelector( + state => + state.currentUserInfo && + state.currentUserInfo.id && + isStaff(state.currentUserInfo.id), + ); + const { staffUserHasBeenLoggedIn } = React.useContext(StaffContext); const styles = useStyles(unboundStyles); + const staffCanSee = useStaffCanSee(); + + let staffCanSeeRows; + if (staffCanSee || staffUserHasBeenLoggedIn) { + staffCanSeeRows = ( + <> + + __DEV__ + {__DEV__ ? 'TRUE' : 'FALSE'} + + + Staff Release + {isStaffRelease ? 'TRUE' : 'FALSE'} + + + isCurrentUserStaff + + {isCurrentUserStaff ? 'TRUE' : 'FALSE'} + + + + hasStaffUserLoggedIn + + {staffUserHasBeenLoggedIn ? 'TRUE' : 'FALSE'} + + + + ); + } + return ( Code version {codeVersion} State version {persistConfig.version} + {staffCanSeeRows} Thank you for using Comm! ); } const unboundStyles = { label: { color: 'panelForegroundTertiaryLabel', fontSize: 16, paddingRight: 12, }, releaseText: { color: 'orange', fontSize: 16, }, row: { flexDirection: 'row', justifyContent: 'space-between', paddingVertical: 6, }, scrollView: { backgroundColor: 'panelBackground', }, scrollViewContentContainer: { paddingTop: 24, }, section: { backgroundColor: 'panelForeground', borderBottomWidth: 1, borderColor: 'panelForegroundBorder', borderTopWidth: 1, marginBottom: 24, paddingHorizontal: 24, paddingVertical: 6, }, text: { color: 'panelForegroundLabel', fontSize: 16, }, thanksText: { color: 'panelForegroundLabel', flex: 1, fontSize: 16, textAlign: 'center', }, }; export default BuildInfo;