fix: push bilibili://following/detail

related #576

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-31 14:51:10 +08:00
parent acb6bc569e
commit 5929150047
3 changed files with 69 additions and 63 deletions

View File

@@ -6,8 +6,7 @@ class MsgFeedReplyMe {
MsgFeedReplyMe({this.cursor, this.items, this.lastViewAt}); MsgFeedReplyMe({this.cursor, this.items, this.lastViewAt});
MsgFeedReplyMe.fromJson(Map<String, dynamic> json) { MsgFeedReplyMe.fromJson(Map<String, dynamic> json) {
cursor = cursor = json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
if (json['items'] != null) { if (json['items'] != null) {
items = <ReplyMeItems>[]; items = <ReplyMeItems>[];
json['items'].forEach((v) { json['items'].forEach((v) {
@@ -56,13 +55,14 @@ class ReplyMeItems {
int? isMulti; int? isMulti;
int? replyTime; int? replyTime;
ReplyMeItems( ReplyMeItems({
{this.id, this.id,
this.user, this.user,
this.item, this.item,
this.counts, this.counts,
this.isMulti, this.isMulti,
this.replyTime}); this.replyTime,
});
ReplyMeItems.fromJson(Map<String, dynamic> json) { ReplyMeItems.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@@ -99,11 +99,11 @@ class User {
User( User(
{this.mid, {this.mid,
this.fans, this.fans,
this.nickname, this.nickname,
this.avatar, this.avatar,
this.midLink, this.midLink,
this.follow}); this.follow});
User.fromJson(Map<String, dynamic> json) { User.fromJson(Map<String, dynamic> json) {
mid = json['mid']; mid = json['mid'];
@@ -153,28 +153,28 @@ class Item {
Item( Item(
{this.subjectId, {this.subjectId,
this.rootId, this.rootId,
this.sourceId, this.sourceId,
this.targetId, this.targetId,
this.type, this.type,
this.businessId, this.businessId,
this.business, this.business,
this.title, this.title,
this.desc, this.desc,
this.image, this.image,
this.uri, this.uri,
this.nativeUri, this.nativeUri,
this.detailTitle, this.detailTitle,
this.rootReplyContent, this.rootReplyContent,
this.sourceContent, this.sourceContent,
this.targetReplyContent, this.targetReplyContent,
this.atDetails, this.atDetails,
this.topicDetails, this.topicDetails,
this.hideReplyButton, this.hideReplyButton,
this.hideLikeButton, this.hideLikeButton,
this.likeState, this.likeState,
this.danmu, this.danmu,
this.message}); this.message});
Item.fromJson(Map<String, dynamic> json) { Item.fromJson(Map<String, dynamic> json) {
subjectId = json['subject_id']; subjectId = json['subject_id'];
@@ -246,11 +246,11 @@ class AtDetails {
AtDetails( AtDetails(
{this.mid, {this.mid,
this.fans, this.fans,
this.nickname, this.nickname,
this.avatar, this.avatar,
this.midLink, this.midLink,
this.follow}); this.follow});
AtDetails.fromJson(Map<String, dynamic> json) { AtDetails.fromJson(Map<String, dynamic> json) {
mid = json['mid']; mid = json['mid'];

View File

@@ -1,6 +1,7 @@
import 'package:PiliPlus/common/widgets/loading_widget.dart'; import 'package:PiliPlus/common/widgets/loading_widget.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/msg/msgfeed_reply_me.dart';
import 'package:PiliPlus/utils/utils.dart'; import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -46,29 +47,31 @@ class _ReplyMePageState extends State<ReplyMePage> {
_replyMeController.onLoadMore(); _replyMeController.onLoadMore();
} }
ReplyMeItems item = loadingState.response[index];
return ListTile( return ListTile(
onTap: () { onTap: () {
String? nativeUri = String? nativeUri = item.item?.nativeUri;
loadingState.response[index].item?.nativeUri;
if (nativeUri != null) { if (nativeUri != null) {
PiliScheme.routePushFromUrl(nativeUri); PiliScheme.routePushFromUrl(
nativeUri,
businessId: item.item?.businessId,
);
} }
}, },
leading: GestureDetector( leading: GestureDetector(
onTap: () { onTap: () {
Get.toNamed( Get.toNamed('/member?mid=${item.user?.mid}');
'/member?mid=${loadingState.response[index].user?.mid}');
}, },
child: NetworkImgLayer( child: NetworkImgLayer(
width: 45, width: 45,
height: 45, height: 45,
type: 'avatar', type: 'avatar',
src: loadingState.response[index].user?.avatar, src: item.user?.avatar,
), ),
), ),
title: Text( title: Text(
"${loadingState.response[index].user?.nickname} " "${item.user?.nickname}${item.isMulti == 1 ? '等人' : ''} "
"回复了我的${loadingState.response[index].item?.business}", "回复了我的${item.item?.business} ${item.isMulti == 1 ? ',共${item.counts}条' : ''}",
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.bodyMedium! .bodyMedium!
@@ -79,9 +82,7 @@ class _ReplyMePageState extends State<ReplyMePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(item.item?.sourceContent ?? "",
loadingState.response[index].item?.sourceContent ??
"",
style: Theme.of(context).textTheme.bodyMedium), style: Theme.of(context).textTheme.bodyMedium),
const SizedBox(height: 4), const SizedBox(height: 4),
if (loadingState if (loadingState
@@ -90,8 +91,7 @@ class _ReplyMePageState extends State<ReplyMePage> {
loadingState loadingState
.response[index].item?.targetReplyContent != .response[index].item?.targetReplyContent !=
"") "")
Text( Text("| ${item.item?.targetReplyContent}",
"| ${loadingState.response[index].item?.targetReplyContent}",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context) style: Theme.of(context)
@@ -101,12 +101,9 @@ class _ReplyMePageState extends State<ReplyMePage> {
color: color:
Theme.of(context).colorScheme.outline, Theme.of(context).colorScheme.outline,
height: 1.5)), height: 1.5)),
if (loadingState.response[index].item?.rootReplyContent != if (item.item?.rootReplyContent != null &&
null && item.item?.rootReplyContent != "")
loadingState.response[index].item?.rootReplyContent != Text(" | ${item.item?.rootReplyContent}",
"")
Text(
" | ${loadingState.response[index].item?.rootReplyContent}",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context) style: Theme.of(context)
@@ -117,8 +114,7 @@ class _ReplyMePageState extends State<ReplyMePage> {
Theme.of(context).colorScheme.outline, Theme.of(context).colorScheme.outline,
height: 1.5)), height: 1.5)),
Text( Text(
Utils.dateFormat( Utils.dateFormat(item.replyTime),
loadingState.response[index].replyTime),
style: Theme.of(context).textTheme.bodyMedium!.copyWith( style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),

View File

@@ -35,6 +35,7 @@ class PiliScheme {
bool selfHandle = false, bool selfHandle = false,
bool off = false, bool off = false,
Map? parameters, Map? parameters,
int? businessId,
}) async { }) async {
try { try {
if (url.startsWith('//')) { if (url.startsWith('//')) {
@@ -47,6 +48,7 @@ class PiliScheme {
selfHandle: selfHandle, selfHandle: selfHandle,
off: off, off: off,
parameters: parameters, parameters: parameters,
businessId: businessId,
); );
} catch (_) { } catch (_) {
return false; return false;
@@ -59,6 +61,7 @@ class PiliScheme {
bool selfHandle = false, bool selfHandle = false,
bool off = false, bool off = false,
Map? parameters, Map? parameters,
int? businessId,
}) async { }) async {
final String scheme = uri.scheme; final String scheme = uri.scheme;
final String host = uri.host.toLowerCase(); final String host = uri.host.toLowerCase();
@@ -273,9 +276,14 @@ class PiliScheme {
), ),
); );
return true; return true;
} else if (path.startsWith("/msg_fold/")) {
// bilibili://comment/msg_fold/1/22222/33333/11111/?enterUri=bilibili://video/22222
// bilibili://comment/msg_fold/11/22222/33333/11111/?enterUri=bilibili://following/detail/44444
} }
return false; return false;
case 'following': case 'following':
// bilibili://following/detail/832703053858603029
// bilibili://following/detail/12345678?comment_root_id=654321\u0026comment_on=1
if (path.startsWith("/detail/")) { if (path.startsWith("/detail/")) {
final queryParameters = uri.queryParameters; final queryParameters = uri.queryParameters;
final commentRootId = queryParameters['comment_root_id']; final commentRootId = queryParameters['comment_root_id'];
@@ -302,7 +310,9 @@ class PiliScheme {
oid: int.parse(oid), oid: int.parse(oid),
rpid: rpid, rpid: rpid,
source: 'routePush', source: 'routePush',
replyType: ReplyType.dynamics, replyType: businessId != null
? ReplyType.values[businessId]
: ReplyType.dynamics,
firstFloor: null, firstFloor: null,
id: queryParameters['comment_secondary_id'] != null id: queryParameters['comment_secondary_id'] != null
? int.tryParse( ? int.tryParse(