mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: pm: share video
Closes #693 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user