feat: pm: share video

Closes #693

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-25 11:52:12 +08:00
parent 738cd61825
commit afe812e2be
33 changed files with 7972 additions and 111 deletions

View File

@@ -71,7 +71,7 @@ class WhisperDetailController
Future sendMsg({
required String message,
dynamic picMsg,
Map? picMsg,
required VoidCallback onClearText,
int? msgType,
int? index,
@@ -95,8 +95,11 @@ class WhisperDetailController
var result = await MsgHttp.sendMsg(
senderUid: ownerMid,
receiverId: int.parse(mid!),
content:
msgType == 5 ? message : jsonEncode(picMsg ?? {"content": message}),
content: msgType == 5
? message
: jsonEncode(
picMsg ?? {"content": message},
),
msgType: msgType ?? (picMsg != null ? 2 : 1),
);
SmartDialog.dismiss();

View File

@@ -273,7 +273,7 @@ class _WhisperDetailPageState
);
if (pickedFile != null) {
SmartDialog.showLoading(msg: '正在上传图片');
dynamic result = await MsgHttp.uploadBfs(
final result = await MsgHttp.uploadBfs(
path: pickedFile.path,
biz: 'im',
);
@@ -281,8 +281,8 @@ class _WhisperDetailPageState
String mimeType = lookupMimeType(pickedFile.path)
?.split('/')
.getOrNull(1) ??
'png';
dynamic picMsg = {
'jpg';
Map picMsg = {
'url': result['data']['image_url'],
'height': result['data']['image_height'],
'width': result['data']['image_width'],

View File

@@ -181,27 +181,38 @@ class ChatItem extends StatelessWidget {
children: [
GestureDetector(
onTap: () async {
dynamic aid = content['id'];
if (aid is String) {
aid = int.tryParse(aid);
}
dynamic bvid = content["bvid"];
if (aid == null && bvid == null) {
SmartDialog.showToast('null');
if (content['source'] == 16) {
PageUtils.viewBangumi(epId: content['id']);
return;
}
bvid ??= IdUtils.av2bv(aid);
SmartDialog.showLoading();
final int cid = await SearchHttp.ab2c(bvid: bvid);
SmartDialog.dismiss<dynamic>().then(
(e) => PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: <String, String?>{
'pic': content['thumb'],
'heroTag': Utils.makeHeroTag(bvid),
},
),
);
if (content['source'] == 5) {
dynamic aid = content['id'];
if (aid is String) {
aid = int.tryParse(aid);
}
dynamic bvid = content["bvid"];
if (aid == null && bvid == null) {
SmartDialog.showToast('null');
return;
}
bvid ??= IdUtils.av2bv(aid);
SmartDialog.showLoading();
final int cid = await SearchHttp.ab2c(bvid: bvid);
SmartDialog.dismiss<dynamic>().then(
(e) => PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: <String, String?>{
'pic': content['thumb'],
'heroTag': Utils.makeHeroTag(bvid),
},
),
);
return;
}
SmartDialog.showToast(
'unsupported source type: ${content['source']}');
},
child: NetworkImgLayer(
width: 220,