opt: pm share

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-26 10:26:16 +08:00
parent b8d2ff7e9b
commit 0bdf620c2f
9 changed files with 210 additions and 134 deletions

View File

@@ -28,17 +28,9 @@ import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
class PageUtils {
static void pmShareVideo({
String? author,
required int id,
required int source,
required String cover,
required String title,
String? bvid,
String? url,
int? authorId,
String? sourceDesc,
}) async {
static void pmShare({required Map content}) async {
// debugPrint(content.toString());
List<UserModel> userList = <UserModel>[];
final shareListRes = await GrpcRepo.shareList(size: 3);
@@ -64,16 +56,8 @@ class PageUtils {
showModalBottomSheet(
context: Get.context!,
builder: (context) => ShareVideoPanel(
author: author,
id: id,
source: source,
cover: cover,
title: title,
bvid: bvid,
url: url,
authorId: authorId,
sourceDesc: sourceDesc,
builder: (context) => SharePanel(
content: content,
userList: userList,
),
useSafeArea: true,

View File

@@ -39,17 +39,9 @@ class RequestUtils {
// 16番剧id 为 epid
// 17番剧
// https://github.com/SocialSisterYi/bilibili-API-collect/tree/master/docs/message/private_msg_content.md
static Future pmShareVideo({
static Future pmShare({
required int receiverId,
String? author,
required int id,
required int source,
required String cover,
required String title,
String? bvid,
String? url,
int? authorId,
String? sourceDesc,
required Map content,
String? message,
ValueChanged<bool>? callback,
}) async {
@@ -59,22 +51,10 @@ class RequestUtils {
final videoRes = await GrpcRepo.sendMsg(
senderUid: ownerMid,
receiverId: receiverId,
content: jsonEncode(
{
if (author != null) "author": author,
"headline": title,
"id": id,
"source": source,
"thumb": cover,
"title": title,
if (bvid != null) "bvid": bvid,
// pgc
if (url != null) "url": url,
if (authorId != null) "author_id": authorId,
if (sourceDesc != null) "source_desc": sourceDesc,
},
),
msgType: MsgType.EN_MSG_TYPE_SHARE_V2,
content: jsonEncode(content),
msgType: content['source'] is String
? MsgType.EN_MSG_TYPE_COMMON_SHARE_CARD
: MsgType.EN_MSG_TYPE_SHARE_V2,
);
if (videoRes['status']) {