mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Start conversation upgrade
This commit is contained in:
@ -4,6 +4,7 @@ import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/routes/update_conversation_route.dart';
|
||||
import 'package:comunic/ui/screens/conversation_screen.dart';
|
||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -25,7 +26,7 @@ class ConversationRoute extends StatefulWidget {
|
||||
State<StatefulWidget> createState() => _ConversationRouteState();
|
||||
}
|
||||
|
||||
class _ConversationRouteState extends State<ConversationRoute> {
|
||||
class _ConversationRouteState extends SafeState<ConversationRoute> {
|
||||
final ConversationsHelper _conversationsHelper = ConversationsHelper();
|
||||
Conversation _conversation;
|
||||
String _conversationName;
|
||||
@ -42,21 +43,22 @@ class _ConversationRouteState extends State<ConversationRoute> {
|
||||
Future<void> _loadConversation() async {
|
||||
setError(false);
|
||||
|
||||
_conversation = await _conversationsHelper.getSingle(widget.conversationID,
|
||||
force: true);
|
||||
try {
|
||||
_conversation = await _conversationsHelper
|
||||
.getSingle(widget.conversationID, force: true);
|
||||
|
||||
if (_conversation == null) return setError(true);
|
||||
if (_conversation == null) return setError(true);
|
||||
|
||||
final conversationName =
|
||||
await ConversationsHelper.getConversationNameAsync(_conversation);
|
||||
final conversationName =
|
||||
await ConversationsHelper.getConversationNameAsync(_conversation);
|
||||
|
||||
if (!this.mounted) return null;
|
||||
if (!this.mounted) return null;
|
||||
|
||||
if (conversationName == null) return setError(true);
|
||||
|
||||
setState(() {
|
||||
_conversationName = conversationName;
|
||||
});
|
||||
setState(() => _conversationName = conversationName);
|
||||
} catch (e, s) {
|
||||
print("Failed to get conversation name! $e => $s");
|
||||
setError(true);
|
||||
}
|
||||
}
|
||||
|
||||
void _openSettings() {
|
||||
|
@ -42,19 +42,18 @@ class _UpdateConversationRoute extends State<UpdateConversationRoute> {
|
||||
Future<void> _loadConversation() async {
|
||||
setError(false);
|
||||
|
||||
final conversation = await ConversationsHelper()
|
||||
.getSingle(widget.conversationID, force: true);
|
||||
try {
|
||||
final conversation = await ConversationsHelper()
|
||||
.getSingle(widget.conversationID, force: true);
|
||||
|
||||
if (conversation == null) return setError(true);
|
||||
//Load information about the members of the conversation
|
||||
_membersInfo = await UsersHelper().getList(conversation.membersID);
|
||||
|
||||
//Load information about the members of the conversation
|
||||
_membersInfo = await UsersHelper().getUsersInfo(conversation.members);
|
||||
|
||||
if (_membersInfo == null) return setError(true);
|
||||
|
||||
setState(() {
|
||||
_conversation = conversation;
|
||||
});
|
||||
setState(() => _conversation = conversation);
|
||||
} catch (e, s) {
|
||||
print("Failed to load conversation information! $e=>$s");
|
||||
setError(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the body of this widget
|
||||
|
Reference in New Issue
Block a user