You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
package com.example.request
|
|
|
|
import android.content.Context
|
|
import android.content.pm.PackageManager
|
|
import android.os.Build
|
|
import android.telephony.TelephonyManager
|
|
import com.example.lib.BuildConfig
|
|
import com.example.utils.AndroidId
|
|
import com.example.utils.NetworkManager
|
|
import com.example.utils.notificationListenerEnable
|
|
|
|
class BaseRequestImp(
|
|
private val context: Context,
|
|
private val network: NetworkManager,
|
|
) : BaseRequest {
|
|
private val telephonyManager: TelephonyManager? =
|
|
context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager?
|
|
private val versionCode: Int = runCatching {
|
|
context.packageManager.getPackageInfo(
|
|
context.packageName,
|
|
PackageManager.GET_META_DATA
|
|
).versionCode
|
|
}.getOrDefault(0)
|
|
|
|
override val affId: Int
|
|
get() = BuildConfig.aff_id
|
|
|
|
override val userId: String
|
|
get() = AndroidId.androidId ?: ""
|
|
|
|
override val appVer: Int
|
|
get() = versionCode
|
|
|
|
override val telcoCode: String
|
|
get() {
|
|
/* return telephonyManager?.run {
|
|
if (networkOperator.isNullOrBlank()) simOperator
|
|
else networkOperator
|
|
} ?: ""*/
|
|
return "46000"
|
|
}
|
|
|
|
override val netType: Int
|
|
get() = network.type.value
|
|
|
|
override val recvFlag: Boolean
|
|
get() = context.notificationListenerEnable()
|
|
|
|
override val countryCode: String
|
|
get() = context.resources.configuration.locales.get(0).country
|
|
|
|
override val subId: String
|
|
get() = context.packageName
|
|
|
|
override val sdkVer: Int
|
|
get() = BuildConfig.sdk_version
|
|
|
|
override val androidVer: Int
|
|
get() = Build.VERSION.SDK_INT
|
|
|
|
override val pkg: String
|
|
get() = context.packageName
|
|
} |