Merge branch 'main' into design

This commit is contained in:
guozhigq
2024-05-12 22:51:49 +08:00
10 changed files with 74 additions and 65 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -450,6 +450,7 @@ class VideoIntroController extends GetxController {
videoDetailCtr.danmakuCid.value = cid; videoDetailCtr.danmakuCid.value = cid;
videoDetailCtr.cover.value = cover; videoDetailCtr.cover.value = cover;
videoDetailCtr.queryVideoUrl(); videoDetailCtr.queryVideoUrl();
videoDetailCtr.getSubtitle();
// 重新请求评论 // 重新请求评论
try { 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/index.dart';
import 'package:pilipala/pages/video/detail/reply_new/index.dart'; import 'package:pilipala/pages/video/detail/reply_new/index.dart';
import 'package:pilipala/utils/feed_back.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/storage.dart';
import 'package:pilipala/utils/url_utils.dart'; import 'package:pilipala/utils/url_utils.dart';
import 'package:pilipala/utils/utils.dart'; import 'package:pilipala/utils/utils.dart';
@ -642,23 +643,25 @@ InlineSpan buildContent(
'', '',
); );
} else { } else {
final String redirectUrl = final String pathSegment = Uri.parse(matchStr).path;
await UrlUtils.parseRedirectUrl(matchStr); Map matchRes = IdUtils.matchAvorBv(input: pathSegment);
if (redirectUrl == matchStr) { List matchKeys = matchRes.keys.toList();
Clipboard.setData(ClipboardData(text: matchStr)); if (matchKeys.isNotEmpty) {
SmartDialog.showToast('地址可能有误');
return;
}
final String pathSegment = Uri.parse(redirectUrl).path;
final String lastPathSegment =
pathSegment.split('/').last;
if (lastPathSegment.startsWith('BV')) {
UrlUtils.matchUrlPush( UrlUtils.matchUrlPush(
lastPathSegment, matchRes.containsKey('AV')
? matchRes['AV']! as int
: matchRes['BV'],
title, title,
redirectUrl, matchStr,
); );
} else { } else {
final String redirectUrl =
await UrlUtils.parseRedirectUrl(matchStr);
// if (redirectUrl == matchStr) {
// Clipboard.setData(ClipboardData(text: matchStr));
// SmartDialog.showToast('地址可能有误');
// return;
// }
Get.toNamed( Get.toNamed(
'/webview', '/webview',
parameters: { parameters: {

View File

@ -52,7 +52,10 @@ class WebviewController extends GetxController {
loadProgress.value = progress; loadProgress.value = progress;
}, },
onPageStarted: (String url) { onPageStarted: (String url) {
final String str = Uri.parse(url).pathSegments[0]; 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 Map matchRes = IdUtils.matchAvorBv(input: str);
final List matchKeys = matchRes.keys.toList(); final List matchKeys = matchRes.keys.toList();
if (matchKeys.isNotEmpty) { if (matchKeys.isNotEmpty) {
@ -63,6 +66,7 @@ class WebviewController extends GetxController {
); );
} }
} }
}
}, },
// 加载完成 // 加载完成
onUrlChange: (UrlChange urlChange) async { onUrlChange: (UrlChange urlChange) async {

View File

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

View File

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

View File

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