Skip to content

Commit d5cf3a3

Browse files
author
code3-dev
committed
update core
1 parent cdabccc commit d5cf3a3

File tree

24 files changed

+599
-537
lines changed

24 files changed

+599
-537
lines changed

FA.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ yay -S proxycloud-gui-bin
181181
## 🙏 قدردانی
182182

183183
- [Flutter](https://flutter.dev/) - مجموعه ابزار رابط کاربری برای ساخت برنامه‌های کامپایل شده بومی
184-
- [V2Ray](https://www.v2ray.com/) - پلتفرمی برای ساخت پروکسی‌ها برای دور زدن محدودیت‌های شبکه
184+
- [Xray Core](https://github.com/XTLS/Xray-core) - پلتفرمی برای ساخت پروکسی‌ها برای دور زدن محدودیت‌های شبکه
185+
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite) - کتابخانه اندروید برای هسته Xray
185186
- [Provider](https://pub.dev/packages/provider) - راه حل مدیریت وضعیت
186187
- تمام مشارکت‌کنندگانی که به شکل‌گیری این پروژه کمک کرده‌اند
187188

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ If you encounter any issues or have questions, please open an issue on our GitHu
190190
## 🙏 Acknowledgements
191191

192192
- [Flutter](https://flutter.dev/) - UI toolkit for building natively compiled applications
193-
- [V2Ray](https://www.v2ray.com/) - A platform for building proxies to bypass network restrictions
193+
- [Xray Core](https://github.com/XTLS/Xray-core) - A platform for building proxies to bypass network restrictions
194+
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite) - Android library for Xray core
194195
- [Provider](https://pub.dev/packages/provider) - State management solution
195196
- All contributors who have helped shape this project
196197

RU.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ yay -S proxycloud-gui-bin
181181
## 🙏 Благодарности
182182

183183
- [Flutter](https://flutter.dev/) - UI-инструментарий для создания нативно компилируемых приложений
184-
- [V2Ray](https://www.v2ray.com/) - Платформа для создания прокси для обхода сетевых ограничений
184+
- [Xray Core](https://github.com/XTLS/Xray-core) - Платформа для создания прокси для обхода сетевых ограничений
185+
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite) - Android библиотека для ядра Xray
185186
- [Provider](https://pub.dev/packages/provider) - Решение для управления состоянием
186187
- Всем участникам, которые помогли сформировать этот проект
187188

ZH.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ yay -S proxycloud-gui-bin
182182
## 🙏 致谢
183183

184184
- [Flutter](https://flutter.dev/) - 用于构建原生编译应用程序的UI工具包
185-
- [V2Ray](https://www.v2ray.com/) - 一个用于构建绕过网络限制的代理的平台
185+
- [Xray Core](https://github.com/XTLS/Xray-core) - 一个用于构建绕过网络限制的代理的平台
186+
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite) - Xray核心的Android库
186187
- [Provider](https://pub.dev/packages/provider) - 状态管理解决方案
187188
- 所有帮助塑造这个项目的贡献者
188189

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ android {
4242
applicationId = "com.cloud.pira"
4343
minSdk = flutter.minSdkVersion
4444
targetSdk = flutter.targetSdkVersion
45-
versionCode = 45
46-
versionName = "3.7.5"
45+
versionCode = 46
46+
versionName = "3.7.6"
4747

4848
manifestPlaceholders.put("io.flutter.embedding.android.EnableImpeller", "false")
4949
}

lib/models/app_update.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class AppUpdate {
66
final String messText;
77

88
// Current app version - manually set
9-
static const String currentAppVersion = '3.7.5';
9+
static const String currentAppVersion = '3.7.6';
1010

1111
AppUpdate({required this.version, required this.url, required this.messText});
1212

lib/providers/v2ray_provider.dart

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
1919
bool _isLoadingServers = false;
2020
bool _isProxyMode = false;
2121
bool _isInitializing = true; // New flag to track initialization state
22-
22+
2323
// Method channel for VPN control
2424
static const platform = MethodChannel('com.cloud.pira/vpn_control');
2525

@@ -41,11 +41,11 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
4141
V2RayProvider() {
4242
WidgetsBinding.instance.addObserver(this);
4343
_initialize();
44-
44+
4545
// Set up method channel handler
4646
platform.setMethodCallHandler(_handleMethodCall);
4747
}
48-
48+
4949
// Handle method calls from native side
5050
Future<dynamic> _handleMethodCall(MethodCall call) async {
5151
switch (call.method) {
@@ -60,7 +60,7 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
6060
Future<void> _handleNotificationDisconnect() async {
6161
// Actually disconnect the VPN service
6262
await _v2rayService.disconnect();
63-
63+
6464
// Update config status when disconnected from notification
6565
for (int i = 0; i < _configs.length; i++) {
6666
_configs[i].isConnected = false;
@@ -85,7 +85,7 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
8585
_setLoading(true);
8686
_isInitializing = true; // Set initialization flag
8787
notifyListeners();
88-
88+
8989
try {
9090
await _v2rayService.initialize();
9191

@@ -121,23 +121,25 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
121121
Future<void> _enhancedSyncWithVpnServiceState() async {
122122
try {
123123
print('Enhanced synchronization with VPN service state...');
124-
124+
125125
// First, check if VPN is actually running using the improved method
126126
final isActuallyConnected = await _v2rayService.isActuallyConnected();
127-
print('VPN service status - Actually connected (primary check): $isActuallyConnected');
128-
127+
print(
128+
'VPN service status - Actually connected (primary check): $isActuallyConnected',
129+
);
130+
129131
// Reset all connection states first
130132
for (int i = 0; i < _configs.length; i++) {
131133
_configs[i].isConnected = false;
132134
}
133-
135+
134136
if (isActuallyConnected) {
135137
print('VPN is actually running, synchronizing config states...');
136-
138+
137139
// Try to get the active config from service
138140
final activeConfigFromService = _v2rayService.activeConfig;
139141
print('Active config from service: ${activeConfigFromService?.remark}');
140-
142+
141143
if (activeConfigFromService != null) {
142144
bool configFound = false;
143145

@@ -161,7 +163,9 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
161163
config.isConnected = true;
162164
_selectedConfig = config;
163165
configFound = true;
164-
print('Found matching config by address/port: ${config.remark}');
166+
print(
167+
'Found matching config by address/port: ${config.remark}',
168+
);
165169
break;
166170
}
167171
}
@@ -174,14 +178,18 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
174178
_configs.add(activeConfigFromService);
175179
activeConfigFromService.isConnected = true;
176180
_selectedConfig = activeConfigFromService;
177-
print('Added active config to list: ${activeConfigFromService.remark}');
181+
print(
182+
'Added active config to list: ${activeConfigFromService.remark}',
183+
);
178184
}
179185
} else {
180186
// VPN is running but we don't have the config details
181187
// Try to find any config that might be connected
182-
print('VPN is running but no active config in service, checking configs...');
188+
print(
189+
'VPN is running but no active config in service, checking configs...',
190+
);
183191
V2RayConfig? foundConnectedConfig;
184-
192+
185193
// Check if any config has connection details that match a running service
186194
for (var config in _configs) {
187195
try {
@@ -196,14 +204,18 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
196204
print('Error checking config ${config.remark}: $e');
197205
}
198206
}
199-
207+
200208
if (foundConnectedConfig == null) {
201-
print('Could not identify which config is connected, marking first available');
209+
print(
210+
'Could not identify which config is connected, marking first available',
211+
);
202212
// As a fallback, mark the first config as connected if we have configs
203213
if (_configs.isNotEmpty) {
204214
_configs.first.isConnected = true;
205215
_selectedConfig = _configs.first;
206-
print('Marked first config as connected: ${_configs.first.remark}');
216+
print(
217+
'Marked first config as connected: ${_configs.first.remark}',
218+
);
207219
}
208220
}
209221
}
@@ -214,7 +226,7 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
214226
config.isConnected = false;
215227
}
216228
_selectedConfig = null;
217-
229+
218230
// Clear active config from service if it exists
219231
if (_v2rayService.activeConfig != null) {
220232
await _v2rayService.disconnect();
@@ -422,7 +434,7 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
422434
try {
423435
// Parse multiple configurations from text (similar to subscription parsing)
424436
final configs = await _v2rayService.parseSubscriptionContent(configText);
425-
437+
426438
if (configs.isEmpty) {
427439
throw Exception('No valid configurations found');
428440
}
@@ -757,7 +769,8 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
757769
debugPrint('Connection successful for ${config.remark}');
758770
// Verify the connection is actually established
759771
await Future.delayed(const Duration(seconds: 1));
760-
final connectionVerified = await _v2rayService.isActuallyConnected();
772+
final connectionVerified = await _v2rayService
773+
.isActuallyConnected();
761774
if (connectionVerified) {
762775
debugPrint('Connection verified for ${config.remark}');
763776
break;
@@ -1025,7 +1038,10 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
10251038
return await _v2rayService.parseSubscriptionContent(content);
10261039
}
10271040

1028-
Future<void> addSubscriptionFromFile(String name, List<V2RayConfig> configs) async {
1041+
Future<void> addSubscriptionFromFile(
1042+
String name,
1043+
List<V2RayConfig> configs,
1044+
) async {
10291045
_setLoading(true);
10301046
_errorMessage = '';
10311047
try {
@@ -1038,7 +1054,8 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
10381054
final subscription = Subscription(
10391055
id: DateTime.now().millisecondsSinceEpoch.toString(),
10401056
name: name,
1041-
url: 'file://subscription', // Special indicator for file-based subscriptions
1057+
url:
1058+
'file://subscription', // Special indicator for file-based subscriptions
10421059
lastUpdated: DateTime.now(),
10431060
configIds: newConfigIds,
10441061
);
@@ -1066,4 +1083,4 @@ class V2RayProvider with ChangeNotifier, WidgetsBindingObserver {
10661083
_setLoading(false);
10671084
}
10681085
}
1069-
}
1086+
}

lib/screens/about_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AboutScreen extends StatelessWidget {
6464
Text(
6565
context.tr(
6666
TranslationKeys.aboutVersion,
67-
parameters: {'version': '3.7.5'},
67+
parameters: {'version': '3.7.6'},
6868
),
6969
style: const TextStyle(fontSize: 16, color: Colors.grey),
7070
),

lib/screens/server_selection_screen.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,7 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
410410
if (mounted) {
411411
try {
412412
_autoConnectStatusStream.add(
413-
context.tr(
414-
TranslationKeys.serverSelectionTestingServers,
415-
),
413+
context.tr(TranslationKeys.serverSelectionTestingServers),
416414
);
417415
} catch (e) {
418416
debugPrint('Error updating status stream: $e');
@@ -445,9 +443,7 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
445443
}
446444
ScaffoldMessenger.of(context).showSnackBar(
447445
SnackBar(
448-
content: Text(
449-
context.tr('common.cancel'),
450-
),
446+
content: Text(context.tr('common.cancel')),
451447
backgroundColor: Colors.orange,
452448
),
453449
);
@@ -521,7 +517,10 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
521517
ScaffoldMessenger.of(context).showSnackBar(
522518
SnackBar(
523519
content: Text(
524-
result.errorMessage ?? context.tr(TranslationKeys.serverSelectionNoSuitableServer),
520+
result.errorMessage ??
521+
context.tr(
522+
TranslationKeys.serverSelectionNoSuitableServer,
523+
),
525524
),
526525
backgroundColor: Colors.orange,
527526
),
@@ -1016,7 +1015,8 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
10161015
TextButton(
10171016
onPressed: () {
10181017
// Cancel the auto-select operation
1019-
_autoSelectCancellationToken?.cancel();
1018+
_autoSelectCancellationToken
1019+
?.cancel();
10201020
Navigator.of(context).pop();
10211021
},
10221022
child: Text(

lib/services/update_service.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ class UpdateService {
1111
// Check for updates
1212
Future<AppUpdate?> checkForUpdates() async {
1313
try {
14-
final response = await http.get(Uri.parse(updateUrl)).timeout(
14+
final response = await http
15+
.get(Uri.parse(updateUrl))
16+
.timeout(
1517
const Duration(seconds: 60),
1618
onTimeout: () {
17-
throw Exception('Network timeout: Check your internet connection');
19+
throw Exception(
20+
'Network timeout: Check your internet connection',
21+
);
1822
},
1923
);
2024
if (response.statusCode == 200) {
@@ -41,7 +45,12 @@ class UpdateService {
4145
mainAxisSize: MainAxisSize.min,
4246
crossAxisAlignment: CrossAxisAlignment.start,
4347
children: [
44-
Text(context.tr(TranslationKeys.updateServiceNewVersion, parameters: {'version': update.version})),
48+
Text(
49+
context.tr(
50+
TranslationKeys.updateServiceNewVersion,
51+
parameters: {'version': update.version},
52+
),
53+
),
4554
const SizedBox(height: 8),
4655
Text(update.messText),
4756
],

0 commit comments

Comments
 (0)