Compare commits

...

6 Commits

Author SHA1 Message Date
chen08209
07bbaf6b6f Update version 2024-05-01 23:40:04 +08:00
chen08209
e8feb7c431 Set Android notification low importance 2024-05-01 23:40:03 +08:00
chen08209
4d16820526 Fix the issue that VpnService can't be closed correctly in special cases 2024-05-01 23:40:00 +08:00
chen08209
92294b49c6 Fix the problem that TileService is not destroyed correctly in some cases
Adjust tab animation defaults
2024-05-01 23:39:59 +08:00
chen08209
8a188a37c9 Add Telegram in README_zh_CN.md 2024-05-01 21:52:07 +08:00
chen08209
48af16c265 Add Telegram 2024-05-01 21:50:26 +08:00
8 changed files with 30 additions and 15 deletions

View File

@@ -10,12 +10,12 @@ A multi-platform proxy client based on ClashMeta, simple and easy to use, open-s
on Desktop: on Desktop:
<p style="text-align: center;"> <p style="text-align: center;">
<img src="snapshots/desktop.gif"> <img alt="desktop" src="snapshots/desktop.gif">
</p> </p>
on Mobile: on Mobile:
<p style="text-align: center;"> <p style="text-align: center;">
<img src="snapshots/mobile.gif"> <img alt="mobile" src="snapshots/mobile.gif">
</p> </p>
## Features ## Features
@@ -28,6 +28,10 @@ on Mobile:
✨ Support subscription link, Dark mode ✨ Support subscription link, Dark mode
## Contact
[Telegram](https://t.me/+G-veVtwBOl4wODc1)
## Build ## Build
1. Update submodules 1. Update submodules
@@ -81,4 +85,7 @@ on Mobile:
```bash ```bash
dart .\setup.dart dart .\setup.dart
``` ```

View File

@@ -10,12 +10,12 @@
on Desktop: on Desktop:
<p style="text-align: center;"> <p style="text-align: center;">
<img src="snapshots/desktop.gif"> <img alt="desktop" src="snapshots/desktop.gif">
</p> </p>
on Mobile: on Mobile:
<p style="text-align: center;"> <p style="text-align: center;">
<img src="snapshots/mobile.gif"> <img alt="mobile" src="snapshots/mobile.gif">
</p> </p>
## Features ## Features
@@ -28,6 +28,10 @@ on Mobile:
✨ 支持一键导入订阅, 深色模式 ✨ 支持一键导入订阅, 深色模式
## Contact
[Telegram](https://t.me/+G-veVtwBOl4wODc1)
## Build ## Build
1. 更新 submodules 1. 更新 submodules

View File

@@ -10,6 +10,7 @@ import io.flutter.embedding.engine.FlutterEngine
class MainActivity : FlutterActivity() { class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GlobalState.flutterEngine?.destroy()
super.configureFlutterEngine(flutterEngine) super.configureFlutterEngine(flutterEngine)
flutterEngine.plugins.add(AppPlugin()) flutterEngine.plugins.add(AppPlugin())
flutterEngine.plugins.add(ProxyPlugin()) flutterEngine.plugins.add(ProxyPlugin())

View File

@@ -37,14 +37,12 @@ class FlClashTileService : TileService() {
} }
} }
override fun onStartListening() { override fun onStartListening() {
super.onStartListening() super.onStartListening()
GlobalState.runState.value?.let { updateTile(it) } GlobalState.runState.value?.let { updateTile(it) }
GlobalState.runState.observeForever(observer) GlobalState.runState.observeForever(observer)
} }
@SuppressLint("StartActivityAndCollapseDeprecated") @SuppressLint("StartActivityAndCollapseDeprecated")
private fun activityTransfer() { private fun activityTransfer() {
val intent = Intent(this, TempActivity::class.java) val intent = Intent(this, TempActivity::class.java)
@@ -88,7 +86,7 @@ class FlClashTileService : TileService() {
if(currentTilePlugin == null){ if(currentTilePlugin == null){
initFlutterEngine() initFlutterEngine()
}else{ }else{
currentTilePlugin?.handleStart() currentTilePlugin.handleStart()
} }
} else if(GlobalState.runState.value == RunState.START){ } else if(GlobalState.runState.value == RunState.START){
GlobalState.runState.value = RunState.PENDING GlobalState.runState.value = RunState.PENDING
@@ -97,7 +95,6 @@ class FlClashTileService : TileService() {
} }
override fun onDestroy() { override fun onDestroy() {
GlobalState.runState.removeObserver(observer) GlobalState.runState.removeObserver(observer)
super.onDestroy() super.onDestroy()

View File

@@ -25,7 +25,8 @@ class FlClashVpnService : VpnService() {
private val CHANNEL = "FlClash" private val CHANNEL = "FlClash"
var fd: Int? = null; var fd: Int? = null
private val notificationId: Int = 1
private val passList = listOf( private val passList = listOf(
"*zhihu.com", "*zhihu.com",
@@ -100,11 +101,12 @@ class FlClashVpnService : VpnService() {
fun startForeground(title: String, content: String) { fun startForeground(title: String, content: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = val channel =
NotificationChannel(CHANNEL, "FlClash", NotificationManager.IMPORTANCE_DEFAULT) NotificationChannel(CHANNEL, "FlClash", NotificationManager.IMPORTANCE_LOW)
val manager = getSystemService(NotificationManager::class.java) val manager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannel(channel) manager.createNotificationChannel(channel)
val intent = Intent(this, MainActivity::class.java) val intent = Intent(this, MainActivity::class.java)
val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.getActivity( PendingIntent.getActivity(
this, this,
@@ -120,7 +122,9 @@ class FlClashVpnService : VpnService() {
PendingIntent.FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT
) )
} }
val icon = IconCompat.createWithResource(this, this.applicationInfo.icon) val icon = IconCompat.createWithResource(this, this.applicationInfo.icon)
val notification = with(NotificationCompat.Builder(this, CHANNEL)) { val notification = with(NotificationCompat.Builder(this, CHANNEL)) {
setSmallIcon(icon) setSmallIcon(icon)
setContentTitle(title) setContentTitle(title)
@@ -132,12 +136,13 @@ class FlClashVpnService : VpnService() {
build() build()
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(1, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE) startForeground(notificationId, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else { } else {
startForeground(1, notification) startForeground(notificationId, notification)
} }
} }
} }
private fun stopForeground() { private fun stopForeground() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
stopForeground(Service.STOP_FOREGROUND_REMOVE) stopForeground(Service.STOP_FOREGROUND_REMOVE)

View File

@@ -78,6 +78,7 @@ Future<void> vpnService() async {
TileListenerWithVpn( TileListenerWithVpn(
onStop: () async { onStop: () async {
await app?.tip(appLocalizations.stopVpn); await app?.tip(appLocalizations.stopVpn);
await globalState.stopSystemProxy();
clashCore.shutdown(); clashCore.shutdown();
exit(0); exit(0);
}, },

View File

@@ -87,7 +87,7 @@ class Config extends ChangeNotifier {
_isMinimizeOnExit = true, _isMinimizeOnExit = true,
_isAccessControl = false, _isAccessControl = false,
_accessControl = AccessControl(), _accessControl = AccessControl(),
_isAnimateToPage = false; _isAnimateToPage = true;
deleteProfileById(String id) { deleteProfileById(String id) {
_profiles = profiles.where((element) => element.id != id).toList(); _profiles = profiles.where((element) => element.id != id).toList();

View File

@@ -1,7 +1,7 @@
name: fl_clash name: fl_clash
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free. description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
publish_to: 'none' publish_to: 'none'
version: 0.7.0 version: 0.7.1
environment: environment:
sdk: '>=3.1.0 <4.0.0' sdk: '>=3.1.0 <4.0.0'