package com.atmob.keyboard_android.util

import android.content.Intent
import com.blankj.utilcode.util.IntentUtils
import com.blankj.utilcode.util.Utils
import java.io.Serializable

/**
 * 跳转工具类
 */
class LaunchUtil private constructor() {
    companion object {
        /**
         * 跳转到App的启动页
         *
         * @param args 跳转参数
         */
        fun startLaunchActivity(args: Map<String, Serializable?> = mapOf<String, Serializable>()) {
            val intent: Intent? = IntentUtils.getLaunchAppIntent(Utils.getApp().packageName)
            if (intent == null) {
                return
            }
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            for (entry in args) {
                intent.putExtra(entry.key, entry.value)
            }
            Utils.getApp().startActivity(intent)
        }
    }
}