package com.adealink.weparty.commonui.toast.util

import com.adealink.frame.router.annotation.RouterUri
import com.adealink.frame.router.handler.UriHandler
import com.adealink.frame.router.request.UriRequest

/**
 * Created by XiaoDongLin.
 * Date: 2025/9/5
 */

const val ROUTER_TOAST_URI = "/showToast"
const val EXTRA_TOAST_TEXT = "text"

@RouterUri(
    path = [ROUTER_TOAST_URI],
    desc = "展示Toast",
)
class ToastUriHandler : UriHandler() {
    override fun handle(request: UriRequest) {
        val text = request.intent.getStringExtra(EXTRA_TOAST_TEXT)
        if (!text.isNullOrEmpty()) {
            showToast(text)
        }
    }
}