package com.gh.common.chain

import android.content.Context
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.entity.GameEntity

class CheckStoragePermissionHandler : ChainHandler() {

    override fun handleRequest(context: Context, gameEntity: GameEntity) {
        PermissionHelper.checkStoragePermissionBeforeAction(context, object : EmptyCallback {
            override fun onCallback() {
                if (hasNext()) {
                    getNext()?.handleRequest(context, gameEntity)
                } else {
                    processEndCallback?.invoke(null)
                }
            }
        })
    }
}