Fixed the issue with decimal point in Subscription-Userinfo field (#547)

https://github.com/MetaCubeX/ClashMetaForAndroid/discussions/292
This commit is contained in:
YuHuanTin
2025-06-20 09:06:51 +08:00
committed by GitHub
parent 131097a236
commit 38d0d4397e
2 changed files with 7 additions and 6 deletions

View File

@@ -160,13 +160,13 @@ class ProfileManager(private val context: Context) : IProfileManager,
val info = flag.split("=")
when {
info[0].contains("upload") && info[1].isNotEmpty() -> upload =
BigDecimal(info[1]).longValueExact()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("download") && info[1].isNotEmpty() -> download =
BigDecimal(info[1]).longValueExact()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("total") && info[1].isNotEmpty() -> total =
BigDecimal(info[1]).longValueExact()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("expire") && info[1].isNotEmpty() -> {
if (info[1].isNotEmpty()) {

View File

@@ -21,6 +21,7 @@ import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import okhttp3.Request
import java.math.BigDecimal
import java.net.URL
import java.util.*
import java.util.concurrent.TimeUnit
@@ -88,13 +89,13 @@ object ProfileProcessor {
val info = flag.split("=")
when {
info[0].contains("upload") && info[1].isNotEmpty() -> upload =
info[1].toLong()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("download") && info[1].isNotEmpty() -> download =
info[1].toLong()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("total") && info[1].isNotEmpty() -> total =
info[1].toLong()
BigDecimal(info[1].split('.').first()).longValueExact()
info[0].contains("expire") && info[1].isNotEmpty() -> expire =
(info[1].toDouble() * 1000).toLong()