package rowedto.jockeyedto.sheetedto.atticedto.fadeedto

import android.app.Activity
import android.content.Intent
import android.util.Log
import rowedto.jockeyedto.sheetedto.atticedto.Moneyedto
import rowedto.jockeyedto.sheetedto.atticedto.allowedto.Provideedto
import rowedto.jockeyedto.sheetedto.atticedto.directionedto.noxiousedto.batedto.Celebrationedto
import rowedto.jockeyedto.sheetedto.atticedto.equipmentedto.exactedto.costumeedto.Geneticedto
import rowedto.jockeyedto.sheetedto.atticedto.equipmentedto.exactedto.costumeedto.Swimmingedto
import rowedto.jockeyedto.sheetedto.atticedto.expandedto.colonyedto.dietedto.Successedto
import rowedto.jockeyedto.sheetedto.atticedto.peakedto.affinityedto.jacketedto.Scrapedto
import rowedto.jockeyedto.sheetedto.atticedto.roleedto.verticaledto.routeedto.Sailedto
import rowedto.jockeyedto.sheetedto.atticedto.strainedto.wolfedto.furtheredto.Archiveedto
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_APP_MANAGER
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_BATTERY_INFO
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_JUNK_CLEAN_PUSH
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_RECOVERY_DOCUMENTS
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_RECOVERY_PHOTOS
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_RECOVERY_VIDEOS
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_SCREENSHOT_CLEAN
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_SIMILAR_IMAGE
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_WEATHER
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.ID_XINGZUO
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto.isGuide

object Lobbyedto {

    private val TAG = "SplashJumpUtils"
    fun jumpNextPage(context: Activity) {

        var jumpType = context.intent.getIntExtra("actionId", 0)

        Log.e(TAG, "actionId: $jumpType")

        if (jumpType == 0) {
            val uri = context.intent.data
            val str = (uri?.getQueryParameter("type") ?: "0")
            jumpType = str.toIntOrNull() ?: 0
            if (jumpType != 0) {
            }
        }

        when (jumpType) {
//=================================主动广播=======================================
            ID_JUNK_CLEAN_PUSH -> {
                context.startActivity(Intent(context, Celebrationedto::class.java))
            }

            ID_SIMILAR_IMAGE -> {
                context.startActivity(Intent(context, Successedto::class.java))
            }

            ID_SCREENSHOT_CLEAN -> {
                context.startActivity(Intent(context, Successedto::class.java))
            }

            ID_RECOVERY_PHOTOS -> {
                context.startActivity(
                    Intent(context, Archiveedto::class.java).putExtra(
                        "ScanType", Dynamicedto.SCAN_PHOTOS
                    )
                )
            }

            ID_RECOVERY_VIDEOS -> {
                context.startActivity(
                    Intent(context, Archiveedto::class.java).putExtra(
                        "ScanType",
                        Dynamicedto.SCAN_VIDEOS
                    )
                )

            }

            ID_RECOVERY_DOCUMENTS -> {
                context.startActivity(
                    Intent(context, Archiveedto::class.java).putExtra(
                        "ScanType",
                        Dynamicedto.SCAN_DOCUMENTS
                    )
                )
            }

//            ID_WHATSAPP_CLEANER -> {
//                context.startActivity(Intent(context, WhatsAppCleanerAnimationActivity::class.java))
//            }
//
//            ID_APP_PROCESS -> {
//                context.startActivity(Intent(context, AppProcessAnimationActivity::class.java))
//            }

            ID_APP_MANAGER -> {
                context.startActivity(Intent(context, Provideedto::class.java))
            }

            ID_BATTERY_INFO -> {
                context.startActivity(Intent(context, Scrapedto::class.java))
            }
            ID_WEATHER->{
                context.startActivity(Intent(context, Geneticedto::class.java))
            }
            ID_XINGZUO->{
                context.startActivity(Intent(context, Swimmingedto::class.java))
            }

//================================被动广播=========================================

            else -> {
                val isHotLaunch = context.intent?.extras?.getBoolean("isHotLaunch", false) ?: false
                if (!isHotLaunch) {
                    if (!isGuide) {
                        context.startActivity(Intent(context, Sailedto::class.java))
                        isGuide = true
                    } else {
                        context.startActivity(Intent(context, Moneyedto::class.java))
                    }

                }
            }
        }
        context.finish()
    }
}