package com.atmob.keyboard_android.util

import android.content.Context
import com.atmob.keyboard_android.R
import com.atmob.keyboard_android.ui.popup.ConfirmDialog

/**
 * 权限弹窗工具类
 */
class PermissionDialogUtil {
    companion object {
        /**
         * 显示权限弹窗
         */
        fun showPermissionDialog(context: Context) {
            val keyboardService = KeyboardHolder.getKeyboardService()
            if (keyboardService == null) {
                return
            }

            val keyboardWindow = keyboardService.getKeyboardWindow()

            ConfirmDialog(context, keyboardWindow)
                .bindDataModel(
                    ConfirmDialog.DataModel(
                        title = context.resources.getString(R.string.dialog_permission_tip_title),
                        content = context.resources.getString(R.string.dialog_permission_tip_content),
                        rejectBtnText = context.resources.getString(R.string.reject),
                        allowBtnText = context.resources.getString(R.string.allow)
                    )
                )
                .bindOnActionCallback(object : ConfirmDialog.OnActionCallback {
                    override fun onReject() {
                    }

                    override fun onAllow() {
                    }
                })
                .show()
        }
    }
}