package com.amz.genie.activities

import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.amz.genie.R
import com.amz.genie.helpers.Preferences
import com.amz.genie.helpers.Utils.isNetworkAvailable


@SuppressLint("CustomSplashScreen")
class SplashActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        Handler(Looper.getMainLooper()).postDelayed({
            if (isNetworkAvailable(this)) {
                if (Preferences.getUserData(this) == null) {
                    navigateTo(LoginActivity::class.java,
                        R.anim.right_in, R.anim.left_out)
                    finish()

                } else {
                    navigateTo(MainActivity::class.java,
                        R.anim.right_in, R.anim.left_out)
                    finish()
                }

            }

        }, 800)
    }
}