mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-14 05:03:57 +08:00
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/scaffold.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pbenum.dart'
|
||||
show PlaylistSource;
|
||||
@@ -363,8 +364,7 @@ abstract final class PiliScheme {
|
||||
return false;
|
||||
case 'livearea':
|
||||
Get.to(
|
||||
Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
scaffold(
|
||||
appBar: AppBar(title: const Text('直播')),
|
||||
body: const ViewSafeArea(child: LivePage()),
|
||||
),
|
||||
@@ -372,8 +372,7 @@ abstract final class PiliScheme {
|
||||
return true;
|
||||
case 'rank':
|
||||
Get.to(
|
||||
Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
scaffold(
|
||||
appBar: AppBar(title: const Text('排行榜')),
|
||||
body: const ViewSafeArea(child: RankPage()),
|
||||
),
|
||||
|
||||
@@ -77,15 +77,11 @@ abstract final class CacheManager {
|
||||
}
|
||||
|
||||
static Future<void> autoClearCache() async {
|
||||
if (Pref.autoClearCache) {
|
||||
await clearLibraryCache();
|
||||
} else {
|
||||
final maxCacheSize = Pref.maxCacheSize;
|
||||
if (maxCacheSize != 0) {
|
||||
final currCache = await loadApplicationCache(maxCacheSize);
|
||||
if (currCache >= maxCacheSize) {
|
||||
await clearLibraryCache();
|
||||
}
|
||||
final maxCacheSize = Pref.maxCacheSize;
|
||||
if (maxCacheSize != 0) {
|
||||
final currCache = await loadApplicationCache(maxCacheSize);
|
||||
if (currCache >= maxCacheSize) {
|
||||
await clearLibraryCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ class GlobalData {
|
||||
|
||||
bool dynamicsWaterfallFlow = Pref.dynamicsWaterfallFlow;
|
||||
|
||||
bool showMedal = Pref.showMedal;
|
||||
|
||||
// 私有构造函数
|
||||
GlobalData._();
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/permission_handler.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/share_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
@@ -27,7 +26,6 @@ import 'package:share_plus/share_plus.dart';
|
||||
abstract final class ImageUtils {
|
||||
static String get time =>
|
||||
DateFormat('yyyy-MM-dd_HH-mm-ss').format(DateTime.now());
|
||||
static bool silentDownImg = Pref.silentDownImg;
|
||||
static const _androidRelativePath = 'Pictures/${Constants.appName}';
|
||||
|
||||
// 图片分享
|
||||
@@ -101,7 +99,7 @@ abstract final class ImageUtils {
|
||||
if (PlatformUtils.isMobile && !await checkPermissionDependOnSdkInt()) {
|
||||
return false;
|
||||
}
|
||||
if (!silentDownImg) SmartDialog.showLoading(msg: '正在下载');
|
||||
SmartDialog.showLoading(msg: '正在下载');
|
||||
|
||||
late String imageName = "cover_${Utils.getFileName(url)}";
|
||||
late String imagePath = '$tmpDirPath/$imageName';
|
||||
@@ -114,7 +112,7 @@ abstract final class ImageUtils {
|
||||
if (Platform.isIOS) {
|
||||
final res1 = await Request().downloadFile(url.http2https, imagePath);
|
||||
if (res1.statusCode != 200) throw '${res1.statusCode}';
|
||||
if (!silentDownImg) SmartDialog.showLoading(msg: '正在保存');
|
||||
SmartDialog.showLoading(msg: '正在保存');
|
||||
bool success =
|
||||
await LivePhotoMaker.create(
|
||||
coverImage: imagePath,
|
||||
@@ -135,7 +133,7 @@ abstract final class ImageUtils {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!silentDownImg) SmartDialog.showLoading(msg: '正在保存');
|
||||
SmartDialog.showLoading(msg: '正在保存');
|
||||
await saveFileImg(
|
||||
filePath: videoPath,
|
||||
fileName: videoName,
|
||||
@@ -148,7 +146,7 @@ abstract final class ImageUtils {
|
||||
SmartDialog.showToast(err.toString());
|
||||
return false;
|
||||
} finally {
|
||||
if (!silentDownImg) SmartDialog.dismiss(status: SmartStatus.loading);
|
||||
SmartDialog.dismiss(status: SmartStatus.loading);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,14 +158,12 @@ abstract final class ImageUtils {
|
||||
return false;
|
||||
}
|
||||
CancelToken? cancelToken;
|
||||
if (!silentDownImg) {
|
||||
cancelToken = CancelToken();
|
||||
SmartDialog.showLoading(
|
||||
msg: '正在下载原图',
|
||||
clickMaskDismiss: true,
|
||||
onDismiss: cancelToken.cancel,
|
||||
);
|
||||
}
|
||||
cancelToken = CancelToken();
|
||||
SmartDialog.showLoading(
|
||||
msg: '正在下载原图',
|
||||
clickMaskDismiss: true,
|
||||
onDismiss: cancelToken.cancel,
|
||||
);
|
||||
try {
|
||||
final futures = imgList.map((url) async {
|
||||
final name = Utils.getFileName(url);
|
||||
@@ -234,7 +230,7 @@ abstract final class ImageUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cancelToken?.isCancelled == true) {
|
||||
if (cancelToken.isCancelled) {
|
||||
SmartDialog.showToast('已取消下载');
|
||||
return false;
|
||||
} else {
|
||||
@@ -242,14 +238,14 @@ abstract final class ImageUtils {
|
||||
}
|
||||
return success;
|
||||
} catch (e) {
|
||||
if (cancelToken?.isCancelled == true) {
|
||||
if (cancelToken.isCancelled) {
|
||||
SmartDialog.showToast('已取消下载');
|
||||
} else {
|
||||
SmartDialog.showToast(e.toString());
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
if (!silentDownImg) SmartDialog.dismiss(status: SmartStatus.loading);
|
||||
SmartDialog.dismiss(status: SmartStatus.loading);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
abstract final class MaxScreenSize {
|
||||
static int? _maxWidth;
|
||||
static int? _maxHeight;
|
||||
|
||||
static Future<void> init() {
|
||||
return _initScreenSize();
|
||||
}
|
||||
|
||||
static Future<void> _initScreenSize() async {
|
||||
final res = await Utils.channel.invokeMethod('maxScreenSize');
|
||||
_handleRes(res);
|
||||
}
|
||||
|
||||
static void _handleRes(dynamic res) {
|
||||
if (res is Map) {
|
||||
_maxWidth = res['maxWidth'];
|
||||
_maxHeight = res['maxHeight'];
|
||||
}
|
||||
}
|
||||
|
||||
static bool isWindowMode({required num width, required num height}) {
|
||||
if (!Platform.isAndroid) return false;
|
||||
width = width.round();
|
||||
height = height.round();
|
||||
final hasWidthMatch = width == _maxWidth || width == _maxHeight;
|
||||
final hasHeightMatch = height == _maxWidth || height == _maxHeight;
|
||||
return !(hasWidthMatch && hasHeightMatch);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
||||
import 'package:PiliPlus/pages/contact/view.dart';
|
||||
import 'package:PiliPlus/pages/fav_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/share/view.dart';
|
||||
import 'package:PiliPlus/pages/webview/view.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/extension.dart';
|
||||
@@ -26,7 +27,6 @@ import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
@@ -180,10 +180,7 @@ abstract final class PageUtils {
|
||||
}
|
||||
|
||||
static void reportVideo(int aid) {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {'url': 'https://www.bilibili.com/appeal/?avid=$aid'},
|
||||
);
|
||||
WebViewPage.toWebView('https://www.bilibili.com/appeal/?avid=$aid');
|
||||
}
|
||||
|
||||
static void enterPip({int? width, int? height, bool isAuto = false}) {
|
||||
@@ -366,7 +363,7 @@ abstract final class PageUtils {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
handleWebview(url.http2https);
|
||||
PiliScheme.routePushFromUrl(url.http2https);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,29 +408,6 @@ abstract final class PageUtils {
|
||||
);
|
||||
}
|
||||
|
||||
static void inAppWebview(
|
||||
String url, {
|
||||
bool off = false,
|
||||
}) {
|
||||
if (Pref.openInBrowser) {
|
||||
launchURL(url);
|
||||
} else {
|
||||
if (off) {
|
||||
Get.offNamed(
|
||||
'/webview',
|
||||
parameters: {'url': url},
|
||||
arguments: {'inApp': true},
|
||||
);
|
||||
} else {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {'url': url},
|
||||
arguments: {'inApp': true},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> launchURL(
|
||||
String url, {
|
||||
LaunchMode mode = LaunchMode.externalApplication,
|
||||
@@ -448,31 +422,6 @@ abstract final class PageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> handleWebview(
|
||||
String url, {
|
||||
bool off = false,
|
||||
bool inApp = false,
|
||||
Map? parameters,
|
||||
}) async {
|
||||
if (!inApp && Pref.openInBrowser) {
|
||||
if (!await PiliScheme.routePushFromUrl(url, selfHandle: true)) {
|
||||
launchURL(url);
|
||||
}
|
||||
} else {
|
||||
if (off) {
|
||||
Get.offNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': url,
|
||||
...?parameters,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
PiliScheme.routePushFromUrl(url, parameters: parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void>? showVideoBottomSheet(
|
||||
BuildContext context, {
|
||||
required Widget child,
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
|
||||
abstract final class RecommendFilter {
|
||||
static int minDurationForRcmd = Pref.minDurationForRcmd;
|
||||
static int minPlayForRcmd = Pref.minPlayForRcmd;
|
||||
static int minLikeRatioForRecommend = Pref.minLikeRatioForRecommend;
|
||||
static bool exemptFilterForFollowed = Pref.exemptFilterForFollowed;
|
||||
static bool applyFilterToRelatedVideos = Pref.applyFilterToRelatedVideos;
|
||||
static RegExp rcmdRegExp = RegExp(
|
||||
Pref.banWordForRecommend,
|
||||
caseSensitive: false,
|
||||
);
|
||||
static bool enableFilter = rcmdRegExp.pattern.isNotEmpty;
|
||||
|
||||
static bool filter(BaseVideoItemModel videoItem) {
|
||||
//由于相关视频中没有已关注标签,只能视为非关注视频
|
||||
if (videoItem.isFollowed && exemptFilterForFollowed) {
|
||||
return false;
|
||||
}
|
||||
return filterAll(videoItem);
|
||||
}
|
||||
|
||||
static bool filterLikeRatio(int? like, int? view) {
|
||||
if (view != null) {
|
||||
return (view > -1 && view < minPlayForRcmd) ||
|
||||
(like != null &&
|
||||
like > -1 &&
|
||||
like * 100 < minLikeRatioForRecommend * view);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool filterTitle(String title) {
|
||||
return (enableFilter && rcmdRegExp.hasMatch(title));
|
||||
}
|
||||
|
||||
static bool filterAll(BaseVideoItemModel videoItem) {
|
||||
return (videoItem.duration > 0 &&
|
||||
videoItem.duration < minDurationForRcmd) ||
|
||||
filterLikeRatio(videoItem.stat.like, videoItem.stat.view) ||
|
||||
filterTitle(videoItem.title);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,14 @@
|
||||
import 'dart:convert' show jsonEncode;
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
show ReplyInfo;
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/reply.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/pages/webview/view.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/theme_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -21,8 +16,6 @@ import 'package:get/get.dart';
|
||||
abstract final class ReplyUtils {
|
||||
static void onCheckReply({
|
||||
required ReplyInfo replyInfo,
|
||||
required bool biliSendCommAntifraud,
|
||||
required sourceId,
|
||||
required bool isManual,
|
||||
}) {
|
||||
try {
|
||||
@@ -41,8 +34,6 @@ abstract final class ReplyUtils {
|
||||
mid: replyInfo.mid.toInt(),
|
||||
//
|
||||
isManual: isManual,
|
||||
biliSendCommAntifraud: biliSendCommAntifraud,
|
||||
sourceId: sourceId,
|
||||
);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
@@ -61,40 +52,7 @@ abstract final class ReplyUtils {
|
||||
List? pictures,
|
||||
dynamic mid,
|
||||
bool isManual = false,
|
||||
required bool biliSendCommAntifraud,
|
||||
required sourceId,
|
||||
}) async {
|
||||
// biliSendCommAntifraud
|
||||
if (Platform.isAndroid && biliSendCommAntifraud) {
|
||||
try {
|
||||
final String cookieString = Accounts.main.cookieJar
|
||||
.toJson()
|
||||
.entries
|
||||
.map((i) => '${i.key}=${i.value}')
|
||||
.join(';');
|
||||
Utils.channel.invokeMethod(
|
||||
'biliSendCommAntifraud',
|
||||
{
|
||||
'action': 0,
|
||||
'oid': oid,
|
||||
'type': type,
|
||||
'rpid': id,
|
||||
'root': root,
|
||||
'parent': parent,
|
||||
'ctime': ctime,
|
||||
'comment_text': message,
|
||||
if (pictures?.isNotEmpty == true) 'pictures': jsonEncode(pictures),
|
||||
'source_id': '$sourceId',
|
||||
'uid': mid,
|
||||
'cookies': [cookieString],
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('biliSendCommAntifraud: $e');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// CommAntifraud
|
||||
if (!isManual) {
|
||||
await Future.delayed(const Duration(seconds: 8));
|
||||
@@ -116,12 +74,8 @@ abstract final class ReplyUtils {
|
||||
if (uri != null) {
|
||||
Utils.copyText(uri);
|
||||
}
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url':
|
||||
'https://www.bilibili.com/h5/comment/appeal?${ThemeUtils.themeUrl(theme.isDark)}',
|
||||
},
|
||||
WebViewPage.toWebView(
|
||||
'https://www.bilibili.com/h5/comment/appeal?${ThemeUtils.themeUrl(theme.isDark)}',
|
||||
);
|
||||
},
|
||||
child: const Text('申诉'),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||
@@ -26,6 +25,7 @@ import 'package:PiliPlus/pages/fav_detail/controller.dart'
|
||||
show BaseFavController;
|
||||
import 'package:PiliPlus/pages/group_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/login/geetest/geetest_webview_dialog.dart';
|
||||
import 'package:PiliPlus/pages/webview/view.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/size_ext.dart';
|
||||
@@ -34,7 +34,6 @@ import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/theme_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
@@ -42,7 +41,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show LengthLimitingTextInputFormatter;
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gt3_flutter_plugin/gt3_flutter_plugin.dart';
|
||||
|
||||
abstract final class RequestUtils {
|
||||
static Future<void> syncHistoryStatus() async {
|
||||
@@ -333,58 +331,52 @@ abstract final class RequestUtils {
|
||||
String? dynText,
|
||||
bool isManual = false,
|
||||
}) async {
|
||||
if (isManual || Pref.enableCreateDynAntifraud) {
|
||||
try {
|
||||
if (id != null) {
|
||||
if (!isManual) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
}
|
||||
final res = await DynamicsHttp.dynamicDetail(
|
||||
id: id,
|
||||
clearCookie: true,
|
||||
);
|
||||
final isSuccess = res.isSuccess;
|
||||
final theme = ThemeUtils.theme;
|
||||
final actions = [
|
||||
if (!isSuccess)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Utils.copyText('https://www.bilibili.com/opus/$id');
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url':
|
||||
'https://www.bilibili.com/h5/comment/appeal?${ThemeUtils.themeUrl(theme.isDark)}',
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Text('申诉'),
|
||||
),
|
||||
if (!isManual)
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'关闭',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
),
|
||||
];
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
barrierDismissible: isManual,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('动态检查结果'),
|
||||
content: SelectableText(
|
||||
'${isSuccess ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'}${dynText != null ? ' \n\n动态内容: $dynText' : ''}',
|
||||
),
|
||||
actions: actions.isEmpty ? null : actions,
|
||||
),
|
||||
);
|
||||
try {
|
||||
if (id != null) {
|
||||
if (!isManual) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
}
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('check dyn error: $e');
|
||||
final res = await DynamicsHttp.dynamicDetail(
|
||||
id: id,
|
||||
clearCookie: true,
|
||||
);
|
||||
final isSuccess = res.isSuccess;
|
||||
final theme = ThemeUtils.theme;
|
||||
final actions = [
|
||||
if (!isSuccess)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Utils.copyText('https://www.bilibili.com/opus/$id');
|
||||
WebViewPage.toWebView(
|
||||
'https://www.bilibili.com/h5/comment/appeal?${ThemeUtils.themeUrl(theme.isDark)}',
|
||||
);
|
||||
},
|
||||
child: const Text('申诉'),
|
||||
),
|
||||
if (!isManual)
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'关闭',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
),
|
||||
];
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
barrierDismissible: isManual,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('动态检查结果'),
|
||||
content: SelectableText(
|
||||
'${isSuccess ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'}${dynText != null ? ' \n\n动态内容: $dynText' : ''}',
|
||||
),
|
||||
actions: actions.isEmpty ? null : actions,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('check dyn error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,118 +562,20 @@ abstract final class RequestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (PlatformUtils.isDesktop) {
|
||||
final json = await showDialog<Map<String, dynamic>>(
|
||||
context: Get.context!,
|
||||
builder: (context) => GeetestWebviewDialog(gt!, challenge!),
|
||||
);
|
||||
if (json != null) {
|
||||
captchaData
|
||||
..validate = json['geetest_validate']
|
||||
..seccode = json['geetest_seccode']
|
||||
..geetest = GeetestData(
|
||||
challenge: json['geetest_challenge'],
|
||||
gt: gt!,
|
||||
);
|
||||
gaiaVgateValidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final registerData = Gt3RegisterData(
|
||||
challenge: challenge,
|
||||
gt: gt,
|
||||
success: true,
|
||||
final json = await showDialog<Map<String, dynamic>>(
|
||||
context: Get.context!,
|
||||
builder: (context) => GeetestWebviewDialog(gt!, challenge!),
|
||||
);
|
||||
|
||||
Gt3FlutterPlugin()
|
||||
..addEventHandler(
|
||||
onClose: (Map<String, dynamic> message) {
|
||||
SmartDialog.showToast('关闭验证');
|
||||
},
|
||||
onResult: (Map<String, dynamic> message) {
|
||||
if (kDebugMode) debugPrint("Captcha result: $message");
|
||||
String code = message["code"];
|
||||
if (code == "1") {
|
||||
// 发送 message["result"] 中的数据向 B 端的业务服务接口进行查询
|
||||
SmartDialog.showToast('验证成功');
|
||||
final result = message['result'];
|
||||
captchaData
|
||||
..validate = result?['geetest_validate']
|
||||
..seccode = result?['geetest_seccode']
|
||||
..geetest = GeetestData(
|
||||
challenge: result?['geetest_challenge'],
|
||||
gt: gt!,
|
||||
);
|
||||
gaiaVgateValidate();
|
||||
} else {
|
||||
// 终端用户完成验证失败,自动重试 If the verification fails, it will be automatically retried.
|
||||
if (kDebugMode) debugPrint("Captcha result code : $code");
|
||||
}
|
||||
},
|
||||
onError: (Map<String, dynamic> message) {
|
||||
SmartDialog.showToast("Captcha onError: $message");
|
||||
String code = message["code"];
|
||||
// 处理验证中返回的错误 Handling errors returned in verification
|
||||
if (Platform.isAndroid) {
|
||||
// Android 平台
|
||||
if (code == "-2") {
|
||||
// Dart 调用异常 Call exception
|
||||
} else if (code == "-1") {
|
||||
// Gt3RegisterData 参数不合法 Parameter is invalid
|
||||
} else if (code == "201") {
|
||||
// 网络无法访问 Network inaccessible
|
||||
} else if (code == "202") {
|
||||
// Json 解析错误 Analysis error
|
||||
} else if (code == "204") {
|
||||
// WebView 加载超时,请检查是否混淆极验 SDK Load timed out
|
||||
} else if (code == "204_1") {
|
||||
// WebView 加载前端页面错误,请查看日志 Error loading front-end page, please check the log
|
||||
} else if (code == "204_2") {
|
||||
// WebView 加载 SSLError
|
||||
} else if (code == "206") {
|
||||
// gettype 接口错误或返回为 null API error or return null
|
||||
} else if (code == "207") {
|
||||
// getphp 接口错误或返回为 null API error or return null
|
||||
} else if (code == "208") {
|
||||
// ajax 接口错误或返回为 null API error or return null
|
||||
} else {
|
||||
// 更多错误码参考开发文档 More error codes refer to the development document
|
||||
// https://docs.geetest.com/sensebot/apirefer/errorcode/android
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isIOS) {
|
||||
// iOS 平台
|
||||
if (code == "-1009") {
|
||||
// 网络无法访问 Network inaccessible
|
||||
} else if (code == "-1004") {
|
||||
// 无法查找到 HOST Unable to find HOST
|
||||
} else if (code == "-1002") {
|
||||
// 非法的 URL Illegal URL
|
||||
} else if (code == "-1001") {
|
||||
// 网络超时 Network timeout
|
||||
} else if (code == "-999") {
|
||||
// 请求被意外中断, 一般由用户进行取消操作导致 The interrupted request was usually caused by the user cancelling the operation
|
||||
} else if (code == "-21") {
|
||||
// 使用了重复的 challenge Duplicate challenges are used
|
||||
// 检查获取 challenge 是否进行了缓存 Check if the fetch challenge is cached
|
||||
} else if (code == "-20") {
|
||||
// 尝试过多, 重新引导用户触发验证即可 Try too many times, lead the user to request verification again
|
||||
} else if (code == "-10") {
|
||||
// 预判断时被封禁, 不会再进行图形验证 Banned during pre-judgment, and no more image captcha verification
|
||||
} else if (code == "-2") {
|
||||
// Dart 调用异常 Call exception
|
||||
} else if (code == "-1") {
|
||||
// Gt3RegisterData 参数不合法 Parameter is invalid
|
||||
} else {
|
||||
// 更多错误码参考开发文档 More error codes refer to the development document
|
||||
// https://docs.geetest.com/sensebot/apirefer/errorcode/ios
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
..startCaptcha(registerData);
|
||||
if (json != null) {
|
||||
captchaData
|
||||
..validate = json['geetest_validate']
|
||||
..seccode = json['geetest_seccode']
|
||||
..geetest = GeetestData(
|
||||
challenge: json['geetest_challenge'],
|
||||
gt: gt!,
|
||||
);
|
||||
gaiaVgateValidate();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> showUserRealName(String mid) async {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models/user/danmaku_rule_adapter.dart';
|
||||
@@ -10,7 +9,6 @@ import 'package:PiliPlus/utils/accounts/account_type_adapter.dart';
|
||||
import 'package:PiliPlus/utils/accounts/cookie_jar_adapter.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/set_int_adapter.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:hive_ce/hive.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
@@ -22,7 +20,6 @@ abstract final class GStorage {
|
||||
static late final Box<dynamic> setting;
|
||||
static late final Box<dynamic> video;
|
||||
static late final Box<int> watchProgress;
|
||||
static late final Box<Uint8List>? reply;
|
||||
|
||||
static Future<void> init() async {
|
||||
Hive.init(path.join(appSupportDirPath, 'hive'));
|
||||
@@ -63,18 +60,6 @@ abstract final class GStorage {
|
||||
},
|
||||
).then((res) => watchProgress = res),
|
||||
]);
|
||||
|
||||
if (Pref.saveReply) {
|
||||
reply = await Hive.openBox<Uint8List>(
|
||||
'reply',
|
||||
keyComparator: _intStrDescKeyComparator,
|
||||
compactionStrategy: (entries, deletedEntries) {
|
||||
return deletedEntries > 10;
|
||||
},
|
||||
);
|
||||
} else {
|
||||
reply = null;
|
||||
}
|
||||
}
|
||||
|
||||
static String exportAllSettings() {
|
||||
@@ -117,7 +102,6 @@ abstract final class GStorage {
|
||||
video.compact(),
|
||||
Accounts.account.compact(),
|
||||
watchProgress.compact(),
|
||||
?reply?.compact(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -130,7 +114,6 @@ abstract final class GStorage {
|
||||
video.close(),
|
||||
Accounts.account.close(),
|
||||
watchProgress.close(),
|
||||
?reply?.close(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -143,7 +126,6 @@ abstract final class GStorage {
|
||||
video.clear(),
|
||||
Accounts.clear(),
|
||||
watchProgress.clear(),
|
||||
?reply?.clear(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,158 +1,65 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
abstract final class SettingBoxKey {
|
||||
static const String btmProgressBehavior = 'btmProgressBehavior',
|
||||
defaultVideoQa = 'defaultVideoQa',
|
||||
static const String defaultVideoQa = 'defaultVideoQa',
|
||||
defaultVideoQaCellular = 'defaultVideoQaCellular',
|
||||
defaultAudioQa = 'defaultAudioQa',
|
||||
defaultAudioQaCellular = 'defaultAudioQaCellular',
|
||||
autoPlayEnable = 'autoPlayEnable',
|
||||
fullScreenMode = 'fullScreenMode',
|
||||
defaultDecode = 'defaultDecode',
|
||||
secondDecode = 'secondDecode',
|
||||
defaultPicQa = 'defaultPicQa',
|
||||
enableHA = 'enableHA',
|
||||
audioOutput = 'audioOutput',
|
||||
expandBuffer = 'expandBuffer',
|
||||
hardwareDecoding = 'hardwareDecoding',
|
||||
videoSync = 'videoSync',
|
||||
autosync = 'autosync',
|
||||
p1080 = 'p1080',
|
||||
enableAutoEnter = 'enableAutoEnter',
|
||||
enableAutoExit = 'enableAutoExit',
|
||||
enableOnlineTotal = 'enableOnlineTotal',
|
||||
superChatType = 'superChatType',
|
||||
fullScreenSCWidth = 'fullScreenSCWidth',
|
||||
keyboardControl = 'keyboardControl',
|
||||
pauseOnMinimize = 'pauseOnMinimize',
|
||||
pgcSkipType = 'pgcSkipType',
|
||||
audioPlayMode = 'audioPlayMode',
|
||||
showBatteryLevel = 'showBatteryLevel';
|
||||
|
||||
static const String enableVerticalExpand = 'enableVerticalExpand',
|
||||
horizontalScreen = 'horizontalScreen',
|
||||
static const String horizontalScreen = 'horizontalScreen',
|
||||
CDNService = 'CDNService',
|
||||
disableAudioCDN = 'disableAudioCDN',
|
||||
autoPiP = 'autoPiP',
|
||||
enableAutoLongPressSpeed = 'enableAutoLongPressSpeed',
|
||||
useRelativeSlide = 'useRelativeSlide',
|
||||
sliderDuration = 'sliderOffset',
|
||||
enableQuickDouble = 'enableQuickDouble',
|
||||
fullScreenGestureReverse = 'fullScreenGestureReverse',
|
||||
enableBackgroundPlay = 'enableBackgroundPlay',
|
||||
continuePlayInBackground = 'continuePlayInBackground',
|
||||
appRcmd = 'appRcmd',
|
||||
enableSaveLastData = 'enableSaveLastData',
|
||||
minDurationForRcmd = 'minDurationForRcmd',
|
||||
minPlayForRcmd = 'minPlayForRcmd',
|
||||
minLikeRatioForRecommend = 'minLikeRatioForRecommend',
|
||||
exemptFilterForFollowed = 'exemptFilterForFollowed',
|
||||
banWordForRecommend = 'banWordForRecommend',
|
||||
applyFilterToRelatedVideos = 'applyFilterToRelatedVideos',
|
||||
autoClearCache = 'autoClearCache',
|
||||
maxCacheSize = 'maxCacheSize',
|
||||
defaultShowComment = 'defaultShowComment',
|
||||
replySortType = 'replySortType',
|
||||
defaultDynamicType = 'defaultDynamicType',
|
||||
showDynInteraction = 'showDynInteraction',
|
||||
enableHotKey = 'enableHotKey',
|
||||
enableSearchRcmd = 'enableSearchRcmd',
|
||||
enableQuickFav = 'enableQuickFav',
|
||||
enableSystemProxy = 'enableSystemProxy',
|
||||
enableAi = 'enableAi',
|
||||
defaultHomePage = 'defaultHomePage',
|
||||
previewQuality = 'previewQuality',
|
||||
checkDynamic = 'checkDynamic',
|
||||
dynamicPeriod = 'dynamicPeriod',
|
||||
schemeVariant = 'schemeVariant',
|
||||
showViewPoints = 'showViewPoints',
|
||||
showRelatedVideo = 'showRelatedVideo',
|
||||
showVideoReply = 'showVideoReply',
|
||||
showBangumiReply = 'showBangumiReply',
|
||||
alwaysExpandIntroPanel = 'alwaysExapndIntroPanel',
|
||||
expandIntroPanelH = 'exapndIntroPanelH',
|
||||
horizontalSeasonPanel = 'horizontalSeasonPanel',
|
||||
horizontalMemberPage = 'horizontalMemberPage',
|
||||
showArgueMsg = 'showArgueMsg',
|
||||
reverseFromFirst = 'reverseFromFirst',
|
||||
badCertificateCallback = 'badCertificateCallback',
|
||||
continuePlayingPart = 'continuePlayingPart',
|
||||
cdnSpeedTest = 'cdnSpeedTest',
|
||||
horizontalPreview = 'horizontalPreview',
|
||||
banWordForReply = 'banWordForReply',
|
||||
banWordForZone = 'banWordForZone',
|
||||
savedRcmdTip = 'savedRcmdTip',
|
||||
openInBrowser = 'openInBrowser',
|
||||
refreshDragPercentage = 'refreshDragPercentage',
|
||||
refreshDisplacement = 'refreshDisplacement',
|
||||
showHotRcmd = 'showHotRcmd',
|
||||
audioNormalization = 'audioNormalization',
|
||||
fallbackNormalization = 'fallbackNormalization',
|
||||
superResolutionType = 'superResolutionType',
|
||||
preInitPlayer = 'preInitPlayer',
|
||||
searchSuggestion = 'searchSuggestion',
|
||||
showDecorate = 'showDynDecorate',
|
||||
showMedal = 'showMedal',
|
||||
enableLivePhoto = 'enableLivePhoto',
|
||||
showSeekPreview = 'showSeekPreview',
|
||||
showDmChart = 'showDmChart',
|
||||
enableCommAntifraud = 'enableCommAntifraud',
|
||||
biliSendCommAntifraud = 'biliSendCommAntifraud',
|
||||
enableCreateDynAntifraud = 'enableCreateDynAntifraud',
|
||||
coinWithLike = 'coinWithLike',
|
||||
isPureBlackTheme = 'isPureBlackTheme',
|
||||
antiGoodsDyn = 'antiGoodsDyn',
|
||||
antiGoodsReply = 'antiGoodsReply',
|
||||
expandDynLivePanel = 'expandDynLivePanel',
|
||||
springDescription = 'springDescription',
|
||||
enableHttp2 = 'enableHttp2',
|
||||
slideDismissReplyPage = 'slideDismissReplyPage',
|
||||
showFSActionItem = 'showFSActionItem',
|
||||
showDynActionBar = 'showDynActionBar',
|
||||
darkVideoPage = 'darkVideoPage',
|
||||
enableSlideVolumeBrightness = 'enableSlideVolumeBrightness',
|
||||
enableSlideFS = 'enableSlideFS',
|
||||
retryCount = 'retryCount',
|
||||
retryDelay = 'retryDelay',
|
||||
liveQuality = 'liveQuality',
|
||||
liveQualityCellular = 'liveQualityCellular',
|
||||
fastForBackwardDuration = 'fastForBackwardDuration',
|
||||
recordSearchHistory = 'recordSearchHistory',
|
||||
showPgcTimeline = 'showPgcTimeline',
|
||||
pageTransition = 'pageTransition',
|
||||
banWordForDyn = 'banWordForDyn',
|
||||
enableLog = 'enableLog',
|
||||
memberTab = 'memberTab',
|
||||
dynamicDetailRatio = 'dynamicDetailRatio',
|
||||
directExitOnBack = 'directExitOnBack',
|
||||
quickFavId = 'quickFavId',
|
||||
showFsScreenshotBtn = 'showFsScreenshotBtn',
|
||||
showFsLockBtn = 'showFsLockBtn',
|
||||
silentDownImg = 'silentDownImg',
|
||||
showMemberShop = 'showMemberShop',
|
||||
enablePlayAll = 'enablePlayAll',
|
||||
enableTapDm = 'enableTapDm',
|
||||
setSystemBrightness = 'setSystemBrightness',
|
||||
downloadPath = 'downloadPath',
|
||||
followOrderType = 'followOrderType',
|
||||
enableImgMenu = 'enableImgMenu',
|
||||
showDynDispute = 'showDynDispute',
|
||||
touchSlopH = 'touchSlopH',
|
||||
floatingNavBar = 'floatingNavBar',
|
||||
removeSafeArea = 'removeSafeArea';
|
||||
floatingNavBar = 'floatingNavBar';
|
||||
|
||||
static const String minimizeOnExit = 'minimizeOnExit',
|
||||
windowSize = 'windowSize',
|
||||
static const String windowSize = 'windowSize',
|
||||
windowPosition = 'windowPosition',
|
||||
isWindowMaximized = 'isWindowMaximized',
|
||||
showWindowTitleBar = 'showWindowTitleBar',
|
||||
desktopVolume = 'desktopVolume',
|
||||
showTrayIcon = 'showTrayIcon',
|
||||
uiScale = 'uiScale';
|
||||
desktopVolume = 'desktopVolume';
|
||||
|
||||
static const String subtitlePreferenceV2 = 'subtitlePreferenceV2',
|
||||
enableDragSubtitle = 'enableDragSubtitle',
|
||||
subtitlePaddingH = 'subtitlePaddingH',
|
||||
static const String subtitlePaddingH = 'subtitlePaddingH',
|
||||
subtitlePaddingB = 'subtitlePaddingB',
|
||||
subtitleBgOpacity = 'subtitleBgOpaticy',
|
||||
subtitleStrokeWidth = 'subtitleStrokeWidth',
|
||||
@@ -160,25 +67,15 @@ abstract final class SettingBoxKey {
|
||||
subtitleFontScaleFS = 'subtitleFontScaleFS',
|
||||
subtitleFontWeight = 'subtitleFontWeight';
|
||||
|
||||
static const String webdavUri = 'webdavUri',
|
||||
webdavUsername = 'webdavUsername',
|
||||
webdavPassword = 'webdavPassword',
|
||||
webdavDirectory = 'webdavDirectory';
|
||||
|
||||
static const String enableSponsorBlock = 'enableSponsorBlock',
|
||||
blockSettings = 'blockSettings',
|
||||
blockLimit = 'blockLimit',
|
||||
blockColor = 'blockColor',
|
||||
blockUserID = 'blockUserID',
|
||||
blockToast = 'blockToast',
|
||||
blockServer = 'blockServer',
|
||||
blockTrack = 'blockTrack';
|
||||
blockServer = 'blockServer';
|
||||
|
||||
static const String enableShowDanmaku = 'enableShowDanmaku',
|
||||
enableShowLiveDanmaku = 'enableShowLiveDanmaku',
|
||||
pipNoDanmaku = 'pipNoDanmaku',
|
||||
showVipDanmaku = 'showVipDanmaku',
|
||||
mergeDanmaku = 'mergeDanmaku',
|
||||
danmakuWeight = 'danmakuWeight',
|
||||
danmakuBlockType = 'danmakuBlockType',
|
||||
danmakuShowArea = 'danmakuShowArea',
|
||||
@@ -194,29 +91,17 @@ abstract final class SettingBoxKey {
|
||||
danmakuStrokeWidth = 'strokeWidth',
|
||||
danmakuFontWeight = 'fontWeight';
|
||||
|
||||
static const String systemProxyHost = 'systemProxyHost',
|
||||
systemProxyPort = 'systemProxyPort';
|
||||
|
||||
static const String themeMode = 'themeMode',
|
||||
defaultTextScale = 'textScale',
|
||||
dynamicColor = 'dynamicColor',
|
||||
customColor = 'customColor',
|
||||
smallCardWidth = 'smallCardWidth',
|
||||
recommendCardWidth = 'recommendCardWidth',
|
||||
dynamicsWaterfallFlow = 'dynamicsWaterfallFlow',
|
||||
upPanelPosition = 'upPanelPosition',
|
||||
dynamicsShowAllFollowedUp = 'dynamicsShowAllFollowedUp',
|
||||
hideTopBar = 'hideSearchBar',
|
||||
hideBottomBar = 'hideTabBar',
|
||||
barHideType = 'barHideType',
|
||||
tabBarSort = 'tabBarSort',
|
||||
dynamicBadgeMode = 'dynamicBadgeMode',
|
||||
msgBadgeMode = 'msgBadgeMode',
|
||||
msgUnReadTypeV2 = 'msgUnReadTypeV2',
|
||||
navBarSort = 'navBarSort',
|
||||
tempPlayerConf = 'tempPlayerConf',
|
||||
liveCdnUrl = 'liveCdnUrl',
|
||||
saveReply = 'saveReply';
|
||||
liveCdnUrl = 'liveCdnUrl';
|
||||
}
|
||||
|
||||
abstract final class LocalCacheKey {
|
||||
|
||||
@@ -3,33 +3,21 @@ import 'dart:math' show pow, sqrt;
|
||||
|
||||
import 'package:PiliPlus/common/widgets/pair.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/models/common/bar_hide_type.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/common/follow_order_type.dart';
|
||||
import 'package:PiliPlus/models/common/member/tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/msg/msg_unread_type.dart';
|
||||
import 'package:PiliPlus/models/common/nav_bar_config.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/skip_type.dart';
|
||||
import 'package:PiliPlus/models/common/super_chat_type.dart';
|
||||
import 'package:PiliPlus/models/common/super_resolution_type.dart';
|
||||
import 'package:PiliPlus/models/common/theme/theme_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/audio_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/cdn_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/live_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/subtitle_pref_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/models/user/danmaku_rule.dart';
|
||||
import 'package:PiliPlus/models/user/info.dart';
|
||||
import 'package:PiliPlus/pages/setting/pages/fullscreen_sc_size.dart'
|
||||
show kFullScreenSCWidth;
|
||||
import 'package:PiliPlus/plugin/pl_player/models/audio_output_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/hwdec_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/utils/device_utils.dart';
|
||||
@@ -43,7 +31,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flex_seed_scheme/flex_seed_scheme.dart' show FlexSchemeVariant;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_navigation/src/routes/transitions_type.dart';
|
||||
import 'package:hive_ce/hive.dart';
|
||||
|
||||
abstract final class Pref {
|
||||
@@ -82,12 +70,6 @@ abstract final class Pref {
|
||||
GlobalData().blackMids..remove(mid),
|
||||
);
|
||||
|
||||
static MemberTabType get memberTab =>
|
||||
MemberTabType.values[_setting.get(
|
||||
SettingBoxKey.memberTab,
|
||||
defaultValue: 0,
|
||||
)];
|
||||
|
||||
static int get _themeTypeInt => _setting.get(
|
||||
SettingBoxKey.themeMode,
|
||||
defaultValue: ThemeType.system.index,
|
||||
@@ -165,14 +147,6 @@ abstract final class Pref {
|
||||
.toSet() ??
|
||||
MsgUnReadType.values.toSet();
|
||||
|
||||
static NavigationBarType get defaultHomePage =>
|
||||
NavigationBarType.values[defaultHomePageIndex];
|
||||
|
||||
static int get defaultHomePageIndex => _setting.get(
|
||||
SettingBoxKey.defaultHomePage,
|
||||
defaultValue: NavigationBarType.home.index,
|
||||
);
|
||||
|
||||
static int get previewQ =>
|
||||
_setting.get(SettingBoxKey.previewQuality, defaultValue: 100);
|
||||
|
||||
@@ -188,33 +162,6 @@ abstract final class Pref {
|
||||
defaultValue: UpPanelPosition.leftFixed.index,
|
||||
)];
|
||||
|
||||
static FullScreenMode get fullScreenMode {
|
||||
int? index = _setting.get(SettingBoxKey.fullScreenMode);
|
||||
if (index == null) {
|
||||
final FullScreenMode mode = horizontalScreen && DeviceUtils.isTablet
|
||||
? .none
|
||||
: .auto;
|
||||
_setting.put(SettingBoxKey.fullScreenMode, mode.index);
|
||||
return mode;
|
||||
}
|
||||
return FullScreenMode.values[index];
|
||||
}
|
||||
|
||||
static BtmProgressBehavior get btmProgressBehavior =>
|
||||
BtmProgressBehavior.values[_setting.get(
|
||||
SettingBoxKey.btmProgressBehavior,
|
||||
defaultValue: BtmProgressBehavior.alwaysShow.index,
|
||||
)];
|
||||
|
||||
static SubtitlePrefType get subtitlePreferenceV2 =>
|
||||
SubtitlePrefType.values[_setting.get(
|
||||
SettingBoxKey.subtitlePreferenceV2,
|
||||
defaultValue: SubtitlePrefType.off.index,
|
||||
)];
|
||||
|
||||
static bool get useRelativeSlide =>
|
||||
_setting.get(SettingBoxKey.useRelativeSlide, defaultValue: false);
|
||||
|
||||
static int get sliderDuration =>
|
||||
_setting.get(SettingBoxKey.sliderDuration, defaultValue: 90);
|
||||
|
||||
@@ -258,11 +205,6 @@ abstract final class Pref {
|
||||
static String get videoSync =>
|
||||
_setting.get(SettingBoxKey.videoSync, defaultValue: 'display-resample');
|
||||
|
||||
static String get autosync => _setting.get(
|
||||
SettingBoxKey.autosync,
|
||||
defaultValue: Platform.isAndroid ? '30' : '0',
|
||||
);
|
||||
|
||||
static CDNService get defaultCDNService {
|
||||
if (_setting.get(SettingBoxKey.CDNService) case final String cdnName) {
|
||||
return CDNService.values.byName(cdnName);
|
||||
@@ -270,38 +212,6 @@ abstract final class Pref {
|
||||
return CDNService.backupUrl;
|
||||
}
|
||||
|
||||
static String get banWordForRecommend =>
|
||||
_setting.get(SettingBoxKey.banWordForRecommend, defaultValue: '');
|
||||
|
||||
static String get banWordForReply =>
|
||||
_setting.get(SettingBoxKey.banWordForReply, defaultValue: '');
|
||||
|
||||
static String get banWordForZone =>
|
||||
_setting.get(SettingBoxKey.banWordForZone, defaultValue: '');
|
||||
|
||||
static bool get appRcmd =>
|
||||
_setting.get(SettingBoxKey.appRcmd, defaultValue: true);
|
||||
|
||||
static String get systemProxyHost =>
|
||||
_setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
|
||||
|
||||
static String get systemProxyPort =>
|
||||
_setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
|
||||
|
||||
static DynamicsTabType get defaultDynamicType =>
|
||||
DynamicsTabType.values[defaultDynamicTypeIndex];
|
||||
|
||||
static int get defaultDynamicTypeIndex => _setting.get(
|
||||
SettingBoxKey.defaultDynamicType,
|
||||
defaultValue: DynamicsTabType.all.index,
|
||||
);
|
||||
|
||||
static bool get showDynInteraction =>
|
||||
_setting.get(SettingBoxKey.showDynInteraction, defaultValue: true);
|
||||
|
||||
static double get blockLimit =>
|
||||
_setting.get(SettingBoxKey.blockLimit, defaultValue: 0.0);
|
||||
|
||||
static double get refreshDragPercentage =>
|
||||
_setting.get(SettingBoxKey.refreshDragPercentage, defaultValue: 0.25);
|
||||
|
||||
@@ -329,15 +239,6 @@ abstract final class Pref {
|
||||
defaultValue: HttpString.sponsorBlockBaseUrl,
|
||||
);
|
||||
|
||||
static bool get blockTrack =>
|
||||
_setting.get(SettingBoxKey.blockTrack, defaultValue: false);
|
||||
|
||||
static bool get checkDynamic =>
|
||||
_setting.get(SettingBoxKey.checkDynamic, defaultValue: true);
|
||||
|
||||
static int get dynamicPeriod =>
|
||||
_setting.get(SettingBoxKey.dynamicPeriod, defaultValue: 5);
|
||||
|
||||
static FlexSchemeVariant get schemeVariant =>
|
||||
FlexSchemeVariant.values[_setting.get(
|
||||
SettingBoxKey.schemeVariant,
|
||||
@@ -364,24 +265,6 @@ abstract final class Pref {
|
||||
static double get subtitleFontScaleFS =>
|
||||
_setting.get(SettingBoxKey.subtitleFontScaleFS, defaultValue: 1.5);
|
||||
|
||||
static bool get showViewPoints =>
|
||||
_setting.get(SettingBoxKey.showViewPoints, defaultValue: true);
|
||||
|
||||
static bool get showRelatedVideo =>
|
||||
_setting.get(SettingBoxKey.showRelatedVideo, defaultValue: true);
|
||||
|
||||
static bool get showVideoReply =>
|
||||
_setting.get(SettingBoxKey.showVideoReply, defaultValue: true);
|
||||
|
||||
static bool get showBangumiReply =>
|
||||
_setting.get(SettingBoxKey.showBangumiReply, defaultValue: true);
|
||||
|
||||
static bool get alwaysExpandIntroPanel =>
|
||||
_setting.get(SettingBoxKey.alwaysExpandIntroPanel, defaultValue: false);
|
||||
|
||||
static bool get expandIntroPanelH =>
|
||||
_setting.get(SettingBoxKey.expandIntroPanelH, defaultValue: false);
|
||||
|
||||
static bool get horizontalSeasonPanel => _setting.get(
|
||||
SettingBoxKey.horizontalSeasonPanel,
|
||||
defaultValue: horizontalScreen,
|
||||
@@ -398,12 +281,6 @@ abstract final class Pref {
|
||||
static double get danmakuLineHeight =>
|
||||
_setting.get(SettingBoxKey.danmakuLineHeight, defaultValue: 1.6);
|
||||
|
||||
static bool get showArgueMsg =>
|
||||
_setting.get(SettingBoxKey.showArgueMsg, defaultValue: true);
|
||||
|
||||
static bool get reverseFromFirst =>
|
||||
_setting.get(SettingBoxKey.reverseFromFirst, defaultValue: true);
|
||||
|
||||
static int get subtitlePaddingH =>
|
||||
_setting.get(SettingBoxKey.subtitlePaddingH, defaultValue: 24);
|
||||
|
||||
@@ -422,113 +299,20 @@ abstract final class Pref {
|
||||
static bool get badCertificateCallback =>
|
||||
_setting.get(SettingBoxKey.badCertificateCallback, defaultValue: false);
|
||||
|
||||
static bool get continuePlayingPart =>
|
||||
_setting.get(SettingBoxKey.continuePlayingPart, defaultValue: true);
|
||||
|
||||
static bool get cdnSpeedTest =>
|
||||
_setting.get(SettingBoxKey.cdnSpeedTest, defaultValue: true);
|
||||
|
||||
static bool get horizontalPreview =>
|
||||
_setting.get(SettingBoxKey.horizontalPreview, defaultValue: false);
|
||||
|
||||
static bool get openInBrowser =>
|
||||
_setting.get(SettingBoxKey.openInBrowser, defaultValue: false);
|
||||
|
||||
static bool get savedRcmdTip =>
|
||||
_setting.get(SettingBoxKey.savedRcmdTip, defaultValue: true);
|
||||
|
||||
static bool get showVipDanmaku =>
|
||||
_setting.get(SettingBoxKey.showVipDanmaku, defaultValue: true);
|
||||
|
||||
static bool get mergeDanmaku =>
|
||||
_setting.get(SettingBoxKey.mergeDanmaku, defaultValue: false);
|
||||
|
||||
static bool get showHotRcmd =>
|
||||
_setting.get(SettingBoxKey.showHotRcmd, defaultValue: false);
|
||||
|
||||
static String get audioNormalization =>
|
||||
_setting.get(SettingBoxKey.audioNormalization, defaultValue: '0');
|
||||
|
||||
static String get fallbackNormalization =>
|
||||
_setting.get(SettingBoxKey.fallbackNormalization, defaultValue: '0');
|
||||
|
||||
static SuperResolutionType get superResolutionType {
|
||||
SuperResolutionType? superResolutionType;
|
||||
final index = _setting.get(SettingBoxKey.superResolutionType);
|
||||
if (index != null) {
|
||||
superResolutionType = SuperResolutionType.values.elementAtOrNull(index);
|
||||
}
|
||||
return superResolutionType ?? SuperResolutionType.disable;
|
||||
}
|
||||
|
||||
static bool get preInitPlayer =>
|
||||
_setting.get(SettingBoxKey.preInitPlayer, defaultValue: false);
|
||||
|
||||
static bool get searchSuggestion =>
|
||||
_setting.get(SettingBoxKey.searchSuggestion, defaultValue: true);
|
||||
|
||||
static bool get showDecorate =>
|
||||
_setting.get(SettingBoxKey.showDecorate, defaultValue: true);
|
||||
|
||||
static bool get showMedal =>
|
||||
_setting.get(SettingBoxKey.showMedal, defaultValue: true);
|
||||
|
||||
static bool get enableLivePhoto =>
|
||||
_setting.get(SettingBoxKey.enableLivePhoto, defaultValue: true);
|
||||
|
||||
static bool get showSeekPreview =>
|
||||
_setting.get(SettingBoxKey.showSeekPreview, defaultValue: true);
|
||||
|
||||
static bool get showDmChart =>
|
||||
_setting.get(SettingBoxKey.showDmChart, defaultValue: false);
|
||||
|
||||
static bool get enableCommAntifraud =>
|
||||
_setting.get(SettingBoxKey.enableCommAntifraud, defaultValue: false);
|
||||
|
||||
static bool get biliSendCommAntifraud =>
|
||||
Platform.isAndroid &&
|
||||
_setting.get(SettingBoxKey.biliSendCommAntifraud, defaultValue: false);
|
||||
|
||||
static bool get enableCreateDynAntifraud =>
|
||||
_setting.get(SettingBoxKey.enableCreateDynAntifraud, defaultValue: false);
|
||||
|
||||
static bool get coinWithLike =>
|
||||
_setting.get(SettingBoxKey.coinWithLike, defaultValue: false);
|
||||
|
||||
static bool get isPureBlackTheme =>
|
||||
_setting.get(SettingBoxKey.isPureBlackTheme, defaultValue: false);
|
||||
|
||||
static bool get antiGoodsDyn =>
|
||||
_setting.get(SettingBoxKey.antiGoodsDyn, defaultValue: false);
|
||||
|
||||
static bool get antiGoodsReply =>
|
||||
_setting.get(SettingBoxKey.antiGoodsReply, defaultValue: false);
|
||||
|
||||
static bool get expandDynLivePanel =>
|
||||
_setting.get(SettingBoxKey.expandDynLivePanel, defaultValue: false);
|
||||
|
||||
static bool get slideDismissReplyPage => _setting.get(
|
||||
SettingBoxKey.slideDismissReplyPage,
|
||||
defaultValue: Platform.isIOS,
|
||||
);
|
||||
|
||||
static bool get showFSActionItem =>
|
||||
_setting.get(SettingBoxKey.showFSActionItem, defaultValue: true);
|
||||
|
||||
static bool get showDynActionBar =>
|
||||
_setting.get(SettingBoxKey.showDynActionBar, defaultValue: true);
|
||||
|
||||
static bool get darkVideoPage =>
|
||||
_setting.get(SettingBoxKey.darkVideoPage, defaultValue: false);
|
||||
|
||||
static bool get enableSlideVolumeBrightness => _setting.get(
|
||||
SettingBoxKey.enableSlideVolumeBrightness,
|
||||
defaultValue: true,
|
||||
);
|
||||
|
||||
static bool get enableSlideFS =>
|
||||
_setting.get(SettingBoxKey.enableSlideFS, defaultValue: true);
|
||||
|
||||
static int get retryCount =>
|
||||
_setting.get(SettingBoxKey.retryCount, defaultValue: 2);
|
||||
|
||||
@@ -545,27 +329,9 @@ abstract final class Pref {
|
||||
defaultValue: LiveQuality.superHD.code,
|
||||
);
|
||||
|
||||
static bool get enableDragSubtitle =>
|
||||
_setting.get(SettingBoxKey.enableDragSubtitle, defaultValue: false);
|
||||
|
||||
static int get fastForBackwardDuration =>
|
||||
_setting.get(SettingBoxKey.fastForBackwardDuration, defaultValue: 10);
|
||||
|
||||
static bool get recordSearchHistory =>
|
||||
_setting.get(SettingBoxKey.recordSearchHistory, defaultValue: true);
|
||||
|
||||
static String get webdavUri =>
|
||||
_setting.get(SettingBoxKey.webdavUri, defaultValue: '');
|
||||
|
||||
static String get webdavUsername =>
|
||||
_setting.get(SettingBoxKey.webdavUsername, defaultValue: '');
|
||||
|
||||
static String get webdavPassword =>
|
||||
_setting.get(SettingBoxKey.webdavPassword, defaultValue: '');
|
||||
|
||||
static String get webdavDirectory =>
|
||||
_setting.get(SettingBoxKey.webdavDirectory, defaultValue: '/');
|
||||
|
||||
static bool get showPgcTimeline =>
|
||||
_setting.get(SettingBoxKey.showPgcTimeline, defaultValue: true);
|
||||
|
||||
@@ -588,73 +354,11 @@ abstract final class Pref {
|
||||
static bool get enableLog =>
|
||||
_setting.get(SettingBoxKey.enableLog, defaultValue: true);
|
||||
|
||||
static bool get disableAudioCDN =>
|
||||
_setting.get(SettingBoxKey.disableAudioCDN, defaultValue: false);
|
||||
|
||||
static int get minDurationForRcmd =>
|
||||
_setting.get(SettingBoxKey.minDurationForRcmd, defaultValue: 0);
|
||||
|
||||
static int get minPlayForRcmd =>
|
||||
_setting.get(SettingBoxKey.minPlayForRcmd, defaultValue: 0);
|
||||
|
||||
static int get minLikeRatioForRecommend =>
|
||||
_setting.get(SettingBoxKey.minLikeRatioForRecommend, defaultValue: 0);
|
||||
|
||||
static bool get exemptFilterForFollowed =>
|
||||
_setting.get(SettingBoxKey.exemptFilterForFollowed, defaultValue: true);
|
||||
|
||||
static bool get applyFilterToRelatedVideos => _setting.get(
|
||||
SettingBoxKey.applyFilterToRelatedVideos,
|
||||
defaultValue: true,
|
||||
);
|
||||
|
||||
static bool get enableBackgroundPlay =>
|
||||
_setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: true);
|
||||
|
||||
static bool get autoExitFullscreen =>
|
||||
_setting.get(SettingBoxKey.enableAutoExit, defaultValue: true);
|
||||
|
||||
static bool get autoPlayEnable =>
|
||||
_setting.get(SettingBoxKey.autoPlayEnable, defaultValue: false);
|
||||
|
||||
static bool get pipNoDanmaku =>
|
||||
_setting.get(SettingBoxKey.pipNoDanmaku, defaultValue: false);
|
||||
|
||||
static bool get enableVerticalExpand =>
|
||||
_setting.get(SettingBoxKey.enableVerticalExpand, defaultValue: false);
|
||||
|
||||
static double get defaultTextScale =>
|
||||
_setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
|
||||
|
||||
static double get uiScale =>
|
||||
_setting.get(SettingBoxKey.uiScale, defaultValue: 1.0);
|
||||
|
||||
static bool get dynamicsWaterfallFlow => _setting.get(
|
||||
SettingBoxKey.dynamicsWaterfallFlow,
|
||||
defaultValue: horizontalScreen,
|
||||
);
|
||||
|
||||
static bool get hideTopBar => _setting.get(
|
||||
SettingBoxKey.hideTopBar,
|
||||
defaultValue: PlatformUtils.isMobile,
|
||||
);
|
||||
|
||||
static bool get hideBottomBar => _setting.get(
|
||||
SettingBoxKey.hideBottomBar,
|
||||
defaultValue: PlatformUtils.isMobile,
|
||||
);
|
||||
|
||||
static BarHideType get barHideType =>
|
||||
BarHideType.values[_setting.get(
|
||||
SettingBoxKey.barHideType,
|
||||
defaultValue: BarHideType.sync.index,
|
||||
)];
|
||||
|
||||
static bool get dynamicsShowAllFollowedUp => _setting.get(
|
||||
SettingBoxKey.dynamicsShowAllFollowedUp,
|
||||
defaultValue: false,
|
||||
);
|
||||
|
||||
static bool get enableShowDanmaku =>
|
||||
_setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: true);
|
||||
|
||||
@@ -664,9 +368,6 @@ abstract final class Pref {
|
||||
static bool get enableQuickFav =>
|
||||
_setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);
|
||||
|
||||
static bool get p1080 =>
|
||||
_setting.get(SettingBoxKey.p1080, defaultValue: true);
|
||||
|
||||
static int get customColor =>
|
||||
_setting.get(SettingBoxKey.customColor, defaultValue: 0);
|
||||
|
||||
@@ -674,21 +375,9 @@ abstract final class Pref {
|
||||
!Platform.isIOS &&
|
||||
_setting.get(SettingBoxKey.dynamicColor, defaultValue: true);
|
||||
|
||||
static bool get autoClearCache =>
|
||||
_setting.get(SettingBoxKey.autoClearCache, defaultValue: false);
|
||||
|
||||
static bool get enableSystemProxy =>
|
||||
_setting.get(SettingBoxKey.enableSystemProxy, defaultValue: false);
|
||||
|
||||
static bool get enableHttp2 =>
|
||||
_setting.get(SettingBoxKey.enableHttp2, defaultValue: false);
|
||||
|
||||
static ReplySortType get replySortType =>
|
||||
ReplySortType.values[_setting.get(
|
||||
SettingBoxKey.replySortType,
|
||||
defaultValue: ReplySortType.hot.index,
|
||||
)];
|
||||
|
||||
static DynamicBadgeMode get dynamicBadgeMode =>
|
||||
DynamicBadgeMode.values[_setting.get(
|
||||
SettingBoxKey.dynamicBadgeMode,
|
||||
@@ -701,21 +390,9 @@ abstract final class Pref {
|
||||
defaultValue: Transition.native.index,
|
||||
)];
|
||||
|
||||
static bool get enableQuickDouble =>
|
||||
_setting.get(SettingBoxKey.enableQuickDouble, defaultValue: true);
|
||||
|
||||
static bool get fullScreenGestureReverse =>
|
||||
_setting.get(SettingBoxKey.fullScreenGestureReverse, defaultValue: false);
|
||||
|
||||
static bool get autoPiP =>
|
||||
_setting.get(SettingBoxKey.autoPiP, defaultValue: false);
|
||||
|
||||
static bool get enableSponsorBlock =>
|
||||
_setting.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
||||
|
||||
static bool get enableHA =>
|
||||
_setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
||||
|
||||
static Set<int> get danmakuBlockType => Set<int>.from(
|
||||
_setting.get(SettingBoxKey.danmakuBlockType, defaultValue: const <int>{}),
|
||||
);
|
||||
@@ -750,44 +427,20 @@ abstract final class Pref {
|
||||
defaultValue: PlatformUtils.isMobile ? 5 : 6,
|
||||
);
|
||||
|
||||
static bool get expandBuffer =>
|
||||
_setting.get(SettingBoxKey.expandBuffer, defaultValue: false);
|
||||
|
||||
static String get audioOutput => _setting.get(
|
||||
SettingBoxKey.audioOutput,
|
||||
defaultValue: AudioOutput.defaultValue,
|
||||
);
|
||||
|
||||
static bool get enableAi =>
|
||||
_setting.get(SettingBoxKey.enableAi, defaultValue: false);
|
||||
|
||||
static bool get enableOnlineTotal =>
|
||||
_setting.get(SettingBoxKey.enableOnlineTotal, defaultValue: false);
|
||||
|
||||
static bool get autoEnterFullScreen =>
|
||||
_setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||
|
||||
static bool get enableAutoLongPressSpeed =>
|
||||
_setting.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||
|
||||
static double get playSpeedDefault =>
|
||||
_video.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
||||
|
||||
static double get longPressSpeedDefault =>
|
||||
_video.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 3.0);
|
||||
|
||||
static bool get defaultShowComment =>
|
||||
_setting.get(SettingBoxKey.defaultShowComment, defaultValue: false);
|
||||
|
||||
static bool get enableTrending =>
|
||||
_setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
|
||||
|
||||
static bool get enableSearchRcmd =>
|
||||
_setting.get(SettingBoxKey.enableSearchRcmd, defaultValue: true);
|
||||
|
||||
static bool get enableSaveLastData =>
|
||||
_setting.get(SettingBoxKey.enableSaveLastData, defaultValue: true);
|
||||
|
||||
static PlayRepeat get playRepeat =>
|
||||
PlayRepeat.values[_video.get(
|
||||
VideoBoxKey.playRepeat,
|
||||
@@ -800,51 +453,12 @@ abstract final class Pref {
|
||||
static bool get continuePlayInBackground =>
|
||||
_setting.get(SettingBoxKey.continuePlayInBackground, defaultValue: false);
|
||||
|
||||
static bool get directExitOnBack =>
|
||||
_setting.get(SettingBoxKey.directExitOnBack, defaultValue: false);
|
||||
|
||||
static bool get historyPause =>
|
||||
_localCache.get(LocalCacheKey.historyPause, defaultValue: false);
|
||||
|
||||
static int? get quickFavId => _setting.get(SettingBoxKey.quickFavId);
|
||||
|
||||
static bool get tempPlayerConf =>
|
||||
_setting.get(SettingBoxKey.tempPlayerConf, defaultValue: false);
|
||||
|
||||
static bool get showFsScreenshotBtn =>
|
||||
_setting.get(SettingBoxKey.showFsScreenshotBtn, defaultValue: true);
|
||||
|
||||
static bool get showFsLockBtn =>
|
||||
_setting.get(SettingBoxKey.showFsLockBtn, defaultValue: true);
|
||||
|
||||
static bool get silentDownImg =>
|
||||
_setting.get(SettingBoxKey.silentDownImg, defaultValue: false);
|
||||
|
||||
static String get buvid {
|
||||
String? buvid = _localCache.get(LocalCacheKey.buvid);
|
||||
if (buvid == null) {
|
||||
buvid = LoginUtils.generateBuvid();
|
||||
_localCache.put(LocalCacheKey.buvid, buvid);
|
||||
}
|
||||
return buvid;
|
||||
}
|
||||
|
||||
static bool get showMemberShop =>
|
||||
_setting.get(SettingBoxKey.showMemberShop, defaultValue: false);
|
||||
|
||||
static SuperChatType get superChatType =>
|
||||
SuperChatType.values[_setting.get(
|
||||
SettingBoxKey.superChatType,
|
||||
defaultValue: SuperChatType.valid.index,
|
||||
)];
|
||||
|
||||
static double get fullScreenSCWidth => _setting.get(
|
||||
SettingBoxKey.fullScreenSCWidth,
|
||||
defaultValue: kFullScreenSCWidth,
|
||||
);
|
||||
|
||||
static bool get minimizeOnExit =>
|
||||
_setting.get(SettingBoxKey.minimizeOnExit, defaultValue: true);
|
||||
static final String buvid = LoginUtils.generateBuvid();
|
||||
|
||||
static Size get windowSize {
|
||||
final List<double>? size = (_setting.get(SettingBoxKey.windowSize) as List?)
|
||||
@@ -863,12 +477,6 @@ abstract final class Pref {
|
||||
defaultValue: PlatformUtils.isDesktop,
|
||||
);
|
||||
|
||||
static bool get pauseOnMinimize =>
|
||||
_setting.get(SettingBoxKey.pauseOnMinimize, defaultValue: false);
|
||||
|
||||
static bool get showWindowTitleBar =>
|
||||
_setting.get(SettingBoxKey.showWindowTitleBar, defaultValue: true);
|
||||
|
||||
static double get desktopVolume =>
|
||||
_setting.get(SettingBoxKey.desktopVolume, defaultValue: 1.0);
|
||||
|
||||
@@ -883,15 +491,6 @@ abstract final class Pref {
|
||||
static bool get enablePlayAll =>
|
||||
_setting.get(SettingBoxKey.enablePlayAll, defaultValue: true);
|
||||
|
||||
static bool get enableTapDm =>
|
||||
_setting.get(SettingBoxKey.enableTapDm, defaultValue: true);
|
||||
|
||||
static bool get showTrayIcon =>
|
||||
_setting.get(SettingBoxKey.showTrayIcon, defaultValue: true);
|
||||
|
||||
static bool get setSystemBrightness =>
|
||||
_setting.get(SettingBoxKey.setSystemBrightness, defaultValue: false);
|
||||
|
||||
static String? get downloadPath => _setting.get(SettingBoxKey.downloadPath);
|
||||
|
||||
static String? get liveCdnUrl => _setting.get(SettingBoxKey.liveCdnUrl);
|
||||
@@ -910,18 +509,9 @@ abstract final class Pref {
|
||||
static bool get enableImgMenu =>
|
||||
_setting.get(SettingBoxKey.enableImgMenu, defaultValue: false);
|
||||
|
||||
static bool get showDynDispute =>
|
||||
_setting.get(SettingBoxKey.showDynDispute, defaultValue: false);
|
||||
|
||||
static double get touchSlopH =>
|
||||
_setting.get(SettingBoxKey.touchSlopH, defaultValue: 24.0);
|
||||
|
||||
static bool get saveReply =>
|
||||
_setting.get(SettingBoxKey.saveReply, defaultValue: true);
|
||||
|
||||
static bool get floatingNavBar =>
|
||||
_setting.get(SettingBoxKey.floatingNavBar, defaultValue: false);
|
||||
|
||||
static bool get removeSafeArea =>
|
||||
_setting.get(SettingBoxKey.removeSafeArea, defaultValue: false);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:PiliPlus/common/style.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/cupertino.dart' show CupertinoThemeData;
|
||||
import 'package:flutter/foundation.dart' show PlatformDispatcher;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -118,62 +117,6 @@ abstract final class ThemeUtils {
|
||||
},
|
||||
),
|
||||
);
|
||||
if (isDark) {
|
||||
if (Pref.isPureBlackTheme) {
|
||||
themeData = darkenTheme(themeData);
|
||||
}
|
||||
}
|
||||
return themeData;
|
||||
}
|
||||
|
||||
static ThemeData darkenTheme(ThemeData themeData) {
|
||||
final colorScheme = themeData.colorScheme;
|
||||
final color = colorScheme.surfaceContainerHighest.darken(0.7);
|
||||
return themeData.copyWith(
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
appBarTheme: themeData.appBarTheme.copyWith(
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
cardTheme: themeData.cardTheme.copyWith(
|
||||
color: Colors.black,
|
||||
),
|
||||
dialogTheme: themeData.dialogTheme.copyWith(
|
||||
backgroundColor: color,
|
||||
),
|
||||
bottomSheetTheme: themeData.bottomSheetTheme.copyWith(
|
||||
backgroundColor: color,
|
||||
),
|
||||
bottomNavigationBarTheme: themeData.bottomNavigationBarTheme.copyWith(
|
||||
backgroundColor: color,
|
||||
),
|
||||
navigationBarTheme: themeData.navigationBarTheme.copyWith(
|
||||
backgroundColor: color,
|
||||
),
|
||||
navigationRailTheme: themeData.navigationRailTheme.copyWith(
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
colorScheme: colorScheme.copyWith(
|
||||
primary: colorScheme.primary.darken(0.1),
|
||||
onPrimary: colorScheme.onPrimary.darken(0.1),
|
||||
primaryContainer: colorScheme.primaryContainer.darken(0.1),
|
||||
onPrimaryContainer: colorScheme.onPrimaryContainer.darken(0.1),
|
||||
inversePrimary: colorScheme.inversePrimary.darken(0.1),
|
||||
secondary: colorScheme.secondary.darken(0.1),
|
||||
onSecondary: colorScheme.onSecondary.darken(0.1),
|
||||
secondaryContainer: colorScheme.secondaryContainer.darken(0.1),
|
||||
onSecondaryContainer: colorScheme.onSecondaryContainer.darken(0.1),
|
||||
error: colorScheme.error.darken(0.1),
|
||||
surface: Colors.black,
|
||||
onSurface: colorScheme.onSurface.darken(0.15),
|
||||
surfaceTint: colorScheme.surfaceTint.darken(),
|
||||
inverseSurface: colorScheme.inverseSurface.darken(),
|
||||
onInverseSurface: colorScheme.onInverseSurface.darken(),
|
||||
surfaceContainer: colorScheme.surfaceContainer.darken(),
|
||||
surfaceContainerHigh: colorScheme.surfaceContainerHigh.darken(),
|
||||
surfaceContainerHighest: colorScheme.surfaceContainerHighest.darken(
|
||||
0.4,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
@@ -60,7 +61,7 @@ abstract final class UrlUtils {
|
||||
}
|
||||
} else {
|
||||
if (redirectUrl.isNotEmpty) {
|
||||
PageUtils.handleWebview(redirectUrl);
|
||||
PiliScheme.routePushFromUrl(redirectUrl);
|
||||
} else {
|
||||
SmartDialog.showToast('matchUrlPush: $pathSegment');
|
||||
}
|
||||
|
||||
@@ -30,14 +30,8 @@ abstract final class Utils {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> copyText(
|
||||
String text, {
|
||||
bool needToast = true,
|
||||
String? toastText,
|
||||
}) {
|
||||
if (needToast) {
|
||||
SmartDialog.showToast(toastText ?? '已复制');
|
||||
}
|
||||
static Future<void> copyText(String text, {String? toastText}) {
|
||||
SmartDialog.showToast(toastText ?? '已复制');
|
||||
return Clipboard.setData(ClipboardData(text: text));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart' show kDebugMode, debugPrint;
|
||||
abstract final class VideoUtils {
|
||||
static CDNService cdnService = Pref.defaultCDNService;
|
||||
static String? liveCdnUrl = Pref.liveCdnUrl;
|
||||
static bool disableAudioCDN = Pref.disableAudioCDN;
|
||||
|
||||
static const _proxyTf = 'proxy-tf-all-ws.bilivideo.com';
|
||||
|
||||
@@ -41,8 +40,7 @@ abstract final class VideoUtils {
|
||||
// upos-sz-mirrorcoso1.bilivideo.com os=mcdn
|
||||
mcdnUpgcxcode = url;
|
||||
} else {
|
||||
if (defaultCDNService == CDNService.backupUrl ||
|
||||
(isAudio && disableAudioCDN)) {
|
||||
if (defaultCDNService == CDNService.backupUrl) {
|
||||
return url;
|
||||
}
|
||||
return uri.replace(host: defaultCDNService.host).toString();
|
||||
|
||||
Reference in New Issue
Block a user