package com.develop.base.util

import android.content.Context
import android.widget.Toast
import com.develop.base.ext.globalApp

object GlobalToast {

    fun showToast(msg: String, duration: Int = Toast.LENGTH_SHORT) {
        ThreadUtils.runOnMainThread {
            if (!msg.contains("错误")) {
                Toast.makeText(globalApp(), msg, duration).show()
            }
        }
    }

    fun showErrorToast(context: Context, msg: String, duration: Int = Toast.LENGTH_SHORT) {
        ThreadUtils.runOnMainThread {
            Toast.makeText(context, msg, duration).show()
        }
    }

    fun showSuccessToast(context: Context, msg: String, duration: Int = Toast.LENGTH_SHORT) {

    }
}