package com.swago.app

import android.app.Application
import android.content.Intent
import android.util.Log
import android.widget.Toast
import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.swago.baseswago.constant.ARouteConstant
import com.swago.baseswago.inter.ApiManager
import com.swago.baseswago.util.*
import com.tencent.qcloud.tim.uikit.TUIKit
import com.tencent.qcloud.tim.uikit.base.IUIKitCallBack

/**
 *@date 2022/2/26 11:33
 *description:
 */
class SplashVm (application: Application) : BaseViewModel(application) {

    fun loginByAuto() {
        requestData {
            val data = ApiManager.loginApi.loginByAuto()
            UserInfo.setLoginInfo(data)
            SpUtil.putString("login_info", Gson().toJson(data))
            SwagoLoading.cancelLoadingDialog()
            ARouter.getInstance().build(ARouteConstant.Home.home)
                .withFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP).navigation()
        }
    }
}