package com.zxhl.economize.activity

import android.content.Intent
import android.text.TextUtils
import android.view.View
import com.zxbw.modulemain.activity.SplashActivity
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.utils.Utils
import com.zxhl.cms.widget.CenterDialog
import com.zxhl.economize.Appli
import com.zxhl.economize.R

/**
 * @author (wangXuewei)
 * @detail :
 */
class InitActivity :BaseActivity() {
    override fun onClick(v: View?) {

    }

    override fun layoutID(): Int = R.layout.activity_splash

    override fun init() {
        if (AppContext.get()!=null){
            var source = Utils.getChannel(AppContext.get())
            if (!TextUtils.isEmpty(source)) {
                SettingPreference.setSource(source)
            }
        }
        if (SettingPreference.getFirstApp()) {
            CenterDialog.showPrivacyProtocol(this, {
                Appli().initAppConfig()
                SettingPreference.setFirstApp()
                startActivity(Intent(this@InitActivity, SplashActivity::class.java))
                finish()
            }, {
                finish()
            })
        } else {
            startActivity(Intent(this@InitActivity, SplashActivity::class.java))
            finish()
        }
    }

}