package com.nivesh.production.niveshfd.partnerOnBoarding.ui.activities1

import android.os.Build
import android.os.Bundle
import android.window.OnBackInvokedDispatcher
import androidx.activity.OnBackPressedCallback
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.databinding.ActivitySignupBinding
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity
import com.nivesh.production.niveshfd.partnerOnBoarding.ui.fragments1.SignUpFragment


class SignUpActivity : BaseActivity() {
    lateinit var binding: ActivitySignupBinding
    var type : Int? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        init()
    }

    private fun init() {
        type = intent.getIntExtra("type", 0);

        binding = ActivitySignupBinding.inflate(layoutInflater)
        binding.apply {
            setContentView(this.root)
        }
        supportFragmentManager.beginTransaction()
            .add(R.id.signUpContainer, SignUpFragment())
            .commit()
    }

//    @Deprecated("Deprecated in Java")
//    override fun onBackPressed() {
//        if (Build.VERSION.SDK_INT >= 33) {
//            onBackInvokedDispatcher.registerOnBackInvokedCallback(
//                OnBackInvokedDispatcher.PRIORITY_DEFAULT
//            ) {
//                exitOnBackPressed()
//            }
//        } else {
//            onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
//                override fun handleOnBackPressed() {
//                    exitOnBackPressed()
//                }
//            })
//        }
//    }

    private fun exitOnBackPressed() {
        if (isTaskRoot) {
            finish()
        } else {

        }
    }
}