Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-17 12:42:42 +08:00
parent ad931d7ea2
commit aaab5371b2
2 changed files with 12 additions and 8 deletions

View File

@@ -368,14 +368,12 @@ class MyApp extends StatelessWidget {
} }
class _CustomHttpOverrides extends HttpOverrides { class _CustomHttpOverrides extends HttpOverrides {
final badCertificateCallback = kDebugMode || Pref.badCertificateCallback;
@override @override
HttpClient createHttpClient(SecurityContext? context) { HttpClient createHttpClient(SecurityContext? context) {
final client = super.createHttpClient(context) final client = super.createHttpClient(context)
// ..maxConnectionsPerHost = 32 // ..maxConnectionsPerHost = 32
..idleTimeout = const Duration(seconds: 15); ..idleTimeout = const Duration(seconds: 15);
if (badCertificateCallback) { if (kDebugMode || Pref.badCertificateCallback) {
client.badCertificateCallback = (cert, host, port) => true; client.badCertificateCallback = (cert, host, port) => true;
} }
return client; return client;

View File

@@ -23,6 +23,7 @@ abstract class ImageUtils {
static String get time => static String get time =>
DateFormat('yyyy-MM-dd_HH-mm-ss').format(DateTime.now()); DateFormat('yyyy-MM-dd_HH-mm-ss').format(DateTime.now());
static bool silentDownImg = Pref.silentDownImg; static bool silentDownImg = Pref.silentDownImg;
static const _androidRelativePath = 'Pictures/${Constants.appName}';
// 图片分享 // 图片分享
static Future<void> onShareImg(String url) async { static Future<void> onShareImg(String url) async {
@@ -201,11 +202,16 @@ abstract class ImageUtils {
del: true, del: true,
); );
} else { } else {
return (filePath: file.path, name: name, statusCode: 200, del: false); return (
filePath: file.path,
name: name,
statusCode: 200,
del: false,
);
} }
}); });
final result = await Future.wait(futures, eagerError: true); final result = await Future.wait(futures, eagerError: true);
if (Platform.isAndroid) { if (Utils.isMobile) {
final delList = <String>[]; final delList = <String>[];
final saveList = <SaveFileData>[]; final saveList = <SaveFileData>[];
for (var i in result) { for (var i in result) {
@@ -215,7 +221,7 @@ abstract class ImageUtils {
SaveFileData( SaveFileData(
filePath: i.filePath, filePath: i.filePath,
fileName: i.name, fileName: i.name,
androidRelativePath: 'Pictures/${Constants.appName}', androidRelativePath: _androidRelativePath,
), ),
); );
} }
@@ -291,7 +297,7 @@ abstract class ImageUtils {
result = await SaverGallery.saveImage( result = await SaverGallery.saveImage(
bytes, bytes,
fileName: fileName, fileName: fileName,
androidRelativePath: "Pictures/${Constants.appName}", androidRelativePath: _androidRelativePath,
skipIfExists: false, skipIfExists: false,
); );
SmartDialog.dismiss(); SmartDialog.dismiss();
@@ -334,7 +340,7 @@ abstract class ImageUtils {
result = await SaverGallery.saveFile( result = await SaverGallery.saveFile(
filePath: filePath, filePath: filePath,
fileName: fileName, fileName: fileName,
androidRelativePath: "Pictures/${Constants.appName}", androidRelativePath: _androidRelativePath,
skipIfExists: false, skipIfExists: false,
); );
if (del) file.tryDel(); if (del) file.tryDel();