package com.gh.gamecenter.provider

import android.app.Activity
import android.app.Application
import android.content.Context
import cn.jiguang.verifysdk.api.JVerificationInterface
import com.gh.gamecenter.LoginHelper
import com.gh.gamecenter.core.provider.IQuickLoginProvider

@com.therouter.inject.ServiceProvider
class QuickLoginProviderImpl : IQuickLoginProvider {

    override fun init(app: Application) {
        cn.jiguang.d.a.a(app)
        LoginHelper.init(app)
    }

    override fun preLogin(context: Context) {
        LoginHelper.preLogin(context)
    }

    override fun startLogin(context: Context, entrance: String, continuablePath: String?, callback: (() -> Unit)?) {
        LoginHelper.loginAuth(context, continuablePath, callback)
    }

    override fun isOpenMobileData(context: Context): Boolean {
        return JVerificationInterface.isInitSuccess() && JVerificationInterface.checkVerifyEnable(context)
    }

    override fun checkPolicyAndContinue(context: Context, callback: () -> Unit) {
        LoginHelper.checkPolicyAndContinue(context, callback)
    }

    override fun addCustomViewToLoginAuthPage(activity: Activity) {
        LoginHelper.addCustomViewToLoginAuthPage(activity)
    }

    override fun finishAuthActivity() {
        LoginHelper.finishAuthActivity()
    }

    override fun release() {
        LoginHelper.release()
    }

}