1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00
comunicmobile/lib/utils/conversations_utils.dart

26 lines
816 B
Dart
Raw Normal View History

import 'package:comunic/helpers/conversations_helper.dart';
2020-05-05 11:21:37 +00:00
import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
/// Conversations utilities
///
/// @author Pierre HUBERT
/// Open a private conversation with a given [userID]
Future<bool> openPrivateConversation(BuildContext context, int? userID) async {
2021-03-10 16:54:41 +00:00
try {
final convID = await ConversationsHelper().getPrivate(userID);
2021-03-10 16:54:41 +00:00
// Open the conversation
MainController.of(context)!.openConversationById(convID);
2021-03-10 16:54:41 +00:00
return true;
} catch (e, s) {
print("Failed to find private conversation! $e => $s");
showSimpleSnack(context, tr("Could not find a private conversation!")!);
return false;
}
}