fix: msg_feed insert type error (#411)

* fix: msg_feed insert type error

* jump to dyn secondary reply
This commit is contained in:
My-Responsitories
2025-03-09 09:49:16 +08:00
committed by GitHub
parent 2f616ba237
commit 2949adbbfd
5 changed files with 29 additions and 31 deletions

View File

@@ -23,10 +23,12 @@ class AtMeController extends CommonController {
cursor = data.cursor?.id ?? -1; cursor = data.cursor?.id ?? -1;
cursorTime = data.cursor?.time ?? -1; cursorTime = data.cursor?.time ?? -1;
if (currentPage != 1 && loadingState.value is Success) { if (currentPage != 1 && loadingState.value is Success) {
data.items ??= <AtMeItems>[]; loadingState.value = LoadingState.success(
data.items!.insert(0, (loadingState.value as Success).response); (loadingState.value as Success).response as List
} ..addAll(data.items ?? <AtMeItems>[]));
} else {
loadingState.value = LoadingState.success(data.items); loadingState.value = LoadingState.success(data.items);
}
return true; return true;
} }

View File

@@ -3,7 +3,7 @@ import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/pages/common/common_controller.dart';
import 'package:PiliPlus/http/msg.dart'; import 'package:PiliPlus/http/msg.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
import '../../../models/msg/msgfeed_like_me.dart'; import 'package:PiliPlus/models/msg/msgfeed_like_me.dart';
class LikeMeController extends CommonController { class LikeMeController extends CommonController {
int cursor = -1; int cursor = -1;
@@ -24,23 +24,17 @@ class LikeMeController extends CommonController {
} }
cursor = data.total?.cursor?.id ?? -1; cursor = data.total?.cursor?.id ?? -1;
cursorTime = data.total?.cursor?.time ?? -1; cursorTime = data.total?.cursor?.time ?? -1;
List<LikeMeItems> latest = <LikeMeItems>[]; List<LikeMeItems> latest = data.latest?.items ?? [];
List<LikeMeItems> total = <LikeMeItems>[]; List<LikeMeItems> total = data.total?.items ?? [];
if (data.latest?.items?.isNotEmpty == true) {
latest.addAll(data.latest!.items!);
}
if (data.total?.items?.isNotEmpty == true) {
total.addAll(data.total!.items!);
}
if (currentPage != 1 && loadingState.value is Success) { if (currentPage != 1 && loadingState.value is Success) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair = loadingState.value = LoadingState.success((loadingState.value as Success)
(loadingState.value as Success).response; .response as Pair<List<LikeMeItems>, List<LikeMeItems>>
latest.insertAll(0, pair.first); ..first.addAll(latest)
total.insertAll(0, pair.second); ..second.addAll(total));
} else {
loadingState.value =
LoadingState.success(Pair(first: latest, second: total));
} }
loadingState.value = LoadingState.success(
Pair(first: latest, second: total),
);
return true; return true;
} }

View File

@@ -2,8 +2,7 @@ import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/pages/common/common_controller.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/http/msg.dart'; import 'package:PiliPlus/http/msg.dart';
import 'package:PiliPlus/models/msg/msgfeed_reply_me.dart';
import '../../../models/msg/msgfeed_reply_me.dart';
class ReplyMeController extends CommonController { class ReplyMeController extends CommonController {
int cursor = -1; int cursor = -1;
@@ -24,10 +23,12 @@ class ReplyMeController extends CommonController {
cursor = data.cursor?.id ?? -1; cursor = data.cursor?.id ?? -1;
cursorTime = data.cursor?.time ?? -1; cursorTime = data.cursor?.time ?? -1;
if (currentPage != 1 && loadingState.value is Success) { if (currentPage != 1 && loadingState.value is Success) {
data.items ??= <ReplyMeItems>[]; loadingState.value = LoadingState.success(
data.items!.insert(0, (loadingState.value as Success).response); (loadingState.value as Success).response as List
} ..addAll(data.items ?? <ReplyMeItems>[]));
} else {
loadingState.value = LoadingState.success(data.items); loadingState.value = LoadingState.success(data.items);
}
return true; return true;
} }

View File

@@ -185,12 +185,7 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
onTitleChanged: (controller, title) { onTitleChanged: (controller, title) {
_titleStream.add(title); _titleStream.add(title);
}, },
onCloseWindow: (controller) => Get.back( onCloseWindow: (controller) => Get.back(),
result:
_url.startsWith('https://www.bilibili.com/h5/comment/report')
? true
: null,
),
onLoadStop: (controller, url) { onLoadStop: (controller, url) {
if (url.toString().startsWith('https://live.bilibili.com')) { if (url.toString().startsWith('https://live.bilibili.com')) {
_webViewController?.evaluateJavascript( _webViewController?.evaluateJavascript(

View File

@@ -218,8 +218,10 @@ class PiliScheme {
int type = int.parse(pathSegments[1]); int type = int.parse(pathSegments[1]);
int oid = int.parse(pathSegments[2]); int oid = int.parse(pathSegments[2]);
int rootId = int.parse(pathSegments[3]); int rootId = int.parse(pathSegments[3]);
int? rpId = uri.queryParameters['anchor'] != null
? int.tryParse(uri.queryParameters['anchor']!)
: null;
// int subType = int.parse(value.queryParameters['subType'] ?? '0'); // int subType = int.parse(value.queryParameters['subType'] ?? '0');
// int rpID = int.parse(value.queryParameters['anchor'] ?? '0');
// int extraIntentId = // int extraIntentId =
// int.parse(value.queryParameters['extraIntentId'] ?? '0'); // int.parse(value.queryParameters['extraIntentId'] ?? '0');
Get.to( Get.to(
@@ -234,6 +236,9 @@ class PiliScheme {
String? enterUri = uri.queryParameters['enterUri']; String? enterUri = uri.queryParameters['enterUri'];
if (enterUri != null) { if (enterUri != null) {
routePush(Uri.parse(enterUri)); routePush(Uri.parse(enterUri));
} else {
routePush(
Uri.parse('bilibili://following/detail/$oid'));
} }
}, },
icon: const Icon(Icons.open_in_new), icon: const Icon(Icons.open_in_new),
@@ -243,6 +248,7 @@ class PiliScheme {
body: VideoReplyReplyPanel( body: VideoReplyReplyPanel(
oid: oid, oid: oid,
rpid: rootId, rpid: rootId,
id: rpId,
source: 'routePush', source: 'routePush',
replyType: ReplyType.values[type], replyType: ReplyType.values[type],
firstFloor: null, firstFloor: null,