Skip to content
Merged
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/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "com.patterniha.pattng"
minSdk = 24
targetSdk = 37
versionCode = 748
versionName = (project.findProperty("pattngVersion") as? String)?.takeIf { it.isNotBlank() } ?: "2.3.8"
versionCode = 749
versionName = (project.findProperty("pattngVersion") as? String)?.takeIf { it.isNotBlank() } ?: "2.3.9"

val abiFilterList = (properties["ABI_FILTERS"] as? String)?.split(';')
splits {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.v2ray.ang.BuildConfig
import com.v2ray.ang.dto.entities.AssetUrlCache
import com.v2ray.ang.dto.entities.AssetUrlItem
import com.v2ray.ang.dto.entities.ProfileItem
import com.v2ray.ang.extension.isGroupType
import com.v2ray.ang.dto.entities.RulesetItem
import com.v2ray.ang.dto.entities.ServerAffiliationInfo
import com.v2ray.ang.dto.entities.SubscriptionCache
Expand Down Expand Up @@ -349,7 +350,9 @@ object MmkvManager {
val serverList = if (append) {
decodeServerList(subscriptionId)
} else {
mutableListOf()
replacedServers.filter { guid ->
decodeServerConfig(guid)?.configType?.isGroupType() == true
}.toMutableList()
}
val indexedServers = serverList.toHashSet()
profiles.keys.forEach { guid ->
Expand All @@ -373,7 +376,7 @@ object MmkvManager {
val referencedByOtherGroups = decodeServersReferencedByOtherGroups(subscriptionId)
val removablePayloads = ProfileReplacement.findRemovablePayloads(
replacedServers = replacedServers,
replacementServers = profiles.keys,
replacementServers = serverList.toSet(),
protectedServer = protectedServer,
serversReferencedByOtherGroups = referencedByOtherGroups,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class CheckUpdateViewModel(application: Application) : BaseViewModel(application

fun checkForUpdates() {
launchLoading {
toast(R.string.update_checking_for_update)
try {
val result = UpdateCheckerManager.checkForUpdate(_checkPreRelease.value)
if (result.hasUpdate) {
Expand Down
12 changes: 6 additions & 6 deletions V2rayNG/app/src/main/java/com/v2ray/ang/ui/compose/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ val colorFabInactiveDark = Color(0xFF646464) // Dark Gray
val dividerColorLight = Color(0xFFE0E0E0) // Light Gray
val dividerColorDark = Color(0xFF424242) // Dark Gray

// Toast Colors 70%
val toastNormalBgLight = Color(0xB3353A3E) // Dark Gray
val toastNormalBgDark = Color(0xB34A4F54) // Darker Gray
val toastSuccessBg = Color(0xB3388E3C) // Green
val toastErrorBg = Color(0xB3D50000) // Red
val toastInfoBg = Color(0xB33F51B5) // Indigo Blue
// Toast Colors 85%
val toastNormalBgLight = Color(0xD9353A3E) // Dark Gray
val toastNormalBgDark = Color(0xD94A4F54) // Darker Gray
val toastSuccessBg = Color(0xD9388E3C) // Green
val toastErrorBg = Color(0xD9D50000) // Red
val toastInfoBg = Color(0xD93F51B5) // Indigo Blue
val toastIconCircleBg = Color(0x33FFFFFF) // Semi-transparent White
val toastTextColor = Color.White // White

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ class MainActivity : HelperBaseComponentActivity() {
toast(R.string.title_file_chooser)
return
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CINNAMON_BUN &&
MmkvManager.decodeSettingsBool(AppConfig.PREF_PROXY_SHARING)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CINNAMON_BUN
) {
checkAndRequestPermission(PermissionType.ACCESS_LOCAL_NETWORK) {}
}
Expand Down
32 changes: 30 additions & 2 deletions V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainBottomBar.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.v2ray.ang.ui.main

import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -20,9 +22,13 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
Expand All @@ -33,6 +39,7 @@ import com.v2ray.ang.ui.compose.AppDivider
import com.v2ray.ang.ui.compose.colorFabActive
import com.v2ray.ang.ui.compose.colorFabInactiveDark
import com.v2ray.ang.ui.compose.colorFabInactiveLight
import kotlinx.coroutines.launch

@Composable
fun MainBottomBar(
Expand All @@ -41,6 +48,15 @@ fun MainBottomBar(
isDarkTheme: Boolean,
onAction: (MainAction) -> Unit
) {
val scope = rememberCoroutineScope()
val rotationAnim = remember { Animatable(0f) }

LaunchedEffect(isRunning) {
if (!isRunning) {
rotationAnim.snapTo(0f)
}
}

Box(modifier = Modifier.fillMaxWidth()) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -68,7 +84,17 @@ fun MainBottomBar(
}
}
FloatingActionButton(
onClick = { onAction(MainAction.ToggleService) },
onClick = {
if (!isRunning) {
scope.launch {
rotationAnim.animateTo(
targetValue = 720f,
animationSpec = tween(durationMillis = 3000)
)
}
}
onAction(MainAction.ToggleService)
},
modifier = Modifier
.align(Alignment.TopEnd)
.padding(end = 24.dp)
Expand All @@ -85,7 +111,9 @@ fun MainBottomBar(
if (isRunning) R.string.acc_stop else R.string.acc_start
),
tint = Color.White,
modifier = Modifier.size(24.dp)
modifier = Modifier
.size(24.dp)
.graphicsLayer { rotationZ = rotationAnim.value }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class MainRepository(
AppConfig.MSG_STATE_RUNNING -> MainServiceEvent.StateRunning
AppConfig.MSG_STATE_NOT_RUNNING -> MainServiceEvent.StateNotRunning
AppConfig.MSG_STATE_START_SUCCESS -> MainServiceEvent.StateStartSuccess
AppConfig.MSG_STATE_START_FAILURE -> MainServiceEvent.StateStartFailure(safeIntent.getStringExtra("content").orEmpty())
AppConfig.MSG_STATE_START_FAILURE -> MainServiceEvent.StateStartFailure(
safeIntent.getStringExtra("content")
)
AppConfig.MSG_STATE_CONNECTING -> MainServiceEvent.StateConnecting(safeIntent.getStringExtra("content").orEmpty())

AppConfig.MSG_STATE_STOP_SUCCESS -> MainServiceEvent.StateStopSuccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sealed class MainServiceEvent {
data object StateRunning : MainServiceEvent()
data object StateNotRunning : MainServiceEvent()
data object StateStartSuccess : MainServiceEvent()
data class StateStartFailure(val message: String) : MainServiceEvent()
data class StateStartFailure(val message: String? = null) : MainServiceEvent()
data class StateConnecting(val message: String) : MainServiceEvent()
data object StateStopSuccess : MainServiceEvent()
data class MeasureDelayResult(val result: ConnectionTestResult, val requestId: String) : MainServiceEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ class MainViewModel(
is MainServiceEvent.StateStartFailure -> {
// The daemon attaches a reason only when it is a localized resource string, e.g.
// the Aether core stopping or missing on this ABI; the generic text is the fallback.
val reason = event.message.trim()
if (reason.isEmpty()) toastError(R.string.toast_services_failure) else toastError(reason)
if (!event.message.isNullOrBlank()) {
toastError(event.message)
} else {
toastError(R.string.toast_services_failure)
}
updateRunningState(false)
}

Expand Down