package com.base.filerecoveryrecyclebin.activity

import android.graphics.Color
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.databinding.ActivityMainBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity
import com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import com.base.filerecoveryrecyclebin.utils.BarUtils
import com.base.filerecoveryrecyclebin.view.PermissionDialog.showPermissionBottomSheet
import com.base.filerecoveryrecyclebin.view.RateStarPop.showRateStarPopDialog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class MainActivity : BaseActivity<ActivityMainBinding>() {

    override val binding: ActivityMainBinding by lazy {
        ActivityMainBinding.inflate(layoutInflater)
    }


    override fun initView() {
        BarUtils.setStatusBarLightMode(this, true)
        BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
//        binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
//        showRateStarPopDialog()
//        showExitFunctionDialog()
    }

    override fun onResume() {
        super.onResume()
        if (!checkStorePermission()) {
            if (dialog == null) {
                dialog = showPermissionBottomSheet(launcher)
            }
        }

        lifecycleScope.launch(Dispatchers.Main) {
            delay(1000)
            showRateStarPopDialog()
        }
    }
}