opt msg top

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-03 22:34:27 +08:00
parent 19cf085e3e
commit 84e24b5827
8 changed files with 86 additions and 60 deletions

View File

@@ -19,15 +19,21 @@ import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';
class MsgHttp {
static Future<LoadingState<MsgFeedReplyMe>> msgFeedReplyMe(
{int cursor = -1, int cursorTime = -1}) async {
var res = await Request().get(Api.msgFeedReply, queryParameters: {
'id': cursor == -1 ? null : cursor,
'reply_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
});
static Future<LoadingState<MsgFeedReplyMe>> msgFeedReplyMe({
int? cursor,
int? cursorTime,
}) async {
var res = await Request().get(
Api.msgFeedReply,
queryParameters: {
if (cursor != null) 'id': cursor,
if (cursorTime != null) 'reply_time': cursorTime,
'platform': 'web',
'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
},
);
if (res.data['code'] == 0) {
MsgFeedReplyMe data = MsgFeedReplyMe.fromJson(res.data['data']);
return Success(data);
@@ -37,14 +43,18 @@ class MsgHttp {
}
static Future<LoadingState<MsgFeedAtMe>> msgFeedAtMe(
{int cursor = -1, int cursorTime = -1}) async {
var res = await Request().get(Api.msgFeedAt, queryParameters: {
'id': cursor == -1 ? null : cursor,
'at_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
});
{int? cursor, int? cursorTime}) async {
var res = await Request().get(
Api.msgFeedAt,
queryParameters: {
if (cursor != null) 'id': cursor,
if (cursorTime != null) 'at_time': cursorTime,
'platform': 'web',
'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
},
);
if (res.data['code'] == 0) {
MsgFeedAtMe data = MsgFeedAtMe.fromJson(res.data['data']);
return Success(data);
@@ -54,13 +64,14 @@ class MsgHttp {
}
static Future<LoadingState<MsgFeedLikeMe>> msgFeedLikeMe(
{int cursor = -1, int cursorTime = -1}) async {
{int? cursor, int? cursorTime}) async {
var res = await Request().get(Api.msgFeedLike, queryParameters: {
'id': cursor == -1 ? null : cursor,
'like_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
if (cursor != null) 'id': cursor,
if (cursorTime != null) 'like_time': cursorTime,
'platform': 'web',
'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
});
if (res.data['code'] == 0) {
MsgFeedLikeMe data = MsgFeedLikeMe.fromJson(res.data['data']);
@@ -71,11 +82,17 @@ class MsgHttp {
}
static Future<LoadingState<List<SystemNotifyList>?>> msgFeedNotify(
{int cursor = -1, int pageSize = 20}) async {
var res = await Request().get(Api.msgSysNotify, queryParameters: {
'cursor': cursor == -1 ? null : cursor,
'page_size': pageSize,
});
{int? cursor, int pageSize = 20}) async {
var res = await Request().get(
Api.msgSysNotify,
queryParameters: {
if (cursor != null) 'cursor': cursor,
'page_size': pageSize,
'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
},
);
if (res.data['code'] == 0) {
List<SystemNotifyList>? list = (res.data['data'] as List?)
?.map((e) => SystemNotifyList.fromJson(e))

View File

@@ -5,8 +5,8 @@ import 'package:PiliPlus/pages/common/common_list_controller.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class AtMeController extends CommonListController<MsgFeedAtMe, AtMeItems> {
int cursor = -1;
int cursorTime = -1;
int? cursor;
int? cursorTime;
@override
void onInit() {
@@ -25,15 +25,15 @@ class AtMeController extends CommonListController<MsgFeedAtMe, AtMeItems> {
if (data.cursor?.isEnd == true) {
isEnd = true;
}
cursor = data.cursor?.id ?? -1;
cursorTime = data.cursor?.time ?? -1;
cursor = data.cursor?.id;
cursorTime = data.cursor?.time;
return false;
}
@override
Future<void> onRefresh() {
cursor = -1;
cursorTime = -1;
cursor = null;
cursorTime = null;
return super.onRefresh();
}

View File

@@ -83,9 +83,12 @@ class _AtMePageState extends State<AtMePage> {
return ListTile(
onTap: () {
String? nativeUri = item.item?.nativeUri;
if (nativeUri != null) {
PiliScheme.routePushFromUrl(nativeUri);
if (nativeUri == null ||
nativeUri.isEmpty ||
nativeUri.startsWith('?')) {
return;
}
PiliScheme.routePushFromUrl(nativeUri);
},
onLongPress: () => showConfirmDialog(
context: context,

View File

@@ -7,8 +7,8 @@ import 'package:PiliPlus/utils/extension.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
int cursor = -1;
int cursorTime = -1;
int? cursor;
int? cursorTime;
bool isEnd = false;
@@ -33,8 +33,8 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
data.total?.items.isNullOrEmpty == true) {
isEnd = true;
}
cursor = data.total?.cursor?.id ?? -1;
cursorTime = data.total?.cursor?.time ?? -1;
cursor = data.total?.cursor?.id;
cursorTime = data.total?.cursor?.time;
List<LikeMeItems> latest = data.latest?.items ?? [];
List<LikeMeItems> total = data.total?.items ?? [];
if (!isRefresh && loadingState.value.isSuccess) {
@@ -48,8 +48,8 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
@override
Future<void> onRefresh() {
cursor = -1;
cursorTime = -1;
cursor = null;
cursorTime = null;
return super.onRefresh();
}

View File

@@ -178,9 +178,12 @@ class _LikeMePageState extends State<LikeMePage> {
return ListTile(
onTap: () {
String? nativeUri = item.item?.nativeUri;
if (nativeUri != null) {
PiliScheme.routePushFromUrl(nativeUri);
if (nativeUri == null ||
nativeUri.isEmpty ||
nativeUri.startsWith('?')) {
return;
}
PiliScheme.routePushFromUrl(nativeUri);
},
onLongPress: () => showDialog(
context: context,

View File

@@ -6,8 +6,8 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class ReplyMeController
extends CommonListController<MsgFeedReplyMe, ReplyMeItems> {
int cursor = -1;
int cursorTime = -1;
int? cursor;
int? cursorTime;
@override
void onInit() {
@@ -26,15 +26,15 @@ class ReplyMeController
if (data.cursor?.isEnd == true) {
isEnd = true;
}
cursor = data.cursor?.id ?? -1;
cursorTime = data.cursor?.time ?? -1;
cursor = data.cursor?.id;
cursorTime = data.cursor?.time;
return false;
}
@override
Future<void> onRefresh() {
cursor = -1;
cursorTime = -1;
cursor = null;
cursorTime = null;
return super.onRefresh();
}

View File

@@ -84,13 +84,16 @@ class _ReplyMePageState extends State<ReplyMePage> {
return ListTile(
onTap: () {
String? nativeUri = item.item?.nativeUri;
if (nativeUri != null) {
PiliScheme.routePushFromUrl(
nativeUri,
businessId: item.item?.businessId,
oid: item.item?.subjectId,
);
if (nativeUri == null ||
nativeUri.isEmpty ||
nativeUri.startsWith('?')) {
return;
}
PiliScheme.routePushFromUrl(
nativeUri,
businessId: item.item?.businessId,
oid: item.item?.subjectId,
);
},
onLongPress: () => showConfirmDialog(
context: context,

View File

@@ -7,7 +7,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class SysMsgController
extends CommonListController<List<SystemNotifyList>?, SystemNotifyList> {
final pageSize = 20;
int cursor = -1;
int? cursor;
@override
void onInit() {
@@ -17,10 +17,10 @@ class SysMsgController
@override
void handleListResponse(List<SystemNotifyList> dataList) {
if (cursor == -1) {
if (cursor == null) {
msgSysUpdateCursor(dataList.first.cursor);
}
cursor = dataList.last.cursor ?? -1;
cursor = dataList.last.cursor;
if (!isEnd && dataList.length + 1 < pageSize) {
isEnd = true;
}
@@ -34,7 +34,7 @@ class SysMsgController
@override
Future<void> onRefresh() {
cursor = -1;
cursor = null;
return super.onRefresh();
}