diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt index dae7e38f..4eaac0b5 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt @@ -66,10 +66,44 @@ data class ProfileItem( return Utils.getIpv6Address(server) + ":" + serverPort } - fun getKeyProperty(): ProfileItem { - val copy = this.copy() - copy.subscriptionId = "" - copy.addedTime = 0L - return copy + override fun equals(other: Any?): Boolean { + if (other == null) return false + val obj = other as ProfileItem + + return (this.server == obj.server + && this.serverPort == obj.serverPort + && this.password == obj.password + && this.method == obj.method + && this.flow == obj.flow + && this.username == obj.username + + && this.network == obj.network + && this.headerType == obj.headerType + && this.host == obj.host + && this.path == obj.path + && this.seed == obj.seed + && this.quicSecurity == obj.quicSecurity + && this.quicKey == obj.quicKey + && this.mode == obj.mode + && this.serviceName == obj.serviceName + && this.authority == obj.authority + + && this.security == obj.security + && this.sni == obj.sni + && this.alpn == obj.alpn + && this.fingerPrint == obj.fingerPrint + && this.publicKey == obj.publicKey + && this.shortId == obj.shortId + + && this.secretKey == obj.secretKey + && this.localAddress == obj.localAddress + && this.reserved == obj.reserved + && this.mtu == obj.mtu + + && this.obfsPassword == obj.obfsPassword + && this.portHopping == obj.portHopping + && this.portHoppingInterval == obj.portHoppingInterval + && this.pinSHA256 == obj.pinSHA256 + ) } } \ No newline at end of file diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/MainViewModel.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/MainViewModel.kt index abf71e65..cf70c2f0 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/MainViewModel.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/MainViewModel.kt @@ -257,10 +257,10 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { val deleteServer = mutableListOf() serversCacheCopy.forEachIndexed { index, it -> - val outbound = it.second.getKeyProperty() + val outbound = it.second serversCacheCopy.forEachIndexed { index2, it2 -> if (index2 > index) { - val outbound2 = it2.second.getKeyProperty() + val outbound2 = it2.second if (outbound.equals(outbound2) && !deleteServer.contains(it2.first)) { deleteServer.add(it2.first) }