package com.swago.baseswago.dialog

import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.launcher.ARouter
import com.swago.baseswago.constant.ARouteConstant
import com.swago.baseswago.databinding.DialogOffLineBinding
import com.swago.baseswago.util.NoDoubleClickListener
import com.swago.baseswago.util.SpUtil
import com.swago.baseswago.util.UserInfo

/**
 *@date 2021/12/18 17:11
 *description:
 */
class ForceOfflineDialog : BaseXDFragment<DialogOffLineBinding>(){

    init {
        setCanCancel(false)
    }

    companion object{
        fun newInstance():ForceOfflineDialog{
            val forceDialog = ForceOfflineDialog()
            val bundle = Bundle()
            forceDialog.arguments = bundle
            return forceDialog
        }
    }

    override fun initOther() {
        binding.tvOk.setOnClickListener(object:NoDoubleClickListener(){
            override fun onClick() {
                UserInfo.clearUserInfo()
                SpUtil.clearSp()
                ARouter.getInstance().build(ARouteConstant.Login.login)
                    .withFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
                    .navigation()
                dismissAllowingStateLoss()
            }
        })
    }

    override fun initLiveData() {

    }


}