diff --git a/.eslintrc.js b/.eslintrc.js index 499cd4ded..33ed5a5f6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -62,7 +62,7 @@ module.exports = { "space-in-parens": [2, "always"], "module-resolver/use-alias": 2, // At least before we start making production builds - "no-console": 0, + "no-console": ["error", { allow: ["warn", "error"] }], "no-restricted-globals": 0, "no-param-reassign": 0, "no-var": 1, diff --git a/src/api/users.js b/src/api/users.js index 8947f2018..20e291348 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -43,7 +43,7 @@ const fetchUserMe = async ( params: Object = {}, opts: Object = {} ): Promise { }, [neutralZoom, zoom] ); const tapToFocus = async ( { nativeEvent } ) => { - try { - await camera.current.focus( { x: nativeEvent.x, y: nativeEvent.y } ); - tapToFocusAnimation.setValue( 1 ); - setTappedCoordinates( nativeEvent ); - } catch ( e ) { - console.log( e, "couldn't tap to focus" ); - } + await camera.current.focus( { x: nativeEvent.x, y: nativeEvent.y } ); + tapToFocusAnimation.setValue( 1 ); + setTappedCoordinates( nativeEvent ); }; return ( diff --git a/src/components/CustomDrawerContent.js b/src/components/CustomDrawerContent.js index c64177f95..5044e849d 100644 --- a/src/components/CustomDrawerContent.js +++ b/src/components/CustomDrawerContent.js @@ -6,6 +6,7 @@ import { } from "@react-navigation/drawer"; import type { Node } from "react"; import React from "react"; +import useCurrentUser from "sharedHooks/useCurrentUser"; type Props = { state: any, @@ -16,6 +17,7 @@ type Props = { const CustomDrawerContent = ( { ...props }: Props ): Node => { // $FlowFixMe const { state, navigation, descriptors } = props; + const currentUser = useCurrentUser( ); return ( @@ -31,10 +33,6 @@ const CustomDrawerContent = ( { ...props }: Props ): Node => { label="projects" onPress={( ) => navigation.navigate( "projects" )} /> - console.log( "nav to help/tutorials" )} - /> navigation.navigate( "about" )} @@ -48,7 +46,7 @@ const CustomDrawerContent = ( { ...props }: Props ): Node => { onPress={( ) => navigation.navigate( "network" )} /> navigation.navigate( "login" )} /> diff --git a/src/components/Identify/GridItem.js b/src/components/Identify/GridItem.js index 834cdd68d..6b278af58 100644 --- a/src/components/Identify/GridItem.js +++ b/src/components/Identify/GridItem.js @@ -18,20 +18,18 @@ import { type Props = { item: Object, - handlePress: Function, reviewedIds: Array, setReviewedIds: Function } const GridItem = ( { - item, handlePress, reviewedIds, setReviewedIds + item, reviewedIds, setReviewedIds }: Props ): Node => { const [showLoadingWheel, setShowLoadingWheel] = useState( false ); const commonName = item.taxon && item.taxon.preferred_common_name; const name = item.taxon ? item.taxon.name : "unknown"; const isSpecies = item.taxon && item.taxon.rank === "species"; const wasReviewed = reviewedIds.includes( item.id ); - const onPress = ( ) => handlePress( item ); // TODO: fix whatever funkiness is preventing realm mapTo from correctly // displaying camelcased item keys on ObservationList @@ -62,7 +60,6 @@ const GridItem = ( { return ( ( console.log( "press in identify" )} reviewedIds={reviewedIds} setReviewedIds={setReviewedIds} /> diff --git a/src/components/LoginSignUp/SignUp.js b/src/components/LoginSignUp/SignUp.js index 16a452ad3..c09b0bd70 100644 --- a/src/components/LoginSignUp/SignUp.js +++ b/src/components/LoginSignUp/SignUp.js @@ -13,14 +13,12 @@ const SignUp = (): Node => { const [username, setUsername] = useState( "" ); const [password, setPassword] = useState( "" ); - const register = async () => { - const error = await registerUser( + const register = async ( ) => { + await registerUser( email, username, password ); - - console.log( "Register", error ); }; return ( diff --git a/src/components/ObsEdit/AddEvidenceModal.js b/src/components/ObsEdit/AddEvidenceModal.js index f5ba006f4..6e97244a3 100644 --- a/src/components/ObsEdit/AddEvidenceModal.js +++ b/src/components/ObsEdit/AddEvidenceModal.js @@ -74,7 +74,6 @@ const AddEvidenceModal = ( { const onRecordSound = () => { // TODO - need to implement - console.log( "Record sound" ); }; return ( diff --git a/src/components/ObsEdit/ObsEdit.js b/src/components/ObsEdit/ObsEdit.js index 026f5e5fc..aa902a179 100644 --- a/src/components/ObsEdit/ObsEdit.js +++ b/src/components/ObsEdit/ObsEdit.js @@ -17,8 +17,8 @@ import { ActivityIndicator, BackHandler } from "react-native"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; import { Menu } from "react-native-paper"; import Photo from "realmModels/Photo"; +import useCurrentUser from "sharedHooks/useCurrentUser"; import useLocalObservation from "sharedHooks/useLocalObservation"; -import useLoggedIn from "sharedHooks/useLoggedIn"; import colors from "styles/tailwindColors"; import AddEvidenceModal from "./AddEvidenceModal"; @@ -53,7 +53,7 @@ const ObsEdit = ( ): Node => { const navigation = useNavigation( ); const { params } = useRoute( ); const localObservation = useLocalObservation( params?.uuid ); - const isLoggedIn = useLoggedIn( ); + const currentUser = useCurrentUser( ); const [mediaViewerVisible, setMediaViewerVisible] = useState( false ); const [initialPhotoSelected, setInitialPhotoSelected] = useState( null ); const [showAddEvidenceModal, setShowAddEvidenceModal] = useState( false ); @@ -236,7 +236,7 @@ const ObsEdit = ( ): Node => { setLoading( false ); setNextScreen( ); }} - disabled={!isLoggedIn} + disabled={!currentUser} /> {