This commit refactors the data repositories to remove user-specific filtering. It simplifies the data access logic by retrieving all data from the Hive boxes and removing the need to filter by `userId` in the repository methods. This change makes the app function in single-user mode and removes the need to manage multiple user contexts within the data layer. Specifically: - Removes `userId` parameter from repository methods. - Updates the setting repository to use fixed keys. - Removes user ID filtering from queries. - Removes user ID parameters from Cubits and Blocs - Updates initial data creation
43 lines
991 B
Dart
43 lines
991 B
Dart
import 'package:hive_ce/hive.dart';
|
|
import '/utils/id_generator.dart';
|
|
|
|
part 'sms_message.g.dart';
|
|
|
|
@HiveType(typeId: 1004)
|
|
class SmsMessage extends HiveObject {
|
|
@HiveField(0)
|
|
final String id;
|
|
|
|
@HiveField(1)
|
|
final String? body;
|
|
|
|
@HiveField(2)
|
|
final String? sender;
|
|
|
|
@HiveField(3)
|
|
final DateTime? date;
|
|
|
|
// Комментарий: Добавлено поле для хранения идентификатора связанной транзакции.
|
|
@HiveField(4)
|
|
String? transactionId;
|
|
|
|
SmsMessage({
|
|
String? id,
|
|
this.body,
|
|
this.sender,
|
|
this.date,
|
|
this.transactionId,
|
|
}) : id = id ?? IdGenerator.generateId();
|
|
|
|
// Комментарий: Добавляем метод для обновления transactionId
|
|
SmsMessage copyWith({String? transactionId, String? userId}) {
|
|
return SmsMessage(
|
|
id: id,
|
|
body: body,
|
|
sender: sender,
|
|
date: date,
|
|
transactionId: transactionId ?? this.transactionId,
|
|
);
|
|
}
|
|
}
|