package com.abbidot.tracker.ui.activity.account

import android.content.Intent
import android.view.View
import coil.load
import com.abbidot.tracker.R
import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.databinding.ActivitySignupSuccessBinding
import com.abbidot.tracker.ui.activity.set.FirstPermissionsActivity
import com.abbidot.tracker.util.Util

class SignupSuccessActivity :
    BaseActivity<ActivitySignupSuccessBinding>(ActivitySignupSuccessBinding::inflate) {

    override fun getTopBar() = null

    override fun initData() {
        super.initData()

        mViewBinding.apply {
            ivSignupSuccessDone.load(R.drawable.pwd_reset_successful_done)

            setOnClickListenerViews(btnSignupSuccessOk)
        }
    }

    override fun onClick(v: View?) {
        mViewBinding.apply {
            when (v!!) {
                btnSignupSuccessOk -> {
                    val hasPermissions = Util.checkNeedPermissionsEnabled(mContext)
                    if (hasPermissions) {
//                        val isExistNewInvite = MMKVUtil.getInt(MMKVKey.isExistNewInvite)
//                        if (isExistNewInvite == ConstantInt.NoShare) {
//                            intent.setClass(mContext, AddNewTracker1Activity::class.java)
//                        } else {
//                            intent.setClass(mContext, ShowInviteDeviceActivity::class.java)
//                        }
                        startActivityFinish(
                            Util.checkBindDeviceAndPetGoActivity(
                                mContext
                            )
                        )
                    } else {
                        val intent = Intent()
                        intent.setClass(
                            mContext, FirstPermissionsActivity::class.java
                        )
                        startActivityFinish(intent)
                    }
                }
            }
        }
    }
}