38 lines
1.1 KiB
Kotlin
38 lines
1.1 KiB
Kotlin
package com.gh.common.util
|
|
|
|
import com.gh.gamecenter.core.utils.SPUtils
|
|
import com.gh.gamecenter.common.retrofit.Response
|
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
|
import io.reactivex.schedulers.Schedulers
|
|
import okhttp3.ResponseBody
|
|
|
|
/**
|
|
* 激活信息辅助类
|
|
*/
|
|
object ActivationHelper {
|
|
|
|
private const val HAS_SENT_ACTIVATED_INFO = "has_sent_activated_info"
|
|
|
|
var mHasSentActivatedInfo = SPUtils.getBoolean(HAS_SENT_ACTIVATED_INFO, false)
|
|
|
|
/**
|
|
* 发送激活信息 (用于推广)
|
|
*/
|
|
@JvmStatic
|
|
fun sendActivationInfo() {
|
|
if (!mHasSentActivatedInfo) {
|
|
RetrofitManager.getInstance()
|
|
.api.postActivationInfo()
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribe(object : Response<ResponseBody>() {
|
|
override fun onResponse(response: ResponseBody?) {
|
|
super.onResponse(response)
|
|
|
|
mHasSentActivatedInfo = true
|
|
SPUtils.setBoolean(HAS_SENT_ACTIVATED_INFO, true)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
} |