2019-05-02 06:09:40 +00:00
|
|
|
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';
|
2019-05-02 06:09:40 +00:00
|
|
|
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 {
|
|
|
|
final convID = await ConversationsHelper().getPrivate(userID);
|
|
|
|
|
|
|
|
if (convID == null) {
|
|
|
|
showSimpleSnack(context, tr("Could not find a private conversation!"));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open the conversation
|
2020-04-17 13:26:37 +00:00
|
|
|
MainController.of(context).openConversation(convID);
|
2019-05-02 06:09:40 +00:00
|
|
|
|
|
|
|
// Success
|
|
|
|
return true;
|
|
|
|
}
|