package com.adealink.weparty.webview.payermax

import android.net.Uri
import android.webkit.ValueCallback
import android.webkit.WebView
import com.adealink.weparty.webview.CommonWebChromeClient
import com.ushareit.easysdk.web.util.SPWebHelper
import com.ushareit.easysdk.web.view.SPBaseChromeClient

class SpWebChromeClient(
    webHelper: SPWebHelper,
    private val webChromeClient: CommonWebChromeClient?
) : SPBaseChromeClient(webHelper) {

    override fun onReceivedTitle(view: WebView?, title: String?) {
        super.onReceivedTitle(view, title)
        webChromeClient?.onReceivedTitle(view, title)
    }

    override fun onProgressChanged(view: WebView?, newProgress: Int) {
        super.onProgressChanged(view, newProgress)
        webChromeClient?.onProgressChanged(view, newProgress)
    }

    override fun onShowFileChooser(
        webView: WebView?,
        filePathCallback: ValueCallback<Array<Uri>>?,
        fileChooserParams: FileChooserParams?
    ): Boolean {
        return webChromeClient?.onShowFileChooser(webView, filePathCallback, fileChooserParams)
            ?: super.onShowFileChooser(webView, filePathCallback, fileChooserParams)
    }

}