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'; import 'package:uuid/uuid.dart';
class MsgHttp { class MsgHttp {
static Future<LoadingState<MsgFeedReplyMe>> msgFeedReplyMe( static Future<LoadingState<MsgFeedReplyMe>> msgFeedReplyMe({
{int cursor = -1, int cursorTime = -1}) async { int? cursor,
var res = await Request().get(Api.msgFeedReply, queryParameters: { int? cursorTime,
'id': cursor == -1 ? null : cursor, }) async {
'reply_time': cursorTime == -1 ? null : cursorTime, var res = await Request().get(
'platform': 'android', Api.msgFeedReply,
'mobi_app': 'android', queryParameters: {
'build': '8350200', 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) { if (res.data['code'] == 0) {
MsgFeedReplyMe data = MsgFeedReplyMe.fromJson(res.data['data']); MsgFeedReplyMe data = MsgFeedReplyMe.fromJson(res.data['data']);
return Success(data); return Success(data);
@@ -37,14 +43,18 @@ class MsgHttp {
} }
static Future<LoadingState<MsgFeedAtMe>> msgFeedAtMe( static Future<LoadingState<MsgFeedAtMe>> msgFeedAtMe(
{int cursor = -1, int cursorTime = -1}) async { {int? cursor, int? cursorTime}) async {
var res = await Request().get(Api.msgFeedAt, queryParameters: { var res = await Request().get(
'id': cursor == -1 ? null : cursor, Api.msgFeedAt,
'at_time': cursorTime == -1 ? null : cursorTime, queryParameters: {
'platform': 'android', if (cursor != null) 'id': cursor,
'mobi_app': 'android', if (cursorTime != null) 'at_time': cursorTime,
'build': '8350200', 'platform': 'web',
}); 'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
},
);
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
MsgFeedAtMe data = MsgFeedAtMe.fromJson(res.data['data']); MsgFeedAtMe data = MsgFeedAtMe.fromJson(res.data['data']);
return Success(data); return Success(data);
@@ -54,13 +64,14 @@ class MsgHttp {
} }
static Future<LoadingState<MsgFeedLikeMe>> msgFeedLikeMe( 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: { var res = await Request().get(Api.msgFeedLike, queryParameters: {
'id': cursor == -1 ? null : cursor, if (cursor != null) 'id': cursor,
'like_time': cursorTime == -1 ? null : cursorTime, if (cursorTime != null) 'like_time': cursorTime,
'platform': 'android', 'platform': 'web',
'mobi_app': 'android', 'mobi_app': 'web',
'build': '8350200', 'build': 0,
'web_location': 333.40164,
}); });
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
MsgFeedLikeMe data = MsgFeedLikeMe.fromJson(res.data['data']); MsgFeedLikeMe data = MsgFeedLikeMe.fromJson(res.data['data']);
@@ -71,11 +82,17 @@ class MsgHttp {
} }
static Future<LoadingState<List<SystemNotifyList>?>> msgFeedNotify( static Future<LoadingState<List<SystemNotifyList>?>> msgFeedNotify(
{int cursor = -1, int pageSize = 20}) async { {int? cursor, int pageSize = 20}) async {
var res = await Request().get(Api.msgSysNotify, queryParameters: { var res = await Request().get(
'cursor': cursor == -1 ? null : cursor, Api.msgSysNotify,
'page_size': pageSize, queryParameters: {
}); if (cursor != null) 'cursor': cursor,
'page_size': pageSize,
'mobi_app': 'web',
'build': 0,
'web_location': 333.40164,
},
);
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
List<SystemNotifyList>? list = (res.data['data'] as List?) List<SystemNotifyList>? list = (res.data['data'] as List?)
?.map((e) => SystemNotifyList.fromJson(e)) ?.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'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class AtMeController extends CommonListController<MsgFeedAtMe, AtMeItems> { class AtMeController extends CommonListController<MsgFeedAtMe, AtMeItems> {
int cursor = -1; int? cursor;
int cursorTime = -1; int? cursorTime;
@override @override
void onInit() { void onInit() {
@@ -25,15 +25,15 @@ class AtMeController extends CommonListController<MsgFeedAtMe, AtMeItems> {
if (data.cursor?.isEnd == true) { if (data.cursor?.isEnd == true) {
isEnd = true; isEnd = true;
} }
cursor = data.cursor?.id ?? -1; cursor = data.cursor?.id;
cursorTime = data.cursor?.time ?? -1; cursorTime = data.cursor?.time;
return false; return false;
} }
@override @override
Future<void> onRefresh() { Future<void> onRefresh() {
cursor = -1; cursor = null;
cursorTime = -1; cursorTime = null;
return super.onRefresh(); return super.onRefresh();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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