mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-20 08:08:44 +00:00
remove boolext
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -39,7 +39,7 @@ class PiliScheme {
|
||||
try {
|
||||
if (url.startsWith('//')) {
|
||||
url = 'https:$url';
|
||||
} else if (RegExp(r'^\S+://').hasMatch(url).not) {
|
||||
} else if (!RegExp(r'^\S+://').hasMatch(url)) {
|
||||
url = 'https://$url';
|
||||
}
|
||||
return routePush(
|
||||
@@ -457,7 +457,7 @@ class PiliScheme {
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
if (selfHandle.not) {
|
||||
if (!selfHandle) {
|
||||
debugPrint('$uri');
|
||||
SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者');
|
||||
}
|
||||
@@ -485,7 +485,7 @@ class PiliScheme {
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (selfHandle.not) {
|
||||
if (!selfHandle) {
|
||||
debugPrint('$uri');
|
||||
SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者');
|
||||
}
|
||||
@@ -505,13 +505,13 @@ class PiliScheme {
|
||||
String host = uri.host;
|
||||
|
||||
if (selfHandle &&
|
||||
host.contains('bilibili.com').not &&
|
||||
host.contains('b23.tv').not) {
|
||||
!host.contains('bilibili.com') &&
|
||||
!host.contains('b23.tv')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void launchURL() {
|
||||
if (selfHandle.not) {
|
||||
if (selfHandle) {
|
||||
_toWebview(uri.toString(), off, parameters);
|
||||
}
|
||||
}
|
||||
@@ -531,7 +531,7 @@ class PiliScheme {
|
||||
uri = Uri.parse(redirectUrl);
|
||||
host = uri.host;
|
||||
}
|
||||
if (host.contains('bilibili.com').not) {
|
||||
if (!host.contains('bilibili.com')) {
|
||||
launchURL();
|
||||
return false;
|
||||
}
|
||||
@@ -541,7 +541,7 @@ class PiliScheme {
|
||||
|
||||
if (host.contains('t.bilibili.com')) {
|
||||
bool hasMatch = await _onPushDynDetail(path, off);
|
||||
if (hasMatch.not) {
|
||||
if (!hasMatch) {
|
||||
launchURL();
|
||||
}
|
||||
return hasMatch;
|
||||
@@ -609,7 +609,7 @@ class PiliScheme {
|
||||
return false;
|
||||
case 'dynamic' || 'opus':
|
||||
bool hasMatch = await _onPushDynDetail(path, off);
|
||||
if (hasMatch.not) {
|
||||
if (!hasMatch) {
|
||||
launchURL();
|
||||
}
|
||||
return hasMatch;
|
||||
|
||||
@@ -68,10 +68,6 @@ extension StringExt on String? {
|
||||
bool get isNullOrEmpty => this == null || this!.isEmpty;
|
||||
}
|
||||
|
||||
extension BoolExt on bool {
|
||||
bool get not => !this;
|
||||
}
|
||||
|
||||
extension BuildContextExt on BuildContext {
|
||||
Color get vipColor {
|
||||
return Theme.of(this).brightness == Brightness.light
|
||||
|
||||
@@ -160,10 +160,8 @@ class PageUtils {
|
||||
...[
|
||||
...[
|
||||
...scheduleTimeChoices,
|
||||
if (scheduleTimeChoices
|
||||
.contains(
|
||||
shutdownTimerService.scheduledExitInMinutes)
|
||||
.not)
|
||||
if (!scheduleTimeChoices.contains(
|
||||
shutdownTimerService.scheduledExitInMinutes))
|
||||
shutdownTimerService.scheduledExitInMinutes,
|
||||
]..sort(),
|
||||
-1,
|
||||
@@ -193,7 +191,7 @@ class PageUtils {
|
||||
child: Divider(height: 1),
|
||||
),
|
||||
),
|
||||
if (isLive.not) ...[
|
||||
if (!isLive) ...[
|
||||
const SizedBox(height: 10),
|
||||
ListTile(
|
||||
dense: true,
|
||||
@@ -586,8 +584,8 @@ class PageUtils {
|
||||
bool inApp = false,
|
||||
Map? parameters,
|
||||
}) async {
|
||||
if (inApp.not && GStorage.openInBrowser) {
|
||||
if ((await PiliScheme.routePushFromUrl(url, selfHandle: true)).not) {
|
||||
if (!inApp && GStorage.openInBrowser) {
|
||||
if (!await PiliScheme.routePushFromUrl(url, selfHandle: true)) {
|
||||
launchURL(url);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -97,22 +97,24 @@ class ReplyUtils {
|
||||
}
|
||||
|
||||
// CommAntifraud
|
||||
if (isManual.not) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
if (!isManual) {
|
||||
await Future.delayed(const Duration(seconds: 8));
|
||||
}
|
||||
void showReplyCheckResult(String message) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('评论检查结果'),
|
||||
content: SelectableText(message),
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('评论检查结果'),
|
||||
content: SelectableText(message),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
// root reply
|
||||
if (rpid == null) {
|
||||
if (rpid == null || rpid == 0) {
|
||||
// no cookie check
|
||||
var res = await ReplyHttp.replyList(
|
||||
isLogin: false,
|
||||
@@ -124,7 +126,7 @@ class ReplyUtils {
|
||||
enableFilter: false,
|
||||
antiGoodsReply: false,
|
||||
);
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
if (res is Error) {
|
||||
SmartDialog.showToast('获取评论主列表时发生错误:${res.errMsg}');
|
||||
return;
|
||||
@@ -134,14 +136,10 @@ class ReplyUtils {
|
||||
replies.replies?.indexWhere((item) => item.rpid == replyId) ?? -1;
|
||||
if (index != -1) {
|
||||
// found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
'无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message');
|
||||
} else {
|
||||
// not found
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
// cookie check
|
||||
final res1 = await ReplyHttp.replyReplyList(
|
||||
isLogin: true,
|
||||
@@ -152,17 +150,13 @@ class ReplyUtils {
|
||||
filterBanWord: false,
|
||||
antiGoodsReply: false,
|
||||
);
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
if (res1 is Error) {
|
||||
// not found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
'无法找到你的评论。\n\n你的评论:$message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult('无法找到你的评论。\n\n你的评论:$message');
|
||||
} else {
|
||||
// found
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
// no cookie check
|
||||
final res2 = await ReplyHttp.replyReplyList(
|
||||
isLogin: false,
|
||||
@@ -174,35 +168,31 @@ class ReplyUtils {
|
||||
isCheck: true,
|
||||
antiGoodsReply: false,
|
||||
);
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
if (res2 is Error) {
|
||||
// not found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
res2.errMsg?.startsWith('12022') == true
|
||||
? '你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message'
|
||||
: '评论不可见(${res2.errMsg}): $message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult(
|
||||
res2.errMsg?.startsWith('12022') == true
|
||||
? '你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message'
|
||||
: '评论不可见(${res2.errMsg}): $message',
|
||||
);
|
||||
} else {
|
||||
// found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(isManual
|
||||
? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'
|
||||
: '''
|
||||
showReplyCheckResult(isManual
|
||||
? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'
|
||||
: '''
|
||||
你评论状态有点可疑,虽然无账号翻找评论区获取不到你的评论,但是无账号可通过
|
||||
https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? replyId}&type=$replyType
|
||||
获取你的评论,疑似评论区被戒严或者这是你的视频。
|
||||
|
||||
你的评论:$message''');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 1;; i++) {
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
final res3 = await ReplyHttp.replyReplyList(
|
||||
isLogin: false,
|
||||
oid: oid,
|
||||
@@ -226,18 +216,14 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
||||
// not found
|
||||
} else {
|
||||
// found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
'无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1;; i++) {
|
||||
if (context.mounted.not) return;
|
||||
if (!context.mounted) return;
|
||||
final res4 = await ReplyHttp.replyReplyList(
|
||||
isLogin: true,
|
||||
oid: oid,
|
||||
@@ -261,21 +247,13 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
||||
// not found
|
||||
} else {
|
||||
// found
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
'你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult('你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (context.mounted) {
|
||||
showReplyCheckResult(
|
||||
'评论不可见: $message',
|
||||
);
|
||||
}
|
||||
showReplyCheckResult('评论不可见: $message');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import 'package:PiliPlus/pages/common/multi_select_controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/group_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/later/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -402,7 +401,7 @@ class RequestUtils {
|
||||
).then((res) {
|
||||
if (res['status']) {
|
||||
ctr.handleSelect(false);
|
||||
if (isCopy.not) {
|
||||
if (!isCopy) {
|
||||
List<T> dataList = ctr.loadingState.value.data!;
|
||||
List<T> remainList = dataList
|
||||
.toSet()
|
||||
|
||||
@@ -48,7 +48,7 @@ class Utils {
|
||||
return str;
|
||||
},
|
||||
);
|
||||
if (hasMatch.not) {
|
||||
if (!hasMatch) {
|
||||
src += '@${quality ?? GlobalData().imgQuality}q.webp';
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ class Utils {
|
||||
static bool? _isIpad;
|
||||
|
||||
static Future<bool> isIpad() async {
|
||||
if (Platform.isIOS.not) {
|
||||
if (!Platform.isIOS) {
|
||||
return false;
|
||||
}
|
||||
if (_isIpad != null) {
|
||||
@@ -502,7 +502,7 @@ class Utils {
|
||||
try {
|
||||
final res = await Request().get(Api.latestApp, uaType: 'mob');
|
||||
if (res.data is Map || res.data.isEmpty) {
|
||||
if (isAuto.not) {
|
||||
if (!isAuto) {
|
||||
SmartDialog.showToast('检查更新失败,GitHub接口未返回数据,请检查网络');
|
||||
}
|
||||
return;
|
||||
@@ -511,7 +511,7 @@ class Utils {
|
||||
DateTime current = DateTime.parse('${BuildConfig.buildTime}Z');
|
||||
current = current.copyWith(hour: current.hour - 8);
|
||||
if (current.compareTo(latest) >= 0) {
|
||||
if (isAuto.not) {
|
||||
if (!isAuto) {
|
||||
SmartDialog.showToast('已是最新版本');
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:PiliPlus/models/live/live_room/room_info.dart';
|
||||
import 'package:PiliPlus/models/video/play/url.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class VideoUtils {
|
||||
static String getCdnUrl(dynamic item, [String? defaultCDNService]) {
|
||||
@@ -13,13 +12,13 @@ class VideoUtils {
|
||||
if (item is AudioItem) {
|
||||
if (GStorage.setting
|
||||
.get(SettingBoxKey.disableAudioCDN, defaultValue: true)) {
|
||||
return item.backupUrl.isNullOrEmpty.not
|
||||
return item.backupUrl?.isNotEmpty == true
|
||||
? item.backupUrl!
|
||||
: item.baseUrl ?? "";
|
||||
}
|
||||
}
|
||||
if (defaultCDNService == CDNService.baseUrl.code) {
|
||||
return (item.baseUrl as String?).isNullOrEmpty.not
|
||||
return (item.baseUrl as String?)?.isNotEmpty == true
|
||||
? item.baseUrl
|
||||
: item.backupUrl ?? "";
|
||||
}
|
||||
@@ -31,17 +30,17 @@ class VideoUtils {
|
||||
backupUrl = item.backupUrl;
|
||||
}
|
||||
if (defaultCDNService == CDNService.backupUrl.code) {
|
||||
return backupUrl.isNullOrEmpty.not ? backupUrl : item.baseUrl ?? "";
|
||||
return backupUrl?.isNotEmpty == true ? backupUrl : item.baseUrl ?? "";
|
||||
}
|
||||
videoUrl = backupUrl.isNullOrEmpty ? item.baseUrl : backupUrl;
|
||||
videoUrl = backupUrl?.isNotEmpty == true ? backupUrl : item.baseUrl;
|
||||
|
||||
if (videoUrl.isNullOrEmpty) {
|
||||
return "";
|
||||
}
|
||||
debugPrint("videoUrl:$videoUrl");
|
||||
// debugPrint("videoUrl:$videoUrl");
|
||||
|
||||
String defaultCDNHost = CDNService.fromCode(defaultCDNService).host;
|
||||
debugPrint("defaultCDNHost:$defaultCDNHost");
|
||||
// debugPrint("defaultCDNHost:$defaultCDNHost");
|
||||
if (videoUrl!.contains("szbdyd.com")) {
|
||||
final uri = Uri.parse(videoUrl);
|
||||
String hostname = uri.queryParameters['xy_usource'] ?? defaultCDNHost;
|
||||
@@ -54,7 +53,7 @@ class VideoUtils {
|
||||
// videoUrl =
|
||||
// 'https://proxy-tf-all-ws.bilivideo.com/?url=${Uri.encodeComponent(videoUrl)}';
|
||||
}
|
||||
debugPrint("videoUrl:$videoUrl");
|
||||
// debugPrint("videoUrl:$videoUrl");
|
||||
|
||||
// /// 先获取backupUrl 一般是upgcxcode地址 播放更稳定
|
||||
// if (item is VideoItem) {
|
||||
|
||||
Reference in New Issue
Block a user