Merge branch 'fix'

This commit is contained in:
guozhigq
2024-05-09 00:01:56 +08:00
10 changed files with 74 additions and 65 deletions

View File

@ -46,7 +46,7 @@ class ApiInterceptor extends Interceptor {
// 处理网络请求错误
// handler.next(err);
String url = err.requestOptions.uri.toString();
if (!url.contains('heartBeat')) {
if (!url.contains('heartbeat')) {
SmartDialog.showToast(
await dioError(err),
displayType: SmartToastType.onlyRefresh,

View File

@ -218,7 +218,7 @@ class AboutController extends GetxController {
RxString currentVersion = ''.obs;
RxString remoteVersion = ''.obs;
late LatestDataModel remoteAppInfo;
RxBool isUpdate = true.obs;
RxBool isUpdate = false.obs;
RxBool isLoading = true.obs;
late LatestDataModel data;

View File

@ -40,10 +40,10 @@ class MainController extends GetxController {
dynamicBadgeType.value = DynamicBadgeMode.values[setting.get(
SettingBoxKey.dynamicBadgeMode,
defaultValue: DynamicBadgeMode.number.code)];
setNavBarConfig();
if (dynamicBadgeType.value != DynamicBadgeMode.hidden) {
getUnreadDynamic();
}
setNavBarConfig();
}
void onBackPressed(BuildContext context) {

View File

@ -138,14 +138,14 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
duration: const Duration(milliseconds: 500),
offset: Offset(0, snapshot.data ? 0 : 1),
child: GlobalData().enableMYBar
? NavigationBar(
onDestinationSelected: (value) => setIndex(value),
selectedIndex: _mainController.selectedIndex,
destinations: <Widget>[
..._mainController.navigationBars.map((e) {
return NavigationDestination(
icon: Obx(
() => Badge(
? Obx(
() => NavigationBar(
onDestinationSelected: (value) => setIndex(value),
selectedIndex: _mainController.selectedIndex,
destinations: <Widget>[
..._mainController.navigationBars.map((e) {
return NavigationDestination(
icon: Badge(
label: _mainController
.dynamicBadgeType.value ==
DynamicBadgeMode.number
@ -159,25 +159,25 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
e['count'] > 0,
child: e['icon'],
),
),
selectedIcon: e['selectIcon'],
label: e['label'],
);
}).toList(),
],
selectedIcon: e['selectIcon'],
label: e['label'],
);
}).toList(),
],
),
)
: BottomNavigationBar(
currentIndex: _mainController.selectedIndex,
type: BottomNavigationBarType.fixed,
onTap: (value) => setIndex(value),
iconSize: 16,
selectedFontSize: 12,
unselectedFontSize: 12,
items: [
..._mainController.navigationBars.map((e) {
return BottomNavigationBarItem(
icon: Obx(
() => Badge(
: Obx(
() => BottomNavigationBar(
currentIndex: _mainController.selectedIndex,
type: BottomNavigationBarType.fixed,
onTap: (value) => setIndex(value),
iconSize: 16,
selectedFontSize: 12,
unselectedFontSize: 12,
items: [
..._mainController.navigationBars.map((e) {
return BottomNavigationBarItem(
icon: Badge(
label: _mainController
.dynamicBadgeType.value ==
DynamicBadgeMode.number
@ -191,12 +191,12 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
e['count'] > 0,
child: e['icon'],
),
),
activeIcon: e['selectIcon'],
label: e['label'],
);
}).toList(),
],
activeIcon: e['selectIcon'],
label: e['label'],
);
}).toList(),
],
),
),
);
},

View File

@ -450,6 +450,7 @@ class VideoIntroController extends GetxController {
videoDetailCtr.danmakuCid.value = cid;
videoDetailCtr.cover.value = cover;
videoDetailCtr.queryVideoUrl();
videoDetailCtr.getSubtitle();
// 重新请求评论
try {
/// 未渲染回复组件时可能异常

View File

@ -12,6 +12,7 @@ import 'package:pilipala/pages/preview/index.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/reply_new/index.dart';
import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/url_utils.dart';
import 'package:pilipala/utils/utils.dart';
@ -642,23 +643,25 @@ InlineSpan buildContent(
'',
);
} else {
final String redirectUrl =
await UrlUtils.parseRedirectUrl(matchStr);
if (redirectUrl == matchStr) {
Clipboard.setData(ClipboardData(text: matchStr));
SmartDialog.showToast('地址可能有误');
return;
}
final String pathSegment = Uri.parse(redirectUrl).path;
final String lastPathSegment =
pathSegment.split('/').last;
if (lastPathSegment.startsWith('BV')) {
final String pathSegment = Uri.parse(matchStr).path;
Map matchRes = IdUtils.matchAvorBv(input: pathSegment);
List matchKeys = matchRes.keys.toList();
if (matchKeys.isNotEmpty) {
UrlUtils.matchUrlPush(
lastPathSegment,
matchRes.containsKey('AV')
? matchRes['AV']! as int
: matchRes['BV'],
title,
redirectUrl,
matchStr,
);
} else {
final String redirectUrl =
await UrlUtils.parseRedirectUrl(matchStr);
// if (redirectUrl == matchStr) {
// Clipboard.setData(ClipboardData(text: matchStr));
// SmartDialog.showToast('地址可能有误');
// return;
// }
Get.toNamed(
'/webview',
parameters: {

View File

@ -52,15 +52,19 @@ class WebviewController extends GetxController {
loadProgress.value = progress;
},
onPageStarted: (String url) {
final String str = Uri.parse(url).pathSegments[0];
final Map matchRes = IdUtils.matchAvorBv(input: str);
final List matchKeys = matchRes.keys.toList();
if (matchKeys.isNotEmpty) {
if (matchKeys.first == 'BV') {
Get.offAndToNamed(
'/searchResult',
parameters: {'keyword': matchRes['BV']},
);
final List pathSegments = Uri.parse(url).pathSegments;
if (pathSegments.isNotEmpty &&
url != 'https://passport.bilibili.com/h5-app/passport/login') {
final String str = pathSegments[0];
final Map matchRes = IdUtils.matchAvorBv(input: str);
final List matchKeys = matchRes.keys.toList();
if (matchKeys.isNotEmpty) {
if (matchKeys.first == 'BV') {
Get.offAndToNamed(
'/searchResult',
parameters: {'keyword': matchRes['BV']},
);
}
}
}
},

View File

@ -334,7 +334,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
color: Colors.white,
),
),
fuc: () => _.triggerFullScreen(),
fuc: () => _.triggerFullScreen(status: !_.isFullScreen.value),
),
};
final List<Widget> list = [];

View File

@ -26,7 +26,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
static final List<MediaItem> _item = [];
Box setting = GStrorage.setting;
bool enableBackgroundPlay = false;
PlPlayerController player = PlPlayerController.getInstance(videoType: 'none');
PlPlayerController player = PlPlayerController.getInstance();
VideoPlayerServiceHandler() {
revalidateSetting();

View File

@ -4,7 +4,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:pilipala/utils/route_push.dart';
import '../http/search.dart';
import '../models/common/search_type.dart';
import 'id_utils.dart';
import 'url_utils.dart';
import 'utils.dart';
@ -140,11 +139,13 @@ class PiliSchame {
print('bilibili.com path: $path');
final String lastPathSegment = path!.split('/').last;
if (path.startsWith('/video')) {
if (lastPathSegment.contains('BV')) {
_videoPush(null, lastPathSegment);
}
if (lastPathSegment.contains('av')) {
_videoPush(Utils.matchNum(lastPathSegment)[0], null);
Map matchRes = IdUtils.matchAvorBv(input: path);
if (matchRes.containsKey('AV')) {
_videoPush(matchRes['AV']! as int, null);
} else if (matchRes.containsKey('BV')) {
_videoPush(null, matchRes['BV'] as String);
} else {
SmartDialog.showToast('投稿匹配失败');
}
}
if (path.startsWith('/bangumi')) {