opt: func

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-07 14:41:25 +08:00
parent 286193f08f
commit dd6ff101d1
63 changed files with 181 additions and 180 deletions

View File

@@ -44,7 +44,7 @@ class PiliScheme {
} else if (RegExp(r'^\S+://').hasMatch(url).not) {
url = 'https://$url';
}
return await routePush(
return routePush(
Uri.parse(url),
selfHandle: selfHandle,
off: off,
@@ -454,7 +454,7 @@ class PiliScheme {
return false;
}
case 'http' || 'https':
return await _fullPathPush(
return _fullPathPush(
uri,
selfHandle: selfHandle,
off: off,

View File

@@ -76,7 +76,7 @@ class CacheManage {
}
/// 清除 Documents 目录下的 DioCache.db
Future clearApplicationCache() async {
Future<void> clearApplicationCache() async {
Directory directory = await getApplicationDocumentsDirectory();
if (directory.existsSync()) {
String dioCacheFileName =
@@ -89,7 +89,7 @@ class CacheManage {
}
// 清除 Library/Caches 目录及文件缓存
static Future clearLibraryCache() async {
static Future<void> clearLibraryCache() async {
var appDocDir = await getTemporaryDirectory();
if (appDocDir.existsSync()) {
// await appDocDir.delete(recursive: true);
@@ -102,7 +102,7 @@ class CacheManage {
}
/// 递归方式删除目录及文件
Future deleteDirectory(FileSystemEntity file) async {
Future<void> deleteDirectory(FileSystemEntity file) async {
if (file is Directory) {
final List<FileSystemEntity> children = file.listSync();
for (final FileSystemEntity child in children) {

View File

@@ -2,11 +2,7 @@ import 'package:PiliPlus/http/user.dart';
import 'package:PiliPlus/utils/storage.dart';
class Data {
static Future init() async {
await historyStatus();
}
static Future historyStatus() async {
static Future<void> init() async {
if (!Accounts.main.isLogin) {
return;
}

View File

@@ -91,15 +91,15 @@ class DownloadUtils {
final androidInfo = await DeviceInfoPlugin().androidInfo;
if (androidInfo.version.sdkInt <= 32) {
if (!context.mounted) return false;
return await requestStoragePer(context);
return requestStoragePer(context);
} else {
return await requestPhotoPer();
return requestPhotoPer();
}
}
return await requestStoragePer(context);
return requestStoragePer(context);
}
static Future downloadLivePhoto({
static Future<bool> downloadLivePhoto({
required BuildContext context,
required String url,
required String liveUrl,
@@ -108,7 +108,7 @@ class DownloadUtils {
}) async {
try {
if (!await checkPermissionDependOnSdkInt(context)) {
return;
return false;
}
SmartDialog.showLoading(msg: '正在下载');
@@ -168,12 +168,12 @@ class DownloadUtils {
}
}
static Future downloadImg(
static Future<bool> downloadImg(
BuildContext context,
List<String> imgList, {
String imgType = 'cover',
}) async {
if (!await checkPermissionDependOnSdkInt(context)) return;
if (!await checkPermissionDependOnSdkInt(context)) return false;
final cancelToken = CancelToken();
SmartDialog.showLoading(
msg: '正在下载原图',

View File

@@ -25,7 +25,7 @@ import 'package:webview_cookie_manager/webview_cookie_manager.dart';
class LoginUtils {
static final random = Random();
static Future onLoginMain() async {
static Future<void> onLoginMain() async {
final account = Accounts.main;
GrpcRepo.updateHeaders(account.accessKey);
try {
@@ -112,7 +112,7 @@ class LoginUtils {
}
}
static Future onLogoutMain() async {
static Future<void> onLogoutMain() async {
GrpcRepo.updateHeaders(null);
await Future.wait([

View File

@@ -261,7 +261,7 @@ class PageUtils {
);
}
static Future pushDynFromId({id, rid, bool off = false}) async {
static Future<void> pushDynFromId({id, rid, bool off = false}) async {
SmartDialog.showLoading();
dynamic res = await DynamicsHttp.dynamicDetail(
id: id,

View File

@@ -45,7 +45,7 @@ class RequestUtils {
// 16番剧id 为 epid
// 17番剧
// https://github.com/SocialSisterYi/bilibili-API-collect/tree/master/docs/message/private_msg_content.md
static Future pmShare({
static Future<void> pmShare({
required int receiverId,
required Map content,
String? message,
@@ -86,7 +86,7 @@ class RequestUtils {
SmartDialog.dismiss();
}
static Future actionRelationMod({
static Future<void> actionRelationMod({
required BuildContext context,
required dynamic mid,
required bool isFollow,
@@ -260,7 +260,7 @@ class RequestUtils {
// }
// }
static Future insertCreatedDyn(result) async {
static Future<void> insertCreatedDyn(result) async {
try {
dynamic id = result['data']['dyn_id'];
if (id != null) {
@@ -285,7 +285,7 @@ class RequestUtils {
}
}
static Future checkCreatedDyn({id, dynText, isManual}) async {
static Future<void> checkCreatedDyn({id, dynText, isManual}) async {
if (isManual == true || GStorage.enableCreateDynAntifraud) {
try {
if (id != null) {
@@ -310,7 +310,7 @@ class RequestUtils {
}
// 动态点赞
static Future onLikeDynamic(
static Future<void> onLikeDynamic(
DynamicItemModel item, VoidCallback callback) async {
feedBack();
String dynamicId = item.idStr!;
@@ -437,7 +437,7 @@ class RequestUtils {
});
}
static Future validate(
static Future<void> validate(
String vVoucher, ValueChanged<String> onSuccess) async {
final res = await ValidateHttp.gaiaVgateRegister(vVoucher);
if (!res['status']) {

View File

@@ -590,7 +590,7 @@ class Utils {
}
// 下载适用于当前系统的安装包
static Future onDownload(data) async {
static Future<void> onDownload(data) async {
await SmartDialog.dismiss();
try {
void download(plat) {