package com.base.pdfviewerscannerwhite.utils

import android.content.Intent
import android.net.Uri
import android.print.PrintDocumentAdapter
import android.view.ActionMode

object IntentShareUtils {

    fun sharePdfIntent(uri: Uri): Intent {
        val shareIntent = Intent().apply {
            action = Intent.ACTION_SEND
            putExtra(Intent.EXTRA_STREAM, uri)
            type = "application/pdf"
            addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 授权临时权限
        }
        return shareIntent
    }

    fun sharePdfPrintIntent(uri: Uri): Intent {
        // 创建打印的 Intent
        val intent = Intent(Intent.ACTION_SEND)
        intent.setDataAndType(uri, "application/pdf")

        // 启动打印服务
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
        return intent
    }

}