package com.example.smartlab

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import androidx.appcompat.app.AppCompatActivity


class StartActivity : AppCompatActivity() {

    private val splash_display_lenght: Int = 1500
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_start)
        Handler().postDelayed(Runnable {
            val prefs = getSharedPreferences("PREFERENCE", MODE_PRIVATE)

            if (prefs.getBoolean("isFirstRun", true)) {
                startActivity(Intent(this@StartActivity, OnBoard1Activity::class.java))
            } else if (prefs.getBoolean("AuthorizationFlag", true)) {
                startActivity(Intent(this@StartActivity, RegestrationActivity::class.java))
            } else {
                startActivity(Intent(this@StartActivity, CreatePasswordActivity::class.java))
            }
            getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit().putBoolean("isFirstRun", false).commit()
            finish()
        }, splash_display_lenght.toLong())
    }
}