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
10 changes: 10 additions & 0 deletions android/app/src/main/kotlin/com/follow/clash/ServiceState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ object ServiceState {
}
}

fun toggleRequiresVpnConsent(): Boolean {
if (isRunningRequested()) {
return false
}
val options = sharedState.vpnOptions
?: GlobalState.application.sharedState.vpnOptions
?: return false
return options.enable && VpnService.prepare(GlobalState.application) != null
}

suspend fun refresh(): Long = transitionLock.withLock {
val current = runTimeMillis
mutableRunState.value = if (current == 0L) RunState.STOPPED else RunState.STARTED
Expand Down
7 changes: 6 additions & 1 deletion android/app/src/main/kotlin/com/follow/clash/TileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.follow.clash
import android.annotation.SuppressLint
import android.os.Build
import android.service.quicksettings.Tile
import com.follow.clash.common.GlobalState
import com.follow.clash.common.QuickAction
import com.follow.clash.common.quickIntent
import com.follow.clash.common.toPendingIntent
Expand All @@ -28,7 +29,11 @@ class TileService : android.service.quicksettings.TileService() {

override fun onClick() {
super.onClick()
openQuickAction()
if (ServiceState.toggleRequiresVpnConsent()) {
openQuickAction()
} else {
GlobalState.launch { ServiceState.handleToggleAction() }
}
}

override fun onStopListening() {
Expand Down
5 changes: 4 additions & 1 deletion plugins/setup/buildkit/build_tool/lib/src/go_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ String _resolveCc(Target target) {
if (entries.isEmpty) {
throw BuildException('No NDK prebuilt toolchain found in $prebuiltDir');
}
return p.join(entries.first.path, 'bin', target.ndkCcName);
final ccName = Platform.isWindows
? '${target.ndkCcName}.cmd'
: target.ndkCcName;
return p.join(entries.first.path, 'bin', ccName);
}

class GoBuilder {
Expand Down