1.优化首次添加设备宠物没经纬度时,用手机位置显示在地图上

2.启用 R8 代码精简/混淆及资源裁剪
This commit is contained in:
2026-09-10 18:36:52 +08:00
parent 1a032383ce
commit 26cca6a454
13 changed files with 81 additions and 20 deletions

View File

@@ -29,8 +29,8 @@ android {
minSdkVersion 24
targetSdkVersion 35
versionCode 2501
versionName "2.5.1"
// versionName "2.5.1-Beta1"
// versionName "2.5.1"
versionName "2.5.1-Beta1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -97,6 +97,9 @@ android {
storePassword keyKeyStorePassword
keyAlias keyKeyAlias
keyPassword keyKeyAliasPassword
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true // 推荐开启v3签名,Android 9+支持,防重打包更好
}
debug {
storeFile keyKeyStoreFile
@@ -302,8 +305,8 @@ dependencies {
// https://docs.jiguang.cn/jpush/client/Android/android_guide
// implementation 'cn.jiguang.sdk:jcore:3.1.2' // 此处以JCore 2.7.2 版本为例。
// implementation 'cn.jiguang.sdk:jpush:4.6.0' // 此处以JPush 4.0.0 版本为例
implementation 'cn.jiguang.sdk:jcore-google:5.3.7' // 此处以JCore 2.7.2 版本为例。
implementation 'cn.jiguang.sdk:jpush-google:6.0.7' // 此处以JPush 4.0.0 版本为例
implementation 'cn.jiguang.sdk:jcore-google:5.5.2' // 此处以JCore 2.7.2 版本为例。
implementation 'cn.jiguang.sdk:jpush-google:6.2.1' // 此处以JPush 4.0.0 版本为例
// 接入华为厂商
// implementation 'com.huawei.hms:push:6.1.0.300'
// implementation 'cn.jiguang.sdk.plugin:huawei:4.0.0'// 极光厂商插件版本与接入 JPush 版本保持一致,下同

View File

@@ -140,6 +140,16 @@
-keepnames class com.google.gson.internal.** { *; }
-keep class com.google.gson.internal.LinkedTreeMap { *; }
# GMS & Firebase 基础保留规则
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
-keep class com.google.firebase.** { *; }
-dontwarn com.google.firebase.**
# 保留注解,R8 full mode容易丢失
-keepattributes Signature,RuntimeVisibleAnnotations,InnerClasses,EnclosingMethod
# ==============================
# 项目实体类/数据类 —— 这是核心,开启混淆后必崩的关键!!
# ==============================

View File

@@ -48,6 +48,8 @@ class MyApplication : Application() {
Toaster.init(this)
Toaster.setView(R.layout.toast_my_layout)
AppUtils.saveUniqueId(this)
initLocationServer()
// JPushInterface.setDebugMode(true)

View File

@@ -22,6 +22,7 @@ import com.abbidot.baselibrary.util.AppUtils
import com.abbidot.baselibrary.util.LogUtil
import com.abbidot.baselibrary.util.MMKVUtil
import com.abbidot.baselibrary.util.Utils
import com.abbidot.baselibrary.util.rsa.Base64
import com.abbidot.tracker.R
import com.abbidot.tracker.constant.KeyNames
import com.abbidot.tracker.databinding.ActivitySplashBinding
@@ -38,6 +39,7 @@ import com.hjq.toast.Toaster
import com.qmuiteam.qmui.arch.QMUIActivity
import com.stripe.android.PaymentConfiguration
import com.tencent.mm.opensdk.openapi.IWXAPI
import java.nio.charset.StandardCharsets
import java.util.Calendar
@@ -79,16 +81,20 @@ class SplashActivity : QMUIActivity() {
// 清除所有通知,角标数字
notificationManager.cancelAll()
Utils.SECRET_KEY = Util.getMetadata(applicationContext, KeyNames.HTTP_REQUEST_KEY)
val encodedAppSecret = Util.getMetadata(applicationContext, KeyNames.HTTP_REQUEST_KEY)
val sb = StringBuilder(encodedAppSecret)
sb.deleteCharAt(5)
sb.deleteCharAt(9)
val encodedAppSecretSB = sb.toString()
val decodedBytes = Base64.decode2(encodedAppSecretSB)
val appSecret = String(decodedBytes, StandardCharsets.UTF_8)
Utils.SECRET_KEY = appSecret
Utils.CARD_RSA_KEY = Util.getMetadata(applicationContext, KeyNames.CARD_RSA_KEY)
INetworkService.apply {
//国内外服务器切换域名
BASE_URL = if (AppUtils.isDebug()) BASE_URL_TEST
else if (AppUtils.isChina())
BASE_URL_CN
else
BASE_URL_ABROAD
else if (AppUtils.isChina()) BASE_URL_CN
else BASE_URL_ABROAD
}
SRBleUtil.instance.init(application)
@@ -144,8 +150,7 @@ class SplashActivity : QMUIActivity() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, enter, exit)
} else {
@Suppress("DEPRECATION")
overridePendingTransition(enter, exit)
@Suppress("DEPRECATION") overridePendingTransition(enter, exit)
}
}

View File

@@ -780,10 +780,23 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
if (latitude == 0.0 && longitude == 0.0) {
if (!mCountDownTimerViewModel.isStartCountDown) {
mHomeMapCommon.clearMarker()
isMoveCamera = true
// isMoveCamera = true
mCountDownTimerViewModel.startCountDown(30)
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.setText(R.string.txt_locating)
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
//宠物经纬度为0就用手机定位
val userGpsLat = MMKVUtil.getDouble(MMKVKey.UserGpsLat)
val userGpsLon = MMKVUtil.getDouble(MMKVKey.UserGpsLon)
if (userGpsLat == 0.0 && userGpsLon == 0.0) {
val isOutOfChina =
LonAndLatUtil.isLocationOutOfChina(userGpsLat, userGpsLon)
MMKVUtil.putBoolean(MMKVKey.isGpsToGCJ02, !isOutOfChina)
mHomeMapCommon.refreshPetCurrentLocation(
userGpsLat, userGpsLon, isMoveCamera
)
isMoveCamera = false
}
}
mHomeMapCommon.switchShowLocation(ConstantInt.UserLocationType)
} else {

View File

@@ -36,7 +36,7 @@
<string name="txt_change_email_tip">Invierà il codice di verifica a %s.</string>
<string name="txt_upgrade_unlock">Passa a Prime per sbloccare\nFunzionalità esclusive!</string>
<string name="txt_new_firmware_version">Rilevata nuova versione firmware: %s</string>
<string name="txt_invites_you_check">"%@" ti invita a effettuare il check-in su "%@"</string>
<string name="txt_invites_you_check">"%s" ti invita a effettuare il check-in su "%s"</string>
<string name="txt_subscription_expired">Il tuo abbonamento è scaduto,\ntipreghiamo di ricaricarlo</string>
<string name="txt_fences_set">Set recinzioni %s</string>
<string name="txt_is_nearby">%s è nelle vicinanze</string>
@@ -420,7 +420,7 @@
<string name="txt_about_live">Informazioni su Live</string>
<string name="txt_about_live_tip">Il Live Tracking si interromperà tra un\'ora, ma puoi interromperlo prima per risparmiare batteria.</string>
<string name="txt_resting">Riposando</string>
<string name="txt_resting_time">TEMPO DI RIPOSO</string>
<string name="txt_resting_time">Tempo di riposo</string>
<string name="txt_no_signal">Nessun segnale</string>
<string name="txt_wifi">WiFi</string>
<string name="txt_set_measurement_units">Seleziona unità di misura</string>