package com.gh.gamecenter.gamedetail.accelerator.chain

import android.content.Context
import com.gh.common.util.TempCertificationUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.gamedetail.accelerator.UserVerifyDialogUtils

class AcceleratorRealNameInterceptor : AcceleratorValidator.Interceptor {
    override fun intercept(
        context: Context,
        chain: AcceleratorValidator.Chain,
        listener: AcceleratorValidator.ValidateListener?
    ) {
        val request = chain.request
        if (TempCertificationUtils.isUserVerified()) {
            chain.proceed(context, request, listener)
        } else {
            UserVerifyDialogUtils.showUnVerifiedDialog(
                context,
                R.string.real_name_tips.toResString(),
                R.string.acceleration_service_without_real_name_description.toResString()
            )
        }
    }
}