mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: reply message
opt: pm share Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -648,7 +648,7 @@ class _ArticlePageState extends State<ArticlePage>
|
|||||||
children: [
|
children: [
|
||||||
Icon(Icons.forward_to_inbox, size: 19),
|
Icon(Icons.forward_to_inbox, size: 19),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Text('分享至动态'),
|
Text('分享至消息'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -246,7 +246,14 @@ class _HistoryPageState extends State<HistoryPage>
|
|||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
controller: _historyController.scrollController,
|
controller: _historyController.scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
Obx(() => _buildBody(_historyController.loadingState.value)),
|
SliverPadding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: StyleString.safeSpace - 5,
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 80,
|
||||||
|
),
|
||||||
|
sliver:
|
||||||
|
Obx(() => _buildBody(_historyController.loadingState.value)),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -263,29 +270,23 @@ class _HistoryPageState extends State<HistoryPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Success() => loadingState.response?.isNotEmpty == true
|
Success() => loadingState.response?.isNotEmpty == true
|
||||||
? SliverPadding(
|
? SliverGrid(
|
||||||
padding: EdgeInsets.only(
|
gridDelegate: Grid.videoCardHDelegate(context),
|
||||||
top: StyleString.safeSpace - 5,
|
delegate: SliverChildBuilderDelegate(
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 80,
|
(context, index) {
|
||||||
),
|
if (index == loadingState.response!.length - 1) {
|
||||||
sliver: SliverGrid(
|
_historyController.onLoadMore();
|
||||||
gridDelegate: Grid.videoCardHDelegate(context),
|
}
|
||||||
delegate: SliverChildBuilderDelegate(
|
final item = loadingState.response![index];
|
||||||
(context, index) {
|
return HistoryItem(
|
||||||
if (index == loadingState.response!.length - 1) {
|
videoItem: item,
|
||||||
_historyController.onLoadMore();
|
ctr: _historyController.baseCtr,
|
||||||
}
|
onChoose: () => _historyController.onSelect(index),
|
||||||
final item = loadingState.response![index];
|
onDelete: (kid, business) =>
|
||||||
return HistoryItem(
|
_historyController.delHistory(item),
|
||||||
videoItem: item,
|
);
|
||||||
ctr: _historyController.baseCtr,
|
},
|
||||||
onChoose: () => _historyController.onSelect(index),
|
childCount: loadingState.response!.length,
|
||||||
onDelete: (kid, business) =>
|
|
||||||
_historyController.delHistory(item),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
childCount: loadingState.response!.length,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: HttpError(
|
: HttpError(
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import 'package:PiliPlus/utils/feed_back.dart';
|
|||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:PiliPlus/utils/url_utils.dart';
|
import 'package:PiliPlus/utils/url_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:html/parser.dart' show parse;
|
|
||||||
|
|
||||||
class ReplyItemGrpc extends StatelessWidget {
|
class ReplyItemGrpc extends StatelessWidget {
|
||||||
const ReplyItemGrpc({
|
const ReplyItemGrpc({
|
||||||
@@ -618,7 +617,6 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
message = message.replaceAll(RegExp(r"\{vote:\d+?\}"), "");
|
message = message.replaceAll(RegExp(r"\{vote:\d+?\}"), "");
|
||||||
}
|
}
|
||||||
message = parse(message).body?.text ?? message;
|
|
||||||
// 构建正则表达式
|
// 构建正则表达式
|
||||||
final List<String> specialTokens = [
|
final List<String> specialTokens = [
|
||||||
...content.emote.keys,
|
...content.emote.keys,
|
||||||
|
|||||||
@@ -43,12 +43,11 @@ class RequestUtils {
|
|||||||
required int receiverId,
|
required int receiverId,
|
||||||
required Map content,
|
required Map content,
|
||||||
String? message,
|
String? message,
|
||||||
ValueChanged<bool>? callback,
|
|
||||||
}) async {
|
}) async {
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
|
|
||||||
final ownerMid = Accounts.main.mid;
|
final ownerMid = Accounts.main.mid;
|
||||||
final videoRes = await GrpcRepo.sendMsg(
|
final contentRes = await GrpcRepo.sendMsg(
|
||||||
senderUid: ownerMid,
|
senderUid: ownerMid,
|
||||||
receiverId: receiverId,
|
receiverId: receiverId,
|
||||||
content: jsonEncode(content),
|
content: jsonEncode(content),
|
||||||
@@ -57,26 +56,26 @@ class RequestUtils {
|
|||||||
: MsgType.EN_MSG_TYPE_SHARE_V2,
|
: MsgType.EN_MSG_TYPE_SHARE_V2,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (videoRes['status']) {
|
if (contentRes['status']) {
|
||||||
if (message?.isNotEmpty == true) {
|
if (message?.isNotEmpty == true) {
|
||||||
var textRes = await MsgHttp.sendMsg(
|
var msgRes = await MsgHttp.sendMsg(
|
||||||
senderUid: ownerMid,
|
senderUid: ownerMid,
|
||||||
receiverId: receiverId,
|
receiverId: receiverId,
|
||||||
content: jsonEncode({"content": message}),
|
content: jsonEncode({"content": message}),
|
||||||
msgType: 1,
|
msgType: 1,
|
||||||
);
|
);
|
||||||
Get.back();
|
Get.back();
|
||||||
if (textRes['status']) {
|
if (msgRes['status']) {
|
||||||
SmartDialog.showToast('分享成功');
|
SmartDialog.showToast('分享成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('视频分享成功,但消息分享失败: ${textRes['msg']}');
|
SmartDialog.showToast('内容分享成功,但消息分享失败: ${msgRes['msg']}');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast('分享成功');
|
SmartDialog.showToast('分享成功');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('分享失败: ${videoRes['msg']}');
|
SmartDialog.showToast('分享失败: ${contentRes['msg']}');
|
||||||
}
|
}
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user