Video post

This commit is contained in:
2025-02-10 00:44:52 +08:00
parent dad869967e
commit 7ed508e2bb
17 changed files with 345 additions and 76 deletions

View File

@ -145,6 +145,7 @@ class PostWriteController extends ChangeNotifier {
'stories': 'writePostTypeStory',
'articles': 'writePostTypeArticle',
'questions': 'writePostTypeQuestion',
'videos': 'writePostTypeVideo',
};
static const kAttachmentProgressWeight = 0.9;
@ -197,6 +198,7 @@ class PostWriteController extends ChangeNotifier {
PostWriteMedia? thumbnail;
List<PostWriteMedia> attachments = List.empty(growable: true);
DateTime? publishedAt, publishedUntil;
SnAttachment? videoAttachment;
Future<void> fetchRelatedPost(
BuildContext context, {
@ -507,6 +509,7 @@ class PostWriteController extends ChangeNotifier {
if (replyingPost != null) 'reply_to': replyingPost!.id,
if (repostingPost != null) 'repost_to': repostingPost!.id,
if (reward != null) 'reward': reward,
if (videoAttachment != null) 'video': videoAttachment!.rid,
},
onSendProgress: (count, total) {
progress = baseProgressVal + (count / total) * (kPostingProgressWeight / 2);
@ -633,6 +636,11 @@ class PostWriteController extends ChangeNotifier {
notifyListeners();
}
void setVideoAttachment(SnAttachment? value) {
videoAttachment = value;
notifyListeners();
}
void reset() {
publishedAt = null;
publishedUntil = null;