package com.secspace.sms.shortcut

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.secspace.log.Callback
import com.secspace.log.Log
import com.secspace.sms.helpers.Constant
import com.simplemobiletools.commons.extensions.toast

/**
 * Created by Gz on 2024/3/5.
 */
class ShortCutActivity: AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val intent = intent
        Log.d("ShortCutActivity", "initData: action=${intent.action}")
        when(intent.action){
            Constant.EXPORT_LOG ->{
                Log.exportLogsAsync(getExternalFilesDir("logs")!!.absolutePath,object : Callback{
                    override fun onSuccess() {
                        toast("日志导出成功!")
                        finish()
                    }

                    override fun onFailure(e: Exception) {
                        toast("日志导出失败! exception=${e.message}")
                        finish()
                    }
                })
            }
        }
    }

}
