mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: reply jump url
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'dart:math' show Random;
|
||||
import 'package:PiliPlus/build_config.dart';
|
||||
import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
@@ -175,11 +176,13 @@ class Request {
|
||||
}
|
||||
|
||||
// 日志拦截器 输出请求、响应内容
|
||||
// dio.interceptors.add(LogInterceptor(
|
||||
// request: false,
|
||||
// requestHeader: false,
|
||||
// responseHeader: false,
|
||||
// ));
|
||||
if (BuildConfig.isDebug) {
|
||||
dio.interceptors.add(LogInterceptor(
|
||||
request: false,
|
||||
requestHeader: false,
|
||||
responseHeader: false,
|
||||
));
|
||||
}
|
||||
|
||||
dio.transformer = BackgroundTransformer();
|
||||
dio.options.validateStatus = (int? status) {
|
||||
|
||||
@@ -26,6 +26,7 @@ class SearchPanelController extends CommonController {
|
||||
String tag;
|
||||
int? pubBegin;
|
||||
int? pubEnd;
|
||||
bool? hasPushDetail;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -46,7 +47,10 @@ class SearchPanelController extends CommonController {
|
||||
?.insertAll(0, (loadingState.value as Success).response);
|
||||
}
|
||||
loadingState.value = LoadingState.success(response.response.list);
|
||||
if (currentPage == 1) {
|
||||
if (hasPushDetail != true &&
|
||||
currentPage == 1 &&
|
||||
searchType == SearchType.video) {
|
||||
hasPushDetail = true;
|
||||
onPushDetail(response.response.list);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -836,13 +836,11 @@ class ReplyItem extends StatelessWidget {
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
final String title = content.jumpUrl[matchStr]['title'];
|
||||
late final String title = content.url[matchStr]!.title;
|
||||
if (appUrlSchema == '') {
|
||||
if (matchStr.startsWith('BV')) {
|
||||
UrlUtils.matchUrlPush(
|
||||
matchStr,
|
||||
'',
|
||||
);
|
||||
if (RegExp(r'^(av|bv)', caseSensitive: false)
|
||||
.hasMatch(matchStr)) {
|
||||
UrlUtils.matchUrlPush(matchStr, '');
|
||||
} else if (RegExp(r'^[Cc][Vv][0-9]+$')
|
||||
.hasMatch(matchStr)) {
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
|
||||
@@ -876,13 +876,11 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
final String title = content.url[matchStr]!.title;
|
||||
late final String title = content.url[matchStr]!.title;
|
||||
if (appUrlSchema == '') {
|
||||
if (matchStr.startsWith('BV')) {
|
||||
UrlUtils.matchUrlPush(
|
||||
matchStr,
|
||||
'',
|
||||
);
|
||||
if (RegExp(r'^(av|bv)', caseSensitive: false)
|
||||
.hasMatch(matchStr)) {
|
||||
UrlUtils.matchUrlPush(matchStr, '');
|
||||
} else if (RegExp(r'^[Cc][Vv][0-9]+$')
|
||||
.hasMatch(matchStr)) {
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
|
||||
@@ -10,6 +10,7 @@ commit_hash=$(git rev-parse HEAD)
|
||||
|
||||
cat <<EOL > lib/build_config.dart
|
||||
class BuildConfig {
|
||||
static const bool isDebug = false;
|
||||
static const String buildTime = '$build_time';
|
||||
static const String commitHash = '$commit_hash';
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../http/init.dart';
|
||||
@@ -53,19 +54,25 @@ class UrlUtils {
|
||||
String redirectUrl,
|
||||
) async {
|
||||
final Map matchRes = IdUtils.matchAvorBv(input: pathSegment);
|
||||
if (matchRes.containsKey('BV')) {
|
||||
final String bv = matchRes['BV'];
|
||||
final int cid = await SearchHttp.ab2c(bvid: bv);
|
||||
if (matchRes.isNotEmpty) {
|
||||
int? aid = matchRes['AV'];
|
||||
String? bvid = matchRes['BV'];
|
||||
bvid ??= IdUtils.av2bv(aid!);
|
||||
final int cid = await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
await Get.toNamed(
|
||||
'/video?bvid=$bv&cid=$cid',
|
||||
'/video?bvid=$bvid&cid=$cid',
|
||||
arguments: <String, String?>{
|
||||
'pic': '',
|
||||
'heroTag': Utils.makeHeroTag(bv),
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
preventDuplicates: false,
|
||||
);
|
||||
} else {
|
||||
Utils.handleWebview(redirectUrl);
|
||||
if (redirectUrl.isNotEmpty) {
|
||||
Utils.handleWebview(redirectUrl);
|
||||
} else {
|
||||
SmartDialog.showToast('matchUrlPush: $pathSegment');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user