{"size": 962, "ext": "js", "max_stars_repo_path": "src/SplashScreen.js", "max_stars_repo_name": "SandManTaj/CrossCam", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/SplashScreen.js", "max_issues_repo_name": "SandManTaj/CrossCam", "max_issues_repo_issues_event_min_datetime": "2021-05-11T05:12:14.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T05:12:14.000Z", "max_forks_repo_path": "src/SplashScreen.js", "max_forks_repo_name": "tajsandhu/CrossCam", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 26.0, "max_line_length": 75, "alphanum_fraction": 0.5093555094}
import React from 'react'
import { View, Text } from 'react-native'
import { Auth } from 'aws-amplify';
import { getUserName } from './Utils';

export default class SplashScreen extends React.Component {

    constructor(props) {
        super(props);
    }

    async componentDidMount() {
        this.getAuthStatus()
            .then(res => {
                if (res == true) {
                    this.props.navigation.navigate('Camera')
                } else {
                    this.props.navigation.navigate('Login')
                }
            })
    }

    //determines if a user is logged in or not
    getAuthStatus = async() =>{
        return Auth.currentAuthenticatedUser()
            .then(() => {return true})
            .catch(() => {return false})
    }

    render() {
        return(
            <View style={{alignItems: 'center', justifyContent: 'center'}}>
                <Text>Loading</Text>
            </View>
        )
    }
}