Приложение на флаторе, настройки

This commit is contained in:
Халимов Рустам
2026-05-13 17:21:37 +03:00
parent 89e325556c
commit e8161d23d4
119 changed files with 18469 additions and 0 deletions
@@ -0,0 +1,13 @@
import '../../../../core/errors/result.dart';
import '../../domain/entities/chat.dart';
import '../../domain/entities/message.dart';
abstract class ChatLocalDataSource {
Future<Result<List<Chat>>> getCachedChats();
Future<Result<void>> cacheChats(List<Chat> chats);
Future<Result<Chat>> getChatFromCache(String chatId);
Future<Result<void>> cacheChat(Chat chat);
Future<Result<List<Message>>> getMessagesFromCache(String chatId);
Future<Result<void>> cacheMessages(String chatId, List<Message> messages);
Future<Result<void>> clearCache();
}
@@ -0,0 +1,12 @@
import '../../../../core/errors/result.dart';
import '../../domain/entities/chat.dart';
import '../../domain/entities/message.dart';
abstract class ChatRemoteDataSource {
Future<Result<List<Chat>>> getChats();
Future<Result<Chat>> getChatById(String chatId);
Future<Result<void>> createChat(String title, List<String> participantIds);
Future<Result<void>> sendMessage(String chatId, Message message);
Future<Result<List<Message>>> getMessages(String chatId, {int? limit, String? lastMessageId});
Stream<Result<Message>> listenToMessages(String chatId);
}
@@ -0,0 +1,47 @@
import '../../../../core/errors/errors.dart';
import '../../../../core/errors/result.dart';
import '../../domain/entities/chat.dart';
import '../../domain/entities/message.dart';
import '../../domain/repositories/chat_repository.dart';
class ChatRepositoryImpl implements ChatRepository {
@override
Future<Result<void>> createChat(String title, List<String> participantIds) async {
return const Result.success(null);
}
@override
Future<Result<void>> deleteChat(String chatId) async {
return const Result.success(null);
}
@override
Future<Result<Chat>> getChatById(String chatId) async {
return const Result.failure(AppError.notFound(message: 'Chat not found'));
}
@override
Future<Result<List<Chat>>> getChats() async {
// Return empty list for now
return const Result.success([]);
}
@override
Future<Result<List<Message>>> getMessages(
String chatId, {
int? limit,
String? lastMessageId,
}) async {
return const Result.success([]);
}
@override
Future<Result<void>> sendMessage(String chatId, Message message) async {
return const Result.success(null);
}
@override
Future<Result<void>> updateChat(String chatId, String title) async {
return const Result.success(null);
}
}