multiple runtime bugfixes for 1.5.5+65
This commit is contained in:
@@ -39,6 +39,7 @@ class _ChatInfoState extends State<ChatInfo> {
|
||||
GetParticipantsCache(
|
||||
chatToken: widget.room.token,
|
||||
onUpdate: (GetParticipantsResponse data) {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
participants = data;
|
||||
});
|
||||
|
||||
@@ -2,14 +2,12 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:nextcloud/nextcloud.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
|
||||
|
||||
import '../../../../api/marianumcloud/talk/room/get_room_response.dart';
|
||||
import '../../../../api/marianumcloud/talk/send_message/send_message.dart';
|
||||
import '../../../../api/marianumcloud/talk/send_message/send_message_params.dart';
|
||||
import '../../../../api/marianumcloud/talk/share_files_to_chat.dart';
|
||||
import '../../../../api/marianumcloud/webdav/webdav_api.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_state.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
@@ -68,11 +66,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
Future<void> mediaUpload(List<String>? paths) async {
|
||||
if (paths == null) return;
|
||||
|
||||
unawaited(
|
||||
WebdavApi.webdav.then(
|
||||
(webdav) => webdav.mkcol(PathUri.parse('/$talkShareFolder')),
|
||||
),
|
||||
);
|
||||
unawaited(ensureTalkShareFolder());
|
||||
|
||||
if (!mounted) return;
|
||||
unawaited(
|
||||
@@ -113,6 +107,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
settings = context.read<SettingsCubit>();
|
||||
_loadDraft();
|
||||
final draftReply = settings
|
||||
.val()
|
||||
.talkSettings
|
||||
@@ -122,6 +117,24 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant ChatTextfield oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
// The state survives a room switch in the split view, so the draft has to
|
||||
// follow the new token. Every edit persists through _setDraft, so the
|
||||
// outgoing room's draft is already stored at this point.
|
||||
if (oldWidget.sendToToken != widget.sendToToken) _loadDraft();
|
||||
}
|
||||
|
||||
/// Seeds the field from the stored draft. Only ever called on mount and on a
|
||||
/// room switch: `TextEditingController.text` resets selection and composing,
|
||||
/// so doing this per build would drop the cursor position, any active text
|
||||
/// selection and a running IME composition on every chat update.
|
||||
void _loadDraft() {
|
||||
_textBoxController.text =
|
||||
settings.val().talkSettings.drafts[widget.sendToToken] ?? '';
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Defer to end-of-frame: resetting the shared notifier synchronously during
|
||||
@@ -263,8 +276,6 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_textBoxController.text =
|
||||
settings.val().talkSettings.drafts[widget.sendToToken] ?? '';
|
||||
final chatBloc = context.watch<ChatBloc>();
|
||||
final chatState = chatBloc.state.data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user