mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 15:16:15 +08:00
opt share img
opt block query Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -258,7 +258,7 @@ class Request {
|
|||||||
CancelToken? cancelToken,
|
CancelToken? cancelToken,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final response = await dio.download(
|
return await dio.download(
|
||||||
urlPath,
|
urlPath,
|
||||||
savePath,
|
savePath,
|
||||||
cancelToken: cancelToken,
|
cancelToken: cancelToken,
|
||||||
@@ -268,7 +268,6 @@ class Request {
|
|||||||
// },
|
// },
|
||||||
);
|
);
|
||||||
// if (kDebugMode) debugPrint('downloadFile success: ${response.data}');
|
// if (kDebugMode) debugPrint('downloadFile success: ${response.data}');
|
||||||
return response;
|
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
// if (kDebugMode) debugPrint('downloadFile error: $e');
|
// if (kDebugMode) debugPrint('downloadFile error: $e');
|
||||||
return Response(
|
return Response(
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
|||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:PiliPlus/utils/video_utils.dart';
|
import 'package:PiliPlus/utils/video_utils.dart';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:dio/dio.dart' show Options;
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||||
@@ -700,6 +701,7 @@ class VideoDetailController extends GetxController
|
|||||||
'videoID': bvid,
|
'videoID': bvid,
|
||||||
'cid': cid.value,
|
'cid': cid.value,
|
||||||
},
|
},
|
||||||
|
options: Options(validateStatus: (status) => true),
|
||||||
);
|
);
|
||||||
if (result.statusCode == 200) {
|
if (result.statusCode == 200) {
|
||||||
if (result.data case List list) {
|
if (result.data case List list) {
|
||||||
|
|||||||
@@ -23,24 +23,20 @@ class ImageUtil {
|
|||||||
static Future<void> onShareImg(String url) async {
|
static Future<void> onShareImg(String url) async {
|
||||||
try {
|
try {
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
var response = await Request().get(
|
|
||||||
url,
|
|
||||||
options: Options(responseType: ResponseType.bytes),
|
|
||||||
);
|
|
||||||
final temp = await getTemporaryDirectory();
|
final temp = await getTemporaryDirectory();
|
||||||
|
var path = '${temp.path}/${Utils.getFileName(url)}';
|
||||||
|
var res = await Request().downloadFile(url.http2https, path);
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
var name = Utils.getFileName(url);
|
if (res.statusCode == 200) {
|
||||||
var path = '${temp.path}/$name';
|
SharePlus.instance.share(
|
||||||
File(path).writeAsBytesSync(response.data);
|
ShareParams(
|
||||||
|
files: [XFile(path)],
|
||||||
SharePlus.instance.share(
|
sharePositionOrigin: await Utils.isIpad()
|
||||||
ShareParams(
|
? Rect.fromLTWH(0, 0, Get.width, Get.height / 2)
|
||||||
files: [XFile(path)],
|
: null,
|
||||||
sharePositionOrigin: await Utils.isIpad()
|
),
|
||||||
? Rect.fromLTWH(0, 0, Get.width, Get.height / 2)
|
);
|
||||||
: null,
|
}
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
SmartDialog.showToast(e.toString());
|
SmartDialog.showToast(e.toString());
|
||||||
}
|
}
|
||||||
@@ -119,10 +115,12 @@ class ImageUtil {
|
|||||||
String videoName = "video_${Utils.getFileName(liveUrl)}";
|
String videoName = "video_${Utils.getFileName(liveUrl)}";
|
||||||
String videoPath = '$tmpPath/$videoName';
|
String videoPath = '$tmpPath/$videoName';
|
||||||
|
|
||||||
await Request.dio.download(liveUrl, videoPath);
|
final res = await Request().downloadFile(liveUrl.http2https, videoPath);
|
||||||
|
if (res.statusCode != 200) throw '${res.statusCode}';
|
||||||
|
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
await Request.dio.download(url, imagePath);
|
final res1 = await Request().downloadFile(url.http2https, imagePath);
|
||||||
|
if (res1.statusCode != 200) throw '${res1.statusCode}';
|
||||||
SmartDialog.showLoading(msg: '正在保存');
|
SmartDialog.showLoading(msg: '正在保存');
|
||||||
bool success = await LivePhotoMaker.create(
|
bool success = await LivePhotoMaker.create(
|
||||||
coverImage: imagePath,
|
coverImage: imagePath,
|
||||||
|
|||||||
Reference in New Issue
Block a user