🐛 Bug fixes on live stream post

This commit is contained in:
LittleSheep 2025-04-07 00:49:43 +08:00
parent ce3d19fb7b
commit cb0986efee
2 changed files with 9 additions and 14 deletions

View File

@ -243,9 +243,13 @@ class PostWriteController extends ChangeNotifier {
contentController.text = post.body['content'] ?? ''; contentController.text = post.body['content'] ?? '';
aliasController.text = post.alias ?? ''; aliasController.text = post.alias ?? '';
rewardController.text = post.body['reward']?.toString() ?? ''; rewardController.text = post.body['reward']?.toString() ?? '';
videoAttachment = post.body['video'] != null if (post.body['video'] != null) {
? SnAttachment.fromJson(post.body['video']) if (post.body['video'] is String) {
: null; videoUrl = post.body['video'];
} else {
videoAttachment = SnAttachment.fromJson(post.body['video']);
}
}
publishedAt = post.publishedAt; publishedAt = post.publishedAt;
publishedUntil = post.publishedUntil; publishedUntil = post.publishedUntil;
visibleUsers = List.from(post.visibleUsersList ?? [], growable: true); visibleUsers = List.from(post.visibleUsersList ?? [], growable: true);
@ -264,6 +268,7 @@ class PostWriteController extends ChangeNotifier {
); );
poll = post.poll; poll = post.poll;
videoLive = post.body['is_live'] ?? false;
editingDraft = post.isDraft; editingDraft = post.isDraft;
if (post.body['thumbnail'] != null) { if (post.body['thumbnail'] != null) {
@ -604,6 +609,7 @@ class PostWriteController extends ChangeNotifier {
'video': videoUrl.isNotEmpty ? videoUrl : videoAttachment!.rid, 'video': videoUrl.isNotEmpty ? videoUrl : videoAttachment!.rid,
if (poll != null) 'poll': poll!.id, if (poll != null) 'poll': poll!.id,
if (realm != null) 'realm': realm!.id, if (realm != null) 'realm': realm!.id,
if (videoLive) 'is_live': videoLive,
'is_draft': saveAsDraft, 'is_draft': saveAsDraft,
}, },
onSendProgress: (count, total) { onSendProgress: (count, total) {

View File

@ -1118,8 +1118,6 @@ class _PostVideoEditor extends StatefulWidget {
} }
class _PostVideoEditorState extends State<_PostVideoEditor> { class _PostVideoEditorState extends State<_PostVideoEditor> {
String? _renderer;
final TextEditingController _streamUrlController = TextEditingController(); final TextEditingController _streamUrlController = TextEditingController();
void _selectVideo() async { void _selectVideo() async {
@ -1296,15 +1294,6 @@ class _PostVideoEditorState extends State<_PostVideoEditor> {
onChanged: (value) => onChanged: (value) =>
widget.controller.setVideoLive(value ?? false), widget.controller.setVideoLive(value ?? false),
), ),
CheckboxListTile(
secondary: const Icon(Symbols.web),
title: Text('postVideoRendererWeb').tr(),
subtitle: Text('postVideoRendererWebDescription').tr(),
value: _renderer == 'web',
onChanged: (value) => setState(
() => _renderer = (value ?? false) ? 'web' : null,
),
),
], ],
), ),
), ),