Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
472cea9037 | ||
|
|
08d07498b9 | ||
|
|
d5aa09949a | ||
|
|
fd1dfe5c60 | ||
|
|
9f89fe8b29 | ||
|
|
78081a12e8 | ||
|
|
6896837f28 | ||
|
|
85eb903402 | ||
|
|
9aa9180f1f | ||
|
|
feb9688a29 | ||
|
|
5c71992174 | ||
|
|
74c3d0ae25 | ||
|
|
ecd1bcafd5 | ||
|
|
184d2d117a | ||
|
|
89e6f17794 | ||
|
|
aef50fe0e3 | ||
|
|
fc0767ed25 | ||
|
|
dbf1724cca | ||
|
|
909aa4038e | ||
|
|
2d0a7d8d46 | ||
|
|
ca96cd1d82 | ||
|
|
91ab1e5dac | ||
|
|
b3a5f74df8 | ||
|
|
1f98be8ad8 | ||
|
|
453c7c98d0 | ||
|
|
91faed35c0 | ||
|
|
07bbaf6b6f | ||
|
|
e8feb7c431 | ||
|
|
4d16820526 | ||
|
|
92294b49c6 | ||
|
|
8a188a37c9 | ||
|
|
48af16c265 |
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -89,7 +89,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Download
|
- name: Download
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -101,13 +101,13 @@ jobs:
|
|||||||
- name: Pre Release
|
- name: Pre Release
|
||||||
run: |
|
run: |
|
||||||
pip install gitchangelog pystache mustache markdown
|
pip install gitchangelog pystache mustache markdown
|
||||||
prelease=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
|
pre=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
|
||||||
if [ -z "$prelease" ]; then
|
if [ -z "pre" ]; then
|
||||||
echo "init" > release.md
|
echo "init" > release.md
|
||||||
else
|
else
|
||||||
current="${{ github.ref_name }}"
|
current="${{ github.ref_name }}"
|
||||||
echo -e "\n\n<details markdown=1><summary>All changes from $current to the latest commit:</summary>\n\n" >> release.md
|
echo -e "\n\n<details markdown=1><summary>All changes from $current to the latest commit:</summary>\n\n" >> release.md
|
||||||
gitchangelog "${prelease}.." >> release.md 2>&1 || echo "Error in gitchangelog"
|
gitchangelog "${pre}.." >> release.md 2>&1 || echo "Error in gitchangelog"
|
||||||
echo -e "\n\n</details>" >> release.md
|
echo -e "\n\n</details>" >> release.md
|
||||||
fi
|
fi
|
||||||
- name: Release
|
- name: Release
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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())
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Submodule core/Clash.Meta updated: 0096393b3a...1c46eb82bf
274
core/common.go
274
core/common.go
@@ -3,25 +3,67 @@ package main
|
|||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"github.com/metacubex/mihomo/adapter/inbound"
|
"github.com/metacubex/mihomo/adapter/inbound"
|
||||||
|
ap "github.com/metacubex/mihomo/adapter/provider"
|
||||||
"github.com/metacubex/mihomo/component/dialer"
|
"github.com/metacubex/mihomo/component/dialer"
|
||||||
"github.com/metacubex/mihomo/component/process"
|
"github.com/metacubex/mihomo/component/process"
|
||||||
"github.com/metacubex/mihomo/component/resolver"
|
"github.com/metacubex/mihomo/component/resolver"
|
||||||
"github.com/metacubex/mihomo/config"
|
"github.com/metacubex/mihomo/config"
|
||||||
|
"github.com/metacubex/mihomo/constant/provider"
|
||||||
"github.com/metacubex/mihomo/dns"
|
"github.com/metacubex/mihomo/dns"
|
||||||
"github.com/metacubex/mihomo/hub/executor"
|
"github.com/metacubex/mihomo/hub/executor"
|
||||||
"github.com/metacubex/mihomo/listener"
|
"github.com/metacubex/mihomo/listener"
|
||||||
"github.com/metacubex/mihomo/log"
|
"github.com/metacubex/mihomo/log"
|
||||||
"github.com/metacubex/mihomo/tunnel"
|
"github.com/metacubex/mihomo/tunnel"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type healthCheckSchema struct {
|
||||||
|
Enable bool `provider:"enable"`
|
||||||
|
URL string `provider:"url"`
|
||||||
|
Interval int `provider:"interval"`
|
||||||
|
TestTimeout int `provider:"timeout,omitempty"`
|
||||||
|
Lazy bool `provider:"lazy,omitempty"`
|
||||||
|
ExpectedStatus string `provider:"expected-status,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type proxyProviderSchema struct {
|
||||||
|
Type string `provider:"type"`
|
||||||
|
Path string `provider:"path,omitempty"`
|
||||||
|
URL string `provider:"url,omitempty"`
|
||||||
|
Proxy string `provider:"proxy,omitempty"`
|
||||||
|
Interval int `provider:"interval,omitempty"`
|
||||||
|
Filter string `provider:"filter,omitempty"`
|
||||||
|
ExcludeFilter string `provider:"exclude-filter,omitempty"`
|
||||||
|
ExcludeType string `provider:"exclude-type,omitempty"`
|
||||||
|
DialerProxy string `provider:"dialer-proxy,omitempty"`
|
||||||
|
|
||||||
|
HealthCheck healthCheckSchema `provider:"health-check,omitempty"`
|
||||||
|
Override ap.OverrideSchema `provider:"override,omitempty"`
|
||||||
|
Header map[string][]string `provider:"header,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ruleProviderSchema struct {
|
||||||
|
Type string `provider:"type"`
|
||||||
|
Behavior string `provider:"behavior"`
|
||||||
|
Path string `provider:"path,omitempty"`
|
||||||
|
URL string `provider:"url,omitempty"`
|
||||||
|
Proxy string `provider:"proxy,omitempty"`
|
||||||
|
Format string `provider:"format,omitempty"`
|
||||||
|
Interval int `provider:"interval,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type GenerateConfigParams struct {
|
type GenerateConfigParams struct {
|
||||||
ProfilePath *string `json:"profile-path"`
|
ProfilePath *string `json:"profile-path"`
|
||||||
Config *config.RawConfig `json:"config" `
|
Config *config.RawConfig `json:"config" `
|
||||||
IsPatch *bool `json:"is-patch"`
|
IsPatch *bool `json:"is-patch"`
|
||||||
|
IsCompatible *bool `json:"is-compatible"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChangeProxyParams struct {
|
type ChangeProxyParams struct {
|
||||||
@@ -46,6 +88,11 @@ type Process struct {
|
|||||||
Target string `json:"target"`
|
Target string `json:"target"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Now struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
func restartExecutable(execPath string) {
|
func restartExecutable(execPath string) {
|
||||||
var err error
|
var err error
|
||||||
executor.Shutdown()
|
executor.Shutdown()
|
||||||
@@ -82,6 +129,19 @@ func readFile(path string) ([]byte, error) {
|
|||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeFile(path string) error {
|
||||||
|
absPath, err := filepath.Abs(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = os.Remove(absPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func getRawConfigWithPath(path *string) *config.RawConfig {
|
func getRawConfigWithPath(path *string) *config.RawConfig {
|
||||||
if path == nil {
|
if path == nil {
|
||||||
return config.DefaultRawConfig()
|
return config.DefaultRawConfig()
|
||||||
@@ -100,18 +160,164 @@ func getRawConfigWithPath(path *string) *config.RawConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func decorationConfig(profilePath *string, cfg config.RawConfig) *config.RawConfig {
|
func decorationConfig(profilePath *string, cfg config.RawConfig, compatible bool) *config.RawConfig {
|
||||||
prof := getRawConfigWithPath(profilePath)
|
prof := getRawConfigWithPath(profilePath)
|
||||||
overwriteConfig(prof, cfg)
|
overwriteConfig(prof, cfg, compatible)
|
||||||
return prof
|
return prof
|
||||||
}
|
}
|
||||||
|
|
||||||
func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfig) {
|
func Reduce[T any, U any](s []T, initVal U, f func(U, T) U) U {
|
||||||
|
for _, v := range s {
|
||||||
|
initVal = f(initVal, v)
|
||||||
|
}
|
||||||
|
return initVal
|
||||||
|
}
|
||||||
|
|
||||||
|
func Map[T, U any](slice []T, fn func(T) U) []U {
|
||||||
|
result := make([]U, len(slice))
|
||||||
|
for i, v := range slice {
|
||||||
|
result[i] = fn(v)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func replaceFromMap(s string, m map[string]string) string {
|
||||||
|
for k, v := range m {
|
||||||
|
s = strings.ReplaceAll(s, k, v)
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeDuplicateFromSlice[T any](slice []T) []T {
|
||||||
|
result := make([]T, 0)
|
||||||
|
seen := make(map[any]struct{})
|
||||||
|
for _, value := range slice {
|
||||||
|
if _, ok := seen[value]; !ok {
|
||||||
|
result = append(result, value)
|
||||||
|
seen[value] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateProxyGroupAndRule(proxyGroup *[]map[string]any, rule *[]string) {
|
||||||
|
var replacements = map[string]string{}
|
||||||
|
var selectArr []map[string]any
|
||||||
|
var urlTestArr []map[string]any
|
||||||
|
var fallbackArr []map[string]any
|
||||||
|
for _, group := range *proxyGroup {
|
||||||
|
switch group["type"] {
|
||||||
|
case "select":
|
||||||
|
selectArr = append(selectArr, group)
|
||||||
|
replacements[group["name"].(string)] = "Proxy"
|
||||||
|
break
|
||||||
|
case "url-test":
|
||||||
|
urlTestArr = append(urlTestArr, group)
|
||||||
|
replacements[group["name"].(string)] = "Auto"
|
||||||
|
break
|
||||||
|
case "fallback":
|
||||||
|
fallbackArr = append(fallbackArr, group)
|
||||||
|
replacements[group["name"].(string)] = "Fallback"
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProxyProxies := Reduce(selectArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||||
|
if cur["proxies"] == nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||||
|
if str, ok := proxyName.(string); ok {
|
||||||
|
str = replaceFromMap(str, replacements)
|
||||||
|
if str != "Proxy" {
|
||||||
|
res = append(res, str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
|
ProxyProxies = removeDuplicateFromSlice(ProxyProxies)
|
||||||
|
|
||||||
|
AutoProxies := Reduce(urlTestArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||||
|
if cur["proxies"] == nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||||
|
if str, ok := proxyName.(string); ok {
|
||||||
|
str = replaceFromMap(str, replacements)
|
||||||
|
if str != "Auto" {
|
||||||
|
res = append(res, str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
|
AutoProxies = removeDuplicateFromSlice(AutoProxies)
|
||||||
|
|
||||||
|
FallbackProxies := Reduce(fallbackArr, []string{}, func(res []string, cur map[string]any) []string {
|
||||||
|
if cur["proxies"] == nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
for _, proxyName := range cur["proxies"].([]interface{}) {
|
||||||
|
if str, ok := proxyName.(string); ok {
|
||||||
|
str = replaceFromMap(str, replacements)
|
||||||
|
if str != "Fallback" {
|
||||||
|
res = append(res, str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
|
FallbackProxies = removeDuplicateFromSlice(FallbackProxies)
|
||||||
|
|
||||||
|
var computedProxyGroup []map[string]any
|
||||||
|
|
||||||
|
if len(ProxyProxies) > 0 {
|
||||||
|
computedProxyGroup = append(computedProxyGroup,
|
||||||
|
map[string]any{
|
||||||
|
"name": "Proxy",
|
||||||
|
"type": "select",
|
||||||
|
"proxies": ProxyProxies,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(AutoProxies) > 0 {
|
||||||
|
computedProxyGroup = append(computedProxyGroup,
|
||||||
|
map[string]any{
|
||||||
|
"name": "Auto",
|
||||||
|
"type": "url-test",
|
||||||
|
"proxies": AutoProxies,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(FallbackProxies) > 0 {
|
||||||
|
computedProxyGroup = append(computedProxyGroup,
|
||||||
|
map[string]any{
|
||||||
|
"name": "Fallback",
|
||||||
|
"type": "fallback",
|
||||||
|
"proxies": FallbackProxies,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
computedRule := Map(*rule, func(value string) string {
|
||||||
|
return replaceFromMap(value, replacements)
|
||||||
|
})
|
||||||
|
|
||||||
|
*proxyGroup = computedProxyGroup
|
||||||
|
*rule = computedRule
|
||||||
|
}
|
||||||
|
|
||||||
|
func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfig, compatible bool) {
|
||||||
targetConfig.ExternalController = ""
|
targetConfig.ExternalController = ""
|
||||||
targetConfig.ExternalUI = ""
|
targetConfig.ExternalUI = ""
|
||||||
targetConfig.Interface = ""
|
targetConfig.Interface = ""
|
||||||
targetConfig.ExternalUIURL = ""
|
targetConfig.ExternalUIURL = ""
|
||||||
targetConfig.IPv6 = patchConfig.IPv6
|
//targetConfig.IPv6 = patchConfig.IPv6
|
||||||
targetConfig.LogLevel = patchConfig.LogLevel
|
targetConfig.LogLevel = patchConfig.LogLevel
|
||||||
targetConfig.FindProcessMode = process.FindProcessAlways
|
targetConfig.FindProcessMode = process.FindProcessAlways
|
||||||
targetConfig.AllowLan = patchConfig.AllowLan
|
targetConfig.AllowLan = patchConfig.AllowLan
|
||||||
@@ -121,22 +327,22 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi
|
|||||||
targetConfig.Tun.Device = patchConfig.Tun.Device
|
targetConfig.Tun.Device = patchConfig.Tun.Device
|
||||||
targetConfig.Tun.DNSHijack = patchConfig.Tun.DNSHijack
|
targetConfig.Tun.DNSHijack = patchConfig.Tun.DNSHijack
|
||||||
targetConfig.Tun.Stack = patchConfig.Tun.Stack
|
targetConfig.Tun.Stack = patchConfig.Tun.Stack
|
||||||
|
targetConfig.GeodataLoader = "standard"
|
||||||
|
targetConfig.Profile.StoreSelected = false
|
||||||
if targetConfig.DNS.Enable == false {
|
if targetConfig.DNS.Enable == false {
|
||||||
targetConfig.DNS = patchConfig.DNS
|
targetConfig.DNS = patchConfig.DNS
|
||||||
} else {
|
|
||||||
targetConfig.DNS.UseHosts = patchConfig.DNS.UseHosts
|
|
||||||
targetConfig.DNS.EnhancedMode = patchConfig.DNS.EnhancedMode
|
|
||||||
targetConfig.DNS.IPv6 = patchConfig.DNS.IPv6
|
|
||||||
targetConfig.DNS.DefaultNameserver = append(patchConfig.DNS.DefaultNameserver, targetConfig.DNS.DefaultNameserver...)
|
|
||||||
targetConfig.DNS.NameServer = append(patchConfig.DNS.NameServer, targetConfig.DNS.NameServer...)
|
|
||||||
targetConfig.DNS.FakeIPFilter = append(patchConfig.DNS.FakeIPFilter, targetConfig.DNS.FakeIPFilter...)
|
|
||||||
targetConfig.DNS.Fallback = append(patchConfig.DNS.Fallback, targetConfig.DNS.Fallback...)
|
|
||||||
if runtime.GOOS == "android" {
|
|
||||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
|
|
||||||
} else if runtime.GOOS == "windows" {
|
|
||||||
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, dns.SystemDNSPlaceholder)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == "android" {
|
||||||
|
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, "dhcp://"+dns.SystemDNSPlaceholder)
|
||||||
|
} else if runtime.GOOS == "windows" {
|
||||||
|
targetConfig.DNS.NameServer = append(targetConfig.DNS.NameServer, dns.SystemDNSPlaceholder)
|
||||||
|
}
|
||||||
|
if compatible == false {
|
||||||
|
targetConfig.ProxyProvider = make(map[string]map[string]any)
|
||||||
|
targetConfig.RuleProvider = make(map[string]map[string]any)
|
||||||
|
generateProxyGroupAndRule(&targetConfig.ProxyGroup, &targetConfig.Rule)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func patchConfig(general *config.General) {
|
func patchConfig(general *config.General) {
|
||||||
@@ -164,10 +370,29 @@ func patchConfig(general *config.General) {
|
|||||||
resolver.DisableIPv6 = !general.IPv6
|
resolver.DisableIPv6 = !general.IPv6
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyConfig(isPatch bool) bool {
|
const concurrentCount = math.MaxInt
|
||||||
if currentConfig == nil {
|
|
||||||
return false
|
func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
ch := make(chan struct{}, concurrentCount)
|
||||||
|
for _, proxyProvider := range proxyProviders {
|
||||||
|
proxyProvider := proxyProvider
|
||||||
|
if proxyProvider.VehicleType() == provider.Compatible {
|
||||||
|
log.Infoln("Start initial Compatible provider %s", proxyProvider.Name())
|
||||||
|
wg.Add(1)
|
||||||
|
ch <- struct{}{}
|
||||||
|
go func() {
|
||||||
|
defer func() { <-ch; wg.Done() }()
|
||||||
|
if err := proxyProvider.Initial(); err != nil {
|
||||||
|
log.Errorln("initial Compatible provider %s error: %v", proxyProvider.Name(), err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func applyConfig(isPatch bool) {
|
||||||
cfg, err := config.ParseRawConfig(currentConfig)
|
cfg, err := config.ParseRawConfig(currentConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cfg, _ = config.ParseRawConfig(config.DefaultRawConfig())
|
cfg, _ = config.ParseRawConfig(config.DefaultRawConfig())
|
||||||
@@ -176,7 +401,6 @@ func applyConfig(isPatch bool) bool {
|
|||||||
patchConfig(cfg.General)
|
patchConfig(cfg.General)
|
||||||
} else {
|
} else {
|
||||||
executor.ApplyConfig(cfg, true)
|
executor.ApplyConfig(cfg, true)
|
||||||
|
healthcheck()
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func InitDartApi(api unsafe.Pointer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendToPort(port int64, msg string) {
|
func SendToPort(port int64, msg string) {
|
||||||
var obj C.Dart_CObject
|
var obj C.Dart_CObject
|
||||||
obj._type = C.Dart_CObject_kString
|
obj._type = C.Dart_CObject_kString
|
||||||
msgString := C.CString(msg)
|
msgString := C.CString(msg)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const (
|
|||||||
Log MessageType = "log"
|
Log MessageType = "log"
|
||||||
Tun MessageType = "tun"
|
Tun MessageType = "tun"
|
||||||
Delay MessageType = "delay"
|
Delay MessageType = "delay"
|
||||||
|
Now MessageType = "now"
|
||||||
Process MessageType = "process"
|
Process MessageType = "process"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,11 +19,11 @@ type Message struct {
|
|||||||
Data interface{} `json:"data"`
|
Data interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (message *Message) toJson() string {
|
func (message *Message) Json() string {
|
||||||
data, _ := json.Marshal(message)
|
data, _ := json.Marshal(message)
|
||||||
return string(data)
|
return string(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendMessage(message Message) {
|
func SendMessage(message Message) {
|
||||||
sendToPort(*Port, message.toJson())
|
SendToPort(*Port, message.Json())
|
||||||
}
|
}
|
||||||
|
|||||||
143
core/hub.go
143
core/hub.go
@@ -7,6 +7,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/metacubex/mihomo/adapter"
|
"github.com/metacubex/mihomo/adapter"
|
||||||
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
"github.com/metacubex/mihomo/adapter/outboundgroup"
|
||||||
|
"github.com/metacubex/mihomo/adapter/provider"
|
||||||
|
"github.com/metacubex/mihomo/common/structure"
|
||||||
"github.com/metacubex/mihomo/common/utils"
|
"github.com/metacubex/mihomo/common/utils"
|
||||||
"github.com/metacubex/mihomo/config"
|
"github.com/metacubex/mihomo/config"
|
||||||
"github.com/metacubex/mihomo/constant"
|
"github.com/metacubex/mihomo/constant"
|
||||||
@@ -21,7 +23,7 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var currentConfig *config.RawConfig
|
var currentConfig = config.DefaultRawConfig()
|
||||||
|
|
||||||
var isInit = false
|
var isInit = false
|
||||||
|
|
||||||
@@ -63,26 +65,63 @@ func validateConfig(s *C.char) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//export updateConfig
|
//export updateConfig
|
||||||
func updateConfig(s *C.char) bool {
|
func updateConfig(s *C.char, port C.longlong) {
|
||||||
paramsString := C.GoString(s)
|
i := int64(port)
|
||||||
var params = &GenerateConfigParams{}
|
go func() {
|
||||||
err := json.Unmarshal([]byte(paramsString), params)
|
paramsString := C.GoString(s)
|
||||||
if err != nil {
|
var params = &GenerateConfigParams{}
|
||||||
log.Errorln("generateConfig Unmarshal error %v", err)
|
err := json.Unmarshal([]byte(paramsString), params)
|
||||||
return false
|
if err != nil {
|
||||||
}
|
bridge.SendToPort(i, err.Error())
|
||||||
prof := decorationConfig(params.ProfilePath, *params.Config)
|
return
|
||||||
currentConfig = prof
|
}
|
||||||
if *params.IsPatch {
|
prof := decorationConfig(params.ProfilePath, *params.Config, *params.IsCompatible)
|
||||||
return applyConfig(true)
|
currentConfig = prof
|
||||||
} else {
|
if *params.IsPatch {
|
||||||
return applyConfig(false)
|
applyConfig(true)
|
||||||
}
|
} else {
|
||||||
|
applyConfig(false)
|
||||||
|
}
|
||||||
|
bridge.SendToPort(i, "")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
//export clearEffect
|
||||||
|
func clearEffect(s *C.char) {
|
||||||
|
path := C.GoString(s)
|
||||||
|
go func() {
|
||||||
|
rawCfg := getRawConfigWithPath(&path)
|
||||||
|
for _, mapping := range rawCfg.RuleProvider {
|
||||||
|
schema := &ruleProviderSchema{}
|
||||||
|
decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true})
|
||||||
|
if err := decoder.Decode(mapping, schema); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if schema.Type == "http" {
|
||||||
|
_ = removeFile(constant.Path.Resolve(schema.Path))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, mapping := range rawCfg.ProxyProvider {
|
||||||
|
schema := &proxyProviderSchema{
|
||||||
|
HealthCheck: healthCheckSchema{
|
||||||
|
Lazy: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
decoder := structure.NewDecoder(structure.Option{TagName: "provider", WeaklyTypedInput: true})
|
||||||
|
if err := decoder.Decode(mapping, schema); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if schema.Type == "http" {
|
||||||
|
_ = removeFile(constant.Path.Resolve(schema.Path))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ = removeFile(path)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export getProxies
|
//export getProxies
|
||||||
func getProxies() *C.char {
|
func getProxies() *C.char {
|
||||||
data, err := json.Marshal(tunnel.Proxies())
|
data, err := json.Marshal(tunnel.ProxiesWithProviders())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return C.CString("")
|
return C.CString("")
|
||||||
}
|
}
|
||||||
@@ -91,27 +130,28 @@ func getProxies() *C.char {
|
|||||||
|
|
||||||
//export changeProxy
|
//export changeProxy
|
||||||
func changeProxy(s *C.char) bool {
|
func changeProxy(s *C.char) bool {
|
||||||
paramsString := C.GoString(s)
|
go func() {
|
||||||
var params = &ChangeProxyParams{}
|
paramsString := C.GoString(s)
|
||||||
err := json.Unmarshal([]byte(paramsString), params)
|
var params = &ChangeProxyParams{}
|
||||||
if err != nil {
|
err := json.Unmarshal([]byte(paramsString), params)
|
||||||
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
if err != nil {
|
||||||
return false
|
log.Infoln("Unmarshal ChangeProxyParams %v", err)
|
||||||
}
|
}
|
||||||
proxies := tunnel.Proxies()
|
proxies := tunnel.ProxiesWithProviders()
|
||||||
proxy := proxies[*params.GroupName]
|
proxy := proxies[*params.GroupName]
|
||||||
if proxy == nil {
|
if proxy == nil {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
log.Infoln("change proxy %s", proxy.Name())
|
log.Infoln("change proxy %s", proxy.Name())
|
||||||
adapterProxy := proxy.(*adapter.Proxy)
|
adapterProxy := proxy.(*adapter.Proxy)
|
||||||
selector, ok := adapterProxy.ProxyAdapter.(*outboundgroup.Selector)
|
selector, ok := adapterProxy.ProxyAdapter.(*outboundgroup.Selector)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
if err := selector.Set(*params.ProxyName); err != nil {
|
if err := selector.Set(*params.ProxyName); err != nil {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +188,7 @@ func asyncTestDelay(s *C.char) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(params.Timeout))
|
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*time.Duration(params.Timeout))
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
proxies := tunnel.Proxies()
|
proxies := tunnel.ProxiesWithProviders()
|
||||||
proxy := proxies[params.ProxyName]
|
proxy := proxies[params.ProxyName]
|
||||||
|
|
||||||
delayData := &Delay{
|
delayData := &Delay{
|
||||||
@@ -239,17 +279,38 @@ func getProviders() *C.char {
|
|||||||
func getProvider(name *C.char) *C.char {
|
func getProvider(name *C.char) *C.char {
|
||||||
providerName := C.GoString(name)
|
providerName := C.GoString(name)
|
||||||
providers := tunnel.Providers()
|
providers := tunnel.Providers()
|
||||||
var provider = providers[providerName]
|
data, err := json.Marshal(providers[providerName])
|
||||||
data, err := json.Marshal(provider)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return C.CString("")
|
return C.CString("")
|
||||||
}
|
}
|
||||||
return C.CString(string(data))
|
return C.CString(string(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//export healthcheck
|
||||||
|
func healthcheck() {
|
||||||
|
hcCompatibleProvider(tunnel.Providers())
|
||||||
|
}
|
||||||
|
|
||||||
//export initNativeApiBridge
|
//export initNativeApiBridge
|
||||||
func initNativeApiBridge(api unsafe.Pointer, port C.longlong) {
|
func initNativeApiBridge(api unsafe.Pointer, port C.longlong) {
|
||||||
bridge.InitDartApi(api)
|
bridge.InitDartApi(api)
|
||||||
i := int64(port)
|
i := int64(port)
|
||||||
bridge.Port = &i
|
bridge.Port = &i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
provider.HealthcheckHook = func(name string, delay uint16) {
|
||||||
|
delayData := &Delay{
|
||||||
|
Name: name,
|
||||||
|
}
|
||||||
|
if delay == 0 {
|
||||||
|
delayData.Value = -1
|
||||||
|
} else {
|
||||||
|
delayData.Value = int32(delay)
|
||||||
|
}
|
||||||
|
bridge.SendMessage(bridge.Message{
|
||||||
|
Type: bridge.Delay,
|
||||||
|
Data: delayData,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:fl_clash/l10n/l10n.dart';
|
import 'package:fl_clash/l10n/l10n.dart';
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
@@ -25,8 +27,14 @@ runAppWithPreferences(
|
|||||||
ChangeNotifierProvider<Config>(
|
ChangeNotifierProvider<Config>(
|
||||||
create: (_) => config,
|
create: (_) => config,
|
||||||
),
|
),
|
||||||
ChangeNotifierProvider<AppState>(
|
ChangeNotifierProxyProvider2<Config, ClashConfig, AppState>(
|
||||||
create: (_) => appState,
|
create: (_) => appState,
|
||||||
|
update: (_, config, clashConfig, appState) {
|
||||||
|
appState?.mode = clashConfig.mode;
|
||||||
|
appState?.isCompatible = config.isCompatible;
|
||||||
|
appState?.selectedMap = config.currentSelectedMap;
|
||||||
|
return appState!;
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
child: child,
|
child: child,
|
||||||
@@ -68,6 +76,7 @@ class ApplicationState extends State<Application> {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
appController.afterInit();
|
appController.afterInit();
|
||||||
appController.initLink();
|
appController.initLink();
|
||||||
|
_updateGroups();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +109,18 @@ class ApplicationState extends State<Application> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updateGroups() {
|
||||||
|
if (globalState.groupsUpdateTimer != null) {
|
||||||
|
globalState.groupsUpdateTimer?.cancel();
|
||||||
|
globalState.groupsUpdateTimer = null;
|
||||||
|
}
|
||||||
|
globalState.groupsUpdateTimer ??=
|
||||||
|
Timer.periodic(appConstant.httpTimeoutDuration, (timer) async {
|
||||||
|
await appController.updateGroups();
|
||||||
|
appController.appState.sortNum++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(context) {
|
Widget build(context) {
|
||||||
return AppStateContainer(
|
return AppStateContainer(
|
||||||
@@ -112,7 +133,6 @@ class ApplicationState extends State<Application> {
|
|||||||
primaryColor: config.primaryColor,
|
primaryColor: config.primaryColor,
|
||||||
),
|
),
|
||||||
builder: (_, state, child) {
|
builder: (_, state, child) {
|
||||||
debugPrint("[Application] update===>");
|
|
||||||
return DynamicColorBuilder(
|
return DynamicColorBuilder(
|
||||||
builder: (lightDynamic, darkDynamic) {
|
builder: (lightDynamic, darkDynamic) {
|
||||||
_updateSystemColorSchemes(lightDynamic, darkDynamic);
|
_updateSystemColorSchemes(lightDynamic, darkDynamic);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@@ -16,19 +17,22 @@ class ClashCore {
|
|||||||
late final ClashFFI clashFFI;
|
late final ClashFFI clashFFI;
|
||||||
late final DynamicLibrary lib;
|
late final DynamicLibrary lib;
|
||||||
|
|
||||||
ClashCore._internal() {
|
DynamicLibrary _getClashLib() {
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
lib = DynamicLibrary.open("libclash.dll");
|
return DynamicLibrary.open("libclash.dll");
|
||||||
clashFFI = ClashFFI(lib);
|
|
||||||
}
|
}
|
||||||
if (Platform.isMacOS) {
|
if (Platform.isMacOS) {
|
||||||
lib = DynamicLibrary.open("libclash.dylib");
|
return DynamicLibrary.open("libclash.dylib");
|
||||||
clashFFI = ClashFFI(lib);
|
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid || Platform.isLinux) {
|
if (Platform.isAndroid || Platform.isLinux) {
|
||||||
lib = DynamicLibrary.open("libclash.so");
|
return DynamicLibrary.open("libclash.so");
|
||||||
clashFFI = ClashFFI(lib);
|
|
||||||
}
|
}
|
||||||
|
throw "Platform is not supported";
|
||||||
|
}
|
||||||
|
|
||||||
|
ClashCore._internal() {
|
||||||
|
lib = _getClashLib();
|
||||||
|
clashFFI = ClashFFI(lib);
|
||||||
clashFFI.initNativeApiBridge(
|
clashFFI.initNativeApiBridge(
|
||||||
NativeApi.initializeApiDLData,
|
NativeApi.initializeApiDLData,
|
||||||
receiver.sendPort.nativePort,
|
receiver.sendPort.nativePort,
|
||||||
@@ -61,51 +65,71 @@ class ClashCore {
|
|||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateConfig(UpdateConfigParams updateConfigParams) {
|
Future<String> updateConfig(UpdateConfigParams updateConfigParams) {
|
||||||
|
final completer = Completer<String>();
|
||||||
|
final receiver = ReceivePort();
|
||||||
|
receiver.listen((message) {
|
||||||
|
if (!completer.isCompleted) {
|
||||||
|
completer.complete(message);
|
||||||
|
receiver.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
final params = json.encode(updateConfigParams);
|
final params = json.encode(updateConfigParams);
|
||||||
return clashFFI.updateConfig(
|
clashFFI.updateConfig(
|
||||||
params.toNativeUtf8().cast(),
|
params.toNativeUtf8().cast(),
|
||||||
) ==
|
receiver.sendPort.nativePort,
|
||||||
1;
|
);
|
||||||
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Group> getProxiesGroups() {
|
Future<List<Group>> getProxiesGroups() {
|
||||||
final proxiesRaw = clashFFI.getProxies();
|
final proxiesRaw = clashFFI.getProxies();
|
||||||
final proxies = json.decode(proxiesRaw.cast<Utf8>().toDartString());
|
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
|
||||||
final groupsRaw = List.from(proxies.values).where((e) {
|
return Isolate.run<List<Group>>(() {
|
||||||
final excludeName = !UsedProxyExtension.valueList
|
final proxies = json.decode(proxiesRawString);
|
||||||
.where((element) => element != UsedProxy.GLOBAL.name)
|
final groupNames = [
|
||||||
.contains(e['name']);
|
UsedProxy.GLOBAL.name,
|
||||||
final validType = GroupTypeExtension.valueList.contains(e['type']);
|
...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) {
|
||||||
return excludeName && validType;
|
final proxy = proxies[e];
|
||||||
}).map(
|
return GroupTypeExtension.valueList.contains(proxy['type']);
|
||||||
(e) {
|
})
|
||||||
e["all"] = ((e["all"] ?? []) as List)
|
];
|
||||||
|
final groupsRaw = groupNames.map((groupName) {
|
||||||
|
final group = proxies[groupName];
|
||||||
|
group["all"] = ((group["all"] ?? []) as List)
|
||||||
.map(
|
.map(
|
||||||
(name) => proxies[name],
|
(name) => proxies[name],
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
return e;
|
return group;
|
||||||
},
|
}).toList();
|
||||||
).toList()
|
return groupsRaw.map((e) => Group.fromJson(e)).toList();
|
||||||
..sort(
|
});
|
||||||
(a, b) {
|
}
|
||||||
final aIndex = GroupTypeExtension.getGroupType(a['type'])?.index;
|
|
||||||
final bIndex = GroupTypeExtension.getGroupType(b['type'])?.index;
|
Future<DelayMap> getDelayMap() {
|
||||||
if (a == null && b == null) {
|
final proxiesRaw = clashFFI.getProxies();
|
||||||
return 0;
|
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
|
||||||
|
return Isolate.run<DelayMap>(() {
|
||||||
|
final proxies = json.decode(proxiesRawString) as Map<String, dynamic>;
|
||||||
|
return proxies.map<String, int?>(
|
||||||
|
(k, v) {
|
||||||
|
final history = v["history"] as List<dynamic>;
|
||||||
|
if (history.isEmpty) {
|
||||||
|
return MapEntry(
|
||||||
|
k,
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final delay = history.last["delay"];
|
||||||
|
return MapEntry(
|
||||||
|
k,
|
||||||
|
delay != 0 ? delay : -1,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (a == null) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (b == null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return aIndex! - bIndex!;
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
final groups = groupsRaw.map((e) => Group.fromJson(e)).toList();
|
});
|
||||||
return groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changeProxy(ChangeProxyParams changeProxyParams) {
|
bool changeProxy(ChangeProxyParams changeProxyParams) {
|
||||||
@@ -122,6 +146,14 @@ class ClashCore {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearEffect(String path) {
|
||||||
|
clashFFI.clearEffect(path.toNativeUtf8().cast());
|
||||||
|
}
|
||||||
|
|
||||||
|
healthcheck() {
|
||||||
|
clashFFI.healthcheck();
|
||||||
|
}
|
||||||
|
|
||||||
VersionInfo getVersionInfo() {
|
VersionInfo getVersionInfo() {
|
||||||
final versionInfoRaw = clashFFI.getVersionInfo();
|
final versionInfoRaw = clashFFI.getVersionInfo();
|
||||||
final versionInfo = json.decode(versionInfoRaw.cast<Utf8>().toDartString());
|
final versionInfo = json.decode(versionInfoRaw.cast<Utf8>().toDartString());
|
||||||
|
|||||||
@@ -907,19 +907,36 @@ class ClashFFI {
|
|||||||
late final _validateConfig =
|
late final _validateConfig =
|
||||||
_validateConfigPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
|
_validateConfigPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
int updateConfig(
|
void updateConfig(
|
||||||
ffi.Pointer<ffi.Char> s,
|
ffi.Pointer<ffi.Char> s,
|
||||||
|
int port,
|
||||||
) {
|
) {
|
||||||
return _updateConfig(
|
return _updateConfig(
|
||||||
s,
|
s,
|
||||||
|
port,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _updateConfigPtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<ffi.Char>, ffi.LongLong)>>('updateConfig');
|
||||||
|
late final _updateConfig =
|
||||||
|
_updateConfigPtr.asFunction<void Function(ffi.Pointer<ffi.Char>, int)>();
|
||||||
|
|
||||||
|
void clearEffect(
|
||||||
|
ffi.Pointer<ffi.Char> s,
|
||||||
|
) {
|
||||||
|
return _clearEffect(
|
||||||
|
s,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final _updateConfigPtr =
|
late final _clearEffectPtr =
|
||||||
_lookup<ffi.NativeFunction<GoUint8 Function(ffi.Pointer<ffi.Char>)>>(
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Char>)>>(
|
||||||
'updateConfig');
|
'clearEffect');
|
||||||
late final _updateConfig =
|
late final _clearEffect =
|
||||||
_updateConfigPtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>();
|
_clearEffectPtr.asFunction<void Function(ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
ffi.Pointer<ffi.Char> getProxies() {
|
ffi.Pointer<ffi.Char> getProxies() {
|
||||||
return _getProxies();
|
return _getProxies();
|
||||||
@@ -1037,6 +1054,14 @@ class ClashFFI {
|
|||||||
late final _getProvider = _getProviderPtr
|
late final _getProvider = _getProviderPtr
|
||||||
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
|
void healthcheck() {
|
||||||
|
return _healthcheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _healthcheckPtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Void Function()>>('healthcheck');
|
||||||
|
late final _healthcheck = _healthcheckPtr.asFunction<void Function()>();
|
||||||
|
|
||||||
void initNativeApiBridge(
|
void initNativeApiBridge(
|
||||||
ffi.Pointer<ffi.Void> api,
|
ffi.Pointer<ffi.Void> api,
|
||||||
int port,
|
int port,
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ abstract mixin class ClashMessageListener {
|
|||||||
void onDelay(Delay delay) {}
|
void onDelay(Delay delay) {}
|
||||||
|
|
||||||
void onProcess(Metadata metadata) {}
|
void onProcess(Metadata metadata) {}
|
||||||
|
|
||||||
|
void onNow(Now now) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClashMessage {
|
class ClashMessage {
|
||||||
@@ -41,6 +43,9 @@ class ClashMessage {
|
|||||||
case MessageType.process:
|
case MessageType.process:
|
||||||
listener.onProcess(Metadata.fromJson(m.data));
|
listener.onProcess(Metadata.fromJson(m.data));
|
||||||
break;
|
break;
|
||||||
|
case MessageType.now:
|
||||||
|
listener.onNow(Now.fromJson(m.data));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'core.dart';
|
import 'core.dart';
|
||||||
|
|
||||||
class ClashService {
|
class ClashService {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ Function debounce<F extends Function>(F func,{int milliseconds = 600}) {
|
|||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
timer!.cancel();
|
timer!.cancel();
|
||||||
}
|
}
|
||||||
timer = Timer(Duration(milliseconds: milliseconds), () {
|
timer = Timer(Duration(milliseconds: milliseconds), () async {
|
||||||
Function.apply(func, args ?? [], namedArgs);
|
await Function.apply(func, args ?? [], namedArgs);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:isolate';
|
|
||||||
|
|
||||||
import 'package:fl_clash/state.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -35,7 +33,6 @@ class AppController {
|
|||||||
config: config,
|
config: config,
|
||||||
clashConfig: clashConfig,
|
clashConfig: clashConfig,
|
||||||
);
|
);
|
||||||
|
|
||||||
updateRunTime();
|
updateRunTime();
|
||||||
updateTraffic();
|
updateTraffic();
|
||||||
globalState.updateFunctionLists = [
|
globalState.updateFunctionLists = [
|
||||||
@@ -71,28 +68,10 @@ class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeProxy() {
|
changeProxy() {
|
||||||
final currentGroupName =
|
globalState.changeProxy(
|
||||||
appState.getCurrentGroupName(config.currentGroupName, clashConfig.mode);
|
appState: appState,
|
||||||
final currentProxyName =
|
config: config,
|
||||||
appState.getCurrentProxyName(config.currentProxyName, clashConfig.mode);
|
clashConfig: clashConfig,
|
||||||
if (config.profiles.isEmpty || currentProxyName == null) {
|
|
||||||
updateSystemProxy(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (currentGroupName == null) return;
|
|
||||||
final groupIndex = appState.groups.indexWhere(
|
|
||||||
(element) => element.name == currentGroupName,
|
|
||||||
);
|
|
||||||
if (groupIndex == -1) return;
|
|
||||||
final proxyIndex = appState.groups[groupIndex].all.indexWhere(
|
|
||||||
(element) => element.name == currentProxyName,
|
|
||||||
);
|
|
||||||
if (proxyIndex == -1) return;
|
|
||||||
clashCore.changeProxy(
|
|
||||||
ChangeProxyParams(
|
|
||||||
groupName: currentGroupName,
|
|
||||||
proxyName: currentProxyName,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,13 +85,7 @@ class AppController {
|
|||||||
config.deleteProfileById(id);
|
config.deleteProfileById(id);
|
||||||
final profilePath = await appPath.getProfilePath(id);
|
final profilePath = await appPath.getProfilePath(id);
|
||||||
if (profilePath == null) return;
|
if (profilePath == null) return;
|
||||||
final file = File(profilePath);
|
clashCore.clearEffect(profilePath);
|
||||||
Isolate.run(() async {
|
|
||||||
final isExists = await file.exists();
|
|
||||||
if (isExists) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (config.currentProfileId == id) {
|
if (config.currentProfileId == id) {
|
||||||
if (config.profiles.isNotEmpty) {
|
if (config.profiles.isNotEmpty) {
|
||||||
final updateId = config.profiles.first.id;
|
final updateId = config.profiles.first.id;
|
||||||
@@ -133,7 +106,7 @@ class AppController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> updateClashConfig({bool isPatch = true}) async {
|
Future<String> updateClashConfig({bool isPatch = true}) async {
|
||||||
return await globalState.updateClashConfig(
|
return await globalState.updateClashConfig(
|
||||||
clashConfig: clashConfig,
|
clashConfig: clashConfig,
|
||||||
config: config,
|
config: config,
|
||||||
@@ -141,12 +114,31 @@ class AppController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyProfile() async {
|
||||||
|
await globalState.applyProfile(
|
||||||
|
appState: appState,
|
||||||
|
config: config,
|
||||||
|
clashConfig: clashConfig,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Function? _changeProfileDebounce;
|
||||||
|
|
||||||
|
changeProfileDebounce(String? profileId) {
|
||||||
|
if (profileId == config.currentProfileId) return;
|
||||||
|
config.currentProfileId = profileId;
|
||||||
|
_changeProfileDebounce ??= debounce<Function(String?)>((profileId) async {
|
||||||
|
await applyProfile();
|
||||||
|
appState.delayMap = {};
|
||||||
|
saveConfigPreferences();
|
||||||
|
});
|
||||||
|
_changeProfileDebounce!([profileId]);
|
||||||
|
}
|
||||||
|
|
||||||
changeProfile(String? value) async {
|
changeProfile(String? value) async {
|
||||||
if (value == config.currentProfileId) return;
|
if (value == config.currentProfileId) return;
|
||||||
config.currentProfileId = value;
|
config.currentProfileId = value;
|
||||||
await updateClashConfig(isPatch: false);
|
await applyProfile();
|
||||||
updateGroups();
|
|
||||||
changeProxy();
|
|
||||||
appState.delayMap = {};
|
appState.delayMap = {};
|
||||||
saveConfigPreferences();
|
saveConfigPreferences();
|
||||||
}
|
}
|
||||||
@@ -160,28 +152,18 @@ class AppController {
|
|||||||
)
|
)
|
||||||
.isBeforeNow();
|
.isBeforeNow();
|
||||||
if (isNotNeedUpdate == false) continue;
|
if (isNotNeedUpdate == false) continue;
|
||||||
final result = await profile.update();
|
await profile.update();
|
||||||
if (result.type == ResultType.error) continue;
|
|
||||||
updateGroups();
|
|
||||||
changeProxy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGroups() {
|
Future<void> updateGroups() async {
|
||||||
globalState.updateGroups(appState);
|
await globalState.updateGroups(appState);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSystemColorSchemes(SystemColorSchemes systemColorSchemes) {
|
updateSystemColorSchemes(SystemColorSchemes systemColorSchemes) {
|
||||||
appState.systemColorSchemes = systemColorSchemes;
|
appState.systemColorSchemes = systemColorSchemes;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCurrentDelay() {
|
|
||||||
final currentProxyName =
|
|
||||||
appState.getCurrentProxyName(config.currentProxyName, clashConfig.mode);
|
|
||||||
if (currentProxyName == null) return;
|
|
||||||
appState.setDelay(Delay(name: currentProxyName, value: null));
|
|
||||||
}
|
|
||||||
|
|
||||||
savePreferences() async {
|
savePreferences() async {
|
||||||
await saveConfigPreferences();
|
await saveConfigPreferences();
|
||||||
await saveClashConfigPreferences();
|
await saveClashConfigPreferences();
|
||||||
@@ -225,26 +207,39 @@ class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
afterInit() async {
|
afterInit() async {
|
||||||
if (appState.isInit) {
|
if (config.autoRun) {
|
||||||
changeProxy();
|
await updateSystemProxy(true);
|
||||||
if (config.autoRun) {
|
} else {
|
||||||
await updateSystemProxy(true);
|
await proxyManager.updateStartTime();
|
||||||
} else {
|
await updateSystemProxy(proxyManager.isStart);
|
||||||
await proxyManager.updateStartTime();
|
|
||||||
await updateSystemProxy(proxyManager.isStart);
|
|
||||||
}
|
|
||||||
autoUpdateProfiles();
|
|
||||||
updateLogStatus();
|
|
||||||
if (!config.silentLaunch) {
|
|
||||||
window?.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
autoUpdateProfiles();
|
||||||
|
updateLogStatus();
|
||||||
|
if (!config.silentLaunch) {
|
||||||
|
window?.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
healthcheck() {
|
||||||
|
for (final delay in appState.delayMap.entries) {
|
||||||
|
setDelay(
|
||||||
|
Delay(
|
||||||
|
name: delay.key,
|
||||||
|
value: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
clashCore.healthcheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
setDelay(Delay delay) {
|
setDelay(Delay delay) {
|
||||||
appState.setDelay(delay);
|
appState.setDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateDelayMap() async {
|
||||||
|
appState.delayMap = await clashCore.getDelayMap();
|
||||||
|
}
|
||||||
|
|
||||||
toPage(int index, {bool hasAnimate = false}) {
|
toPage(int index, {bool hasAnimate = false}) {
|
||||||
final nextLabel = globalState.currentNavigationItems[index].label;
|
final nextLabel = globalState.currentNavigationItems[index].label;
|
||||||
appState.currentLabel = nextLabel;
|
appState.currentLabel = nextLabel;
|
||||||
@@ -355,4 +350,13 @@ class AppController {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearShowProxyDelay() {
|
||||||
|
final showProxyDelay = appState.getRealProxyName(appState.showProxyName);
|
||||||
|
if (showProxyDelay != null) {
|
||||||
|
appState.setDelay(
|
||||||
|
Delay(name: showProxyDelay, value: null),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
enum GroupType { Selector, URLTest, Fallback }
|
enum GroupType { Selector, URLTest, Fallback }
|
||||||
|
|
||||||
|
enum GroupName { GLOBAL, Proxy, Auto, Fallback }
|
||||||
|
|
||||||
extension GroupTypeExtension on GroupType {
|
extension GroupTypeExtension on GroupType {
|
||||||
static List<String> get valueList => GroupType.values
|
static List<String> get valueList => GroupType.values
|
||||||
.map(
|
.map(
|
||||||
@@ -9,8 +11,7 @@ extension GroupTypeExtension on GroupType {
|
|||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
static GroupType? getGroupType(String? value) {
|
static GroupType? getGroupType(String value) {
|
||||||
if (value == null) return null;
|
|
||||||
final index = GroupTypeExtension.valueList.indexOf(value);
|
final index = GroupTypeExtension.valueList.indexOf(value);
|
||||||
if (index == -1) return null;
|
if (index == -1) return null;
|
||||||
return GroupType.values[index];
|
return GroupType.values[index];
|
||||||
@@ -53,4 +54,4 @@ enum ProfileType { file, url }
|
|||||||
|
|
||||||
enum ResultType { success, error }
|
enum ResultType { success, error }
|
||||||
|
|
||||||
enum MessageType { log, tun, delay, process }
|
enum MessageType { log, tun, delay, process, now }
|
||||||
|
|||||||
@@ -80,6 +80,15 @@ class AboutFragment extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text("Telegram"),
|
||||||
|
onTap: () {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse("https://t.me/+G-veVtwBOl4wODc1"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
trailing: const Icon(Icons.launch),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(appLocalizations.project),
|
title: Text(appLocalizations.project),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@@ -35,6 +35,26 @@ class ApplicationSettingFragment extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Selector<Config, bool>(
|
||||||
|
selector: (_, config) => config.isCompatible,
|
||||||
|
builder: (_, isCompatible, __) {
|
||||||
|
return ListItem.switchItem(
|
||||||
|
leading: const Icon(Icons.device_hub),
|
||||||
|
title: const Text("兼容模式"),
|
||||||
|
subtitle: const Text("开启将失去部分应用能力,获得全量的Clash的支持"),
|
||||||
|
delegate: SwitchDelegate(
|
||||||
|
value: isCompatible,
|
||||||
|
onChanged: (bool value) async {
|
||||||
|
final appController = context.appController;
|
||||||
|
appController.config.isCompatible = value;
|
||||||
|
await appController.updateClashConfig(isPatch: false);
|
||||||
|
await appController.updateGroups();
|
||||||
|
appController.changeProxy();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
if (system.isDesktop)
|
if (system.isDesktop)
|
||||||
Selector<Config, bool>(
|
Selector<Config, bool>(
|
||||||
selector: (_, config) => config.autoLaunch,
|
selector: (_, config) => config.autoLaunch,
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
|||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemBuilder: (_, index) {
|
itemBuilder: (_, index) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 84,
|
padding: kMaterialListPadding,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: items[index],
|
child: items[index],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class CoreInfo extends StatelessWidget {
|
|||||||
return Selector<AppState, VersionInfo?>(
|
return Selector<AppState, VersionInfo?>(
|
||||||
selector: (_, appState) => appState.versionInfo,
|
selector: (_, appState) => appState.versionInfo,
|
||||||
builder: (_, versionInfo, __) {
|
builder: (_, versionInfo, __) {
|
||||||
debugPrint("[CoreInfo] update===>");
|
|
||||||
return CommonCard(
|
return CommonCard(
|
||||||
info: Info(
|
info: Info(
|
||||||
label: appLocalizations.coreInfo,
|
label: appLocalizations.coreInfo,
|
||||||
|
|||||||
@@ -96,22 +96,17 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateCurrentDelayContainer(Widget child) {
|
_updateCurrentDelayContainer(Widget child) {
|
||||||
return Selector3<AppState, Config, ClashConfig,
|
return Selector2<AppState, Config, UpdateCurrentDelaySelectorState>(
|
||||||
UpdateCurrentDelaySelectorState>(
|
selector: (_, appState, config) {
|
||||||
selector: (_, appState, config, clashConfig) {
|
|
||||||
final proxyName = appState.getCurrentProxyName(
|
|
||||||
config.currentProxyName,
|
|
||||||
clashConfig.mode,
|
|
||||||
);
|
|
||||||
return UpdateCurrentDelaySelectorState(
|
return UpdateCurrentDelaySelectorState(
|
||||||
isInit: appState.isInit,
|
isInit: appState.isInit,
|
||||||
currentProxyName: proxyName,
|
currentProxyName: appState.getRealProxyName(appState.showProxyName),
|
||||||
delay: appState.delayMap[proxyName],
|
delay: appState
|
||||||
|
.delayMap[appState.getRealProxyName(appState.showProxyName)],
|
||||||
isCurrent: appState.currentLabel == 'dashboard',
|
isCurrent: appState.currentLabel == 'dashboard',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
builder: (_, state, __) {
|
builder: (_, state, __) {
|
||||||
debugPrint("[UpdateCurrentDelay] update===>");
|
|
||||||
_updateCurrentDelay(
|
_updateCurrentDelay(
|
||||||
state.currentProxyName,
|
state.currentProxyName,
|
||||||
state.delay,
|
state.delay,
|
||||||
@@ -132,20 +127,16 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
label: appLocalizations.networkDetection,
|
label: appLocalizations.networkDetection,
|
||||||
),
|
),
|
||||||
child: _updateCurrentDelayContainer(
|
child: _updateCurrentDelayContainer(
|
||||||
Selector3<AppState, Config, ClashConfig, NetworkDetectionSelectorState>(
|
Selector<AppState, NetworkDetectionSelectorState>(
|
||||||
selector: (_, appState, config, clashConfig) {
|
selector: (_, appState) {
|
||||||
final proxyName = appState.getCurrentProxyName(
|
|
||||||
config.currentProxyName,
|
|
||||||
clashConfig.mode,
|
|
||||||
);
|
|
||||||
return NetworkDetectionSelectorState(
|
return NetworkDetectionSelectorState(
|
||||||
isInit: appState.isInit,
|
currentProxyName: appState.showProxyName,
|
||||||
currentProxyName: proxyName,
|
delay: appState.getDelay(
|
||||||
delay: appState.delayMap[proxyName],
|
appState.showProxyName,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
builder: (_, state, __) {
|
builder: (_, state, __) {
|
||||||
debugPrint("[NetworkDetection] update===>");
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -159,8 +150,10 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
state.currentProxyName ?? appLocalizations.noProxy,
|
state.currentProxyName ?? appLocalizations.noProxy,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style:
|
style: Theme.of(context)
|
||||||
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
.textTheme
|
||||||
|
.titleMedium
|
||||||
|
?.toSoftBold(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -11,10 +11,18 @@ class OutboundMode extends StatelessWidget {
|
|||||||
|
|
||||||
_changeMode(BuildContext context, Mode? value) async {
|
_changeMode(BuildContext context, Mode? value) async {
|
||||||
final appController = context.appController;
|
final appController = context.appController;
|
||||||
final clashConfig = context.read<ClashConfig>();
|
final clashConfig = appController.clashConfig;
|
||||||
|
final config = appController.config;
|
||||||
if (value == null || clashConfig.mode == value) return;
|
if (value == null || clashConfig.mode == value) return;
|
||||||
clashConfig.mode = value;
|
clashConfig.mode = value;
|
||||||
await appController.updateClashConfig();
|
await appController.updateClashConfig();
|
||||||
|
if (!config.isCompatible) {
|
||||||
|
final proxySelected = config.currentSelectedMap[GroupName.Proxy.name];
|
||||||
|
final globalSelected = config.currentSelectedMap[GroupName.GLOBAL.name];
|
||||||
|
if (proxySelected != null && globalSelected == null) {
|
||||||
|
config.updateCurrentSelectedMap(GroupName.GLOBAL.name, proxySelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
appController.changeProxy();
|
appController.changeProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +62,8 @@ class OutboundMode extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
Intl.message(item.name),
|
Intl.message(item.name),
|
||||||
style: Theme.of(context)
|
style: Theme
|
||||||
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.titleMedium
|
.titleMedium
|
||||||
?.toSoftBold(),
|
?.toSoftBold(),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class _StartButtonState extends State<StartButton>
|
|||||||
final appController = context.appController;
|
final appController = context.appController;
|
||||||
await appController.updateSystemProxy(isStart);
|
await appController.updateSystemProxy(isStart);
|
||||||
if (isStart && mounted) {
|
if (isStart && mounted) {
|
||||||
appController.clearCurrentDelay();
|
appController.clearShowProxyDelay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,18 +63,20 @@ class _StartButtonState extends State<StartButton>
|
|||||||
hasProfile: config.profiles.isNotEmpty,
|
hasProfile: config.profiles.isNotEmpty,
|
||||||
),
|
),
|
||||||
builder: (_, state, child) {
|
builder: (_, state, child) {
|
||||||
debugPrint("[StartButton] update===>");
|
|
||||||
if (!state.isInit || !state.hasProfile) {
|
if (!state.isInit || !state.hasProfile) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
final textWidth = context.appController.measure.computeTextSize(
|
final textWidth = context.appController.measure
|
||||||
Text(
|
.computeTextSize(
|
||||||
Other.getTimeDifference(
|
Text(
|
||||||
DateTime.now(),
|
Other.getTimeDifference(
|
||||||
),
|
DateTime.now(),
|
||||||
style: Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
),
|
||||||
),
|
style:
|
||||||
).width +
|
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.width +
|
||||||
16;
|
16;
|
||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: _controller.view,
|
animation: _controller.view,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class ProfilesFragment extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||||
|
|
||||||
String _getLastUpdateTimeDifference(DateTime lastDateTime) {
|
String _getLastUpdateTimeDifference(DateTime lastDateTime) {
|
||||||
final currentDateTime = DateTime.now();
|
final currentDateTime = DateTime.now();
|
||||||
final difference = currentDateTime.difference(lastDateTime);
|
final difference = currentDateTime.difference(lastDateTime);
|
||||||
@@ -209,7 +210,7 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
|||||||
child: _profileItem(
|
child: _profileItem(
|
||||||
profile: profile,
|
profile: profile,
|
||||||
groupValue: state.currentProfileId,
|
groupValue: state.currentProfileId,
|
||||||
onChanged: context.appController.changeProfile,
|
onChanged: context.appController.changeProfileDebounce,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -234,7 +235,6 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
|||||||
currentProfileId: config.currentProfileId,
|
currentProfileId: config.currentProfileId,
|
||||||
),
|
),
|
||||||
builder: (context, state, child) {
|
builder: (context, state, child) {
|
||||||
debugPrint("[Profiles] update===>");
|
|
||||||
if (state.profiles.isEmpty) {
|
if (state.profiles.isEmpty) {
|
||||||
return NullStatus(
|
return NullStatus(
|
||||||
label: appLocalizations.nullProfileDesc,
|
label: appLocalizations.nullProfileDesc,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/clash/clash.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -57,150 +56,87 @@ class _ProxiesFragmentState extends State<ProxiesFragment>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateTabController(length) {
|
|
||||||
if (_tabController != null) {
|
|
||||||
_tabController!.dispose();
|
|
||||||
_tabController = null;
|
|
||||||
}
|
|
||||||
_tabController = TabController(
|
|
||||||
length: length,
|
|
||||||
vsync: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
if (_tabController != null) {
|
|
||||||
_tabController!.dispose();
|
|
||||||
_tabController = null;
|
|
||||||
}
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Selector<AppState, bool>(
|
return DelayTestButtonContainer(
|
||||||
selector: (_, appState) => appState.currentLabel == 'proxies',
|
child: Selector<AppState, bool>(
|
||||||
builder: (_, isCurrent, child) {
|
selector: (_, appState) => appState.currentLabel == 'proxies',
|
||||||
if (isCurrent) {
|
builder: (_, isCurrent, child) {
|
||||||
_initActions();
|
if (isCurrent) {
|
||||||
}
|
_initActions();
|
||||||
return child!;
|
}
|
||||||
},
|
return child!;
|
||||||
child: Selector2<AppState, ClashConfig, List<Group>>(
|
},
|
||||||
selector: (_, appState, clashConfig) =>
|
child: Selector3<AppState, Config, ClashConfig, ProxiesSelectorState>(
|
||||||
appState.getCurrentGroups(clashConfig.mode),
|
selector: (_, appState, config, clashConfig) {
|
||||||
shouldRebuild: (prev, next) =>
|
final currentGroups = appState.currentGroups;
|
||||||
!const ListEquality<Group>().equals(prev, next),
|
final groupNames = currentGroups.map((e) => e.name).toList();
|
||||||
builder: (_, groups, __) {
|
return ProxiesSelectorState(
|
||||||
debugPrint("[Proxies] update===>");
|
groupNames: groupNames,
|
||||||
_updateTabController(groups.length);
|
);
|
||||||
return Column(
|
},
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
shouldRebuild: (prev, next) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
if (prev.groupNames.length != next.groupNames.length) {
|
||||||
children: [
|
_tabController?.dispose();
|
||||||
TabBar(
|
_tabController = null;
|
||||||
controller: _tabController,
|
}
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
return prev != next;
|
||||||
dividerColor: Colors.transparent,
|
},
|
||||||
isScrollable: true,
|
builder: (_, state, __) {
|
||||||
tabAlignment: TabAlignment.start,
|
_tabController ??= TabController(
|
||||||
overlayColor:
|
length: state.groupNames.length,
|
||||||
const MaterialStatePropertyAll(Colors.transparent),
|
vsync: this,
|
||||||
tabs: [
|
);
|
||||||
for (final group in groups)
|
return Column(
|
||||||
Tab(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
text: group.name,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
children: [
|
||||||
],
|
TabBar(
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
for (final group in groups)
|
dividerColor: Colors.transparent,
|
||||||
KeepContainer(
|
isScrollable: true,
|
||||||
child: ProxiesTabView(
|
tabAlignment: TabAlignment.start,
|
||||||
group: group,
|
overlayColor:
|
||||||
),
|
const MaterialStatePropertyAll(Colors.transparent),
|
||||||
|
tabs: [
|
||||||
|
for (final groupName in state.groupNames)
|
||||||
|
Tab(
|
||||||
|
text: groupName,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
Expanded(
|
||||||
],
|
child: TabBarView(
|
||||||
);
|
controller: _tabController,
|
||||||
},
|
children: [
|
||||||
|
for (final groupName in state.groupNames)
|
||||||
|
KeepContainer(
|
||||||
|
key: ObjectKey(groupName),
|
||||||
|
child: ProxiesTabView(
|
||||||
|
groupName: groupName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProxiesTabView extends StatefulWidget {
|
class ProxiesTabView extends StatelessWidget {
|
||||||
final Group group;
|
final String groupName;
|
||||||
|
|
||||||
const ProxiesTabView({
|
const ProxiesTabView({
|
||||||
super.key,
|
super.key,
|
||||||
required this.group,
|
required this.groupName,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
|
||||||
State<ProxiesTabView> createState() => _ProxiesTabViewState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ProxiesTabViewState extends State<ProxiesTabView>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
var lock = false;
|
|
||||||
late AnimationController _controller;
|
|
||||||
late Animation<double> _scale;
|
|
||||||
late Animation<double> _opacity;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_controller = AnimationController(
|
|
||||||
vsync: this,
|
|
||||||
duration: const Duration(
|
|
||||||
milliseconds: 200,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
_scale = Tween<double>(
|
|
||||||
begin: 1.0,
|
|
||||||
end: 0.8,
|
|
||||||
).animate(
|
|
||||||
CurvedAnimation(
|
|
||||||
parent: _controller,
|
|
||||||
curve: const Interval(
|
|
||||||
0.0,
|
|
||||||
0.3,
|
|
||||||
curve: Curves.easeIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
_opacity = Tween<double>(
|
|
||||||
begin: 1.0,
|
|
||||||
end: 0.0,
|
|
||||||
).animate(
|
|
||||||
CurvedAnimation(
|
|
||||||
parent: _controller,
|
|
||||||
curve: const Interval(
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
curve: Curves.easeIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
_controller.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
get group => widget.group;
|
|
||||||
|
|
||||||
get measure => context.appController.measure;
|
|
||||||
|
|
||||||
List<Proxy> _sortOfName(List<Proxy> proxies) {
|
List<Proxy> _sortOfName(List<Proxy> proxies) {
|
||||||
return List.of(proxies)
|
return List.of(proxies)
|
||||||
..sort(
|
..sort(
|
||||||
@@ -208,14 +144,13 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Proxy> _sortOfDelay(List<Proxy> proxies) {
|
List<Proxy> _sortOfDelay(BuildContext context, List<Proxy> proxies) {
|
||||||
final appState = context.read<AppState>();
|
final appState = context.read<AppState>();
|
||||||
final delayMap = appState.delayMap;
|
|
||||||
return proxies = List.of(proxies)
|
return proxies = List.of(proxies)
|
||||||
..sort(
|
..sort(
|
||||||
(a, b) {
|
(a, b) {
|
||||||
final aDelay = delayMap[a.name];
|
final aDelay = appState.delayMap[a.name];
|
||||||
final bDelay = delayMap[b.name];
|
final bDelay = appState.delayMap[b.name];
|
||||||
if (aDelay == null && bDelay == null) {
|
if (aDelay == null && bDelay == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -231,38 +166,19 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getProxies(
|
_getProxies(
|
||||||
|
BuildContext context,
|
||||||
List<Proxy> proxies,
|
List<Proxy> proxies,
|
||||||
ProxiesSortType proxiesSortType,
|
ProxiesSortType proxiesSortType,
|
||||||
) {
|
) {
|
||||||
if (proxiesSortType == ProxiesSortType.delay) return _sortOfDelay(proxies);
|
if (proxiesSortType == ProxiesSortType.delay) {
|
||||||
|
return _sortOfDelay(context, proxies);
|
||||||
|
}
|
||||||
if (proxiesSortType == ProxiesSortType.name) return _sortOfName(proxies);
|
if (proxiesSortType == ProxiesSortType.name) return _sortOfName(proxies);
|
||||||
return proxies;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getDelayMap() async {
|
double _getItemHeight(BuildContext context) {
|
||||||
if (lock == true) return;
|
final measure = context.appController.measure;
|
||||||
lock = true;
|
|
||||||
_controller.forward();
|
|
||||||
for (final proxy in group.all) {
|
|
||||||
context.appController.setDelay(
|
|
||||||
Delay(
|
|
||||||
name: proxy.name,
|
|
||||||
value: 0,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
clashCore.delay(
|
|
||||||
proxy.name,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
await Future.delayed(
|
|
||||||
appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
|
||||||
);
|
|
||||||
lock = false;
|
|
||||||
_controller.reverse();
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
double _getItemHeight() {
|
|
||||||
return 12 * 2 +
|
return 12 * 2 +
|
||||||
measure.bodyMediumHeight * 2 +
|
measure.bodyMediumHeight * 2 +
|
||||||
measure.bodySmallHeight +
|
measure.bodySmallHeight +
|
||||||
@@ -270,11 +186,13 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
8 * 2;
|
8 * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
_card({
|
_card(
|
||||||
|
BuildContext context, {
|
||||||
required void Function() onPressed,
|
required void Function() onPressed,
|
||||||
required bool isSelected,
|
required bool isSelected,
|
||||||
required Proxy proxy,
|
required Proxy proxy,
|
||||||
}) {
|
}) {
|
||||||
|
final measure = context.appController.measure;
|
||||||
return CommonCard(
|
return CommonCard(
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
@@ -311,12 +229,22 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: measure.bodySmallHeight,
|
height: measure.bodySmallHeight,
|
||||||
child: Text(
|
child: Selector<AppState, String>(
|
||||||
proxy.type,
|
selector: (context, appState) => appState.getDesc(
|
||||||
style: context.textTheme.bodySmall?.copyWith(
|
proxy.type,
|
||||||
overflow: TextOverflow.ellipsis,
|
proxy.name,
|
||||||
color: context.textTheme.bodySmall?.color?.toLight(),
|
|
||||||
),
|
),
|
||||||
|
builder: (_, desc, __) {
|
||||||
|
return TooltipText(
|
||||||
|
text: Text(
|
||||||
|
desc,
|
||||||
|
style: context.textTheme.bodySmall?.copyWith(
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
color: context.textTheme.bodySmall?.color?.toLight(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@@ -325,7 +253,9 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: measure.labelSmallHeight,
|
height: measure.labelSmallHeight,
|
||||||
child: Selector<AppState, int?>(
|
child: Selector<AppState, int?>(
|
||||||
selector: (context, appState) => appState.delayMap[proxy.name],
|
selector: (context, appState) => appState.getDelay(
|
||||||
|
proxy.name,
|
||||||
|
),
|
||||||
builder: (_, delay, __) {
|
builder: (_, delay, __) {
|
||||||
return FadeBox(
|
return FadeBox(
|
||||||
child: Builder(
|
child: Builder(
|
||||||
@@ -363,107 +293,212 @@ class _ProxiesTabViewState extends State<ProxiesTabView>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildGrid({
|
Widget _buildGrid(
|
||||||
required ProxiesSortType proxiesSortType,
|
BuildContext context, {
|
||||||
|
required List<Proxy> proxies,
|
||||||
required int columns,
|
required int columns,
|
||||||
}) {
|
}) {
|
||||||
return SingleChildScrollView(
|
return GridView.builder(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: AnimateGrid<Proxy>(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
items: _getProxies(group.all, proxiesSortType),
|
crossAxisCount: columns,
|
||||||
columns: columns,
|
mainAxisSpacing: 8,
|
||||||
itemHeight: _getItemHeight(),
|
crossAxisSpacing: 8,
|
||||||
keyBuilder: (item) {
|
mainAxisExtent: _getItemHeight(context),
|
||||||
return ObjectKey(item);
|
|
||||||
},
|
|
||||||
builder: (_, proxy) {
|
|
||||||
return Selector3<AppState, Config, ClashConfig, String?>(
|
|
||||||
selector: (_, appState, config, clashConfig) =>
|
|
||||||
appState.getCurrentProxyName(
|
|
||||||
config.currentProxyName,
|
|
||||||
clashConfig.mode,
|
|
||||||
),
|
|
||||||
builder: (_, value, __) {
|
|
||||||
final currentProxyName =
|
|
||||||
group.type == GroupType.Selector ? value : group.now;
|
|
||||||
return _card(
|
|
||||||
isSelected: proxy.name == currentProxyName,
|
|
||||||
onPressed: () {
|
|
||||||
if (group.type == GroupType.Selector) {
|
|
||||||
final config = context.read<Config>();
|
|
||||||
config.currentProfile?.groupName = group.name;
|
|
||||||
config.currentProfile?.proxyName = proxy.name;
|
|
||||||
config.update();
|
|
||||||
context.appController.changeProxy();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
proxy: proxy,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
itemCount: proxies.length,
|
||||||
|
itemBuilder: (_, index) {
|
||||||
|
final proxy = proxies[index];
|
||||||
|
return Selector3<AppState, Config, ClashConfig,
|
||||||
|
ProxiesCardSelectorState>(
|
||||||
|
selector: (_, appState, config, clashConfig) {
|
||||||
|
final group = appState.getGroupWithName(groupName)!;
|
||||||
|
bool isSelected = config.currentSelectedMap[group.name] == proxy.name ||
|
||||||
|
(config.currentSelectedMap[group.name] == null &&
|
||||||
|
group.now == proxy.name);
|
||||||
|
return ProxiesCardSelectorState(
|
||||||
|
isSelected: isSelected,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
builder: (_, state, __) {
|
||||||
|
return _card(
|
||||||
|
context,
|
||||||
|
isSelected: state.isSelected,
|
||||||
|
onPressed: () {
|
||||||
|
final appController = context.appController;
|
||||||
|
final group =
|
||||||
|
appController.appState.getGroupWithName(groupName)!;
|
||||||
|
if (group.type != GroupType.Selector) {
|
||||||
|
globalState.showSnackBar(
|
||||||
|
context,
|
||||||
|
message: "当前代理组无法选择",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.appController.config.updateCurrentSelectedMap(
|
||||||
|
groupName,
|
||||||
|
proxy.name,
|
||||||
|
);
|
||||||
|
context.appController.changeProxy();
|
||||||
|
},
|
||||||
|
proxy: proxy,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Selector<Config, ProxiesSortType>(
|
return Selector2<AppState, Config, ProxiesTabViewSelectorState>(
|
||||||
selector: (_, config) => config.proxiesSortType,
|
selector: (_, appState, config) {
|
||||||
builder: (_, proxiesSortType, __) {
|
return ProxiesTabViewSelectorState(
|
||||||
return FloatLayout(
|
proxiesSortType: config.proxiesSortType,
|
||||||
floatingWidget: FloatWrapper(
|
sortNum: appState.sortNum,
|
||||||
child: AnimatedBuilder(
|
group: appState.getGroupWithName(groupName)!,
|
||||||
animation: _controller,
|
);
|
||||||
builder: (_, __) {
|
},
|
||||||
return Transform.scale(
|
builder: (_, state, __) {
|
||||||
scale: _scale.value,
|
final proxies = _getProxies(
|
||||||
child: SizedBox(
|
context,
|
||||||
width: 56,
|
state.group.all,
|
||||||
height: 56,
|
state.proxiesSortType,
|
||||||
child: Opacity(
|
);
|
||||||
opacity: _opacity.value,
|
return Align(
|
||||||
child: FloatingActionButton(
|
alignment: Alignment.topCenter,
|
||||||
heroTag: null,
|
child: SlotLayout(
|
||||||
onPressed: _getDelayMap,
|
config: {
|
||||||
child: const Icon(Icons.network_ping),
|
Breakpoints.small: SlotLayout.from(
|
||||||
),
|
key: const Key('proxies_grid_small'),
|
||||||
),
|
builder: (_) => _buildGrid(
|
||||||
),
|
context,
|
||||||
);
|
proxies: proxies,
|
||||||
},
|
columns: 2,
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
child: SlotLayout(
|
|
||||||
config: {
|
|
||||||
Breakpoints.small: SlotLayout.from(
|
|
||||||
key: const Key('proxies_grid_small'),
|
|
||||||
builder: (_) => _buildGrid(
|
|
||||||
proxiesSortType: proxiesSortType,
|
|
||||||
columns: 2,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Breakpoints.medium: SlotLayout.from(
|
),
|
||||||
key: const Key('proxies_grid_medium'),
|
Breakpoints.medium: SlotLayout.from(
|
||||||
builder: (_) => _buildGrid(
|
key: const Key('proxies_grid_medium'),
|
||||||
proxiesSortType: proxiesSortType,
|
builder: (_) => _buildGrid(
|
||||||
columns: 3,
|
context,
|
||||||
),
|
proxies: proxies,
|
||||||
|
columns: 3,
|
||||||
),
|
),
|
||||||
Breakpoints.large: SlotLayout.from(
|
),
|
||||||
key: const Key('proxies_grid_large'),
|
Breakpoints.large: SlotLayout.from(
|
||||||
builder: (_) => _buildGrid(
|
key: const Key('proxies_grid_large'),
|
||||||
proxiesSortType: proxiesSortType,
|
builder: (_) => _buildGrid(
|
||||||
columns: 4,
|
context,
|
||||||
),
|
proxies: proxies,
|
||||||
|
columns: 4,
|
||||||
),
|
),
|
||||||
},
|
),
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DelayTestButtonContainer extends StatefulWidget {
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
const DelayTestButtonContainer({
|
||||||
|
super.key,
|
||||||
|
required this.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DelayTestButtonContainer> createState() =>
|
||||||
|
_DelayTestButtonContainerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DelayTestButtonContainerState extends State<DelayTestButtonContainer>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late AnimationController _controller;
|
||||||
|
late Animation<double> _scale;
|
||||||
|
late Animation<double> _opacity;
|
||||||
|
|
||||||
|
_healthcheck() async {
|
||||||
|
_controller.forward();
|
||||||
|
context.appController.healthcheck();
|
||||||
|
await Future.delayed(
|
||||||
|
appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
||||||
|
);
|
||||||
|
_controller.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_controller = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(
|
||||||
|
milliseconds: 300,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
_scale = Tween<double>(
|
||||||
|
begin: 1.0,
|
||||||
|
end: 0.0,
|
||||||
|
).animate(
|
||||||
|
CurvedAnimation(
|
||||||
|
parent: _controller,
|
||||||
|
curve: const Interval(
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
curve: Curves.easeIn,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
_opacity = Tween<double>(
|
||||||
|
begin: 1.0,
|
||||||
|
end: 0.0,
|
||||||
|
).animate(
|
||||||
|
CurvedAnimation(
|
||||||
|
parent: _controller,
|
||||||
|
curve: const Interval(
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
curve: Curves.easeIn,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FloatLayout(
|
||||||
|
floatingWidget: FloatWrapper(
|
||||||
|
child: AnimatedBuilder(
|
||||||
|
animation: _controller,
|
||||||
|
builder: (_, child) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 56,
|
||||||
|
height: 56,
|
||||||
|
child: Transform.scale(
|
||||||
|
scale: _scale.value,
|
||||||
|
child: Opacity(
|
||||||
|
opacity: _opacity.value,
|
||||||
|
child: child!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: FloatingActionButton(
|
||||||
|
heroTag: null,
|
||||||
|
onPressed: _healthcheck,
|
||||||
|
child: const Icon(Icons.network_ping),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: widget.child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ Future<void> main() async {
|
|||||||
await window?.init();
|
await window?.init();
|
||||||
final config = await preferences.getConfig() ?? Config();
|
final config = await preferences.getConfig() ?? Config();
|
||||||
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
||||||
final appState = AppState();
|
final appState = AppState(
|
||||||
|
mode: clashConfig.mode,
|
||||||
|
isCompatible: config.isCompatible,
|
||||||
|
selectedMap: config.currentSelectedMap,
|
||||||
|
);
|
||||||
await globalState.init(
|
await globalState.init(
|
||||||
appState: appState,
|
appState: appState,
|
||||||
config: config,
|
config: config,
|
||||||
@@ -41,7 +45,11 @@ Future<void> vpnService() async {
|
|||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
final config = await preferences.getConfig() ?? Config();
|
final config = await preferences.getConfig() ?? Config();
|
||||||
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
final clashConfig = await preferences.getClashConfig() ?? ClashConfig();
|
||||||
final appState = AppState();
|
final appState = AppState(
|
||||||
|
mode: clashConfig.mode,
|
||||||
|
isCompatible: config.isCompatible,
|
||||||
|
selectedMap: config.currentSelectedMap,
|
||||||
|
);
|
||||||
clashMessage.addListener(ClashMessageListenerWithVpn(onTun: (String fd) {
|
clashMessage.addListener(ClashMessageListenerWithVpn(onTun: (String fd) {
|
||||||
proxyManager.setProtect(
|
proxyManager.setProtect(
|
||||||
int.parse(fd),
|
int.parse(fd),
|
||||||
@@ -78,6 +86,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);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,33 +5,47 @@ import 'ffi.dart';
|
|||||||
import 'log.dart';
|
import 'log.dart';
|
||||||
import 'navigation.dart';
|
import 'navigation.dart';
|
||||||
import 'package.dart';
|
import 'package.dart';
|
||||||
|
import 'profile.dart';
|
||||||
import 'proxy.dart';
|
import 'proxy.dart';
|
||||||
import 'system_color_scheme.dart';
|
import 'system_color_scheme.dart';
|
||||||
import 'traffic.dart';
|
import 'traffic.dart';
|
||||||
import 'version.dart';
|
import 'version.dart';
|
||||||
|
|
||||||
|
typedef DelayMap = Map<String, int?>;
|
||||||
|
|
||||||
class AppState with ChangeNotifier {
|
class AppState with ChangeNotifier {
|
||||||
List<NavigationItem> _navigationItems;
|
List<NavigationItem> _navigationItems;
|
||||||
int? _runTime;
|
int? _runTime;
|
||||||
bool _isInit;
|
bool _isInit;
|
||||||
DelayMap _delayMap;
|
|
||||||
VersionInfo? _versionInfo;
|
VersionInfo? _versionInfo;
|
||||||
List<Traffic> _traffics;
|
List<Traffic> _traffics;
|
||||||
List<Log> _logs;
|
List<Log> _logs;
|
||||||
List<Package> _packages;
|
List<Package> _packages;
|
||||||
String _currentLabel;
|
String _currentLabel;
|
||||||
SystemColorSchemes _systemColorSchemes;
|
SystemColorSchemes _systemColorSchemes;
|
||||||
|
num _sortNum;
|
||||||
|
Mode _mode;
|
||||||
|
DelayMap _delayMap;
|
||||||
|
SelectedMap _selectedMap;
|
||||||
|
bool _isCompatible;
|
||||||
List<Group> _groups;
|
List<Group> _groups;
|
||||||
|
|
||||||
AppState()
|
AppState({
|
||||||
: _navigationItems = [],
|
required Mode mode,
|
||||||
_delayMap = {},
|
required bool isCompatible,
|
||||||
|
required SelectedMap selectedMap,
|
||||||
|
}) : _navigationItems = [],
|
||||||
_isInit = false,
|
_isInit = false,
|
||||||
_currentLabel = "dashboard",
|
_currentLabel = "dashboard",
|
||||||
_traffics = [],
|
_traffics = [],
|
||||||
_logs = [],
|
_logs = [],
|
||||||
_groups = [],
|
_selectedMap = selectedMap,
|
||||||
_packages = [],
|
_packages = [],
|
||||||
|
_sortNum = 0,
|
||||||
|
_mode = mode,
|
||||||
|
_delayMap = {},
|
||||||
|
_groups = [],
|
||||||
|
_isCompatible = isCompatible,
|
||||||
_systemColorSchemes = SystemColorSchemes();
|
_systemColorSchemes = SystemColorSchemes();
|
||||||
|
|
||||||
String get currentLabel => _currentLabel;
|
String get currentLabel => _currentLabel;
|
||||||
@@ -70,20 +84,38 @@ class AppState with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayMap get delayMap => _delayMap;
|
String getDesc(String type, String? proxyName) {
|
||||||
|
final groupTypeNamesList = GroupType.values.map((e) => e.name).toList();
|
||||||
set delayMap(DelayMap value) {
|
if (!groupTypeNamesList.contains(type)) {
|
||||||
if (_delayMap != value) {
|
return type;
|
||||||
_delayMap = value;
|
} else {
|
||||||
notifyListeners();
|
final index = groups.indexWhere((element) => element.name == proxyName);
|
||||||
|
if (index == -1) return type;
|
||||||
|
return "$type(${groups[index].now})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDelay(Delay delay) {
|
String? getRealProxyName(String? proxyName) {
|
||||||
if (_delayMap[delay.name] != delay.value) {
|
if (proxyName == null) return null;
|
||||||
_delayMap = Map.from(_delayMap)..[delay.name] = delay.value;
|
final index = groups.indexWhere((element) => element.name == proxyName);
|
||||||
notifyListeners();
|
if (index == -1) return proxyName;
|
||||||
|
final group = groups[index];
|
||||||
|
return getRealProxyName(selectedMap.containsKey(proxyName)
|
||||||
|
? selectedMap[proxyName]
|
||||||
|
: group.now);
|
||||||
|
}
|
||||||
|
|
||||||
|
String? get showProxyName {
|
||||||
|
if (currentGroups.isEmpty) {
|
||||||
|
return UsedProxy.DIRECT.name;
|
||||||
}
|
}
|
||||||
|
final firstGroup = currentGroups.first;
|
||||||
|
final firstGroupName = firstGroup.name;
|
||||||
|
return selectedMap[firstGroupName] ?? firstGroup.now;
|
||||||
|
}
|
||||||
|
|
||||||
|
int? getDelay(String? proxyName) {
|
||||||
|
return _delayMap[getRealProxyName(proxyName)];
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionInfo? get versionInfo => _versionInfo;
|
VersionInfo? get versionInfo => _versionInfo;
|
||||||
@@ -144,48 +176,101 @@ class AppState with ChangeNotifier {
|
|||||||
List<Group> get groups => _groups;
|
List<Group> get groups => _groups;
|
||||||
|
|
||||||
set groups(List<Group> value) {
|
set groups(List<Group> value) {
|
||||||
if (_groups != value) {
|
if (!const ListEquality<Group>().equals(_groups, value)) {
|
||||||
_groups = value;
|
_groups = value;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Group> getCurrentGroups(Mode mode) {
|
num get sortNum => _sortNum;
|
||||||
|
|
||||||
|
set sortNum(num value) {
|
||||||
|
if (_sortNum != value) {
|
||||||
|
_sortNum = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Mode get mode => _mode;
|
||||||
|
|
||||||
|
set mode(Mode value) {
|
||||||
|
if (_mode != value) {
|
||||||
|
_mode = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// String? get currentProxyName {
|
||||||
|
// if (mode == Mode.direct) return UsedProxy.DIRECT.name;
|
||||||
|
// if (_currentProxyName != null) return _currentProxyName!;
|
||||||
|
// return currentGroup?.now;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// set currentProxyName(String? value) {
|
||||||
|
// if (_currentProxyName != value) {
|
||||||
|
// _currentProxyName = value;
|
||||||
|
// notifyListeners();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool get isCompatible {
|
||||||
|
return _isCompatible;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isCompatible(bool value) {
|
||||||
|
if (_isCompatible != value) {
|
||||||
|
_isCompatible = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedMap get selectedMap {
|
||||||
|
return _selectedMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
set selectedMap(SelectedMap value) {
|
||||||
|
if (!const MapEquality<String, String>().equals(_selectedMap, value)) {
|
||||||
|
_selectedMap = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Group> get currentGroups {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case Mode.direct:
|
case Mode.direct:
|
||||||
return [];
|
return [];
|
||||||
case Mode.global:
|
case Mode.global:
|
||||||
return groups
|
return groups
|
||||||
.where((element) => element.name == UsedProxy.GLOBAL.name)
|
.where((element) => element.name == GroupName.GLOBAL.name)
|
||||||
.toList();
|
.toList();
|
||||||
case Mode.rule:
|
case Mode.rule:
|
||||||
return groups
|
return groups
|
||||||
.where((element) => element.name != UsedProxy.GLOBAL.name)
|
.where((element) => element.name != GroupName.GLOBAL.name)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String? getCurrentGroupName(String? groupName, Mode mode) {
|
DelayMap get delayMap {
|
||||||
final currentGroups = getCurrentGroups(mode);
|
return _delayMap;
|
||||||
switch (mode) {
|
}
|
||||||
case Mode.direct:
|
|
||||||
return null;
|
set delayMap(DelayMap value) {
|
||||||
case Mode.global:
|
if (!const MapEquality<String, int?>().equals(_delayMap, value)) {
|
||||||
return UsedProxy.GLOBAL.name;
|
_delayMap = value;
|
||||||
case Mode.rule:
|
notifyListeners();
|
||||||
return groupName ??
|
|
||||||
(currentGroups.isNotEmpty ? currentGroups.first.name : null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String? getCurrentProxyName(String? proxyName, Mode mode) {
|
setDelay(Delay delay) {
|
||||||
final currentGroups = getCurrentGroups(mode);
|
if (_delayMap[delay.name] != delay.value) {
|
||||||
switch (mode) {
|
_delayMap = Map.from(_delayMap)..[delay.name] = delay.value;
|
||||||
case Mode.direct:
|
notifyListeners();
|
||||||
return UsedProxy.DIRECT.name;
|
|
||||||
case Mode.global || Mode.rule:
|
|
||||||
return proxyName ??
|
|
||||||
(currentGroups.isNotEmpty ? currentGroups.first.now : null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group? getGroupWithName(String groupName) {
|
||||||
|
final index =
|
||||||
|
currentGroups.indexWhere((element) => element.name == groupName);
|
||||||
|
return index != -1 ? currentGroups[index] : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class AccessControl {
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class Config extends ChangeNotifier {
|
class Config extends ChangeNotifier {
|
||||||
List<Profile> _profiles;
|
List<Profile> _profiles;
|
||||||
|
bool _isCompatible;
|
||||||
String? _currentProfileId;
|
String? _currentProfileId;
|
||||||
bool _autoLaunch;
|
bool _autoLaunch;
|
||||||
bool _silentLaunch;
|
bool _silentLaunch;
|
||||||
@@ -82,12 +83,13 @@ class Config extends ChangeNotifier {
|
|||||||
_autoRun = false,
|
_autoRun = false,
|
||||||
_themeMode = ThemeMode.system,
|
_themeMode = ThemeMode.system,
|
||||||
_openLog = false,
|
_openLog = false,
|
||||||
|
_isCompatible = false,
|
||||||
_primaryColor = appConstant.defaultPrimaryColor.value,
|
_primaryColor = appConstant.defaultPrimaryColor.value,
|
||||||
_proxiesSortType = ProxiesSortType.none,
|
_proxiesSortType = ProxiesSortType.none,
|
||||||
_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();
|
||||||
@@ -159,9 +161,18 @@ class Config extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String? get currentProxyName => currentProfile?.proxyName;
|
|
||||||
|
|
||||||
String? get currentGroupName => currentProfile?.groupName;
|
SelectedMap get currentSelectedMap {
|
||||||
|
return currentProfile?.selectedMap ?? {};
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCurrentSelectedMap(String groupName, String proxyName) {
|
||||||
|
if (currentProfile?.selectedMap[groupName] != proxyName) {
|
||||||
|
currentProfile?.selectedMap = Map.from(currentProfile?.selectedMap ?? {})
|
||||||
|
..[groupName] = proxyName;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@JsonKey(defaultValue: false)
|
@JsonKey(defaultValue: false)
|
||||||
bool get autoLaunch {
|
bool get autoLaunch {
|
||||||
@@ -289,6 +300,18 @@ class Config extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonKey(defaultValue: false)
|
||||||
|
bool get isCompatible {
|
||||||
|
return _isCompatible;
|
||||||
|
}
|
||||||
|
|
||||||
|
set isCompatible(bool value) {
|
||||||
|
if (_isCompatible != value) {
|
||||||
|
_isCompatible = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class UpdateConfigParams with _$UpdateConfigParams {
|
|||||||
const factory UpdateConfigParams({
|
const factory UpdateConfigParams({
|
||||||
@JsonKey(name: "profile-path") String? profilePath,
|
@JsonKey(name: "profile-path") String? profilePath,
|
||||||
required ClashConfig config,
|
required ClashConfig config,
|
||||||
@JsonKey(name: "is-patch") bool? isPatch,
|
@JsonKey(name: "is-patch") required bool isPatch,
|
||||||
|
@JsonKey(name: "is-compatible") required bool isCompatible,
|
||||||
}) = _UpdateConfigParams;
|
}) = _UpdateConfigParams;
|
||||||
|
|
||||||
factory UpdateConfigParams.fromJson(Map<String, Object?> json) =>
|
factory UpdateConfigParams.fromJson(Map<String, Object?> json) =>
|
||||||
@@ -52,6 +53,16 @@ class Delay with _$Delay {
|
|||||||
factory Delay.fromJson(Map<String, Object?> json) => _$DelayFromJson(json);
|
factory Delay.fromJson(Map<String, Object?> json) => _$DelayFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Now with _$Now {
|
||||||
|
const factory Now({
|
||||||
|
required String name,
|
||||||
|
required String value,
|
||||||
|
}) = _Now;
|
||||||
|
|
||||||
|
factory Now.fromJson(Map<String, Object?> json) => _$NowFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class Process with _$Process {
|
class Process with _$Process {
|
||||||
const factory Process({
|
const factory Process({
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
|
|||||||
..isAccessControl = json['isAccessControl'] as bool? ?? false
|
..isAccessControl = json['isAccessControl'] as bool? ?? false
|
||||||
..accessControl =
|
..accessControl =
|
||||||
AccessControl.fromJson(json['accessControl'] as Map<String, dynamic>)
|
AccessControl.fromJson(json['accessControl'] as Map<String, dynamic>)
|
||||||
..isAnimateToPage = json['isAnimateToPage'] as bool? ?? true;
|
..isAnimateToPage = json['isAnimateToPage'] as bool? ?? true
|
||||||
|
..isCompatible = json['isCompatible'] as bool? ?? false;
|
||||||
|
|
||||||
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||||
'profiles': instance.profiles,
|
'profiles': instance.profiles,
|
||||||
@@ -72,6 +73,7 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
|||||||
'isAccessControl': instance.isAccessControl,
|
'isAccessControl': instance.isAccessControl,
|
||||||
'accessControl': instance.accessControl,
|
'accessControl': instance.accessControl,
|
||||||
'isAnimateToPage': instance.isAnimateToPage,
|
'isAnimateToPage': instance.isAnimateToPage,
|
||||||
|
'isCompatible': instance.isCompatible,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$ThemeModeEnumMap = {
|
const _$ThemeModeEnumMap = {
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ mixin _$UpdateConfigParams {
|
|||||||
String? get profilePath => throw _privateConstructorUsedError;
|
String? get profilePath => throw _privateConstructorUsedError;
|
||||||
ClashConfig get config => throw _privateConstructorUsedError;
|
ClashConfig get config => throw _privateConstructorUsedError;
|
||||||
@JsonKey(name: "is-patch")
|
@JsonKey(name: "is-patch")
|
||||||
bool? get isPatch => throw _privateConstructorUsedError;
|
bool get isPatch => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: "is-compatible")
|
||||||
|
bool get isCompatible => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@@ -41,7 +43,8 @@ abstract class $UpdateConfigParamsCopyWith<$Res> {
|
|||||||
$Res call(
|
$Res call(
|
||||||
{@JsonKey(name: "profile-path") String? profilePath,
|
{@JsonKey(name: "profile-path") String? profilePath,
|
||||||
ClashConfig config,
|
ClashConfig config,
|
||||||
@JsonKey(name: "is-patch") bool? isPatch});
|
@JsonKey(name: "is-patch") bool isPatch,
|
||||||
|
@JsonKey(name: "is-compatible") bool isCompatible});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -59,7 +62,8 @@ class _$UpdateConfigParamsCopyWithImpl<$Res, $Val extends UpdateConfigParams>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? profilePath = freezed,
|
Object? profilePath = freezed,
|
||||||
Object? config = null,
|
Object? config = null,
|
||||||
Object? isPatch = freezed,
|
Object? isPatch = null,
|
||||||
|
Object? isCompatible = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
profilePath: freezed == profilePath
|
profilePath: freezed == profilePath
|
||||||
@@ -70,10 +74,14 @@ class _$UpdateConfigParamsCopyWithImpl<$Res, $Val extends UpdateConfigParams>
|
|||||||
? _value.config
|
? _value.config
|
||||||
: config // ignore: cast_nullable_to_non_nullable
|
: config // ignore: cast_nullable_to_non_nullable
|
||||||
as ClashConfig,
|
as ClashConfig,
|
||||||
isPatch: freezed == isPatch
|
isPatch: null == isPatch
|
||||||
? _value.isPatch
|
? _value.isPatch
|
||||||
: isPatch // ignore: cast_nullable_to_non_nullable
|
: isPatch // ignore: cast_nullable_to_non_nullable
|
||||||
as bool?,
|
as bool,
|
||||||
|
isCompatible: null == isCompatible
|
||||||
|
? _value.isCompatible
|
||||||
|
: isCompatible // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +97,8 @@ abstract class _$$UpdateConfigParamsImplCopyWith<$Res>
|
|||||||
$Res call(
|
$Res call(
|
||||||
{@JsonKey(name: "profile-path") String? profilePath,
|
{@JsonKey(name: "profile-path") String? profilePath,
|
||||||
ClashConfig config,
|
ClashConfig config,
|
||||||
@JsonKey(name: "is-patch") bool? isPatch});
|
@JsonKey(name: "is-patch") bool isPatch,
|
||||||
|
@JsonKey(name: "is-compatible") bool isCompatible});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -105,7 +114,8 @@ class __$$UpdateConfigParamsImplCopyWithImpl<$Res>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? profilePath = freezed,
|
Object? profilePath = freezed,
|
||||||
Object? config = null,
|
Object? config = null,
|
||||||
Object? isPatch = freezed,
|
Object? isPatch = null,
|
||||||
|
Object? isCompatible = null,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$UpdateConfigParamsImpl(
|
return _then(_$UpdateConfigParamsImpl(
|
||||||
profilePath: freezed == profilePath
|
profilePath: freezed == profilePath
|
||||||
@@ -116,10 +126,14 @@ class __$$UpdateConfigParamsImplCopyWithImpl<$Res>
|
|||||||
? _value.config
|
? _value.config
|
||||||
: config // ignore: cast_nullable_to_non_nullable
|
: config // ignore: cast_nullable_to_non_nullable
|
||||||
as ClashConfig,
|
as ClashConfig,
|
||||||
isPatch: freezed == isPatch
|
isPatch: null == isPatch
|
||||||
? _value.isPatch
|
? _value.isPatch
|
||||||
: isPatch // ignore: cast_nullable_to_non_nullable
|
: isPatch // ignore: cast_nullable_to_non_nullable
|
||||||
as bool?,
|
as bool,
|
||||||
|
isCompatible: null == isCompatible
|
||||||
|
? _value.isCompatible
|
||||||
|
: isCompatible // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +144,8 @@ class _$UpdateConfigParamsImpl implements _UpdateConfigParams {
|
|||||||
const _$UpdateConfigParamsImpl(
|
const _$UpdateConfigParamsImpl(
|
||||||
{@JsonKey(name: "profile-path") this.profilePath,
|
{@JsonKey(name: "profile-path") this.profilePath,
|
||||||
required this.config,
|
required this.config,
|
||||||
@JsonKey(name: "is-patch") this.isPatch});
|
@JsonKey(name: "is-patch") required this.isPatch,
|
||||||
|
@JsonKey(name: "is-compatible") required this.isCompatible});
|
||||||
|
|
||||||
factory _$UpdateConfigParamsImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$UpdateConfigParamsImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$UpdateConfigParamsImplFromJson(json);
|
_$$UpdateConfigParamsImplFromJson(json);
|
||||||
@@ -142,11 +157,14 @@ class _$UpdateConfigParamsImpl implements _UpdateConfigParams {
|
|||||||
final ClashConfig config;
|
final ClashConfig config;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: "is-patch")
|
@JsonKey(name: "is-patch")
|
||||||
final bool? isPatch;
|
final bool isPatch;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: "is-compatible")
|
||||||
|
final bool isCompatible;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'UpdateConfigParams(profilePath: $profilePath, config: $config, isPatch: $isPatch)';
|
return 'UpdateConfigParams(profilePath: $profilePath, config: $config, isPatch: $isPatch, isCompatible: $isCompatible)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -157,12 +175,15 @@ class _$UpdateConfigParamsImpl implements _UpdateConfigParams {
|
|||||||
(identical(other.profilePath, profilePath) ||
|
(identical(other.profilePath, profilePath) ||
|
||||||
other.profilePath == profilePath) &&
|
other.profilePath == profilePath) &&
|
||||||
(identical(other.config, config) || other.config == config) &&
|
(identical(other.config, config) || other.config == config) &&
|
||||||
(identical(other.isPatch, isPatch) || other.isPatch == isPatch));
|
(identical(other.isPatch, isPatch) || other.isPatch == isPatch) &&
|
||||||
|
(identical(other.isCompatible, isCompatible) ||
|
||||||
|
other.isCompatible == isCompatible));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, profilePath, config, isPatch);
|
int get hashCode =>
|
||||||
|
Object.hash(runtimeType, profilePath, config, isPatch, isCompatible);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@@ -183,7 +204,8 @@ abstract class _UpdateConfigParams implements UpdateConfigParams {
|
|||||||
const factory _UpdateConfigParams(
|
const factory _UpdateConfigParams(
|
||||||
{@JsonKey(name: "profile-path") final String? profilePath,
|
{@JsonKey(name: "profile-path") final String? profilePath,
|
||||||
required final ClashConfig config,
|
required final ClashConfig config,
|
||||||
@JsonKey(name: "is-patch") final bool? isPatch}) =
|
@JsonKey(name: "is-patch") required final bool isPatch,
|
||||||
|
@JsonKey(name: "is-compatible") required final bool isCompatible}) =
|
||||||
_$UpdateConfigParamsImpl;
|
_$UpdateConfigParamsImpl;
|
||||||
|
|
||||||
factory _UpdateConfigParams.fromJson(Map<String, dynamic> json) =
|
factory _UpdateConfigParams.fromJson(Map<String, dynamic> json) =
|
||||||
@@ -196,7 +218,10 @@ abstract class _UpdateConfigParams implements UpdateConfigParams {
|
|||||||
ClashConfig get config;
|
ClashConfig get config;
|
||||||
@override
|
@override
|
||||||
@JsonKey(name: "is-patch")
|
@JsonKey(name: "is-patch")
|
||||||
bool? get isPatch;
|
bool get isPatch;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: "is-compatible")
|
||||||
|
bool get isCompatible;
|
||||||
@override
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$$UpdateConfigParamsImplCopyWith<_$UpdateConfigParamsImpl> get copyWith =>
|
_$$UpdateConfigParamsImplCopyWith<_$UpdateConfigParamsImpl> get copyWith =>
|
||||||
@@ -672,6 +697,151 @@ abstract class _Delay implements Delay {
|
|||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Now _$NowFromJson(Map<String, dynamic> json) {
|
||||||
|
return _Now.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$Now {
|
||||||
|
String get name => throw _privateConstructorUsedError;
|
||||||
|
String get value => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$NowCopyWith<Now> get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $NowCopyWith<$Res> {
|
||||||
|
factory $NowCopyWith(Now value, $Res Function(Now) then) =
|
||||||
|
_$NowCopyWithImpl<$Res, Now>;
|
||||||
|
@useResult
|
||||||
|
$Res call({String name, String value});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$NowCopyWithImpl<$Res, $Val extends Now> implements $NowCopyWith<$Res> {
|
||||||
|
_$NowCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? name = null,
|
||||||
|
Object? value = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
value: null == value
|
||||||
|
? _value.value
|
||||||
|
: value // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$NowImplCopyWith<$Res> implements $NowCopyWith<$Res> {
|
||||||
|
factory _$$NowImplCopyWith(_$NowImpl value, $Res Function(_$NowImpl) then) =
|
||||||
|
__$$NowImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({String name, String value});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$NowImplCopyWithImpl<$Res> extends _$NowCopyWithImpl<$Res, _$NowImpl>
|
||||||
|
implements _$$NowImplCopyWith<$Res> {
|
||||||
|
__$$NowImplCopyWithImpl(_$NowImpl _value, $Res Function(_$NowImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? name = null,
|
||||||
|
Object? value = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$NowImpl(
|
||||||
|
name: null == name
|
||||||
|
? _value.name
|
||||||
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
value: null == value
|
||||||
|
? _value.value
|
||||||
|
: value // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$NowImpl implements _Now {
|
||||||
|
const _$NowImpl({required this.name, required this.value});
|
||||||
|
|
||||||
|
factory _$NowImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$NowImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String name;
|
||||||
|
@override
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Now(name: $name, value: $value)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$NowImpl &&
|
||||||
|
(identical(other.name, name) || other.name == name) &&
|
||||||
|
(identical(other.value, value) || other.value == value));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, name, value);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$NowImplCopyWith<_$NowImpl> get copyWith =>
|
||||||
|
__$$NowImplCopyWithImpl<_$NowImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$NowImplToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Now implements Now {
|
||||||
|
const factory _Now(
|
||||||
|
{required final String name, required final String value}) = _$NowImpl;
|
||||||
|
|
||||||
|
factory _Now.fromJson(Map<String, dynamic> json) = _$NowImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get name;
|
||||||
|
@override
|
||||||
|
String get value;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$NowImplCopyWith<_$NowImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
Process _$ProcessFromJson(Map<String, dynamic> json) {
|
Process _$ProcessFromJson(Map<String, dynamic> json) {
|
||||||
return _Process.fromJson(json);
|
return _Process.fromJson(json);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ _$UpdateConfigParamsImpl _$$UpdateConfigParamsImplFromJson(
|
|||||||
_$UpdateConfigParamsImpl(
|
_$UpdateConfigParamsImpl(
|
||||||
profilePath: json['profile-path'] as String?,
|
profilePath: json['profile-path'] as String?,
|
||||||
config: ClashConfig.fromJson(json['config'] as Map<String, dynamic>),
|
config: ClashConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||||
isPatch: json['is-patch'] as bool?,
|
isPatch: json['is-patch'] as bool,
|
||||||
|
isCompatible: json['is-compatible'] as bool,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$UpdateConfigParamsImplToJson(
|
Map<String, dynamic> _$$UpdateConfigParamsImplToJson(
|
||||||
@@ -20,6 +21,7 @@ Map<String, dynamic> _$$UpdateConfigParamsImplToJson(
|
|||||||
'profile-path': instance.profilePath,
|
'profile-path': instance.profilePath,
|
||||||
'config': instance.config,
|
'config': instance.config,
|
||||||
'is-patch': instance.isPatch,
|
'is-patch': instance.isPatch,
|
||||||
|
'is-compatible': instance.isCompatible,
|
||||||
};
|
};
|
||||||
|
|
||||||
_$ChangeProxyParamsImpl _$$ChangeProxyParamsImplFromJson(
|
_$ChangeProxyParamsImpl _$$ChangeProxyParamsImplFromJson(
|
||||||
@@ -53,6 +55,7 @@ const _$MessageTypeEnumMap = {
|
|||||||
MessageType.tun: 'tun',
|
MessageType.tun: 'tun',
|
||||||
MessageType.delay: 'delay',
|
MessageType.delay: 'delay',
|
||||||
MessageType.process: 'process',
|
MessageType.process: 'process',
|
||||||
|
MessageType.now: 'now',
|
||||||
};
|
};
|
||||||
|
|
||||||
_$DelayImpl _$$DelayImplFromJson(Map<String, dynamic> json) => _$DelayImpl(
|
_$DelayImpl _$$DelayImplFromJson(Map<String, dynamic> json) => _$DelayImpl(
|
||||||
@@ -66,6 +69,16 @@ Map<String, dynamic> _$$DelayImplToJson(_$DelayImpl instance) =>
|
|||||||
'value': instance.value,
|
'value': instance.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_$NowImpl _$$NowImplFromJson(Map<String, dynamic> json) => _$NowImpl(
|
||||||
|
name: json['name'] as String,
|
||||||
|
value: json['value'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$NowImplToJson(_$NowImpl instance) => <String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
'value': instance.value,
|
||||||
|
};
|
||||||
|
|
||||||
_$ProcessImpl _$$ProcessImplFromJson(Map<String, dynamic> json) =>
|
_$ProcessImpl _$$ProcessImplFromJson(Map<String, dynamic> json) =>
|
||||||
_$ProcessImpl(
|
_$ProcessImpl(
|
||||||
uid: (json['uid'] as num).toInt(),
|
uid: (json['uid'] as num).toInt(),
|
||||||
|
|||||||
@@ -27,11 +27,13 @@ Profile _$ProfileFromJson(Map<String, dynamic> json) => Profile(
|
|||||||
userInfo: json['userInfo'] == null
|
userInfo: json['userInfo'] == null
|
||||||
? null
|
? null
|
||||||
: UserInfo.fromJson(json['userInfo'] as Map<String, dynamic>),
|
: UserInfo.fromJson(json['userInfo'] as Map<String, dynamic>),
|
||||||
groupName: json['groupName'] as String?,
|
|
||||||
proxyName: json['proxyName'] as String?,
|
proxyName: json['proxyName'] as String?,
|
||||||
lastUpdateDate: json['lastUpdateDate'] == null
|
lastUpdateDate: json['lastUpdateDate'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['lastUpdateDate'] as String),
|
: DateTime.parse(json['lastUpdateDate'] as String),
|
||||||
|
selectedMap: (json['selectedMap'] as Map<String, dynamic>?)?.map(
|
||||||
|
(k, e) => MapEntry(k, e as String),
|
||||||
|
),
|
||||||
autoUpdateDuration: json['autoUpdateDuration'] == null
|
autoUpdateDuration: json['autoUpdateDuration'] == null
|
||||||
? null
|
? null
|
||||||
: Duration(microseconds: (json['autoUpdateDuration'] as num).toInt()),
|
: Duration(microseconds: (json['autoUpdateDuration'] as num).toInt()),
|
||||||
@@ -41,11 +43,11 @@ Profile _$ProfileFromJson(Map<String, dynamic> json) => Profile(
|
|||||||
Map<String, dynamic> _$ProfileToJson(Profile instance) => <String, dynamic>{
|
Map<String, dynamic> _$ProfileToJson(Profile instance) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'label': instance.label,
|
'label': instance.label,
|
||||||
'groupName': instance.groupName,
|
|
||||||
'proxyName': instance.proxyName,
|
'proxyName': instance.proxyName,
|
||||||
'url': instance.url,
|
'url': instance.url,
|
||||||
'lastUpdateDate': instance.lastUpdateDate?.toIso8601String(),
|
'lastUpdateDate': instance.lastUpdateDate?.toIso8601String(),
|
||||||
'autoUpdateDuration': instance.autoUpdateDuration.inMicroseconds,
|
'autoUpdateDuration': instance.autoUpdateDuration.inMicroseconds,
|
||||||
'userInfo': instance.userInfo,
|
'userInfo': instance.userInfo,
|
||||||
'autoUpdate': instance.autoUpdate,
|
'autoUpdate': instance.autoUpdate,
|
||||||
|
'selectedMap': instance.selectedMap,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ Proxy _$ProxyFromJson(Map<String, dynamic> json) {
|
|||||||
mixin _$Proxy {
|
mixin _$Proxy {
|
||||||
String get name => throw _privateConstructorUsedError;
|
String get name => throw _privateConstructorUsedError;
|
||||||
String get type => throw _privateConstructorUsedError;
|
String get type => throw _privateConstructorUsedError;
|
||||||
|
String? get now => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@@ -230,7 +231,7 @@ abstract class $ProxyCopyWith<$Res> {
|
|||||||
factory $ProxyCopyWith(Proxy value, $Res Function(Proxy) then) =
|
factory $ProxyCopyWith(Proxy value, $Res Function(Proxy) then) =
|
||||||
_$ProxyCopyWithImpl<$Res, Proxy>;
|
_$ProxyCopyWithImpl<$Res, Proxy>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String name, String type});
|
$Res call({String name, String type, String? now});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -248,6 +249,7 @@ class _$ProxyCopyWithImpl<$Res, $Val extends Proxy>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? type = null,
|
Object? type = null,
|
||||||
|
Object? now = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
name: null == name
|
name: null == name
|
||||||
@@ -258,6 +260,10 @@ class _$ProxyCopyWithImpl<$Res, $Val extends Proxy>
|
|||||||
? _value.type
|
? _value.type
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
: type // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
|
now: freezed == now
|
||||||
|
? _value.now
|
||||||
|
: now // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,7 +275,7 @@ abstract class _$$ProxyImplCopyWith<$Res> implements $ProxyCopyWith<$Res> {
|
|||||||
__$$ProxyImplCopyWithImpl<$Res>;
|
__$$ProxyImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String name, String type});
|
$Res call({String name, String type, String? now});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -285,6 +291,7 @@ class __$$ProxyImplCopyWithImpl<$Res>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? name = null,
|
Object? name = null,
|
||||||
Object? type = null,
|
Object? type = null,
|
||||||
|
Object? now = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_$ProxyImpl(
|
return _then(_$ProxyImpl(
|
||||||
name: null == name
|
name: null == name
|
||||||
@@ -295,6 +302,10 @@ class __$$ProxyImplCopyWithImpl<$Res>
|
|||||||
? _value.type
|
? _value.type
|
||||||
: type // ignore: cast_nullable_to_non_nullable
|
: type // ignore: cast_nullable_to_non_nullable
|
||||||
as String,
|
as String,
|
||||||
|
now: freezed == now
|
||||||
|
? _value.now
|
||||||
|
: now // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,21 +313,21 @@ class __$$ProxyImplCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class _$ProxyImpl implements _Proxy {
|
class _$ProxyImpl implements _Proxy {
|
||||||
const _$ProxyImpl({this.name = "", this.type = ""});
|
const _$ProxyImpl({required this.name, required this.type, this.now});
|
||||||
|
|
||||||
factory _$ProxyImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$ProxyImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
_$$ProxyImplFromJson(json);
|
_$$ProxyImplFromJson(json);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
|
||||||
final String name;
|
final String name;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
|
||||||
final String type;
|
final String type;
|
||||||
|
@override
|
||||||
|
final String? now;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Proxy(name: $name, type: $type)';
|
return 'Proxy(name: $name, type: $type, now: $now)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -325,12 +336,13 @@ class _$ProxyImpl implements _Proxy {
|
|||||||
(other.runtimeType == runtimeType &&
|
(other.runtimeType == runtimeType &&
|
||||||
other is _$ProxyImpl &&
|
other is _$ProxyImpl &&
|
||||||
(identical(other.name, name) || other.name == name) &&
|
(identical(other.name, name) || other.name == name) &&
|
||||||
(identical(other.type, type) || other.type == type));
|
(identical(other.type, type) || other.type == type) &&
|
||||||
|
(identical(other.now, now) || other.now == now));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, name, type);
|
int get hashCode => Object.hash(runtimeType, name, type, now);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@@ -347,7 +359,10 @@ class _$ProxyImpl implements _Proxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Proxy implements Proxy {
|
abstract class _Proxy implements Proxy {
|
||||||
const factory _Proxy({final String name, final String type}) = _$ProxyImpl;
|
const factory _Proxy(
|
||||||
|
{required final String name,
|
||||||
|
required final String type,
|
||||||
|
final String? now}) = _$ProxyImpl;
|
||||||
|
|
||||||
factory _Proxy.fromJson(Map<String, dynamic> json) = _$ProxyImpl.fromJson;
|
factory _Proxy.fromJson(Map<String, dynamic> json) = _$ProxyImpl.fromJson;
|
||||||
|
|
||||||
@@ -356,6 +371,8 @@ abstract class _Proxy implements Proxy {
|
|||||||
@override
|
@override
|
||||||
String get type;
|
String get type;
|
||||||
@override
|
@override
|
||||||
|
String? get now;
|
||||||
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$$ProxyImplCopyWith<_$ProxyImpl> get copyWith =>
|
_$$ProxyImplCopyWith<_$ProxyImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ const _$GroupTypeEnumMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_$ProxyImpl _$$ProxyImplFromJson(Map<String, dynamic> json) => _$ProxyImpl(
|
_$ProxyImpl _$$ProxyImplFromJson(Map<String, dynamic> json) => _$ProxyImpl(
|
||||||
name: json['name'] as String? ?? "",
|
name: json['name'] as String,
|
||||||
type: json['type'] as String? ?? "",
|
type: json['type'] as String,
|
||||||
|
now: json['now'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$ProxyImplToJson(_$ProxyImpl instance) =>
|
Map<String, dynamic> _$$ProxyImplToJson(_$ProxyImpl instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
|
'now': instance.now,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -349,7 +349,6 @@ abstract class _UpdateCurrentDelaySelectorState
|
|||||||
mixin _$NetworkDetectionSelectorState {
|
mixin _$NetworkDetectionSelectorState {
|
||||||
String? get currentProxyName => throw _privateConstructorUsedError;
|
String? get currentProxyName => throw _privateConstructorUsedError;
|
||||||
int? get delay => throw _privateConstructorUsedError;
|
int? get delay => throw _privateConstructorUsedError;
|
||||||
bool get isInit => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$NetworkDetectionSelectorStateCopyWith<NetworkDetectionSelectorState>
|
$NetworkDetectionSelectorStateCopyWith<NetworkDetectionSelectorState>
|
||||||
@@ -364,7 +363,7 @@ abstract class $NetworkDetectionSelectorStateCopyWith<$Res> {
|
|||||||
_$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
_$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
||||||
NetworkDetectionSelectorState>;
|
NetworkDetectionSelectorState>;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String? currentProxyName, int? delay, bool isInit});
|
$Res call({String? currentProxyName, int? delay});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -383,7 +382,6 @@ class _$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? currentProxyName = freezed,
|
Object? currentProxyName = freezed,
|
||||||
Object? delay = freezed,
|
Object? delay = freezed,
|
||||||
Object? isInit = null,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
currentProxyName: freezed == currentProxyName
|
currentProxyName: freezed == currentProxyName
|
||||||
@@ -394,10 +392,6 @@ class _$NetworkDetectionSelectorStateCopyWithImpl<$Res,
|
|||||||
? _value.delay
|
? _value.delay
|
||||||
: delay // ignore: cast_nullable_to_non_nullable
|
: delay // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
isInit: null == isInit
|
|
||||||
? _value.isInit
|
|
||||||
: isInit // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,7 +405,7 @@ abstract class _$$NetworkDetectionSelectorStateImplCopyWith<$Res>
|
|||||||
__$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>;
|
__$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({String? currentProxyName, int? delay, bool isInit});
|
$Res call({String? currentProxyName, int? delay});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -429,7 +423,6 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
|||||||
$Res call({
|
$Res call({
|
||||||
Object? currentProxyName = freezed,
|
Object? currentProxyName = freezed,
|
||||||
Object? delay = freezed,
|
Object? delay = freezed,
|
||||||
Object? isInit = null,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_$NetworkDetectionSelectorStateImpl(
|
return _then(_$NetworkDetectionSelectorStateImpl(
|
||||||
currentProxyName: freezed == currentProxyName
|
currentProxyName: freezed == currentProxyName
|
||||||
@@ -440,10 +433,6 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
|||||||
? _value.delay
|
? _value.delay
|
||||||
: delay // ignore: cast_nullable_to_non_nullable
|
: delay // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
isInit: null == isInit
|
|
||||||
? _value.isInit
|
|
||||||
: isInit // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,20 +442,16 @@ class __$$NetworkDetectionSelectorStateImplCopyWithImpl<$Res>
|
|||||||
class _$NetworkDetectionSelectorStateImpl
|
class _$NetworkDetectionSelectorStateImpl
|
||||||
implements _NetworkDetectionSelectorState {
|
implements _NetworkDetectionSelectorState {
|
||||||
const _$NetworkDetectionSelectorStateImpl(
|
const _$NetworkDetectionSelectorStateImpl(
|
||||||
{required this.currentProxyName,
|
{required this.currentProxyName, required this.delay});
|
||||||
required this.delay,
|
|
||||||
required this.isInit});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String? currentProxyName;
|
final String? currentProxyName;
|
||||||
@override
|
@override
|
||||||
final int? delay;
|
final int? delay;
|
||||||
@override
|
|
||||||
final bool isInit;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'NetworkDetectionSelectorState(currentProxyName: $currentProxyName, delay: $delay, isInit: $isInit)';
|
return 'NetworkDetectionSelectorState(currentProxyName: $currentProxyName, delay: $delay)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -476,12 +461,11 @@ class _$NetworkDetectionSelectorStateImpl
|
|||||||
other is _$NetworkDetectionSelectorStateImpl &&
|
other is _$NetworkDetectionSelectorStateImpl &&
|
||||||
(identical(other.currentProxyName, currentProxyName) ||
|
(identical(other.currentProxyName, currentProxyName) ||
|
||||||
other.currentProxyName == currentProxyName) &&
|
other.currentProxyName == currentProxyName) &&
|
||||||
(identical(other.delay, delay) || other.delay == delay) &&
|
(identical(other.delay, delay) || other.delay == delay));
|
||||||
(identical(other.isInit, isInit) || other.isInit == isInit));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, currentProxyName, delay, isInit);
|
int get hashCode => Object.hash(runtimeType, currentProxyName, delay);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@@ -496,16 +480,13 @@ abstract class _NetworkDetectionSelectorState
|
|||||||
implements NetworkDetectionSelectorState {
|
implements NetworkDetectionSelectorState {
|
||||||
const factory _NetworkDetectionSelectorState(
|
const factory _NetworkDetectionSelectorState(
|
||||||
{required final String? currentProxyName,
|
{required final String? currentProxyName,
|
||||||
required final int? delay,
|
required final int? delay}) = _$NetworkDetectionSelectorStateImpl;
|
||||||
required final bool isInit}) = _$NetworkDetectionSelectorStateImpl;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get currentProxyName;
|
String? get currentProxyName;
|
||||||
@override
|
@override
|
||||||
int? get delay;
|
int? get delay;
|
||||||
@override
|
@override
|
||||||
bool get isInit;
|
|
||||||
@override
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$$NetworkDetectionSelectorStateImplCopyWith<
|
_$$NetworkDetectionSelectorStateImplCopyWith<
|
||||||
_$NetworkDetectionSelectorStateImpl>
|
_$NetworkDetectionSelectorStateImpl>
|
||||||
@@ -1740,3 +1721,434 @@ abstract class _HomeNavigationSelectorState
|
|||||||
_$$HomeNavigationSelectorStateImplCopyWith<_$HomeNavigationSelectorStateImpl>
|
_$$HomeNavigationSelectorStateImplCopyWith<_$HomeNavigationSelectorStateImpl>
|
||||||
get copyWith => throw _privateConstructorUsedError;
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProxiesCardSelectorState {
|
||||||
|
bool get isSelected => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$ProxiesCardSelectorStateCopyWith<ProxiesCardSelectorState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
factory $ProxiesCardSelectorStateCopyWith(ProxiesCardSelectorState value,
|
||||||
|
$Res Function(ProxiesCardSelectorState) then) =
|
||||||
|
_$ProxiesCardSelectorStateCopyWithImpl<$Res, ProxiesCardSelectorState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({bool isSelected});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||||
|
$Val extends ProxiesCardSelectorState>
|
||||||
|
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
_$ProxiesCardSelectorStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? isSelected = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
isSelected: null == isSelected
|
||||||
|
? _value.isSelected
|
||||||
|
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProxiesCardSelectorStateImplCopyWith<$Res>
|
||||||
|
implements $ProxiesCardSelectorStateCopyWith<$Res> {
|
||||||
|
factory _$$ProxiesCardSelectorStateImplCopyWith(
|
||||||
|
_$ProxiesCardSelectorStateImpl value,
|
||||||
|
$Res Function(_$ProxiesCardSelectorStateImpl) then) =
|
||||||
|
__$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({bool isSelected});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProxiesCardSelectorStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProxiesCardSelectorStateCopyWithImpl<$Res,
|
||||||
|
_$ProxiesCardSelectorStateImpl>
|
||||||
|
implements _$$ProxiesCardSelectorStateImplCopyWith<$Res> {
|
||||||
|
__$$ProxiesCardSelectorStateImplCopyWithImpl(
|
||||||
|
_$ProxiesCardSelectorStateImpl _value,
|
||||||
|
$Res Function(_$ProxiesCardSelectorStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? isSelected = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$ProxiesCardSelectorStateImpl(
|
||||||
|
isSelected: null == isSelected
|
||||||
|
? _value.isSelected
|
||||||
|
: isSelected // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProxiesCardSelectorStateImpl implements _ProxiesCardSelectorState {
|
||||||
|
const _$ProxiesCardSelectorStateImpl({required this.isSelected});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final bool isSelected;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProxiesCardSelectorState(isSelected: $isSelected)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProxiesCardSelectorStateImpl &&
|
||||||
|
(identical(other.isSelected, isSelected) ||
|
||||||
|
other.isSelected == isSelected));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, isSelected);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||||
|
get copyWith => __$$ProxiesCardSelectorStateImplCopyWithImpl<
|
||||||
|
_$ProxiesCardSelectorStateImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProxiesCardSelectorState implements ProxiesCardSelectorState {
|
||||||
|
const factory _ProxiesCardSelectorState({required final bool isSelected}) =
|
||||||
|
_$ProxiesCardSelectorStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isSelected;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$ProxiesCardSelectorStateImplCopyWith<_$ProxiesCardSelectorStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProxiesSelectorState {
|
||||||
|
List<String> get groupNames => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$ProxiesSelectorStateCopyWith<ProxiesSelectorState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProxiesSelectorStateCopyWith<$Res> {
|
||||||
|
factory $ProxiesSelectorStateCopyWith(ProxiesSelectorState value,
|
||||||
|
$Res Function(ProxiesSelectorState) then) =
|
||||||
|
_$ProxiesSelectorStateCopyWithImpl<$Res, ProxiesSelectorState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({List<String> groupNames});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProxiesSelectorStateCopyWithImpl<$Res,
|
||||||
|
$Val extends ProxiesSelectorState>
|
||||||
|
implements $ProxiesSelectorStateCopyWith<$Res> {
|
||||||
|
_$ProxiesSelectorStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? groupNames = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
groupNames: null == groupNames
|
||||||
|
? _value.groupNames
|
||||||
|
: groupNames // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProxiesSelectorStateImplCopyWith<$Res>
|
||||||
|
implements $ProxiesSelectorStateCopyWith<$Res> {
|
||||||
|
factory _$$ProxiesSelectorStateImplCopyWith(_$ProxiesSelectorStateImpl value,
|
||||||
|
$Res Function(_$ProxiesSelectorStateImpl) then) =
|
||||||
|
__$$ProxiesSelectorStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({List<String> groupNames});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProxiesSelectorStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProxiesSelectorStateCopyWithImpl<$Res, _$ProxiesSelectorStateImpl>
|
||||||
|
implements _$$ProxiesSelectorStateImplCopyWith<$Res> {
|
||||||
|
__$$ProxiesSelectorStateImplCopyWithImpl(_$ProxiesSelectorStateImpl _value,
|
||||||
|
$Res Function(_$ProxiesSelectorStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? groupNames = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$ProxiesSelectorStateImpl(
|
||||||
|
groupNames: null == groupNames
|
||||||
|
? _value._groupNames
|
||||||
|
: groupNames // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProxiesSelectorStateImpl implements _ProxiesSelectorState {
|
||||||
|
const _$ProxiesSelectorStateImpl({required final List<String> groupNames})
|
||||||
|
: _groupNames = groupNames;
|
||||||
|
|
||||||
|
final List<String> _groupNames;
|
||||||
|
@override
|
||||||
|
List<String> get groupNames {
|
||||||
|
if (_groupNames is EqualUnmodifiableListView) return _groupNames;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_groupNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProxiesSelectorState(groupNames: $groupNames)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProxiesSelectorStateImpl &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._groupNames, _groupNames));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType, const DeepCollectionEquality().hash(_groupNames));
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl>
|
||||||
|
get copyWith =>
|
||||||
|
__$$ProxiesSelectorStateImplCopyWithImpl<_$ProxiesSelectorStateImpl>(
|
||||||
|
this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProxiesSelectorState implements ProxiesSelectorState {
|
||||||
|
const factory _ProxiesSelectorState(
|
||||||
|
{required final List<String> groupNames}) = _$ProxiesSelectorStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<String> get groupNames;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ProxiesTabViewSelectorState {
|
||||||
|
ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError;
|
||||||
|
num get sortNum => throw _privateConstructorUsedError;
|
||||||
|
Group get group => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$ProxiesTabViewSelectorStateCopyWith<ProxiesTabViewSelectorState>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $ProxiesTabViewSelectorStateCopyWith<$Res> {
|
||||||
|
factory $ProxiesTabViewSelectorStateCopyWith(
|
||||||
|
ProxiesTabViewSelectorState value,
|
||||||
|
$Res Function(ProxiesTabViewSelectorState) then) =
|
||||||
|
_$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
|
||||||
|
ProxiesTabViewSelectorState>;
|
||||||
|
@useResult
|
||||||
|
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group group});
|
||||||
|
|
||||||
|
$GroupCopyWith<$Res> get group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
|
||||||
|
$Val extends ProxiesTabViewSelectorState>
|
||||||
|
implements $ProxiesTabViewSelectorStateCopyWith<$Res> {
|
||||||
|
_$ProxiesTabViewSelectorStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? proxiesSortType = null,
|
||||||
|
Object? sortNum = null,
|
||||||
|
Object? group = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
proxiesSortType: null == proxiesSortType
|
||||||
|
? _value.proxiesSortType
|
||||||
|
: proxiesSortType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProxiesSortType,
|
||||||
|
sortNum: null == sortNum
|
||||||
|
? _value.sortNum
|
||||||
|
: sortNum // ignore: cast_nullable_to_non_nullable
|
||||||
|
as num,
|
||||||
|
group: null == group
|
||||||
|
? _value.group
|
||||||
|
: group // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Group,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GroupCopyWith<$Res> get group {
|
||||||
|
return $GroupCopyWith<$Res>(_value.group, (value) {
|
||||||
|
return _then(_value.copyWith(group: value) as $Val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$ProxiesTabViewSelectorStateImplCopyWith<$Res>
|
||||||
|
implements $ProxiesTabViewSelectorStateCopyWith<$Res> {
|
||||||
|
factory _$$ProxiesTabViewSelectorStateImplCopyWith(
|
||||||
|
_$ProxiesTabViewSelectorStateImpl value,
|
||||||
|
$Res Function(_$ProxiesTabViewSelectorStateImpl) then) =
|
||||||
|
__$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call({ProxiesSortType proxiesSortType, num sortNum, Group group});
|
||||||
|
|
||||||
|
@override
|
||||||
|
$GroupCopyWith<$Res> get group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
|
||||||
|
_$ProxiesTabViewSelectorStateImpl>
|
||||||
|
implements _$$ProxiesTabViewSelectorStateImplCopyWith<$Res> {
|
||||||
|
__$$ProxiesTabViewSelectorStateImplCopyWithImpl(
|
||||||
|
_$ProxiesTabViewSelectorStateImpl _value,
|
||||||
|
$Res Function(_$ProxiesTabViewSelectorStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? proxiesSortType = null,
|
||||||
|
Object? sortNum = null,
|
||||||
|
Object? group = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$ProxiesTabViewSelectorStateImpl(
|
||||||
|
proxiesSortType: null == proxiesSortType
|
||||||
|
? _value.proxiesSortType
|
||||||
|
: proxiesSortType // ignore: cast_nullable_to_non_nullable
|
||||||
|
as ProxiesSortType,
|
||||||
|
sortNum: null == sortNum
|
||||||
|
? _value.sortNum
|
||||||
|
: sortNum // ignore: cast_nullable_to_non_nullable
|
||||||
|
as num,
|
||||||
|
group: null == group
|
||||||
|
? _value.group
|
||||||
|
: group // ignore: cast_nullable_to_non_nullable
|
||||||
|
as Group,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$ProxiesTabViewSelectorStateImpl
|
||||||
|
implements _ProxiesTabViewSelectorState {
|
||||||
|
const _$ProxiesTabViewSelectorStateImpl(
|
||||||
|
{required this.proxiesSortType,
|
||||||
|
required this.sortNum,
|
||||||
|
required this.group});
|
||||||
|
|
||||||
|
@override
|
||||||
|
final ProxiesSortType proxiesSortType;
|
||||||
|
@override
|
||||||
|
final num sortNum;
|
||||||
|
@override
|
||||||
|
final Group group;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ProxiesTabViewSelectorState(proxiesSortType: $proxiesSortType, sortNum: $sortNum, group: $group)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$ProxiesTabViewSelectorStateImpl &&
|
||||||
|
(identical(other.proxiesSortType, proxiesSortType) ||
|
||||||
|
other.proxiesSortType == proxiesSortType) &&
|
||||||
|
(identical(other.sortNum, sortNum) || other.sortNum == sortNum) &&
|
||||||
|
(identical(other.group, group) || other.group == group));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, proxiesSortType, sortNum, group);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$ProxiesTabViewSelectorStateImplCopyWith<_$ProxiesTabViewSelectorStateImpl>
|
||||||
|
get copyWith => __$$ProxiesTabViewSelectorStateImplCopyWithImpl<
|
||||||
|
_$ProxiesTabViewSelectorStateImpl>(this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _ProxiesTabViewSelectorState
|
||||||
|
implements ProxiesTabViewSelectorState {
|
||||||
|
const factory _ProxiesTabViewSelectorState(
|
||||||
|
{required final ProxiesSortType proxiesSortType,
|
||||||
|
required final num sortNum,
|
||||||
|
required final Group group}) = _$ProxiesTabViewSelectorStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ProxiesSortType get proxiesSortType;
|
||||||
|
@override
|
||||||
|
num get sortNum;
|
||||||
|
@override
|
||||||
|
Group get group;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$ProxiesTabViewSelectorStateImplCopyWith<_$ProxiesTabViewSelectorStateImpl>
|
||||||
|
get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import 'common.dart';
|
|||||||
|
|
||||||
part 'generated/profile.g.dart';
|
part 'generated/profile.g.dart';
|
||||||
|
|
||||||
|
typedef SelectedMap = Map<String, String>;
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class UserInfo {
|
class UserInfo {
|
||||||
int upload;
|
int upload;
|
||||||
@@ -62,27 +64,28 @@ class UserInfo {
|
|||||||
class Profile {
|
class Profile {
|
||||||
String id;
|
String id;
|
||||||
String? label;
|
String? label;
|
||||||
String? groupName;
|
|
||||||
String? proxyName;
|
String? proxyName;
|
||||||
String? url;
|
String? url;
|
||||||
DateTime? lastUpdateDate;
|
DateTime? lastUpdateDate;
|
||||||
Duration autoUpdateDuration;
|
Duration autoUpdateDuration;
|
||||||
UserInfo? userInfo;
|
UserInfo? userInfo;
|
||||||
bool autoUpdate;
|
bool autoUpdate;
|
||||||
|
SelectedMap selectedMap;
|
||||||
|
|
||||||
Profile({
|
Profile({
|
||||||
String? id,
|
String? id,
|
||||||
this.label,
|
this.label,
|
||||||
this.url,
|
this.url,
|
||||||
this.userInfo,
|
this.userInfo,
|
||||||
this.groupName,
|
|
||||||
this.proxyName,
|
this.proxyName,
|
||||||
this.lastUpdateDate,
|
this.lastUpdateDate,
|
||||||
|
SelectedMap? selectedMap,
|
||||||
Duration? autoUpdateDuration,
|
Duration? autoUpdateDuration,
|
||||||
this.autoUpdate = true,
|
this.autoUpdate = true,
|
||||||
}) : id = id ?? DateTime.now().millisecondsSinceEpoch.toString(),
|
}) : id = id ?? DateTime.now().millisecondsSinceEpoch.toString(),
|
||||||
autoUpdateDuration =
|
autoUpdateDuration =
|
||||||
autoUpdateDuration ?? appConstant.defaultUpdateDuration;
|
autoUpdateDuration ?? appConstant.defaultUpdateDuration,
|
||||||
|
selectedMap = selectedMap ?? {};
|
||||||
|
|
||||||
ProfileType get type => url == null ? ProfileType.file : ProfileType.url;
|
ProfileType get type => url == null ? ProfileType.file : ProfileType.url;
|
||||||
|
|
||||||
@@ -158,7 +161,6 @@ class Profile {
|
|||||||
runtimeType == other.runtimeType &&
|
runtimeType == other.runtimeType &&
|
||||||
id == other.id &&
|
id == other.id &&
|
||||||
label == other.label &&
|
label == other.label &&
|
||||||
groupName == other.groupName &&
|
|
||||||
proxyName == other.proxyName &&
|
proxyName == other.proxyName &&
|
||||||
url == other.url &&
|
url == other.url &&
|
||||||
lastUpdateDate == other.lastUpdateDate &&
|
lastUpdateDate == other.lastUpdateDate &&
|
||||||
@@ -170,7 +172,6 @@ class Profile {
|
|||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode ^
|
id.hashCode ^
|
||||||
label.hashCode ^
|
label.hashCode ^
|
||||||
groupName.hashCode ^
|
|
||||||
proxyName.hashCode ^
|
proxyName.hashCode ^
|
||||||
url.hashCode ^
|
url.hashCode ^
|
||||||
lastUpdateDate.hashCode ^
|
lastUpdateDate.hashCode ^
|
||||||
@@ -180,7 +181,7 @@ class Profile {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Profile{id: $id, label: $label, groupName: $groupName, proxyName: $proxyName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate}';
|
return 'Profile{id: $id, label: $label, proxyName: $proxyName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate}';
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile copyWith({
|
Profile copyWith({
|
||||||
@@ -192,14 +193,15 @@ class Profile {
|
|||||||
DateTime? lastUpdateDate,
|
DateTime? lastUpdateDate,
|
||||||
Duration? autoUpdateDuration,
|
Duration? autoUpdateDuration,
|
||||||
bool? autoUpdate,
|
bool? autoUpdate,
|
||||||
|
SelectedMap? selectedMap,
|
||||||
}) {
|
}) {
|
||||||
return Profile(
|
return Profile(
|
||||||
id: id,
|
id: id,
|
||||||
label: label ?? this.label,
|
label: label ?? this.label,
|
||||||
url: url ?? this.url,
|
url: url ?? this.url,
|
||||||
groupName: groupName ?? this.groupName,
|
|
||||||
proxyName: proxyName ?? this.proxyName,
|
proxyName: proxyName ?? this.proxyName,
|
||||||
userInfo: userInfo ?? this.userInfo,
|
userInfo: userInfo ?? this.userInfo,
|
||||||
|
selectedMap: selectedMap ?? this.selectedMap,
|
||||||
lastUpdateDate: lastUpdateDate ?? this.lastUpdateDate,
|
lastUpdateDate: lastUpdateDate ?? this.lastUpdateDate,
|
||||||
autoUpdateDuration: autoUpdateDuration ?? this.autoUpdateDuration,
|
autoUpdateDuration: autoUpdateDuration ?? this.autoUpdateDuration,
|
||||||
autoUpdate: autoUpdate ?? this.autoUpdate,
|
autoUpdate: autoUpdate ?? this.autoUpdate,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ part 'generated/proxy.g.dart';
|
|||||||
|
|
||||||
part 'generated/proxy.freezed.dart';
|
part 'generated/proxy.freezed.dart';
|
||||||
|
|
||||||
typedef DelayMap = Map<String, int?>;
|
typedef ProxyMap = Map<String, Proxy>;
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class Group with _$Group {
|
class Group with _$Group {
|
||||||
@@ -23,8 +23,9 @@ class Group with _$Group {
|
|||||||
@freezed
|
@freezed
|
||||||
class Proxy with _$Proxy {
|
class Proxy with _$Proxy {
|
||||||
const factory Proxy({
|
const factory Proxy({
|
||||||
@Default("") String name,
|
required String name,
|
||||||
@Default("") String type,
|
required String type,
|
||||||
|
String? now,
|
||||||
}) = _Proxy;
|
}) = _Proxy;
|
||||||
|
|
||||||
factory Proxy.fromJson(Map<String, Object?> json) => _$ProxyFromJson(json);
|
factory Proxy.fromJson(Map<String, Object?> json) => _$ProxyFromJson(json);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'config.dart';
|
|||||||
import 'navigation.dart';
|
import 'navigation.dart';
|
||||||
import 'package.dart';
|
import 'package.dart';
|
||||||
import 'profile.dart';
|
import 'profile.dart';
|
||||||
|
import 'proxy.dart';
|
||||||
|
|
||||||
part 'generated/selector.freezed.dart';
|
part 'generated/selector.freezed.dart';
|
||||||
|
|
||||||
@@ -31,7 +32,6 @@ class NetworkDetectionSelectorState with _$NetworkDetectionSelectorState {
|
|||||||
const factory NetworkDetectionSelectorState({
|
const factory NetworkDetectionSelectorState({
|
||||||
required String? currentProxyName,
|
required String? currentProxyName,
|
||||||
required int? delay,
|
required int? delay,
|
||||||
required bool isInit,
|
|
||||||
}) = _NetworkDetectionSelectorState;
|
}) = _NetworkDetectionSelectorState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,3 +101,26 @@ class HomeNavigationSelectorState with _$HomeNavigationSelectorState{
|
|||||||
required String? locale,
|
required String? locale,
|
||||||
}) = _HomeNavigationSelectorState;
|
}) = _HomeNavigationSelectorState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProxiesCardSelectorState with _$ProxiesCardSelectorState{
|
||||||
|
const factory ProxiesCardSelectorState({
|
||||||
|
required bool isSelected,
|
||||||
|
}) = _ProxiesCardSelectorState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProxiesSelectorState with _$ProxiesSelectorState{
|
||||||
|
const factory ProxiesSelectorState({
|
||||||
|
required List<String> groupNames,
|
||||||
|
}) = _ProxiesSelectorState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class ProxiesTabViewSelectorState with _$ProxiesTabViewSelectorState{
|
||||||
|
const factory ProxiesTabViewSelectorState({
|
||||||
|
required ProxiesSortType proxiesSortType,
|
||||||
|
required num sortNum,
|
||||||
|
required Group group,
|
||||||
|
}) = _ProxiesTabViewSelectorState;
|
||||||
|
}
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ class HomePage extends StatelessWidget {
|
|||||||
child: Selector<AppState, List<NavigationItem>>(
|
child: Selector<AppState, List<NavigationItem>>(
|
||||||
selector: (_, appState) => appState.navigationItems,
|
selector: (_, appState) => appState.navigationItems,
|
||||||
builder: (_, navigationItems, __) {
|
builder: (_, navigationItems, __) {
|
||||||
debugPrint("[Home] update===>");
|
|
||||||
final desktopNavigationItems = navigationItems
|
final desktopNavigationItems = navigationItems
|
||||||
.where(
|
.where(
|
||||||
(element) =>
|
(element) =>
|
||||||
|
|||||||
118
lib/state.dart
118
lib/state.dart
@@ -14,7 +14,8 @@ import 'common/common.dart';
|
|||||||
|
|
||||||
class GlobalState {
|
class GlobalState {
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
Timer? currentDelayTimer;
|
Function? updateSortNumDebounce;
|
||||||
|
Timer? groupsUpdateTimer;
|
||||||
Function? updateCurrentDelayDebounce;
|
Function? updateCurrentDelayDebounce;
|
||||||
PageController? pageController;
|
PageController? pageController;
|
||||||
final navigatorKey = GlobalKey<NavigatorState>();
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
@@ -38,7 +39,7 @@ class GlobalState {
|
|||||||
timer?.cancel();
|
timer?.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> updateClashConfig({
|
Future<String> updateClashConfig({
|
||||||
required ClashConfig clashConfig,
|
required ClashConfig clashConfig,
|
||||||
required Config config,
|
required Config config,
|
||||||
bool isPatch = true,
|
bool isPatch = true,
|
||||||
@@ -49,6 +50,7 @@ class GlobalState {
|
|||||||
profilePath: profilePath,
|
profilePath: profilePath,
|
||||||
config: clashConfig,
|
config: clashConfig,
|
||||||
isPatch: isPatch,
|
isPatch: isPatch,
|
||||||
|
isCompatible: config.isCompatible,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,17 +76,23 @@ class GlobalState {
|
|||||||
stopListenUpdate();
|
stopListenUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCurrentDelay(
|
applyProfile({
|
||||||
String? proxyName,
|
required AppState appState,
|
||||||
) {
|
required Config config,
|
||||||
updateCurrentDelayDebounce ??= debounce<Function(String?)>((proxyName) {
|
required ClashConfig clashConfig,
|
||||||
if (proxyName != null) {
|
}) async {
|
||||||
clashCore.delay(
|
final res = await updateClashConfig(
|
||||||
proxyName,
|
clashConfig: clashConfig,
|
||||||
);
|
config: config,
|
||||||
}
|
isPatch: false,
|
||||||
});
|
);
|
||||||
updateCurrentDelayDebounce!([proxyName]);
|
if (res.isNotEmpty) return Result.error(message: res);
|
||||||
|
await updateGroups(appState);
|
||||||
|
changeProxy(
|
||||||
|
appState: appState,
|
||||||
|
config: config,
|
||||||
|
clashConfig: clashConfig,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
init({
|
init({
|
||||||
@@ -100,15 +108,35 @@ class GlobalState {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!appState.isInit) return;
|
if (!appState.isInit) return;
|
||||||
await updateClashConfig(
|
await applyProfile(
|
||||||
clashConfig: clashConfig,
|
appState: appState,
|
||||||
config: config,
|
config: config,
|
||||||
isPatch: false,
|
clashConfig: clashConfig,
|
||||||
);
|
);
|
||||||
updateGroups(appState);
|
|
||||||
updateCoreVersionInfo(appState);
|
updateCoreVersionInfo(appState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeProxy({
|
||||||
|
required AppState appState,
|
||||||
|
required Config config,
|
||||||
|
required ClashConfig clashConfig,
|
||||||
|
}) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (config.profiles.isEmpty) {
|
||||||
|
stopSystemProxy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
config.currentSelectedMap.forEach((key, value) {
|
||||||
|
clashCore.changeProxy(
|
||||||
|
ChangeProxyParams(
|
||||||
|
groupName: key,
|
||||||
|
proxyName: value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
updatePackages(AppState appState) async {
|
updatePackages(AppState appState) async {
|
||||||
if (appState.packages.isEmpty && updatePackagesLock == false) {
|
if (appState.packages.isEmpty && updatePackagesLock == false) {
|
||||||
updatePackagesLock = true;
|
updatePackagesLock = true;
|
||||||
@@ -122,16 +150,16 @@ class GlobalState {
|
|||||||
required Config config,
|
required Config config,
|
||||||
required ClashConfig clashConfig,
|
required ClashConfig clashConfig,
|
||||||
}) {
|
}) {
|
||||||
final hasGroups = appState.getCurrentGroups(clashConfig.mode).isNotEmpty;
|
final group = appState.currentGroups;
|
||||||
final hasProfile = config.profiles.isNotEmpty;
|
final hasProfile = config.profiles.isNotEmpty;
|
||||||
appState.navigationItems = navigation.getItems(
|
appState.navigationItems = navigation.getItems(
|
||||||
openLogs: config.openLogs,
|
openLogs: config.openLogs,
|
||||||
hasProxies: hasGroups && hasProfile,
|
hasProxies: group.isNotEmpty && hasProfile,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateGroups(AppState appState) {
|
Future<void> updateGroups(AppState appState) async {
|
||||||
appState.groups = clashCore.getProxiesGroups();
|
appState.groups = await clashCore.getProxiesGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessage({
|
showMessage({
|
||||||
@@ -198,7 +226,7 @@ class GlobalState {
|
|||||||
required Config config,
|
required Config config,
|
||||||
}) {
|
}) {
|
||||||
final traffic = clashCore.getTraffic();
|
final traffic = clashCore.getTraffic();
|
||||||
if(appState != null){
|
if (appState != null) {
|
||||||
appState.addTraffic(traffic);
|
appState.addTraffic(traffic);
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
@@ -210,6 +238,52 @@ class GlobalState {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showSnackBar(
|
||||||
|
BuildContext context, {
|
||||||
|
required String message,
|
||||||
|
SnackBarAction? action,
|
||||||
|
}) {
|
||||||
|
final width = context.width;
|
||||||
|
EdgeInsets margin;
|
||||||
|
if (width < 600) {
|
||||||
|
margin = const EdgeInsets.only(
|
||||||
|
bottom: 96,
|
||||||
|
right: 16,
|
||||||
|
left: 16,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
margin = EdgeInsets.only(
|
||||||
|
bottom: 16,
|
||||||
|
left: 16,
|
||||||
|
right: width - 316,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
action: action,
|
||||||
|
content: Text(message),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
duration: const Duration(milliseconds: 1500),
|
||||||
|
margin: margin,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateCurrentDelay(
|
||||||
|
String? proxyName,
|
||||||
|
) {
|
||||||
|
updateCurrentDelayDebounce ??= debounce<Function(String?)>((proxyName) {
|
||||||
|
if (proxyName != null) {
|
||||||
|
debugPrint("[delay]=====> $proxyName");
|
||||||
|
clashCore.delay(
|
||||||
|
proxyName,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
updateCurrentDelayDebounce!([proxyName]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final globalState = GlobalState();
|
final globalState = GlobalState();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class AppStateContainer extends StatelessWidget {
|
|||||||
return Selector<Config, bool>(
|
return Selector<Config, bool>(
|
||||||
selector: (_, config) => config.autoLaunch,
|
selector: (_, config) => config.autoLaunch,
|
||||||
builder: (_, isAutoLaunch, child) {
|
builder: (_, isAutoLaunch, child) {
|
||||||
debugPrint("[autoLaunchContainer] update===>");
|
|
||||||
autoLaunch?.updateStatus(isAutoLaunch);
|
autoLaunch?.updateStatus(isAutoLaunch);
|
||||||
return child!;
|
return child!;
|
||||||
},
|
},
|
||||||
@@ -24,18 +23,16 @@ class AppStateContainer extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateNavigationsContainer(Widget child) {
|
_updateNavigationsContainer(Widget child) {
|
||||||
return Selector3<AppState, Config, ClashConfig, UpdateNavigationsSelector>(
|
return Selector2<AppState, Config, UpdateNavigationsSelector>(
|
||||||
selector: (_, appState, config, clashConfig) {
|
selector: (_, appState, config) {
|
||||||
final hasGroups =
|
final group = appState.currentGroups;
|
||||||
appState.getCurrentGroups(clashConfig.mode).isNotEmpty;
|
|
||||||
final hasProfile = config.profiles.isNotEmpty;
|
final hasProfile = config.profiles.isNotEmpty;
|
||||||
return UpdateNavigationsSelector(
|
return UpdateNavigationsSelector(
|
||||||
openLogs: config.openLogs,
|
openLogs: config.openLogs,
|
||||||
hasProxies: hasGroups && hasProfile,
|
hasProxies: group.isNotEmpty && hasProfile,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
builder: (context, state, child) {
|
builder: (context, state, child) {
|
||||||
debugPrint("[NavigationsContainer] update===>");
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(_) {
|
(_) {
|
||||||
context.appController.appState.navigationItems =
|
context.appController.appState.navigationItems =
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class _ClashMessageContainerState extends State<ClashMessageContainer>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onDelay(Delay delay) {
|
void onDelay(Delay delay) {
|
||||||
context.appController.setDelay(delay);
|
final appController = context.appController;
|
||||||
|
appController.setDelay(delay);
|
||||||
super.onDelay(delay);
|
super.onDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onLog(Log log) {
|
void onLog(Log log) {
|
||||||
debugPrint("$log");
|
|
||||||
context.appController.appState.addLog(log);
|
context.appController.appState.addLog(log);
|
||||||
super.onLog(log);
|
super.onLog(log);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -446,7 +446,6 @@ class _OpenContainerRoute<T> extends ModalRoute<T> {
|
|||||||
return Selector<Config, ThemeMode>(
|
return Selector<Config, ThemeMode>(
|
||||||
selector: (_, config) => config.themeMode,
|
selector: (_, config) => config.themeMode,
|
||||||
builder: (_, __, ___) {
|
builder: (_, __, ___) {
|
||||||
debugPrint("[OpenContainerTheme] update===>");
|
|
||||||
_colorTween = _getColorTween(
|
_colorTween = _getColorTween(
|
||||||
transitionType: transitionType,
|
transitionType: transitionType,
|
||||||
closedColor: Theme.of(context).colorScheme.background,
|
closedColor: Theme.of(context).colorScheme.background,
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
locale: config.locale,
|
locale: config.locale,
|
||||||
),
|
),
|
||||||
builder: (_, state, child) {
|
builder: (_, state, child) {
|
||||||
debugPrint("[TrayContainer] update===>");
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
updateMenu(state);
|
updateMenu(state);
|
||||||
});
|
});
|
||||||
|
|||||||
12
pubspec.lock
12
pubspec.lock
@@ -258,10 +258,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_adaptive_scaffold
|
name: flutter_adaptive_scaffold
|
||||||
sha256: "600bbe237530a249f957f7d0f36273c20bd38d137e28e098c5231c30cadbe927"
|
sha256: "9a1d5e9f728815e27b7b612883db19107ba8a35a46a97c757ea00896cb027451"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.10+1"
|
version: "0.1.10+2"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -279,10 +279,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
sha256: "592dc01a18961a51c24ae5d963b724b2b7fa4a95c100fe8eb6ca8a5a4732cadf"
|
sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.18"
|
version: "2.0.19"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -997,10 +997,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: yaml_edit
|
name: yaml_edit
|
||||||
sha256: c566f4f804215d84a7a2c377667f546c6033d5b34b4f9e60dfb09d17c4e97826
|
sha256: e9c1a3543d2da0db3e90270dbb1e4eebc985ee5e3ffe468d83224472b2194a5f
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.3.0 <4.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
flutter: ">=3.19.0"
|
flutter: ">=3.19.0"
|
||||||
|
|||||||
@@ -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.8.0
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.1.0 <4.0.0'
|
sdk: '>=3.1.0 <4.0.0'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user