increase min sdk and apply new formatter
This commit is contained in:
@@ -17,9 +17,10 @@ class CacheDao extends DatabaseAccessor<UserDatabase> with _$CacheDaoMixin {
|
||||
}
|
||||
|
||||
SingleOrNullSelectable<Uint8List?> getCachedIcon(String origin) {
|
||||
final query = selectOnly(db.iconCache)
|
||||
..addColumns([db.iconCache.iconData])
|
||||
..where(db.iconCache.origin.equals(origin));
|
||||
final query =
|
||||
selectOnly(db.iconCache)
|
||||
..addColumns([db.iconCache.iconData])
|
||||
..where(db.iconCache.origin.equals(origin));
|
||||
|
||||
return query.map((row) => row.read(db.iconCache.iconData));
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ class SettingDao extends DatabaseAccessor<UserDatabase> with _$SettingDaoMixin {
|
||||
Future<int> updateSetting(String key, String? partitionKey, Object? value) {
|
||||
final normalizedValue = (value is Iterable) ? jsonEncode(value) : value;
|
||||
|
||||
final driftvalue = normalizedValue
|
||||
.mapNotNull((normalizedValue) => DriftAny(normalizedValue));
|
||||
final driftvalue = normalizedValue.mapNotNull(
|
||||
(normalizedValue) => DriftAny(normalizedValue),
|
||||
);
|
||||
|
||||
return db.setting.insertOne(
|
||||
SettingCompanion.insert(
|
||||
@@ -31,8 +32,9 @@ class SettingDao extends DatabaseAccessor<UserDatabase> with _$SettingDaoMixin {
|
||||
Selectable<MapEntry<String, DriftAny?>> allSettingsOfPartitionKey(
|
||||
String? partitionKey,
|
||||
) {
|
||||
final query = db.setting.select()
|
||||
..where((r) => r.partitionKey.equalsNullable(partitionKey));
|
||||
final query =
|
||||
db.setting.select()
|
||||
..where((r) => r.partitionKey.equalsNullable(partitionKey));
|
||||
|
||||
return query.map((row) => MapEntry(row.key, row.value));
|
||||
}
|
||||
|
||||
@@ -4,25 +4,17 @@ import 'package:lensai/features/user/data/database/daos/setting.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
|
||||
@DriftDatabase(
|
||||
include: {
|
||||
'database.drift',
|
||||
},
|
||||
daos: [
|
||||
SettingDao,
|
||||
CacheDao,
|
||||
],
|
||||
)
|
||||
@DriftDatabase(include: {'database.drift'}, daos: [SettingDao, CacheDao])
|
||||
class UserDatabase extends _$UserDatabase {
|
||||
@override
|
||||
final int schemaVersion = 1;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
},
|
||||
);
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
},
|
||||
);
|
||||
|
||||
UserDatabase(super.e);
|
||||
}
|
||||
|
||||
@@ -9,20 +9,29 @@ class Setting extends Table with TableInfo<Setting, SettingData> {
|
||||
final String? _alias;
|
||||
Setting(this.attachedDatabase, [this._alias]);
|
||||
late final GeneratedColumn<String> key = GeneratedColumn<String>(
|
||||
'key', aliasedName, false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'PRIMARY KEY NOT NULL');
|
||||
'key',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'PRIMARY KEY NOT NULL',
|
||||
);
|
||||
late final GeneratedColumn<String> partitionKey = GeneratedColumn<String>(
|
||||
'partition_key', aliasedName, true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '');
|
||||
'partition_key',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '',
|
||||
);
|
||||
late final GeneratedColumn<DriftAny> value = GeneratedColumn<DriftAny>(
|
||||
'value', aliasedName, true,
|
||||
type: DriftSqlType.any,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '');
|
||||
'value',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.any,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '',
|
||||
);
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [key, partitionKey, value];
|
||||
@override
|
||||
@@ -36,12 +45,19 @@ class Setting extends Table with TableInfo<Setting, SettingData> {
|
||||
SettingData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return SettingData(
|
||||
key: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.string, data['${effectivePrefix}key'])!,
|
||||
partitionKey: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.string, data['${effectivePrefix}partition_key']),
|
||||
value: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.any, data['${effectivePrefix}value']),
|
||||
key:
|
||||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}key'],
|
||||
)!,
|
||||
partitionKey: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}partition_key'],
|
||||
),
|
||||
value: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.any,
|
||||
data['${effectivePrefix}value'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,8 +90,10 @@ class SettingData extends DataClass implements Insertable<SettingData> {
|
||||
return map;
|
||||
}
|
||||
|
||||
factory SettingData.fromJson(Map<String, dynamic> json,
|
||||
{ValueSerializer? serializer}) {
|
||||
factory SettingData.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
ValueSerializer? serializer,
|
||||
}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return SettingData(
|
||||
key: serializer.fromJson<String>(json['key']),
|
||||
@@ -93,22 +111,22 @@ class SettingData extends DataClass implements Insertable<SettingData> {
|
||||
};
|
||||
}
|
||||
|
||||
SettingData copyWith(
|
||||
{String? key,
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent()}) =>
|
||||
SettingData(
|
||||
key: key ?? this.key,
|
||||
partitionKey:
|
||||
partitionKey.present ? partitionKey.value : this.partitionKey,
|
||||
value: value.present ? value.value : this.value,
|
||||
);
|
||||
SettingData copyWith({
|
||||
String? key,
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent(),
|
||||
}) => SettingData(
|
||||
key: key ?? this.key,
|
||||
partitionKey: partitionKey.present ? partitionKey.value : this.partitionKey,
|
||||
value: value.present ? value.value : this.value,
|
||||
);
|
||||
SettingData copyWithCompanion(SettingCompanion data) {
|
||||
return SettingData(
|
||||
key: data.key.present ? data.key.value : this.key,
|
||||
partitionKey: data.partitionKey.present
|
||||
? data.partitionKey.value
|
||||
: this.partitionKey,
|
||||
partitionKey:
|
||||
data.partitionKey.present
|
||||
? data.partitionKey.value
|
||||
: this.partitionKey,
|
||||
value: data.value.present ? data.value.value : this.value,
|
||||
);
|
||||
}
|
||||
@@ -165,11 +183,12 @@ class SettingCompanion extends UpdateCompanion<SettingData> {
|
||||
});
|
||||
}
|
||||
|
||||
SettingCompanion copyWith(
|
||||
{Value<String>? key,
|
||||
Value<String?>? partitionKey,
|
||||
Value<DriftAny?>? value,
|
||||
Value<int>? rowid}) {
|
||||
SettingCompanion copyWith({
|
||||
Value<String>? key,
|
||||
Value<String?>? partitionKey,
|
||||
Value<DriftAny?>? value,
|
||||
Value<int>? rowid,
|
||||
}) {
|
||||
return SettingCompanion(
|
||||
key: key ?? this.key,
|
||||
partitionKey: partitionKey ?? this.partitionKey,
|
||||
@@ -214,20 +233,29 @@ class IconCache extends Table with TableInfo<IconCache, IconCacheData> {
|
||||
final String? _alias;
|
||||
IconCache(this.attachedDatabase, [this._alias]);
|
||||
late final GeneratedColumn<String> origin = GeneratedColumn<String>(
|
||||
'origin', aliasedName, false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'PRIMARY KEY NOT NULL');
|
||||
'origin',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'PRIMARY KEY NOT NULL',
|
||||
);
|
||||
late final GeneratedColumn<Uint8List> iconData = GeneratedColumn<Uint8List>(
|
||||
'icon_data', aliasedName, false,
|
||||
type: DriftSqlType.blob,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL');
|
||||
'icon_data',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.blob,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL',
|
||||
);
|
||||
late final GeneratedColumn<DateTime> fetchDate = GeneratedColumn<DateTime>(
|
||||
'fetch_date', aliasedName, false,
|
||||
type: DriftSqlType.dateTime,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL');
|
||||
'fetch_date',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.dateTime,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL',
|
||||
);
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [origin, iconData, fetchDate];
|
||||
@override
|
||||
@@ -241,12 +269,21 @@ class IconCache extends Table with TableInfo<IconCache, IconCacheData> {
|
||||
IconCacheData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return IconCacheData(
|
||||
origin: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.string, data['${effectivePrefix}origin'])!,
|
||||
iconData: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.blob, data['${effectivePrefix}icon_data'])!,
|
||||
fetchDate: attachedDatabase.typeMapping
|
||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}fetch_date'])!,
|
||||
origin:
|
||||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}origin'],
|
||||
)!,
|
||||
iconData:
|
||||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.blob,
|
||||
data['${effectivePrefix}icon_data'],
|
||||
)!,
|
||||
fetchDate:
|
||||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}fetch_date'],
|
||||
)!,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -263,8 +300,11 @@ class IconCacheData extends DataClass implements Insertable<IconCacheData> {
|
||||
final String origin;
|
||||
final Uint8List iconData;
|
||||
final DateTime fetchDate;
|
||||
const IconCacheData(
|
||||
{required this.origin, required this.iconData, required this.fetchDate});
|
||||
const IconCacheData({
|
||||
required this.origin,
|
||||
required this.iconData,
|
||||
required this.fetchDate,
|
||||
});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
@@ -274,8 +314,10 @@ class IconCacheData extends DataClass implements Insertable<IconCacheData> {
|
||||
return map;
|
||||
}
|
||||
|
||||
factory IconCacheData.fromJson(Map<String, dynamic> json,
|
||||
{ValueSerializer? serializer}) {
|
||||
factory IconCacheData.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
ValueSerializer? serializer,
|
||||
}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return IconCacheData(
|
||||
origin: serializer.fromJson<String>(json['origin']),
|
||||
@@ -293,13 +335,15 @@ class IconCacheData extends DataClass implements Insertable<IconCacheData> {
|
||||
};
|
||||
}
|
||||
|
||||
IconCacheData copyWith(
|
||||
{String? origin, Uint8List? iconData, DateTime? fetchDate}) =>
|
||||
IconCacheData(
|
||||
origin: origin ?? this.origin,
|
||||
iconData: iconData ?? this.iconData,
|
||||
fetchDate: fetchDate ?? this.fetchDate,
|
||||
);
|
||||
IconCacheData copyWith({
|
||||
String? origin,
|
||||
Uint8List? iconData,
|
||||
DateTime? fetchDate,
|
||||
}) => IconCacheData(
|
||||
origin: origin ?? this.origin,
|
||||
iconData: iconData ?? this.iconData,
|
||||
fetchDate: fetchDate ?? this.fetchDate,
|
||||
);
|
||||
IconCacheData copyWithCompanion(IconCacheCompanion data) {
|
||||
return IconCacheData(
|
||||
origin: data.origin.present ? data.origin.value : this.origin,
|
||||
@@ -346,9 +390,9 @@ class IconCacheCompanion extends UpdateCompanion<IconCacheData> {
|
||||
required Uint8List iconData,
|
||||
required DateTime fetchDate,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : origin = Value(origin),
|
||||
iconData = Value(iconData),
|
||||
fetchDate = Value(fetchDate);
|
||||
}) : origin = Value(origin),
|
||||
iconData = Value(iconData),
|
||||
fetchDate = Value(fetchDate);
|
||||
static Insertable<IconCacheData> custom({
|
||||
Expression<String>? origin,
|
||||
Expression<Uint8List>? iconData,
|
||||
@@ -363,11 +407,12 @@ class IconCacheCompanion extends UpdateCompanion<IconCacheData> {
|
||||
});
|
||||
}
|
||||
|
||||
IconCacheCompanion copyWith(
|
||||
{Value<String>? origin,
|
||||
Value<Uint8List>? iconData,
|
||||
Value<DateTime>? fetchDate,
|
||||
Value<int>? rowid}) {
|
||||
IconCacheCompanion copyWith({
|
||||
Value<String>? origin,
|
||||
Value<Uint8List>? iconData,
|
||||
Value<DateTime>? fetchDate,
|
||||
Value<int>? rowid,
|
||||
}) {
|
||||
return IconCacheCompanion(
|
||||
origin: origin ?? this.origin,
|
||||
iconData: iconData ?? this.iconData,
|
||||
@@ -429,18 +474,20 @@ abstract class _$UserDatabase extends GeneratedDatabase {
|
||||
List<DatabaseSchemaEntity> get allSchemaEntities => [setting, iconCache];
|
||||
}
|
||||
|
||||
typedef $SettingCreateCompanionBuilder = SettingCompanion Function({
|
||||
required String key,
|
||||
Value<String?> partitionKey,
|
||||
Value<DriftAny?> value,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $SettingUpdateCompanionBuilder = SettingCompanion Function({
|
||||
Value<String> key,
|
||||
Value<String?> partitionKey,
|
||||
Value<DriftAny?> value,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $SettingCreateCompanionBuilder =
|
||||
SettingCompanion Function({
|
||||
required String key,
|
||||
Value<String?> partitionKey,
|
||||
Value<DriftAny?> value,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $SettingUpdateCompanionBuilder =
|
||||
SettingCompanion Function({
|
||||
Value<String> key,
|
||||
Value<String?> partitionKey,
|
||||
Value<DriftAny?> value,
|
||||
Value<int> rowid,
|
||||
});
|
||||
|
||||
class $SettingFilterComposer extends Composer<_$UserDatabase, Setting> {
|
||||
$SettingFilterComposer({
|
||||
@@ -451,13 +498,19 @@ class $SettingFilterComposer extends Composer<_$UserDatabase, Setting> {
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnFilters<String> get key => $composableBuilder(
|
||||
column: $table.key, builder: (column) => ColumnFilters(column));
|
||||
column: $table.key,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get partitionKey => $composableBuilder(
|
||||
column: $table.partitionKey, builder: (column) => ColumnFilters(column));
|
||||
column: $table.partitionKey,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<DriftAny> get value => $composableBuilder(
|
||||
column: $table.value, builder: (column) => ColumnFilters(column));
|
||||
column: $table.value,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $SettingOrderingComposer extends Composer<_$UserDatabase, Setting> {
|
||||
@@ -469,14 +522,19 @@ class $SettingOrderingComposer extends Composer<_$UserDatabase, Setting> {
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnOrderings<String> get key => $composableBuilder(
|
||||
column: $table.key, builder: (column) => ColumnOrderings(column));
|
||||
column: $table.key,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get partitionKey => $composableBuilder(
|
||||
column: $table.partitionKey,
|
||||
builder: (column) => ColumnOrderings(column));
|
||||
column: $table.partitionKey,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<DriftAny> get value => $composableBuilder(
|
||||
column: $table.value, builder: (column) => ColumnOrderings(column));
|
||||
column: $table.value,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $SettingAnnotationComposer extends Composer<_$UserDatabase, Setting> {
|
||||
@@ -491,89 +549,107 @@ class $SettingAnnotationComposer extends Composer<_$UserDatabase, Setting> {
|
||||
$composableBuilder(column: $table.key, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get partitionKey => $composableBuilder(
|
||||
column: $table.partitionKey, builder: (column) => column);
|
||||
column: $table.partitionKey,
|
||||
builder: (column) => column,
|
||||
);
|
||||
|
||||
GeneratedColumn<DriftAny> get value =>
|
||||
$composableBuilder(column: $table.value, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $SettingTableManager extends RootTableManager<
|
||||
_$UserDatabase,
|
||||
Setting,
|
||||
SettingData,
|
||||
$SettingFilterComposer,
|
||||
$SettingOrderingComposer,
|
||||
$SettingAnnotationComposer,
|
||||
$SettingCreateCompanionBuilder,
|
||||
$SettingUpdateCompanionBuilder,
|
||||
(SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>),
|
||||
SettingData,
|
||||
PrefetchHooks Function()> {
|
||||
class $SettingTableManager
|
||||
extends
|
||||
RootTableManager<
|
||||
_$UserDatabase,
|
||||
Setting,
|
||||
SettingData,
|
||||
$SettingFilterComposer,
|
||||
$SettingOrderingComposer,
|
||||
$SettingAnnotationComposer,
|
||||
$SettingCreateCompanionBuilder,
|
||||
$SettingUpdateCompanionBuilder,
|
||||
(SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>),
|
||||
SettingData,
|
||||
PrefetchHooks Function()
|
||||
> {
|
||||
$SettingTableManager(_$UserDatabase db, Setting table)
|
||||
: super(TableManagerState(
|
||||
: super(
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
$SettingFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$SettingOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$SettingAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback: ({
|
||||
Value<String> key = const Value.absent(),
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
SettingCompanion(
|
||||
key: key,
|
||||
partitionKey: partitionKey,
|
||||
value: value,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback: ({
|
||||
required String key,
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
SettingCompanion.insert(
|
||||
key: key,
|
||||
partitionKey: partitionKey,
|
||||
value: value,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
createFilteringComposer:
|
||||
() => $SettingFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $SettingOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() => $SettingAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<String> key = const Value.absent(),
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => SettingCompanion(
|
||||
key: key,
|
||||
partitionKey: partitionKey,
|
||||
value: value,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
required String key,
|
||||
Value<String?> partitionKey = const Value.absent(),
|
||||
Value<DriftAny?> value = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => SettingCompanion.insert(
|
||||
key: key,
|
||||
partitionKey: partitionKey,
|
||||
value: value,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
BaseReferences(db, table, e),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $SettingProcessedTableManager = ProcessedTableManager<
|
||||
_$UserDatabase,
|
||||
Setting,
|
||||
SettingData,
|
||||
$SettingFilterComposer,
|
||||
$SettingOrderingComposer,
|
||||
$SettingAnnotationComposer,
|
||||
$SettingCreateCompanionBuilder,
|
||||
$SettingUpdateCompanionBuilder,
|
||||
(SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>),
|
||||
SettingData,
|
||||
PrefetchHooks Function()>;
|
||||
typedef $IconCacheCreateCompanionBuilder = IconCacheCompanion Function({
|
||||
required String origin,
|
||||
required Uint8List iconData,
|
||||
required DateTime fetchDate,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $IconCacheUpdateCompanionBuilder = IconCacheCompanion Function({
|
||||
Value<String> origin,
|
||||
Value<Uint8List> iconData,
|
||||
Value<DateTime> fetchDate,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $SettingProcessedTableManager =
|
||||
ProcessedTableManager<
|
||||
_$UserDatabase,
|
||||
Setting,
|
||||
SettingData,
|
||||
$SettingFilterComposer,
|
||||
$SettingOrderingComposer,
|
||||
$SettingAnnotationComposer,
|
||||
$SettingCreateCompanionBuilder,
|
||||
$SettingUpdateCompanionBuilder,
|
||||
(SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>),
|
||||
SettingData,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
typedef $IconCacheCreateCompanionBuilder =
|
||||
IconCacheCompanion Function({
|
||||
required String origin,
|
||||
required Uint8List iconData,
|
||||
required DateTime fetchDate,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $IconCacheUpdateCompanionBuilder =
|
||||
IconCacheCompanion Function({
|
||||
Value<String> origin,
|
||||
Value<Uint8List> iconData,
|
||||
Value<DateTime> fetchDate,
|
||||
Value<int> rowid,
|
||||
});
|
||||
|
||||
class $IconCacheFilterComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
$IconCacheFilterComposer({
|
||||
@@ -584,13 +660,19 @@ class $IconCacheFilterComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnFilters<String> get origin => $composableBuilder(
|
||||
column: $table.origin, builder: (column) => ColumnFilters(column));
|
||||
column: $table.origin,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<Uint8List> get iconData => $composableBuilder(
|
||||
column: $table.iconData, builder: (column) => ColumnFilters(column));
|
||||
column: $table.iconData,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<DateTime> get fetchDate => $composableBuilder(
|
||||
column: $table.fetchDate, builder: (column) => ColumnFilters(column));
|
||||
column: $table.fetchDate,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $IconCacheOrderingComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
@@ -602,13 +684,19 @@ class $IconCacheOrderingComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnOrderings<String> get origin => $composableBuilder(
|
||||
column: $table.origin, builder: (column) => ColumnOrderings(column));
|
||||
column: $table.origin,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<Uint8List> get iconData => $composableBuilder(
|
||||
column: $table.iconData, builder: (column) => ColumnOrderings(column));
|
||||
column: $table.iconData,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<DateTime> get fetchDate => $composableBuilder(
|
||||
column: $table.fetchDate, builder: (column) => ColumnOrderings(column));
|
||||
column: $table.fetchDate,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $IconCacheAnnotationComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
@@ -629,71 +717,88 @@ class $IconCacheAnnotationComposer extends Composer<_$UserDatabase, IconCache> {
|
||||
$composableBuilder(column: $table.fetchDate, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $IconCacheTableManager extends RootTableManager<
|
||||
_$UserDatabase,
|
||||
IconCache,
|
||||
IconCacheData,
|
||||
$IconCacheFilterComposer,
|
||||
$IconCacheOrderingComposer,
|
||||
$IconCacheAnnotationComposer,
|
||||
$IconCacheCreateCompanionBuilder,
|
||||
$IconCacheUpdateCompanionBuilder,
|
||||
(IconCacheData, BaseReferences<_$UserDatabase, IconCache, IconCacheData>),
|
||||
IconCacheData,
|
||||
PrefetchHooks Function()> {
|
||||
class $IconCacheTableManager
|
||||
extends
|
||||
RootTableManager<
|
||||
_$UserDatabase,
|
||||
IconCache,
|
||||
IconCacheData,
|
||||
$IconCacheFilterComposer,
|
||||
$IconCacheOrderingComposer,
|
||||
$IconCacheAnnotationComposer,
|
||||
$IconCacheCreateCompanionBuilder,
|
||||
$IconCacheUpdateCompanionBuilder,
|
||||
(
|
||||
IconCacheData,
|
||||
BaseReferences<_$UserDatabase, IconCache, IconCacheData>,
|
||||
),
|
||||
IconCacheData,
|
||||
PrefetchHooks Function()
|
||||
> {
|
||||
$IconCacheTableManager(_$UserDatabase db, IconCache table)
|
||||
: super(TableManagerState(
|
||||
: super(
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
$IconCacheFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$IconCacheOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$IconCacheAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback: ({
|
||||
Value<String> origin = const Value.absent(),
|
||||
Value<Uint8List> iconData = const Value.absent(),
|
||||
Value<DateTime> fetchDate = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
IconCacheCompanion(
|
||||
origin: origin,
|
||||
iconData: iconData,
|
||||
fetchDate: fetchDate,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback: ({
|
||||
required String origin,
|
||||
required Uint8List iconData,
|
||||
required DateTime fetchDate,
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) =>
|
||||
IconCacheCompanion.insert(
|
||||
origin: origin,
|
||||
iconData: iconData,
|
||||
fetchDate: fetchDate,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
createFilteringComposer:
|
||||
() => $IconCacheFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer:
|
||||
() => $IconCacheOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer:
|
||||
() => $IconCacheAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<String> origin = const Value.absent(),
|
||||
Value<Uint8List> iconData = const Value.absent(),
|
||||
Value<DateTime> fetchDate = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => IconCacheCompanion(
|
||||
origin: origin,
|
||||
iconData: iconData,
|
||||
fetchDate: fetchDate,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
required String origin,
|
||||
required Uint8List iconData,
|
||||
required DateTime fetchDate,
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => IconCacheCompanion.insert(
|
||||
origin: origin,
|
||||
iconData: iconData,
|
||||
fetchDate: fetchDate,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper:
|
||||
(p0) =>
|
||||
p0
|
||||
.map(
|
||||
(e) => (
|
||||
e.readTable(table),
|
||||
BaseReferences(db, table, e),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $IconCacheProcessedTableManager = ProcessedTableManager<
|
||||
_$UserDatabase,
|
||||
IconCache,
|
||||
IconCacheData,
|
||||
$IconCacheFilterComposer,
|
||||
$IconCacheOrderingComposer,
|
||||
$IconCacheAnnotationComposer,
|
||||
$IconCacheCreateCompanionBuilder,
|
||||
$IconCacheUpdateCompanionBuilder,
|
||||
(IconCacheData, BaseReferences<_$UserDatabase, IconCache, IconCacheData>),
|
||||
IconCacheData,
|
||||
PrefetchHooks Function()>;
|
||||
typedef $IconCacheProcessedTableManager =
|
||||
ProcessedTableManager<
|
||||
_$UserDatabase,
|
||||
IconCache,
|
||||
IconCacheData,
|
||||
$IconCacheFilterComposer,
|
||||
$IconCacheOrderingComposer,
|
||||
$IconCacheAnnotationComposer,
|
||||
$IconCacheCreateCompanionBuilder,
|
||||
$IconCacheUpdateCompanionBuilder,
|
||||
(IconCacheData, BaseReferences<_$UserDatabase, IconCache, IconCacheData>),
|
||||
IconCacheData,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
|
||||
class $UserDatabaseManager {
|
||||
final _$UserDatabase _db;
|
||||
|
||||
@@ -60,24 +60,25 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
bool? cookieBannerHandlingGlobalRulesSubFrames,
|
||||
WebContentIsolationStrategy? webContentIsolationStrategy,
|
||||
}) : super(
|
||||
javascriptEnabled: javascriptEnabled ?? true,
|
||||
trackingProtectionPolicy:
|
||||
trackingProtectionPolicy ?? TrackingProtectionPolicy.strict,
|
||||
httpsOnlyMode: httpsOnlyMode ?? HttpsOnlyMode.enabled,
|
||||
globalPrivacyControlEnabled: globalPrivacyControlEnabled ?? true,
|
||||
preferredColorScheme: preferredColorScheme ?? ColorScheme.system,
|
||||
cookieBannerHandlingMode:
|
||||
cookieBannerHandlingMode ?? CookieBannerHandlingMode.rejectAll,
|
||||
cookieBannerHandlingModePrivateBrowsing:
|
||||
cookieBannerHandlingModePrivateBrowsing ??
|
||||
CookieBannerHandlingMode.rejectAll,
|
||||
cookieBannerHandlingGlobalRules:
|
||||
cookieBannerHandlingGlobalRules ?? true,
|
||||
cookieBannerHandlingGlobalRulesSubFrames:
|
||||
cookieBannerHandlingGlobalRulesSubFrames ?? true,
|
||||
webContentIsolationStrategy: webContentIsolationStrategy ??
|
||||
WebContentIsolationStrategy.isolateHighValue,
|
||||
);
|
||||
javascriptEnabled: javascriptEnabled ?? true,
|
||||
trackingProtectionPolicy:
|
||||
trackingProtectionPolicy ?? TrackingProtectionPolicy.strict,
|
||||
httpsOnlyMode: httpsOnlyMode ?? HttpsOnlyMode.enabled,
|
||||
globalPrivacyControlEnabled: globalPrivacyControlEnabled ?? true,
|
||||
preferredColorScheme: preferredColorScheme ?? ColorScheme.system,
|
||||
cookieBannerHandlingMode:
|
||||
cookieBannerHandlingMode ?? CookieBannerHandlingMode.rejectAll,
|
||||
cookieBannerHandlingModePrivateBrowsing:
|
||||
cookieBannerHandlingModePrivateBrowsing ??
|
||||
CookieBannerHandlingMode.rejectAll,
|
||||
cookieBannerHandlingGlobalRules:
|
||||
cookieBannerHandlingGlobalRules ?? true,
|
||||
cookieBannerHandlingGlobalRulesSubFrames:
|
||||
cookieBannerHandlingGlobalRulesSubFrames ?? true,
|
||||
webContentIsolationStrategy:
|
||||
webContentIsolationStrategy ??
|
||||
WebContentIsolationStrategy.isolateHighValue,
|
||||
);
|
||||
|
||||
factory EngineSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$EngineSettingsFromJson(json);
|
||||
@@ -89,15 +90,15 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
super.javascriptEnabled,
|
||||
super.trackingProtectionPolicy,
|
||||
super.httpsOnlyMode,
|
||||
super.globalPrivacyControlEnabled,
|
||||
super.preferredColorScheme,
|
||||
super.cookieBannerHandlingMode,
|
||||
super.cookieBannerHandlingModePrivateBrowsing,
|
||||
super.cookieBannerHandlingGlobalRules,
|
||||
super.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
super.webContentIsolationStrategy,
|
||||
];
|
||||
super.javascriptEnabled,
|
||||
super.trackingProtectionPolicy,
|
||||
super.httpsOnlyMode,
|
||||
super.globalPrivacyControlEnabled,
|
||||
super.preferredColorScheme,
|
||||
super.cookieBannerHandlingMode,
|
||||
super.cookieBannerHandlingModePrivateBrowsing,
|
||||
super.cookieBannerHandlingGlobalRules,
|
||||
super.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
super.webContentIsolationStrategy,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ abstract class _$EngineSettingsCWProxy {
|
||||
EngineSettings javascriptEnabled(bool? javascriptEnabled);
|
||||
|
||||
EngineSettings trackingProtectionPolicy(
|
||||
TrackingProtectionPolicy? trackingProtectionPolicy);
|
||||
TrackingProtectionPolicy? trackingProtectionPolicy,
|
||||
);
|
||||
|
||||
EngineSettings httpsOnlyMode(HttpsOnlyMode? httpsOnlyMode);
|
||||
|
||||
@@ -19,19 +20,24 @@ abstract class _$EngineSettingsCWProxy {
|
||||
EngineSettings preferredColorScheme(ColorScheme? preferredColorScheme);
|
||||
|
||||
EngineSettings cookieBannerHandlingMode(
|
||||
CookieBannerHandlingMode? cookieBannerHandlingMode);
|
||||
CookieBannerHandlingMode? cookieBannerHandlingMode,
|
||||
);
|
||||
|
||||
EngineSettings cookieBannerHandlingModePrivateBrowsing(
|
||||
CookieBannerHandlingMode? cookieBannerHandlingModePrivateBrowsing);
|
||||
CookieBannerHandlingMode? cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
|
||||
EngineSettings cookieBannerHandlingGlobalRules(
|
||||
bool? cookieBannerHandlingGlobalRules);
|
||||
bool? cookieBannerHandlingGlobalRules,
|
||||
);
|
||||
|
||||
EngineSettings cookieBannerHandlingGlobalRulesSubFrames(
|
||||
bool? cookieBannerHandlingGlobalRulesSubFrames);
|
||||
bool? cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
|
||||
EngineSettings webContentIsolationStrategy(
|
||||
WebContentIsolationStrategy? webContentIsolationStrategy);
|
||||
WebContentIsolationStrategy? webContentIsolationStrategy,
|
||||
);
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `EngineSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
@@ -65,8 +71,8 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
|
||||
@override
|
||||
EngineSettings trackingProtectionPolicy(
|
||||
TrackingProtectionPolicy? trackingProtectionPolicy) =>
|
||||
this(trackingProtectionPolicy: trackingProtectionPolicy);
|
||||
TrackingProtectionPolicy? trackingProtectionPolicy,
|
||||
) => this(trackingProtectionPolicy: trackingProtectionPolicy);
|
||||
|
||||
@override
|
||||
EngineSettings httpsOnlyMode(HttpsOnlyMode? httpsOnlyMode) =>
|
||||
@@ -74,8 +80,8 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
|
||||
@override
|
||||
EngineSettings globalPrivacyControlEnabled(
|
||||
bool? globalPrivacyControlEnabled) =>
|
||||
this(globalPrivacyControlEnabled: globalPrivacyControlEnabled);
|
||||
bool? globalPrivacyControlEnabled,
|
||||
) => this(globalPrivacyControlEnabled: globalPrivacyControlEnabled);
|
||||
|
||||
@override
|
||||
EngineSettings preferredColorScheme(ColorScheme? preferredColorScheme) =>
|
||||
@@ -83,35 +89,36 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
|
||||
@override
|
||||
EngineSettings cookieBannerHandlingMode(
|
||||
CookieBannerHandlingMode? cookieBannerHandlingMode) =>
|
||||
this(cookieBannerHandlingMode: cookieBannerHandlingMode);
|
||||
CookieBannerHandlingMode? cookieBannerHandlingMode,
|
||||
) => this(cookieBannerHandlingMode: cookieBannerHandlingMode);
|
||||
|
||||
@override
|
||||
EngineSettings cookieBannerHandlingModePrivateBrowsing(
|
||||
CookieBannerHandlingMode? cookieBannerHandlingModePrivateBrowsing) =>
|
||||
this(
|
||||
cookieBannerHandlingModePrivateBrowsing:
|
||||
cookieBannerHandlingModePrivateBrowsing);
|
||||
CookieBannerHandlingMode? cookieBannerHandlingModePrivateBrowsing,
|
||||
) => this(
|
||||
cookieBannerHandlingModePrivateBrowsing:
|
||||
cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
|
||||
@override
|
||||
EngineSettings cookieBannerHandlingGlobalRules(
|
||||
bool? cookieBannerHandlingGlobalRules) =>
|
||||
this(cookieBannerHandlingGlobalRules: cookieBannerHandlingGlobalRules);
|
||||
bool? cookieBannerHandlingGlobalRules,
|
||||
) => this(cookieBannerHandlingGlobalRules: cookieBannerHandlingGlobalRules);
|
||||
|
||||
@override
|
||||
EngineSettings cookieBannerHandlingGlobalRulesSubFrames(
|
||||
bool? cookieBannerHandlingGlobalRulesSubFrames) =>
|
||||
this(
|
||||
cookieBannerHandlingGlobalRulesSubFrames:
|
||||
cookieBannerHandlingGlobalRulesSubFrames);
|
||||
bool? cookieBannerHandlingGlobalRulesSubFrames,
|
||||
) => this(
|
||||
cookieBannerHandlingGlobalRulesSubFrames:
|
||||
cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
|
||||
@override
|
||||
EngineSettings webContentIsolationStrategy(
|
||||
WebContentIsolationStrategy? webContentIsolationStrategy) =>
|
||||
this(webContentIsolationStrategy: webContentIsolationStrategy);
|
||||
WebContentIsolationStrategy? webContentIsolationStrategy,
|
||||
) => this(webContentIsolationStrategy: webContentIsolationStrategy);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `EngineSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -133,28 +140,31 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
Object? webContentIsolationStrategy = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return EngineSettings(
|
||||
javascriptEnabled: javascriptEnabled == const $CopyWithPlaceholder()
|
||||
? _value.javascriptEnabled
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: javascriptEnabled as bool?,
|
||||
javascriptEnabled:
|
||||
javascriptEnabled == const $CopyWithPlaceholder()
|
||||
? _value.javascriptEnabled
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: javascriptEnabled as bool?,
|
||||
trackingProtectionPolicy:
|
||||
trackingProtectionPolicy == const $CopyWithPlaceholder()
|
||||
? _value.trackingProtectionPolicy
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: trackingProtectionPolicy as TrackingProtectionPolicy?,
|
||||
httpsOnlyMode: httpsOnlyMode == const $CopyWithPlaceholder()
|
||||
? _value.httpsOnlyMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: httpsOnlyMode as HttpsOnlyMode?,
|
||||
httpsOnlyMode:
|
||||
httpsOnlyMode == const $CopyWithPlaceholder()
|
||||
? _value.httpsOnlyMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: httpsOnlyMode as HttpsOnlyMode?,
|
||||
globalPrivacyControlEnabled:
|
||||
globalPrivacyControlEnabled == const $CopyWithPlaceholder()
|
||||
? _value.globalPrivacyControlEnabled
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: globalPrivacyControlEnabled as bool?,
|
||||
preferredColorScheme: preferredColorScheme == const $CopyWithPlaceholder()
|
||||
? _value.preferredColorScheme
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: preferredColorScheme as ColorScheme?,
|
||||
preferredColorScheme:
|
||||
preferredColorScheme == const $CopyWithPlaceholder()
|
||||
? _value.preferredColorScheme
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: preferredColorScheme as ColorScheme?,
|
||||
cookieBannerHandlingMode:
|
||||
cookieBannerHandlingMode == const $CopyWithPlaceholder()
|
||||
? _value.cookieBannerHandlingMode
|
||||
@@ -201,47 +211,57 @@ EngineSettings _$EngineSettingsFromJson(Map<String, dynamic> json) =>
|
||||
EngineSettings.withDefaults(
|
||||
javascriptEnabled: json['javascriptEnabled'] as bool?,
|
||||
trackingProtectionPolicy: $enumDecodeNullable(
|
||||
_$TrackingProtectionPolicyEnumMap, json['trackingProtectionPolicy']),
|
||||
httpsOnlyMode:
|
||||
$enumDecodeNullable(_$HttpsOnlyModeEnumMap, json['httpsOnlyMode']),
|
||||
_$TrackingProtectionPolicyEnumMap,
|
||||
json['trackingProtectionPolicy'],
|
||||
),
|
||||
httpsOnlyMode: $enumDecodeNullable(
|
||||
_$HttpsOnlyModeEnumMap,
|
||||
json['httpsOnlyMode'],
|
||||
),
|
||||
globalPrivacyControlEnabled: json['globalPrivacyControlEnabled'] as bool?,
|
||||
preferredColorScheme: $enumDecodeNullable(
|
||||
_$ColorSchemeEnumMap, json['preferredColorScheme']),
|
||||
_$ColorSchemeEnumMap,
|
||||
json['preferredColorScheme'],
|
||||
),
|
||||
cookieBannerHandlingMode: $enumDecodeNullable(
|
||||
_$CookieBannerHandlingModeEnumMap, json['cookieBannerHandlingMode']),
|
||||
_$CookieBannerHandlingModeEnumMap,
|
||||
json['cookieBannerHandlingMode'],
|
||||
),
|
||||
cookieBannerHandlingModePrivateBrowsing: $enumDecodeNullable(
|
||||
_$CookieBannerHandlingModeEnumMap,
|
||||
json['cookieBannerHandlingModePrivateBrowsing']),
|
||||
_$CookieBannerHandlingModeEnumMap,
|
||||
json['cookieBannerHandlingModePrivateBrowsing'],
|
||||
),
|
||||
cookieBannerHandlingGlobalRules:
|
||||
json['cookieBannerHandlingGlobalRules'] as bool?,
|
||||
cookieBannerHandlingGlobalRulesSubFrames:
|
||||
json['cookieBannerHandlingGlobalRulesSubFrames'] as bool?,
|
||||
webContentIsolationStrategy: $enumDecodeNullable(
|
||||
_$WebContentIsolationStrategyEnumMap,
|
||||
json['webContentIsolationStrategy']),
|
||||
_$WebContentIsolationStrategyEnumMap,
|
||||
json['webContentIsolationStrategy'],
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$EngineSettingsToJson(EngineSettings instance) =>
|
||||
<String, dynamic>{
|
||||
'javascriptEnabled': instance.javascriptEnabled,
|
||||
'trackingProtectionPolicy':
|
||||
_$TrackingProtectionPolicyEnumMap[instance.trackingProtectionPolicy]!,
|
||||
'httpsOnlyMode': _$HttpsOnlyModeEnumMap[instance.httpsOnlyMode]!,
|
||||
'preferredColorScheme':
|
||||
_$ColorSchemeEnumMap[instance.preferredColorScheme]!,
|
||||
'globalPrivacyControlEnabled': instance.globalPrivacyControlEnabled,
|
||||
'cookieBannerHandlingMode':
|
||||
_$CookieBannerHandlingModeEnumMap[instance.cookieBannerHandlingMode]!,
|
||||
'cookieBannerHandlingModePrivateBrowsing':
|
||||
_$CookieBannerHandlingModeEnumMap[
|
||||
instance.cookieBannerHandlingModePrivateBrowsing]!,
|
||||
'cookieBannerHandlingGlobalRules':
|
||||
instance.cookieBannerHandlingGlobalRules,
|
||||
'cookieBannerHandlingGlobalRulesSubFrames':
|
||||
instance.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
'webContentIsolationStrategy': _$WebContentIsolationStrategyEnumMap[
|
||||
instance.webContentIsolationStrategy]!,
|
||||
};
|
||||
Map<String, dynamic> _$EngineSettingsToJson(
|
||||
EngineSettings instance,
|
||||
) => <String, dynamic>{
|
||||
'javascriptEnabled': instance.javascriptEnabled,
|
||||
'trackingProtectionPolicy':
|
||||
_$TrackingProtectionPolicyEnumMap[instance.trackingProtectionPolicy]!,
|
||||
'httpsOnlyMode': _$HttpsOnlyModeEnumMap[instance.httpsOnlyMode]!,
|
||||
'preferredColorScheme': _$ColorSchemeEnumMap[instance.preferredColorScheme]!,
|
||||
'globalPrivacyControlEnabled': instance.globalPrivacyControlEnabled,
|
||||
'cookieBannerHandlingMode':
|
||||
_$CookieBannerHandlingModeEnumMap[instance.cookieBannerHandlingMode]!,
|
||||
'cookieBannerHandlingModePrivateBrowsing':
|
||||
_$CookieBannerHandlingModeEnumMap[instance
|
||||
.cookieBannerHandlingModePrivateBrowsing]!,
|
||||
'cookieBannerHandlingGlobalRules': instance.cookieBannerHandlingGlobalRules,
|
||||
'cookieBannerHandlingGlobalRulesSubFrames':
|
||||
instance.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
'webContentIsolationStrategy':
|
||||
_$WebContentIsolationStrategyEnumMap[instance
|
||||
.webContentIsolationStrategy]!,
|
||||
};
|
||||
|
||||
const _$TrackingProtectionPolicyEnumMap = {
|
||||
TrackingProtectionPolicy.none: 'none',
|
||||
|
||||
@@ -36,8 +36,8 @@ class GeneralSettings with FastEquatable {
|
||||
ThemeMode? themeMode,
|
||||
bool? enableReadability,
|
||||
this.deleteBrowsingDataOnQuit,
|
||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||
enableReadability = enableReadability ?? true;
|
||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||
enableReadability = enableReadability ?? true;
|
||||
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$GeneralSettingsFromJson(json);
|
||||
@@ -49,8 +49,8 @@ class GeneralSettings with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
themeMode,
|
||||
enableReadability,
|
||||
deleteBrowsingDataOnQuit,
|
||||
];
|
||||
themeMode,
|
||||
enableReadability,
|
||||
deleteBrowsingDataOnQuit,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
GeneralSettings enableReadability(bool enableReadability);
|
||||
|
||||
GeneralSettings deleteBrowsingDataOnQuit(
|
||||
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit);
|
||||
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit,
|
||||
);
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `GeneralSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
@@ -42,11 +43,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
|
||||
@override
|
||||
GeneralSettings deleteBrowsingDataOnQuit(
|
||||
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit) =>
|
||||
this(deleteBrowsingDataOnQuit: deleteBrowsingDataOnQuit);
|
||||
Set<DeleteBrowsingDataType>? deleteBrowsingDataOnQuit,
|
||||
) => this(deleteBrowsingDataOnQuit: deleteBrowsingDataOnQuit);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `GeneralSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -59,14 +59,16 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
Object? deleteBrowsingDataOnQuit = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return GeneralSettings(
|
||||
themeMode: themeMode == const $CopyWithPlaceholder()
|
||||
? _value.themeMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: themeMode as ThemeMode,
|
||||
enableReadability: enableReadability == const $CopyWithPlaceholder()
|
||||
? _value.enableReadability
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enableReadability as bool,
|
||||
themeMode:
|
||||
themeMode == const $CopyWithPlaceholder()
|
||||
? _value.themeMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: themeMode as ThemeMode,
|
||||
enableReadability:
|
||||
enableReadability == const $CopyWithPlaceholder()
|
||||
? _value.enableReadability
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enableReadability as bool,
|
||||
deleteBrowsingDataOnQuit:
|
||||
deleteBrowsingDataOnQuit == const $CopyWithPlaceholder()
|
||||
? _value.deleteBrowsingDataOnQuit
|
||||
@@ -100,9 +102,10 @@ Map<String, dynamic> _$GeneralSettingsToJson(GeneralSettings instance) =>
|
||||
<String, dynamic>{
|
||||
'themeMode': _$ThemeModeEnumMap[instance.themeMode]!,
|
||||
'enableReadability': instance.enableReadability,
|
||||
'deleteBrowsingDataOnQuit': instance.deleteBrowsingDataOnQuit
|
||||
?.map((e) => _$DeleteBrowsingDataTypeEnumMap[e]!)
|
||||
.toList(),
|
||||
'deleteBrowsingDataOnQuit':
|
||||
instance.deleteBrowsingDataOnQuit
|
||||
?.map((e) => _$DeleteBrowsingDataTypeEnumMap[e]!)
|
||||
.toList(),
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
|
||||
@@ -25,8 +25,9 @@ Future<String?> _storedAuthData(Ref ref) {
|
||||
AsyncAuthStore authStore(Ref ref) {
|
||||
const secureStorage = FlutterSecureStorage();
|
||||
|
||||
final intial =
|
||||
ref.watch(_storedAuthDataProvider.select((value) => value.valueOrNull));
|
||||
final intial = ref.watch(
|
||||
_storedAuthDataProvider.select((value) => value.valueOrNull),
|
||||
);
|
||||
|
||||
return AsyncAuthStore(
|
||||
initial: intial,
|
||||
@@ -52,7 +53,8 @@ PocketBase pocketBase(Ref ref) {
|
||||
@Riverpod()
|
||||
bool incognitoModeEnabled(Ref ref) {
|
||||
return ref.watch(
|
||||
generalSettingsRepositoryProvider
|
||||
.select((value) => value.deleteBrowsingDataOnQuit != null),
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(value) => value.deleteBrowsingDataOnQuit != null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$iconCacheSizeMegabytesHash() =>
|
||||
@ProviderFor(iconCacheSizeMegabytes)
|
||||
final iconCacheSizeMegabytesProvider =
|
||||
AutoDisposeStreamProvider<double>.internal(
|
||||
iconCacheSizeMegabytes,
|
||||
name: r'iconCacheSizeMegabytesProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$iconCacheSizeMegabytesHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
iconCacheSizeMegabytes,
|
||||
name: r'iconCacheSizeMegabytesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$iconCacheSizeMegabytesHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -32,9 +33,10 @@ String _$storedAuthDataHash() => r'5f7e3ef6233a2036f7ce3728131901a46b1e548e';
|
||||
final _storedAuthDataProvider = AutoDisposeFutureProvider<String?>.internal(
|
||||
_storedAuthData,
|
||||
name: r'_storedAuthDataProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$storedAuthDataHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$storedAuthDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -98,9 +100,10 @@ String _$incognitoModeEnabledHash() =>
|
||||
final incognitoModeEnabledProvider = AutoDisposeProvider<bool>.internal(
|
||||
incognitoModeEnabled,
|
||||
name: r'incognitoModeEnabledProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$incognitoModeEnabledHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$incognitoModeEnabledHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -33,13 +33,15 @@ class AuthRepository extends _$AuthRepository {
|
||||
String password,
|
||||
) async {
|
||||
try {
|
||||
return await _pb.collection('users').create(
|
||||
body: {
|
||||
"email": email,
|
||||
"password": password,
|
||||
"passwordConfirm": password,
|
||||
},
|
||||
);
|
||||
return await _pb
|
||||
.collection('users')
|
||||
.create(
|
||||
body: {
|
||||
"email": email,
|
||||
"password": password,
|
||||
"passwordConfirm": password,
|
||||
},
|
||||
);
|
||||
} on ClientException catch (e) {
|
||||
throw AuthException(e.errorMessage);
|
||||
}
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$authRepositoryHash() => r'90ea6f082ef968831763c7f7ee31863f1fe329fe';
|
||||
@ProviderFor(AuthRepository)
|
||||
final authRepositoryProvider =
|
||||
AutoDisposeNotifierProvider<AuthRepository, void>.internal(
|
||||
AuthRepository.new,
|
||||
name: r'authRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$authRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
AuthRepository.new,
|
||||
name: r'authRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$authRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$AuthRepository = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$cacheRepositoryHash() => r'548b7cba9a23c21bba39f0918d7d90acaaf8d8e9';
|
||||
@ProviderFor(CacheRepository)
|
||||
final cacheRepositoryProvider =
|
||||
NotifierProvider<CacheRepository, void>.internal(
|
||||
CacheRepository.new,
|
||||
name: r'cacheRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$cacheRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
CacheRepository.new,
|
||||
name: r'cacheRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$cacheRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$CacheRepository = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -7,9 +7,8 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'engine_settings.g.dart';
|
||||
|
||||
typedef UpdateEngineSettingsFunc = EngineSettings Function(
|
||||
EngineSettings currentSettings,
|
||||
);
|
||||
typedef UpdateEngineSettingsFunc =
|
||||
EngineSettings Function(EngineSettings currentSettings);
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class EngineSettingsRepository extends _$EngineSettingsRepository {
|
||||
@@ -39,34 +38,52 @@ class EngineSettingsRepository extends _$EngineSettingsRepository {
|
||||
.allSettingsOfPartitionKey(_partitionKey)
|
||||
.watch()
|
||||
.listen((entries) {
|
||||
final settings = Map.fromEntries(entries);
|
||||
final settings = Map.fromEntries(entries);
|
||||
|
||||
state = EngineSettings.fromJson({
|
||||
'incognitoMode': settings['incognitoMode']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'javascriptEnabled': settings['javascriptEnabled']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'trackingProtectionPolicy': settings['trackingProtectionPolicy']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'httpsOnlyMode': settings['httpsOnlyMode']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'globalPrivacyControlEnabled': settings['globalPrivacyControlEnabled']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'cookieBannerHandlingMode': settings['cookieBannerHandlingMode']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'cookieBannerHandlingModePrivateBrowsing':
|
||||
settings['cookieBannerHandlingModePrivateBrowsing']
|
||||
state = EngineSettings.fromJson({
|
||||
'incognitoMode': settings['incognitoMode']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'javascriptEnabled': settings['javascriptEnabled']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'trackingProtectionPolicy': settings['trackingProtectionPolicy']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'cookieBannerHandlingGlobalRules':
|
||||
settings['cookieBannerHandlingGlobalRules']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'cookieBannerHandlingGlobalRulesSubFrames':
|
||||
settings['cookieBannerHandlingGlobalRulesSubFrames']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'webContentIsolationStrategy': settings['webContentIsolationStrategy']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
});
|
||||
});
|
||||
'httpsOnlyMode': settings['httpsOnlyMode']?.readAs(
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
'globalPrivacyControlEnabled':
|
||||
settings['globalPrivacyControlEnabled']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'cookieBannerHandlingMode': settings['cookieBannerHandlingMode']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'cookieBannerHandlingModePrivateBrowsing':
|
||||
settings['cookieBannerHandlingModePrivateBrowsing']?.readAs(
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
'cookieBannerHandlingGlobalRules':
|
||||
settings['cookieBannerHandlingGlobalRules']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'cookieBannerHandlingGlobalRulesSubFrames':
|
||||
settings['cookieBannerHandlingGlobalRulesSubFrames']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'webContentIsolationStrategy':
|
||||
settings['webContentIsolationStrategy']?.readAs(
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(watchSub.cancel());
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$engineSettingsRepositoryHash() =>
|
||||
@ProviderFor(EngineSettingsRepository)
|
||||
final engineSettingsRepositoryProvider =
|
||||
NotifierProvider<EngineSettingsRepository, EngineSettings>.internal(
|
||||
EngineSettingsRepository.new,
|
||||
name: r'engineSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
EngineSettingsRepository.new,
|
||||
name: r'engineSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$EngineSettingsRepository = Notifier<EngineSettings>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -9,9 +9,8 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'general_settings.g.dart';
|
||||
|
||||
typedef UpdateGeneralSettingsFunc = GeneralSettings Function(
|
||||
GeneralSettings currentSettings,
|
||||
);
|
||||
typedef UpdateGeneralSettingsFunc =
|
||||
GeneralSettings Function(GeneralSettings currentSettings);
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
||||
@@ -25,10 +24,14 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
||||
final db = ref.read(userDatabaseProvider);
|
||||
|
||||
return GeneralSettings.fromJson({
|
||||
'themeMode':
|
||||
settings['themeMode']?.readAs(DriftSqlType.string, db.typeMapping),
|
||||
'enableReadability': settings['enableReadability']
|
||||
?.readAs(DriftSqlType.bool, db.typeMapping),
|
||||
'themeMode': settings['themeMode']?.readAs(
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
'enableReadability': settings['enableReadability']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
'deleteBrowsingDataOnQuit': settings['deleteBrowsingDataOnQuit']
|
||||
?.readAs(DriftSqlType.string, db.typeMapping)
|
||||
.mapNotNull(jsonDecode),
|
||||
@@ -64,12 +67,12 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
||||
GeneralSettings build() {
|
||||
final db = ref.watch(userDatabaseProvider);
|
||||
|
||||
final watchSub =
|
||||
db.settingDao.allSettingsOfPartitionKey(_partitionKey).watch().listen(
|
||||
(event) {
|
||||
state = _deserializeSettings(event);
|
||||
},
|
||||
);
|
||||
final watchSub = db.settingDao
|
||||
.allSettingsOfPartitionKey(_partitionKey)
|
||||
.watch()
|
||||
.listen((event) {
|
||||
state = _deserializeSettings(event);
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(watchSub.cancel());
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$generalSettingsRepositoryHash() =>
|
||||
@ProviderFor(GeneralSettingsRepository)
|
||||
final generalSettingsRepositoryProvider =
|
||||
NotifierProvider<GeneralSettingsRepository, GeneralSettings>.internal(
|
||||
GeneralSettingsRepository.new,
|
||||
name: r'generalSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$generalSettingsRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
GeneralSettingsRepository.new,
|
||||
name: r'generalSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$generalSettingsRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$GeneralSettingsRepository = Notifier<GeneralSettings>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -23,9 +23,7 @@ class LocalAuthenticationService extends _$LocalAuthenticationService {
|
||||
}
|
||||
|
||||
void evictCacheOnBackground() {
|
||||
_cache.removeWhere(
|
||||
(key, value) => value.$2.lockOnAppBackground,
|
||||
);
|
||||
_cache.removeWhere((key, value) => value.$2.lockOnAppBackground);
|
||||
}
|
||||
|
||||
Future<bool> authenticate({
|
||||
@@ -38,9 +36,7 @@ class LocalAuthenticationService extends _$LocalAuthenticationService {
|
||||
var result = useAuthCache && _cacheAuth(authKey);
|
||||
|
||||
if (!result) {
|
||||
result = await _auth.authenticate(
|
||||
localizedReason: localizedReason,
|
||||
);
|
||||
result = await _auth.authenticate(localizedReason: localizedReason);
|
||||
}
|
||||
|
||||
if (result && settings != null) {
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$localAuthenticationServiceHash() =>
|
||||
@ProviderFor(LocalAuthenticationService)
|
||||
final localAuthenticationServiceProvider =
|
||||
AsyncNotifierProvider<LocalAuthenticationService, bool>.internal(
|
||||
LocalAuthenticationService.new,
|
||||
name: r'localAuthenticationServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$localAuthenticationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
LocalAuthenticationService.new,
|
||||
name: r'localAuthenticationServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$localAuthenticationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$LocalAuthenticationService = AsyncNotifier<bool>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$authControllerHash() => r'5b56651948683d669f29946fe02bdb004f436afb';
|
||||
@ProviderFor(AuthController)
|
||||
final authControllerProvider =
|
||||
AutoDisposeAsyncNotifierProvider<AuthController, void>.internal(
|
||||
AuthController.new,
|
||||
name: r'authControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$authControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
AuthController.new,
|
||||
name: r'authControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$authControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$AuthController = AutoDisposeAsyncNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -5,10 +5,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:lensai/features/user/domain/providers.dart';
|
||||
import 'package:lensai/features/user/presentation/controllers/controllers.dart';
|
||||
|
||||
enum _AuthType {
|
||||
login,
|
||||
signup,
|
||||
}
|
||||
enum _AuthType { login, signup }
|
||||
|
||||
class UserAuthScreen extends HookConsumerWidget {
|
||||
const UserAuthScreen();
|
||||
@@ -25,14 +22,14 @@ class UserAuthScreen extends HookConsumerWidget {
|
||||
|
||||
final authState = ref.watch(authControllerProvider);
|
||||
|
||||
ref.listen(
|
||||
authStateProvider.select((value) => value.valueOrNull),
|
||||
(previous, next) {
|
||||
if (next?.token.isNotEmpty ?? false) {
|
||||
context.pop(true);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(authStateProvider.select((value) => value.valueOrNull), (
|
||||
previous,
|
||||
next,
|
||||
) {
|
||||
if (next?.token.isNotEmpty ?? false) {
|
||||
context.pop(true);
|
||||
}
|
||||
});
|
||||
|
||||
return Dialog(
|
||||
child: Padding(
|
||||
@@ -57,9 +54,7 @@ class UserAuthScreen extends HookConsumerWidget {
|
||||
},
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8.0,
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
HookBuilder(
|
||||
builder: (context) {
|
||||
final obscure = useState(true);
|
||||
@@ -125,9 +120,7 @@ class UserAuthScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (authState.hasError && !authState.isLoading)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
@@ -141,58 +134,62 @@ class UserAuthScreen extends HookConsumerWidget {
|
||||
if (!authState.isLoading)
|
||||
switch (authType.value) {
|
||||
_AuthType.login => FilledButton(
|
||||
onPressed: () async {
|
||||
if (formKey.currentState?.validate() ?? false) {
|
||||
final controller =
|
||||
ref.read(authControllerProvider.notifier);
|
||||
onPressed: () async {
|
||||
if (formKey.currentState?.validate() ?? false) {
|
||||
final controller = ref.read(
|
||||
authControllerProvider.notifier,
|
||||
);
|
||||
|
||||
await controller.authWithPassword(
|
||||
userTextController.text,
|
||||
passwordTextController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
await controller.authWithPassword(
|
||||
userTextController.text,
|
||||
passwordTextController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
_AuthType.signup => FilledButton(
|
||||
onPressed: () async {
|
||||
if (formKey.currentState?.validate() ?? false) {
|
||||
final controller =
|
||||
ref.read(authControllerProvider.notifier);
|
||||
onPressed: () async {
|
||||
if (formKey.currentState?.validate() ?? false) {
|
||||
final controller = ref.read(
|
||||
authControllerProvider.notifier,
|
||||
);
|
||||
|
||||
await controller.registerWithPassword(
|
||||
userTextController.text,
|
||||
passwordTextController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Signup'),
|
||||
)
|
||||
await controller.registerWithPassword(
|
||||
userTextController.text,
|
||||
passwordTextController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Signup'),
|
||||
),
|
||||
}
|
||||
else
|
||||
const CircularProgressIndicator(),
|
||||
if (!authState.isLoading)
|
||||
switch (authType.value) {
|
||||
_AuthType.login => TextButton(
|
||||
onPressed: () {
|
||||
final controller =
|
||||
ref.read(authControllerProvider.notifier);
|
||||
onPressed: () {
|
||||
final controller = ref.read(
|
||||
authControllerProvider.notifier,
|
||||
);
|
||||
|
||||
controller.clearState();
|
||||
authType.value = _AuthType.signup;
|
||||
},
|
||||
child: const Text('Signup'),
|
||||
),
|
||||
controller.clearState();
|
||||
authType.value = _AuthType.signup;
|
||||
},
|
||||
child: const Text('Signup'),
|
||||
),
|
||||
_AuthType.signup => TextButton(
|
||||
onPressed: () {
|
||||
final controller =
|
||||
ref.read(authControllerProvider.notifier);
|
||||
onPressed: () {
|
||||
final controller = ref.read(
|
||||
authControllerProvider.notifier,
|
||||
);
|
||||
|
||||
controller.clearState();
|
||||
authType.value = _AuthType.login;
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
controller.clearState();
|
||||
authType.value = _AuthType.login;
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
},
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user