Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions V2rayNG/app/src/main/java/com/v2ray/ang/extension/_Ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ fun EConfigType.isGroupType(): Boolean {
/**
* Checks if the config type is a complex type (Custom, PolicyGroup, or ProxyChain).
*
* @return True if the config type is Custom, CustomOutbound, PolicyGroup, or ProxyChain, false otherwise.
* @return True if the config type is Custom, PolicyGroup, or ProxyChain, false otherwise.
*/
fun EConfigType.isComplexType(): Boolean {
return this == EConfigType.CUSTOM_OUTBOUND || this == EConfigType.CUSTOM || this == EConfigType.POLICYGROUP || this == EConfigType.PROXYCHAIN
return this == EConfigType.CUSTOM || this == EConfigType.POLICYGROUP || this == EConfigType.PROXYCHAIN
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fun ShareMethodDialog(
onRemove: (String, String) -> Unit,
) {
val menuActions = serverMenuActions(
isComplexProfile = profile.configType.isComplexType(),
isComplexProfile = profile.configType.isComplexType() || profile.configType == EConfigType.CUSTOM_OUTBOUND,
includeManagementActions = more,
)
SelectListDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class ServerProxyChainActivity : BaseComponentActivity() {
allRemarks = SettingsManager.getProfileRemarks(
excludeConfigTypes = setOf(
EConfigType.CUSTOM,
EConfigType.CUSTOM_OUTBOUND,
EConfigType.POLICYGROUP,
EConfigType.PROXYCHAIN,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import com.v2ray.ang.R
import com.v2ray.ang.dto.entities.ProfileItem
import com.v2ray.ang.enums.EConfigType
import com.v2ray.ang.extension.isComplexType
import com.v2ray.ang.ui.mobile.main.MainAction
import com.v2ray.ang.ui.mobile.main.component.ServerRowUiModel
Expand Down Expand Up @@ -76,7 +77,10 @@ internal fun TvMainDialogs(
}
shareTarget?.let { target ->
TvActionDialog(
serverMenuActions(target.profile.configType.isComplexType(), target.origin.action == ProfileRowAction.More),
serverMenuActions(
target.profile.configType.isComplexType() || target.profile.configType == EConfigType.CUSTOM_OUTBOUND,
target.origin.action == ProfileRowAction.More
),
{ stringResource(it.labelRes) },
{ action ->
shareTarget = null
Expand Down
21 changes: 20 additions & 1 deletion V2rayNG/app/src/main/java/com/v2ray/ang/vm/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import com.v2ray.ang.dto.GroupMapItem
import com.v2ray.ang.dto.LocateTarget
import com.v2ray.ang.dto.RealPingResult
import com.v2ray.ang.dto.TestServiceMessage
import com.v2ray.ang.dto.V2rayConfig
import com.v2ray.ang.dto.entities.ProfileItem
import com.v2ray.ang.dto.entities.ServerAffiliationInfo
import com.v2ray.ang.dto.entities.ServersCache
import com.v2ray.ang.dto.entities.SubscriptionCache
import com.v2ray.ang.dto.entities.SubscriptionItem
import com.v2ray.ang.enums.EConfigType
import com.v2ray.ang.extension.delay
import com.v2ray.ang.extension.isComplexType
import com.v2ray.ang.extension.matchesPattern
Expand All @@ -42,6 +44,7 @@ import com.v2ray.ang.ui.mobile.main.MainUiState
import com.v2ray.ang.ui.mobile.main.component.ServerGroupUiState
import com.v2ray.ang.ui.mobile.main.component.ServerRowUiModel
import com.v2ray.ang.ui.mobile.main.component.buildServerRowUiModel
import com.v2ray.ang.util.JsonUtil
import com.v2ray.ang.util.LogUtil
import com.v2ray.ang.util.Utils
import kotlinx.coroutines.CancellationException
Expand Down Expand Up @@ -732,10 +735,26 @@ class MainViewModel(
withContext(ioDispatcher) {
try {
val seen = HashSet<ProfileItem>()
val seenOutbounds = HashSet<V2rayConfig.OutboundBean>()
val duplicates = ArrayList<String>()
currentServers().forEach { server ->
val profile = server.profile
if (!profile.configType.isComplexType()) {
if (profile.configType == EConfigType.CUSTOM_OUTBOUND) {
val outbound = server.guid
.let(MmkvManager::decodeServerRaw)
?.let {
JsonUtil.fromJsonSafe(
it,
V2rayConfig.OutboundBean::class.java
)
}
if (outbound != null) {
outbound.tag = ""
if (!seenOutbounds.add(outbound)) {
duplicates += server.guid
}
}
} else if (!profile.configType.isComplexType()) {
val identity = profile.duplicateIdentity()
if (!seen.add(identity)) duplicates += server.guid
}
Expand Down
Loading