diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ProfileItem.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ProfileItem.kt index 870d2716..dae7e38f 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ProfileItem.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/ProfileItem.kt @@ -3,7 +3,6 @@ package com.v2ray.ang.dto import com.v2ray.ang.AppConfig.TAG_BLOCKED import com.v2ray.ang.AppConfig.TAG_DIRECT import com.v2ray.ang.AppConfig.TAG_PROXY -import com.v2ray.ang.util.JsonUtil import com.v2ray.ang.util.Utils data class ProfileItem( @@ -67,9 +66,10 @@ data class ProfileItem( return Utils.getIpv6Address(server) + ":" + serverPort } - fun getKeyProperty(): String { - subscriptionId = "" - addedTime = 0L - return JsonUtil.toJson(this) + fun getKeyProperty(): ProfileItem { + val copy = this.copy() + copy.subscriptionId = "" + copy.addedTime = 0L + return copy } } \ No newline at end of file diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/handler/AngConfigManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/handler/AngConfigManager.kt index 073706e1..7488ba7b 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/handler/AngConfigManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/handler/AngConfigManager.kt @@ -209,6 +209,7 @@ object AngConfigManager { var count = 0 servers.lines() + .distinct() .forEach { str -> if (Utils.isValidSubUrl(str)) { count += importUrlAsSubscription(str) @@ -246,6 +247,7 @@ object AngConfigManager { val subItem = MmkvManager.decodeSubscription(subid) var count = 0 servers.lines() + .distinct() .reversed() .forEach { val resId = parseConfig(it, subid, subItem, removedSelectedServer) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/MainViewModel.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/MainViewModel.kt index 1bd0dab8..aa6f3413 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/MainViewModel.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/viewmodel/MainViewModel.kt @@ -266,7 +266,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { serversCacheCopy.forEachIndexed { index2, it2 -> if (index2 > index) { val outbound2 = it2.second.getKeyProperty() - if (outbound == outbound2 && !deleteServer.contains(it2.first)) { + if (outbound.equals(outbound2) && !deleteServer.contains(it2.first)) { deleteServer.add(it2.first) } }