package aicg.wipf.rxcp.vxhm

import aicg.wipf.vzuj.Kmqp.string
import aicg.wipf.vzuj.Opze
import android.util.Log
import com.google.android.gms.tasks.OnCompleteListener
import com.google.android.gms.tasks.Task
import com.google.firebase.messaging.FirebaseMessaging
import com.test.basd.smartjunkcleaner.R

object Mmii {

    private val TAG = R.string.ޤޒސހދ_D.string()

    fun getToken() {
        ނޙޠޏޞވށޔ()
    }

    private fun ގޏޤބޒޑދޙ() {
        FirebaseMessaging.getInstance().token
            .addOnCompleteListener(OnCompleteListener { task ->
                if (!task.isSuccessful) {
                    Opze.event(R.string.ޕޓޛމޠ_D.string())
                    Log.w(TAG, R.string.ނޛޚޛމ_D.string(), task.exception)
                    return@OnCompleteListener
                }

                val token = task.result
                val ޟޕރޤޝޠޠޢ = 2346..2346 + 10
                println(ޟޕރޤޝޠޠޢ.random())
                Opze.event("fcm_token_suc", token)
                val ޛގޚޖވލޑޘ = 2964
                val ހޝޗޗހރޥނ = 8313
                val ޏޔޑޛބޞޛޚ = ޛގޚޖވލޑޘ * ހޝޗޗހރޥނ * ހޝޗޗހރޥނ
                println(ޏޔޑޛބޞޛޚ)
                Log.d(TAG, R.string.ޘޟށޛޞ_D.string((token).toString()))
            })
    }

    fun subscribeToTopic() {
        fun ޏރވމޚޡޜޅ(ގނޑނޢޓގބ: Int, ޛރޣތޢބޢޣ: Int): Int {
            return ގނޑނޢޓގބ + ޛރޣތޢބޢޣ
        }
        val ށޤޣހޒޒޛޓ = ޏރވމޚޡޜޅ(2365, 2112)
        println(ށޤޣހޒޒޛޓ)
        FirebaseMessaging.getInstance().subscribeToTopic(R.string.ޤޑޣމނ_D.string())
            .addOnCompleteListener { task: Task<Void?> ->
                if (task.isSuccessful) {
                    Opze.event(R.string.ޛޒސޙޅ_D.string(), R.string.ޤޑޣމނ_D.string())
                    Log.d(TAG, R.string.ރޑފޙރ_D.string())
                } else {
                    Opze.event(R.string.ޤޚރޚތ_D.string())
                    Log.e(TAG, R.string.ޖކޕށގ_D.string(), task.exception)
                }
            }
    }

    private fun ނޙޠޏޞވށޔ() {
        ގޏޤބޒޑދޙ()
    }
}