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
119 lines
3.0 KiB
Dart
119 lines
3.0 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'sms_handler_settings.dart';
|
|
|
|
// **************************************************************************
|
|
// TypeAdapterGenerator
|
|
// **************************************************************************
|
|
|
|
class SmsProcessingRuleAdapter extends TypeAdapter<SmsProcessingRule> {
|
|
@override
|
|
final typeId = 11;
|
|
|
|
@override
|
|
SmsProcessingRule read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return SmsProcessingRule(
|
|
type: fields[0] as SmsProcessingType,
|
|
pattern: fields[1] as String?,
|
|
customFunctionId: fields[2] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, SmsProcessingRule obj) {
|
|
writer
|
|
..writeByte(3)
|
|
..writeByte(0)
|
|
..write(obj.type)
|
|
..writeByte(1)
|
|
..write(obj.pattern)
|
|
..writeByte(2)
|
|
..write(obj.customFunctionId);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is SmsProcessingRuleAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class SmsHandlerSettingsAdapter extends TypeAdapter<SmsHandlerSettings> {
|
|
@override
|
|
final typeId = 12;
|
|
|
|
@override
|
|
SmsHandlerSettings read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return SmsHandlerSettings(
|
|
rulesBySender: (fields[1] as Map).cast<String, SmsProcessingRule>(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, SmsHandlerSettings obj) {
|
|
writer
|
|
..writeByte(1)
|
|
..writeByte(1)
|
|
..write(obj.rulesBySender);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is SmsHandlerSettingsAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class SmsProcessingTypeAdapter extends TypeAdapter<SmsProcessingType> {
|
|
@override
|
|
final typeId = 10;
|
|
|
|
@override
|
|
SmsProcessingType read(BinaryReader reader) {
|
|
switch (reader.readByte()) {
|
|
case 0:
|
|
return SmsProcessingType.regexp;
|
|
case 1:
|
|
return SmsProcessingType.customFunction;
|
|
default:
|
|
return SmsProcessingType.regexp;
|
|
}
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, SmsProcessingType obj) {
|
|
switch (obj) {
|
|
case SmsProcessingType.regexp:
|
|
writer.writeByte(0);
|
|
case SmsProcessingType.customFunction:
|
|
writer.writeByte(1);
|
|
}
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is SmsProcessingTypeAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|