package com.xuqm.sdk.push import android.content.Context import com.xuqm.sdk.XuqmSDK import com.xuqm.sdk.network.ApiClient import com.xuqm.sdk.push.api.PushApi import com.xuqm.sdk.utils.DeviceUtils import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch object PushSDK { private val api: PushApi by lazy { ApiClient.create() } private val scope = CoroutineScope(Dispatchers.IO) fun registerToken(context: Context, appId: String, userId: String, token: String) { XuqmSDK.requireInit() val vendor = DeviceUtils.getVendor() scope.launch { runCatching { api.registerToken(appId, userId, vendor, token) } } } fun unregisterToken(appId: String, userId: String) { XuqmSDK.requireInit() scope.launch { runCatching { api.unregisterToken(appId, userId) } } } }