opt: func

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-07 13:07:15 +08:00
parent 6353ecc13e
commit 286193f08f
99 changed files with 204 additions and 270 deletions

View File

@@ -18,7 +18,7 @@ class PiliScheme {
static StreamSubscription? listener;
static final uriDigitRegExp = RegExp(r'/(\d+)');
static Future<void> init() async {
static void init() {
// Register our protocol only on Windows platform
// registerProtocolHandler('bilibili');
appLinks = AppLinks();

View File

@@ -50,7 +50,7 @@ class DownloadUtils {
if (status == PermissionStatus.denied ||
status == PermissionStatus.permanentlyDenied) {
if (!context.mounted) return false;
await showDialog(
showDialog(
context: context,
builder: (context) {
return AlertDialog(
@@ -58,7 +58,7 @@ class DownloadUtils {
content: const Text('存储权限未授权'),
actions: [
TextButton(
onPressed: () async {
onPressed: () {
openAppSettings();
},
child: const Text('去授权'),

View File

@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
@@ -474,7 +475,7 @@ class RequestUtils {
Gt3FlutterPlugin()
..addEventHandler(
onClose: (Map<String, dynamic> message) async {
onClose: (Map<String, dynamic> message) {
SmartDialog.showToast('关闭验证');
},
onResult: (Map<String, dynamic> message) async {
@@ -510,7 +511,7 @@ class RequestUtils {
debugPrint("Captcha result code : $code");
}
},
onError: (Map<String, dynamic> message) async {
onError: (Map<String, dynamic> message) {
SmartDialog.showToast("Captcha onError: $message");
String code = message["code"];
// 处理验证中返回的错误 Handling errors returned in verification

View File

@@ -572,7 +572,7 @@ class GStorage {
..replyLengthLimit = replyLengthLimit;
}
static Future<String> exportAllSettings() async {
static String exportAllSettings() {
return jsonEncode({
setting.name: setting.toMap(),
video.name: video.toMap(),
@@ -599,7 +599,7 @@ class GStorage {
..registerAdapter(RuleFilterAdapter());
}
static Future<void> close() async {
static void close() {
// user.compact();
// user.close();
userInfo
@@ -915,7 +915,7 @@ class Accounts {
}
}
static Future<void> refresh() async {
static void refresh() {
for (var a in account.values) {
for (var t in a.type) {
accountMode[t] = a;
@@ -938,7 +938,7 @@ class Accounts {
// Request.buvidActive(AnonymousAccount());
}
static Future<void> close() async {
static void close() {
account
..compact()
..close();

View File

@@ -57,7 +57,7 @@ class Utils {
static bool? _isIpad;
static FutureOr<bool> isIpad() async {
static Future<bool> isIpad() async {
if (Platform.isIOS.not) {
return false;
}
@@ -164,11 +164,11 @@ class Utils {
return '${randomTraceId.toString()}:${randomTraceId.toString().substring(16, 32)}:0:0';
}
static Future copyText(
static void copyText(
String text, {
bool needToast = true,
String? toastText,
}) async {
}) {
Clipboard.setData(ClipboardData(text: text));
if (needToast) {
SmartDialog.showToast(toastText ?? '已复制');