package com.ym.modulecommon.utils

import android.app.Activity
import android.content.Intent
import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.news.AdNewsHomeActivity
import com.ym.modulecommon.news.AdNewsWebActivity

object AdJumpUtils {

    //新闻赚
    fun jumpAdNewsWebActivity(activity: Activity, url: String?, newsId: Int?) {
        try {
            val intent = Intent(activity,AdNewsWebActivity::class.java)
            intent.putExtra("news_url",url)
            intent.putExtra("news_id",newsId)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            AppliContext.get().startActivity(intent)
        } catch (e: Exception) {
            Utils.showToast(AppliContext.get(), "该版本暂不支持，请更新版本！")
        }
    }

    //新闻赚首页
    fun jumpAdNewsHomeActivity(activity: Activity) {
        try {
            val intent = Intent(activity, AdNewsHomeActivity::class.java)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            AppliContext.get().startActivity(intent)
        } catch (e: Exception) {
            Utils.showToast(AppliContext.get(), "该版本暂不支持，请更新版本！")
        }
    }
}