mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-30 00:36:28 +00:00
32 lines
849 B
Dart
32 lines
849 B
Dart
|
import 'package:comunic/helpers/conversations_helper.dart';
|
||
|
import 'package:comunic/ui/routes/conversation_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 {
|
||
|
final convID = await ConversationsHelper().getPrivate(userID);
|
||
|
|
||
|
if (convID == null) {
|
||
|
showSimpleSnack(context, tr("Could not find a private conversation!"));
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
// Open the conversation
|
||
|
Navigator.of(context).push(
|
||
|
MaterialPageRoute(
|
||
|
builder: (c) => ConversationRoute(
|
||
|
conversationID: convID,
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
|
||
|
// Success
|
||
|
return true;
|
||
|
}
|