package com.ElyStudio.leGaou.activities;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.google.firebase.auth.FirebaseAuth;
import com.ElyStudio.leGaou.R;
import com.ElyStudio.leGaou.utilities.AppCompat;

public class SplashScreen extends AppCompat {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                checkUser();
            }
        },2000);


    }

    void checkUser(){
        FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
        if(firebaseAuth.getCurrentUser() != null)
        {
            startActivity(new Intent(SplashScreen.this,MainActivity.class));
            finish();
        }
        else
        {
            startActivity(new Intent(SplashScreen.this,OnboardingScreen.class));
            finish();
        }
    }
}