File tree Expand file tree Collapse file tree 3 files changed +31
-274
lines changed
Expand file tree Collapse file tree 3 files changed +31
-274
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import 'dart:io';
22
33import 'package:flutter/foundation.dart' ;
44import 'package:flutter/material.dart' ;
5- import 'package:http_proxy/http_proxy .dart' ;
5+ import 'package:native_flutter_proxy/native_flutter_proxy .dart' ;
66import 'package:hw_manager_flutter/l10n/app_localizations.dart' ;
77import 'package:hw_manager_flutter/routes/home_route.dart' ;
88import 'package:hw_manager_flutter/shared_preferences.dart' ;
@@ -13,10 +13,28 @@ void main() async {
1313 WidgetsFlutterBinding .ensureInitialized ();
1414 if (! kIsWeb) {
1515 if (Platform .isAndroid || Platform .isIOS) {
16- final HttpProxy httpProxy = await HttpProxy .createHttpProxy ();
17- HttpOverrides .global = httpProxy;
16+ bool enabled = false ;
17+ String ? host;
18+ int ? port;
19+ try {
20+ final ProxySetting settings = await NativeProxyReader .proxySetting;
21+ enabled = settings.enabled;
22+ host = settings.host;
23+ port = settings.port;
24+ } catch (e) {
25+ if (kDebugMode) {
26+ print (e);
27+ }
28+ }
29+ if (enabled && host != null ) {
30+ final proxy = CustomProxy (ipAddress: host, port: port);
31+ proxy.enable ();
32+ if (kDebugMode) {
33+ print ("proxy enabled" );
34+ }
35+ }
1836 }
19- await SimpleSecureStorage .initialize (const InitializationOptions () );
37+ await SimpleSecureStorage .initialize ();
2038 } else {
2139 // To secure your data on Flutter web, we have to encrypt it using a password and a salt.
2240 await SimpleSecureStorage .initialize (WebInitializationOptions (
You can’t perform that action at this time.
0 commit comments