1.优化首次添加设备宠物没经纬度时,用手机位置显示在地图上
2.启用 R8 代码精简/混淆及资源裁剪
This commit is contained in:
@@ -45,6 +45,7 @@ import androidx.annotation.StringDef
|
||||
MMKVKey.UserGpsLon,
|
||||
MMKVKey.UserGpsSpeed,
|
||||
MMKVKey.isFirstCheckBleOpen,
|
||||
MMKVKey.UUID,
|
||||
MMKVKey.Shared
|
||||
)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@@ -87,6 +88,7 @@ annotation class MMKVKey {
|
||||
|
||||
//只使用谷歌地图
|
||||
const val OnlyGoogleMap = "onlyGoogleMap"
|
||||
const val UUID = "uuid"
|
||||
|
||||
//是否gps坐标转换火星坐标
|
||||
const val isGpsToGCJ02 = "gpsToGCJ02"
|
||||
|
||||
@@ -75,7 +75,9 @@ class CommonRequestInterceptor : Interceptor {
|
||||
}
|
||||
}
|
||||
|
||||
val sign = if (paramList.size > 0) {
|
||||
val uuid = MMKVUtil.getString(MMKVKey.UUID)
|
||||
paramList.add("uuid$uuid")
|
||||
val sign = if (paramList.isNotEmpty()) {
|
||||
//按key的字母排序
|
||||
paramList.sort()
|
||||
Utils.get32Md5Value(Utils.SECRET_KEY + paramList.joinToString(""))
|
||||
@@ -85,6 +87,7 @@ class CommonRequestInterceptor : Interceptor {
|
||||
|
||||
val token = MMKVUtil.getString(MMKVKey.Token)
|
||||
builder.addHeader("token", token)
|
||||
builder.addHeader("uuid", uuid)
|
||||
builder.addHeader("sign", sign)
|
||||
|
||||
return chain.proceed(builder.build())
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.abbidot.baselibrary.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import java.util.Locale
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
/**
|
||||
@@ -106,6 +110,24 @@ class AppUtils {
|
||||
return lang.contains("CN") || lang.contains("ZH")
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存唯一标识到本地
|
||||
*/
|
||||
@SuppressLint("HardwareIds")
|
||||
fun saveUniqueId(context: Context) {
|
||||
var uuid = MMKVUtil.getString(MMKVKey.UUID)
|
||||
if (TextUtils.isEmpty(uuid)) {
|
||||
val androidId =
|
||||
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
?: ""
|
||||
uuid = if (TextUtils.isEmpty(androidId))
|
||||
UUID.randomUUID().toString()
|
||||
else
|
||||
androidId
|
||||
MMKVUtil.putString(MMKVKey.UUID, uuid)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统国家地区
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user