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

import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.dialog.PackageCheckDialogFragment

class AcceleratorPackageCheckInterceptor : AcceleratorValidator.Interceptor {
    override fun intercept(
        context: Context,
        chain: AcceleratorValidator.Chain,
        listener: AcceleratorValidator.ValidateListener?
    ) {
        val request = chain.request
        if (context is AppCompatActivity) {
            PackageCheckDialogFragment.show(context, request.game) {
                chain.proceed(context, request, listener)
            }
        }
    }
}