upgrade min sdk; run formatter

This commit is contained in:
Fabian Freund
2025-06-02 22:25:10 +02:00
parent 8fccd767af
commit ad03cc9bac
171 changed files with 4817 additions and 4685 deletions
@@ -42,10 +42,9 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
}
Selectable<Color> getDistinctColors() {
final query =
db.selectOnly(db.container, distinct: true)
..addColumns([db.container.color])
..where(db.container.color.isNotNull());
final query = db.selectOnly(db.container, distinct: true)
..addColumns([db.container.color])
..where(db.container.color.isNotNull());
return query.map(
(row) => row.readWithConverter<Color?, int>(db.container.color)!,
@@ -53,29 +52,26 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
}
Selectable<String> getContainerTabIds(String? containerId) {
final query =
selectOnly(db.tab)
..addColumns([db.tab.id])
..where(
(containerId != null)
? db.tab.containerId.equals(containerId)
: db.tab.containerId.isNull(),
)
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
final query = selectOnly(db.tab)
..addColumns([db.tab.id])
..where(
(containerId != null)
? db.tab.containerId.equals(containerId)
: db.tab.containerId.isNull(),
)
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
return query.map((row) => row.read(db.tab.id)!);
}
Selectable<TabData> getContainerTabsData(String? containerId) {
final query =
db.tab.select()
..where(
(t) =>
(containerId != null)
? t.containerId.equals(containerId)
: t.containerId.isNull(),
)
..orderBy([(t) => OrderingTerm.asc(t.orderKey)]);
final query = db.tab.select()
..where(
(t) => (containerId != null)
? t.containerId.equals(containerId)
: t.containerId.isNull(),
)
..orderBy([(t) => OrderingTerm.asc(t.orderKey)]);
return query;
}
@@ -21,19 +21,17 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
db.tab.select()..where((t) => t.id.equals(id));
Selectable<String> getAllTabIds() {
final query =
selectOnly(db.tab)
..addColumns([db.tab.id])
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
final query = selectOnly(db.tab)
..addColumns([db.tab.id])
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
return query.map((row) => row.read(db.tab.id)!);
}
SingleOrNullSelectable<String?> getTabContainerId(String tabId) {
final query =
selectOnly(db.tab)
..addColumns([db.tab.containerId])
..where(db.tab.id.equals(tabId));
final query = selectOnly(db.tab)
..addColumns([db.tab.containerId])
..where(db.tab.id.equals(tabId));
return query.map((row) => row.read(db.tab.containerId));
}
@@ -154,14 +152,12 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
batch.update(
db.tab,
TabCompanion(
url:
(previousState?.url != state.url)
? Value(state.url)
: const Value.absent(),
title:
(previousState?.title != state.title)
? Value(state.title)
: const Value.absent(),
url: (previousState?.url != state.url)
? Value(state.url)
: const Value.absent(),
title: (previousState?.title != state.title)
? Value(state.title)
: const Value.absent(),
),
where: (t) => t.id.equals(state.id),
);
@@ -174,8 +170,9 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
return db.transaction(() async {
await (db.tab.delete()..where((t) => t.id.isNotIn(retainTabIds))).go();
var currentOrderKey =
await db.containerDao.generateLeadingOrderKey(null).getSingle();
var currentOrderKey = await db.containerDao
.generateLeadingOrderKey(null)
.getSingle();
await db.tab.insertAll(
retainTabIds.map((id) {
@@ -55,11 +55,10 @@ class Container extends Table with TableInfo<Container, ContainerData> {
ContainerData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ContainerData(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
@@ -306,20 +305,18 @@ class Tab extends Table with TableInfo<Tab, TabData> {
TabData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabData(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
containerId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}container_id'],
),
orderKey:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}order_key'],
)!,
orderKey: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}order_key'],
)!,
url: Tab.$converterurln.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
@@ -350,11 +347,10 @@ class Tab extends Table with TableInfo<Tab, TabData> {
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
),
timestamp:
attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}timestamp'],
)!,
timestamp: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}timestamp'],
)!,
);
}
@@ -499,56 +495,47 @@ class TabData extends DataClass implements Insertable<TabData> {
orderKey: orderKey ?? this.orderKey,
url: url.present ? url.value : this.url,
title: title.present ? title.value : this.title,
isProbablyReaderable:
isProbablyReaderable.present
? isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown:
extractedContentMarkdown.present
? extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain:
extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown:
fullContentMarkdown.present
? fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain:
fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
isProbablyReaderable: isProbablyReaderable.present
? isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown: extractedContentMarkdown.present
? extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain: extractedContentPlain.present
? extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown: fullContentMarkdown.present
? fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain: fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
timestamp: timestamp ?? this.timestamp,
);
TabData copyWithCompanion(TabCompanion data) {
return TabData(
id: data.id.present ? data.id.value : this.id,
containerId:
data.containerId.present ? data.containerId.value : this.containerId,
containerId: data.containerId.present
? data.containerId.value
: this.containerId,
orderKey: data.orderKey.present ? data.orderKey.value : this.orderKey,
url: data.url.present ? data.url.value : this.url,
title: data.title.present ? data.title.value : this.title,
isProbablyReaderable:
data.isProbablyReaderable.present
? data.isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown:
data.extractedContentMarkdown.present
? data.extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain:
data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown:
data.fullContentMarkdown.present
? data.fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain:
data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
isProbablyReaderable: data.isProbablyReaderable.present
? data.isProbablyReaderable.value
: this.isProbablyReaderable,
extractedContentMarkdown: data.extractedContentMarkdown.present
? data.extractedContentMarkdown.value
: this.extractedContentMarkdown,
extractedContentPlain: data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentMarkdown: data.fullContentMarkdown.present
? data.fullContentMarkdown.value
: this.fullContentMarkdown,
fullContentPlain: data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
timestamp: data.timestamp.present ? data.timestamp.value : this.timestamp,
);
}
@@ -838,26 +825,22 @@ class TabFts extends Table
TabFt map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabFt(
title:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
url:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url'],
)!,
extractedContentPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
)!,
fullContentPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
)!,
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
url: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url'],
)!,
extractedContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}extracted_content_plain'],
)!,
fullContentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}full_content_plain'],
)!,
);
}
@@ -936,14 +919,12 @@ class TabFt extends DataClass implements Insertable<TabFt> {
return TabFt(
title: data.title.present ? data.title.value : this.title,
url: data.url.present ? data.url.value : this.url,
extractedContentPlain:
data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain:
data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
extractedContentPlain: data.extractedContentPlain.present
? data.extractedContentPlain.value
: this.extractedContentPlain,
fullContentPlain: data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
);
}
@@ -1431,12 +1412,12 @@ class $ContainerTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $ContainerFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $ContainerOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $ContainerAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$ContainerFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$ContainerOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$ContainerAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
@@ -1465,16 +1446,11 @@ class $ContainerTableManager
metadata: metadata,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$ContainerReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map(
(e) => (e.readTable(table), $ContainerReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback: ({tabRefs = false}) {
return PrefetchHooks(
db: db,
@@ -1490,10 +1466,10 @@ class $ContainerTableManager
>(
currentTable: table,
referencedTable: $ContainerReferences._tabRefsTable(db),
managerFromTypedResult:
(p0) => $ContainerReferences(db, table, p0).tabRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
managerFromTypedResult: (p0) =>
$ContainerReferences(db, table, p0).tabRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where(
(e) => e.containerId == item.id,
),
typedResults: items,
@@ -1829,12 +1805,12 @@ class $TabTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $TabFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $TabOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $TabAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$TabFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$TabOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$TabAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
@@ -1891,51 +1867,45 @@ class $TabTableManager
timestamp: timestamp,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$TabReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), $TabReferences(db, table, e)))
.toList(),
prefetchHooksCallback: ({containerId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins: <
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (containerId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.containerId,
referencedTable: $TabReferences._containerIdTable(
db,
),
referencedColumn:
$TabReferences._containerIdTable(db).id,
)
as T;
}
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (containerId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.containerId,
referencedTable: $TabReferences
._containerIdTable(db),
referencedColumn: $TabReferences
._containerIdTable(db)
.id,
)
as T;
}
return state;
},
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
@@ -2079,12 +2049,12 @@ class $TabFtsTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $TabFtsFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $TabFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $TabFtsAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$TabFtsFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$TabFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$TabFtsAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> title = const Value.absent(),
@@ -2113,16 +2083,9 @@ class $TabFtsTableManager
fullContentPlain: fullContentPlain,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
@@ -60,19 +60,17 @@ class _$ContainerAuthSettingsCWProxyImpl
return ContainerAuthSettings(
authenticationRequired:
authenticationRequired == const $CopyWithPlaceholder()
? _value.authenticationRequired
// ignore: cast_nullable_to_non_nullable
: authenticationRequired as bool,
lockOnAppBackground:
lockOnAppBackground == const $CopyWithPlaceholder()
? _value.lockOnAppBackground
// ignore: cast_nullable_to_non_nullable
: lockOnAppBackground as bool,
lockTimeout:
lockTimeout == const $CopyWithPlaceholder()
? _value.lockTimeout
// ignore: cast_nullable_to_non_nullable
: lockTimeout as Duration?,
? _value.authenticationRequired
// ignore: cast_nullable_to_non_nullable
: authenticationRequired as bool,
lockOnAppBackground: lockOnAppBackground == const $CopyWithPlaceholder()
? _value.lockOnAppBackground
// ignore: cast_nullable_to_non_nullable
: lockOnAppBackground as bool,
lockTimeout: lockTimeout == const $CopyWithPlaceholder()
? _value.lockTimeout
// ignore: cast_nullable_to_non_nullable
: lockTimeout as Duration?,
);
}
}
@@ -141,26 +139,22 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
Object? useProxy = const $CopyWithPlaceholder(),
}) {
return ContainerMetadata(
iconData:
iconData == const $CopyWithPlaceholder()
? _value.iconData
// ignore: cast_nullable_to_non_nullable
: iconData as IconData?,
contextualIdentity:
contextualIdentity == const $CopyWithPlaceholder()
? _value.contextualIdentity
// ignore: cast_nullable_to_non_nullable
: contextualIdentity as String?,
authSettings:
authSettings == const $CopyWithPlaceholder()
? _value.authSettings
// ignore: cast_nullable_to_non_nullable
: authSettings as ContainerAuthSettings,
useProxy:
useProxy == const $CopyWithPlaceholder()
? _value.useProxy
// ignore: cast_nullable_to_non_nullable
: useProxy as bool,
iconData: iconData == const $CopyWithPlaceholder()
? _value.iconData
// ignore: cast_nullable_to_non_nullable
: iconData as IconData?,
contextualIdentity: contextualIdentity == const $CopyWithPlaceholder()
? _value.contextualIdentity
// ignore: cast_nullable_to_non_nullable
: contextualIdentity as String?,
authSettings: authSettings == const $CopyWithPlaceholder()
? _value.authSettings
// ignore: cast_nullable_to_non_nullable
: authSettings as ContainerAuthSettings,
useProxy: useProxy == const $CopyWithPlaceholder()
? _value.useProxy
// ignore: cast_nullable_to_non_nullable
: useProxy as bool,
);
}
}
@@ -228,26 +222,22 @@ class _$ContainerDataCWProxyImpl implements _$ContainerDataCWProxy {
Object? metadata = const $CopyWithPlaceholder(),
}) {
return ContainerData(
id:
id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
name:
name == const $CopyWithPlaceholder()
? _value.name
// ignore: cast_nullable_to_non_nullable
: name as String?,
color:
color == const $CopyWithPlaceholder()
? _value.color
// ignore: cast_nullable_to_non_nullable
: color as Color,
metadata:
metadata == const $CopyWithPlaceholder()
? _value.metadata
// ignore: cast_nullable_to_non_nullable
: metadata as ContainerMetadata?,
id: id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
name: name == const $CopyWithPlaceholder()
? _value.name
// ignore: cast_nullable_to_non_nullable
: name as String?,
color: color == const $CopyWithPlaceholder()
? _value.color
// ignore: cast_nullable_to_non_nullable
: color as Color,
metadata: metadata == const $CopyWithPlaceholder()
? _value.metadata
// ignore: cast_nullable_to_non_nullable
: metadata as ContainerMetadata?,
);
}
}
@@ -267,10 +257,9 @@ ContainerAuthSettings _$ContainerAuthSettingsFromJson(
) => ContainerAuthSettings(
authenticationRequired: json['authenticationRequired'] as bool,
lockOnAppBackground: json['lockOnAppBackground'] as bool,
lockTimeout:
json['lockTimeout'] == null
? null
: Duration(microseconds: (json['lockTimeout'] as num).toInt()),
lockTimeout: json['lockTimeout'] == null
? null
: Duration(microseconds: (json['lockTimeout'] as num).toInt()),
);
Map<String, dynamic> _$ContainerAuthSettingsToJson(
@@ -288,12 +277,11 @@ ContainerMetadata _$ContainerMetadataFromJson(Map<String, dynamic> json) =>
const IconDataJsonConverter().fromJson,
),
contextualIdentity: json['contextualIdentity'] as String?,
authSettings:
json['authSettings'] == null
? null
: ContainerAuthSettings.fromJson(
json['authSettings'] as Map<String, dynamic>,
),
authSettings: json['authSettings'] == null
? null
: ContainerAuthSettings.fromJson(
json['authSettings'] as Map<String, dynamic>,
),
useProxy: json['useProxy'] as bool? ?? false,
);
@@ -13,8 +13,9 @@ String _$tabDatabaseHash() => r'422bd4789296dc271fabbd5906f2e2ab16bccaa3';
final tabDatabaseProvider = Provider<TabDatabase>.internal(
tabDatabase,
name: r'tabDatabaseProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$tabDatabaseHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$tabDatabaseHash,
dependencies: null,
allTransitiveDependencies: null,
);