mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: repost video
Closes #279 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -144,11 +144,13 @@ class MsgHttp {
|
|||||||
|
|
||||||
static Future createDynamic({
|
static Future createDynamic({
|
||||||
dynamic mid,
|
dynamic mid,
|
||||||
dynamic dynIdStr, // repost
|
dynamic dynIdStr, // repost dyn
|
||||||
|
dynamic rid, // repost video
|
||||||
|
dynamic dynType,
|
||||||
dynamic rawText,
|
dynamic rawText,
|
||||||
List? pics,
|
List? pics,
|
||||||
int? publishTime,
|
int? publishTime,
|
||||||
ReplyOption replyOption = ReplyOption.allow,
|
ReplyOption? replyOption,
|
||||||
int? privatePub,
|
int? privatePub,
|
||||||
}) async {
|
}) async {
|
||||||
String csrf = await Request.getCsrf();
|
String csrf = await Request.getCsrf();
|
||||||
@@ -171,13 +173,17 @@ class MsgHttp {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
if (dynIdStr == null)
|
if (replyOption != null || publishTime != null)
|
||||||
"option": {
|
"option": {
|
||||||
if (publishTime != null) "timer_pub_time": publishTime,
|
if (publishTime != null) "timer_pub_time": publishTime,
|
||||||
if (replyOption == ReplyOption.close) "close_comment": 1,
|
if (replyOption == ReplyOption.close)
|
||||||
if (replyOption == ReplyOption.choose) "up_choose_comment": 1,
|
"close_comment": 1
|
||||||
|
else if (replyOption == ReplyOption.choose)
|
||||||
|
"up_choose_comment": 1,
|
||||||
},
|
},
|
||||||
"scene": dynIdStr != null
|
"scene": rid != null
|
||||||
|
? 5
|
||||||
|
: dynIdStr != null
|
||||||
? 4
|
? 4
|
||||||
: pics != null
|
: pics != null
|
||||||
? 2
|
? 2
|
||||||
@@ -189,12 +195,20 @@ class MsgHttp {
|
|||||||
if (pics != null) 'pics': pics,
|
if (pics != null) 'pics': pics,
|
||||||
"attach_card": null,
|
"attach_card": null,
|
||||||
"upload_id":
|
"upload_id":
|
||||||
"${mid}_${DateTime.now().millisecondsSinceEpoch ~/ 1000}_${Random().nextInt(9000) + 1000}",
|
"${rid != null ? 0 : mid}_${DateTime.now().millisecondsSinceEpoch ~/ 1000}_${Random().nextInt(9000) + 1000}",
|
||||||
"meta": {
|
"meta": {
|
||||||
"app_meta": {"from": "create.dynamic.web", "mobi_app": "web"}
|
"app_meta": {"from": "create.dynamic.web", "mobi_app": "web"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
if (dynIdStr != null) "web_repost_src": {"dyn_id_str": dynIdStr}
|
if (dynIdStr != null || rid != null)
|
||||||
|
"web_repost_src": {
|
||||||
|
if (dynIdStr != null) "dyn_id_str": dynIdStr,
|
||||||
|
if (rid != null)
|
||||||
|
"revs_id": {
|
||||||
|
"dyn_type": dynType,
|
||||||
|
"rid": rid,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/http/init.dart';
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/user.dart';
|
import 'package:PiliPlus/http/user.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_controller.dart';
|
import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||||
|
import 'package:PiliPlus/pages/dynamics/repost_dyn_panel.dart';
|
||||||
import 'package:PiliPlus/pages/video/detail/introduction/controller.dart';
|
import 'package:PiliPlus/pages/video/detail/introduction/controller.dart';
|
||||||
import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart';
|
import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
@@ -398,6 +399,43 @@ class BangumiIntroController extends CommonController {
|
|||||||
Share.share(videoUrl);
|
Share.share(videoUrl);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text(
|
||||||
|
'分享至动态',
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
useSafeArea: true,
|
||||||
|
builder: (context) => RepostPanel(
|
||||||
|
rid: epId,
|
||||||
|
/**
|
||||||
|
* 1:番剧 // 4097
|
||||||
|
2:电影 // 4098
|
||||||
|
3:纪录片 // 4101
|
||||||
|
4:国创 // 4100
|
||||||
|
5:电视剧 // 4099
|
||||||
|
6:漫画
|
||||||
|
7:综艺 // 4099
|
||||||
|
*/
|
||||||
|
dynType: switch (Get.parameters['type']) {
|
||||||
|
'1' => 4097,
|
||||||
|
'2' => 4098,
|
||||||
|
'3' => 4101,
|
||||||
|
'4' => 4100,
|
||||||
|
'5' || '7' => 4099,
|
||||||
|
_ => -1,
|
||||||
|
},
|
||||||
|
pic: bangumiItem?.cover,
|
||||||
|
title: bangumiItem?.title,
|
||||||
|
uname: '',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,20 +14,37 @@ import 'package:get/get.dart';
|
|||||||
class RepostPanel extends CommonPublishPage {
|
class RepostPanel extends CommonPublishPage {
|
||||||
const RepostPanel({
|
const RepostPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.item,
|
this.item,
|
||||||
required this.callback,
|
this.callback,
|
||||||
|
// video
|
||||||
|
this.rid,
|
||||||
|
this.dynType,
|
||||||
|
this.pic,
|
||||||
|
this.title,
|
||||||
|
this.uname,
|
||||||
|
this.isMax,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// video
|
||||||
|
final int? rid;
|
||||||
|
final int? dynType;
|
||||||
|
final String? pic;
|
||||||
|
final String? title;
|
||||||
|
final String? uname;
|
||||||
|
final bool? isMax;
|
||||||
|
|
||||||
final dynamic item;
|
final dynamic item;
|
||||||
final Function callback;
|
final VoidCallback? callback;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RepostPanel> createState() => _RepostPanelState();
|
State<RepostPanel> createState() => _RepostPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
||||||
bool _isMax = false;
|
late bool _isMax = widget.isMax ?? false;
|
||||||
late final dynamic _pic = (widget.item as DynamicItemModel?)
|
|
||||||
|
late final dynamic _pic = widget.pic ??
|
||||||
|
(widget.item as DynamicItemModel?)
|
||||||
?.modules
|
?.modules
|
||||||
?.moduleDynamic
|
?.moduleDynamic
|
||||||
?.major
|
?.major
|
||||||
@@ -47,7 +64,9 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
?.pics
|
?.pics
|
||||||
?.firstOrNull
|
?.firstOrNull
|
||||||
?.url;
|
?.url;
|
||||||
late final _text = (widget.item as DynamicItemModel?)
|
|
||||||
|
late final _text = widget.title ??
|
||||||
|
(widget.item as DynamicItemModel?)
|
||||||
?.modules
|
?.modules
|
||||||
?.moduleDynamic
|
?.moduleDynamic
|
||||||
?.major
|
?.major
|
||||||
@@ -69,6 +88,9 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
?.title ??
|
?.title ??
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
late final _uname = widget.uname ??
|
||||||
|
(widget.item as DynamicItemModel?)?.modules?.moduleAuthor?.name;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
try {
|
try {
|
||||||
@@ -139,6 +161,7 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (_pic != null) ...[
|
if (_pic != null) ...[
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
@@ -154,8 +177,9 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (_uname?.isNotEmpty == true)
|
||||||
Text(
|
Text(
|
||||||
'@${(widget.item as DynamicItemModel?)?.modules?.moduleAuthor?.name}',
|
'@$_uname',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
@@ -353,13 +377,15 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
|||||||
Future onCustomPublish({required String message, List? pictures}) async {
|
Future onCustomPublish({required String message, List? pictures}) async {
|
||||||
dynamic result = await MsgHttp.createDynamic(
|
dynamic result = await MsgHttp.createDynamic(
|
||||||
mid: GStorage.userInfo.get('userInfoCache')?.mid,
|
mid: GStorage.userInfo.get('userInfoCache')?.mid,
|
||||||
dynIdStr: widget.item.idStr,
|
dynIdStr: widget.item?.idStr,
|
||||||
|
rid: widget.rid,
|
||||||
|
dynType: widget.dynType,
|
||||||
rawText: editController.text,
|
rawText: editController.text,
|
||||||
);
|
);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast('转发成功');
|
SmartDialog.showToast('转发成功');
|
||||||
widget.callback();
|
widget.callback?.call();
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(result['msg']);
|
SmartDialog.showToast(result['msg']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/member.dart';
|
import 'package:PiliPlus/http/member.dart';
|
||||||
|
import 'package:PiliPlus/pages/dynamics/repost_dyn_panel.dart';
|
||||||
import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart';
|
import 'package:PiliPlus/pages/video/detail/introduction/pay_coins_page.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
@@ -503,6 +504,27 @@ class VideoIntroController extends GetxController
|
|||||||
' - $videoUrl');
|
' - $videoUrl');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text(
|
||||||
|
'分享至动态',
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
useSafeArea: true,
|
||||||
|
builder: (context) => RepostPanel(
|
||||||
|
rid: videoDetail.value.aid,
|
||||||
|
dynType: 8,
|
||||||
|
pic: videoDetail.value.pic,
|
||||||
|
title: videoDetail.value.title,
|
||||||
|
uname: videoDetail.value.owner?.name,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user