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
+6 -8
View File
@@ -14,10 +14,9 @@ String _$lightSeedColorFallbackHash() =>
final lightSeedColorFallbackProvider = Provider<Color>.internal( final lightSeedColorFallbackProvider = Provider<Color>.internal(
lightSeedColorFallback, lightSeedColorFallback,
name: r'lightSeedColorFallbackProvider', name: r'lightSeedColorFallbackProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$lightSeedColorFallbackHash,
: _$lightSeedColorFallbackHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,10 +32,9 @@ String _$darkSeedColorFallbackHash() =>
final darkSeedColorFallbackProvider = Provider<Color>.internal( final darkSeedColorFallbackProvider = Provider<Color>.internal(
darkSeedColorFallback, darkSeedColorFallback,
name: r'darkSeedColorFallbackProvider', name: r'darkSeedColorFallbackProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$darkSeedColorFallbackHash,
: _$darkSeedColorFallbackHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
+3 -2
View File
@@ -13,8 +13,9 @@ String _$formatHash() => r'fe7fcdd19b512784a36f3838c57701030475e429';
final formatProvider = AsyncNotifierProvider<Format, void>.internal( final formatProvider = AsyncNotifierProvider<Format, void>.internal(
Format.new, Format.new,
name: r'formatProvider', name: r'formatProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$formatHash, ? null
: _$formatHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
+3 -4
View File
@@ -14,10 +14,9 @@ final willAcceptDropProvider =
AutoDisposeNotifierProvider<WillAcceptDrop, DropTargetData?>.internal( AutoDisposeNotifierProvider<WillAcceptDrop, DropTargetData?>.internal(
WillAcceptDrop.new, WillAcceptDrop.new,
name: r'willAcceptDropProvider', name: r'willAcceptDropProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$willAcceptDropHash,
: _$willAcceptDropHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
+3 -2
View File
@@ -13,8 +13,9 @@ String _$routerHash() => r'25fc899b87c080600f6e1d87d510db333378bdfd';
final routerProvider = Provider<GoRouter>.internal( final routerProvider = Provider<GoRouter>.internal(
router, router,
name: r'routerProvider', name: r'routerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$routerHash, ? null
: _$routerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
+3 -4
View File
@@ -64,10 +64,9 @@ class BangSearchRoute extends GoRouteData {
@override @override
Widget build(BuildContext context, GoRouterState state) { Widget build(BuildContext context, GoRouterState state) {
return BangSearchScreen( return BangSearchScreen(
initialSearchText: initialSearchText: (searchText.isEmpty || searchText == emptySearchText)
(searchText.isEmpty || searchText == emptySearchText) ? null
? null : searchText,
: searchText,
); );
} }
} }
+5 -6
View File
@@ -72,10 +72,9 @@ class SearchRoute extends GoRouteData {
Widget build(BuildContext context, GoRouterState state) { Widget build(BuildContext context, GoRouterState state) {
return SearchScreen( return SearchScreen(
tabType: tabType, tabType: tabType,
initialSearchText: initialSearchText: (searchText.isEmpty || searchText == emptySearchText)
(searchText.isEmpty || searchText == emptySearchText) ? null
? null : searchText,
: searchText,
); );
} }
} }
@@ -124,8 +123,8 @@ class ContextMenuRoute extends GoRouteData {
@override @override
Page<void> buildPage(BuildContext context, GoRouterState state) { Page<void> buildPage(BuildContext context, GoRouterState state) {
return DialogPage( return DialogPage(
builder: builder: (_) =>
(_) => ContextMenuDialog(hitResult: HitResultJson.fromJson($extra)), ContextMenuDialog(hitResult: HitResultJson.fromJson($extra)),
); );
} }
} }
+16 -20
View File
@@ -61,26 +61,22 @@ class _$WebPageInfoCWProxyImpl implements _$WebPageInfoCWProxy {
Object? feeds = const $CopyWithPlaceholder(), Object? feeds = const $CopyWithPlaceholder(),
}) { }) {
return WebPageInfo( return WebPageInfo(
url: url: url == const $CopyWithPlaceholder()
url == const $CopyWithPlaceholder() ? _value.url
? _value.url // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : url as Uri,
: url as Uri, title: title == const $CopyWithPlaceholder()
title: ? _value.title
title == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.title : title as String?,
// ignore: cast_nullable_to_non_nullable favicon: favicon == const $CopyWithPlaceholder()
: title as String?, ? _value.favicon
favicon: // ignore: cast_nullable_to_non_nullable
favicon == const $CopyWithPlaceholder() : favicon as BrowserIcon?,
? _value.favicon feeds: feeds == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.feeds
: favicon as BrowserIcon?, // ignore: cast_nullable_to_non_nullable
feeds: : feeds as Set<Uri>?,
feeds == const $CopyWithPlaceholder()
? _value.feeds
// ignore: cast_nullable_to_non_nullable
: feeds as Set<Uri>?,
); );
} }
} }
@@ -11,19 +11,19 @@ String _$appInitializationServiceHash() =>
/// See also [AppInitializationService]. /// See also [AppInitializationService].
@ProviderFor(AppInitializationService) @ProviderFor(AppInitializationService)
final appInitializationServiceProvider = NotifierProvider< final appInitializationServiceProvider =
AppInitializationService, NotifierProvider<
Result<({bool initialized, String? stage, List<ErrorMessage> errors})> AppInitializationService,
>.internal( Result<({bool initialized, String? stage, List<ErrorMessage> errors})>
AppInitializationService.new, >.internal(
name: r'appInitializationServiceProvider', AppInitializationService.new,
debugGetCreateSourceHash: name: r'appInitializationServiceProvider',
const bool.fromEnvironment('dart.vm.product') debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null ? null
: _$appInitializationServiceHash, : _$appInitializationServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
typedef _$AppInitializationService = typedef _$AppInitializationService =
Notifier< Notifier<
+14 -12
View File
@@ -37,8 +37,10 @@ const _typeMap = {
Iterable<ResourceSize> sizesToList(String? sizes) sync* { Iterable<ResourceSize> sizesToList(String? sizes) sync* {
if (sizes != null) { if (sizes != null) {
final splitted = final splitted = sizes
sizes.split(' ').where((size) => size.contains('x')).toList(); .split(' ')
.where((size) => size.contains('x'))
.toList();
for (final size in splitted) { for (final size in splitted) {
final dimensions = size.split('x'); final dimensions = size.split('x');
@@ -87,10 +89,9 @@ class GenericWebsiteService extends _$GenericWebsiteService {
url: resource['url'] as String, url: resource['url'] as String,
type: resource['type'] as IconType, type: resource['type'] as IconType,
mimeType: resource['mimeType'] as String?, mimeType: resource['mimeType'] as String?,
sizes: sizes: (resource['sizes'] as List<List<int>>)
(resource['sizes'] as List<List<int>>) .map((s) => ResourceSize(height: s[0], width: s[1]))
.map((s) => ResourceSize(height: s[0], width: s[1])) .toList(),
.toList(),
maskable: resource['maskable'] as bool, maskable: resource['maskable'] as bool,
); );
} }
@@ -211,8 +212,10 @@ class GenericWebsiteService extends _$GenericWebsiteService {
final title = document.querySelector('title')?.text; final title = document.querySelector('title')?.text;
final resources = _extractIcons(baseUri, document); final resources = _extractIcons(baseUri, document);
final feeds = final feeds = await FeedFinder(
await FeedFinder(url: baseUri, document: document).parse(); url: baseUri,
document: document,
).parse();
return { return {
'title': title, 'title': title,
@@ -235,10 +238,9 @@ class GenericWebsiteService extends _$GenericWebsiteService {
); );
} }
final resources = final resources = (result['resources']! as List<Map<String, dynamic>>)
(result['resources']! as List<Map<String, dynamic>>) .map(_deserializeResource)
.map(_deserializeResource) .toList();
.toList();
final favicon = final favicon =
await getCachedIcon(url) ?? await getCachedIcon(url) ??
@@ -15,10 +15,9 @@ final genericWebsiteServiceProvider =
NotifierProvider<GenericWebsiteService, void>.internal( NotifierProvider<GenericWebsiteService, void>.internal(
GenericWebsiteService.new, GenericWebsiteService.new,
name: r'genericWebsiteServiceProvider', name: r'genericWebsiteServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$genericWebsiteServiceHash,
: _$genericWebsiteServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -13,8 +13,9 @@ String _$packageInfoHash() => r'cc57db7b4684ab0d5df0f050b8ea045a3658e89a';
final packageInfoProvider = FutureProvider<PackageInfo>.internal( final packageInfoProvider = FutureProvider<PackageInfo>.internal(
packageInfo, packageInfo,
name: r'packageInfoProvider', name: r'packageInfoProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$packageInfoHash, ? null
: _$packageInfoHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -13,10 +13,9 @@ String _$widgetPinnableHash() => r'f91041f0f051ad0f00dd765cafea5571ca8c8088';
final widgetPinnableProvider = FutureProvider<bool>.internal( final widgetPinnableProvider = FutureProvider<bool>.internal(
widgetPinnable, widgetPinnable,
name: r'widgetPinnableProvider', name: r'widgetPinnableProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$widgetPinnableHash,
: _$widgetPinnableHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,10 +32,9 @@ final appWidgetLaunchStreamProvider =
AutoDisposeProvider<Raw<Stream<ReceivedIntentParameter>>>.internal( AutoDisposeProvider<Raw<Stream<ReceivedIntentParameter>>>.internal(
appWidgetLaunchStream, appWidgetLaunchStream,
name: r'appWidgetLaunchStreamProvider', name: r'appWidgetLaunchStreamProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$appWidgetLaunchStreamHash,
: _$appWidgetLaunchStreamHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -22,7 +22,10 @@ class BangDao extends DatabaseAccessor<BangDatabase> with _$BangDaoMixin {
SingleSelectable<int> getBangCount({Iterable<BangGroup>? groups}) { SingleSelectable<int> getBangCount({Iterable<BangGroup>? groups}) {
return db.bang.count( return db.bang.count(
where: groups.mapNotNull((groups) => (t) => t.group.isInValues(groups)), where: groups.mapNotNull(
(groups) =>
(t) => t.group.isInValues(groups),
),
); );
} }
@@ -10,10 +10,9 @@ class SyncDao extends DatabaseAccessor<BangDatabase> with _$SyncDaoMixin {
SyncDao(super.db); SyncDao(super.db);
SingleOrNullSelectable<DateTime?> getLastSyncOfGroup(BangGroup group) { SingleOrNullSelectable<DateTime?> getLastSyncOfGroup(BangGroup group) {
final query = final query = selectOnly(db.bangSync)
selectOnly(db.bangSync) ..addColumns([db.bangSync.lastSync])
..addColumns([db.bangSync.lastSync]) ..where(db.bangSync.group.equalsValue(group));
..where(db.bangSync.group.equalsValue(group));
return query.map((row) => row.read(db.bangSync.lastSync)); return query.map((row) => row.read(db.bangSync.lastSync));
} }
@@ -96,26 +96,22 @@ class BangTable extends Table with TableInfo<BangTable, Bang> {
Bang map(Map<String, dynamic> data, {String? tablePrefix}) { Bang map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Bang( return Bang(
websiteName: websiteName: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}website_name'],
data['${effectivePrefix}website_name'], )!,
)!, domain: attachedDatabase.typeMapping.read(
domain: DriftSqlType.string,
attachedDatabase.typeMapping.read( data['${effectivePrefix}domain'],
DriftSqlType.string, )!,
data['${effectivePrefix}domain'], trigger: attachedDatabase.typeMapping.read(
)!, DriftSqlType.string,
trigger: data['${effectivePrefix}trigger'],
attachedDatabase.typeMapping.read( )!,
DriftSqlType.string, urlTemplate: attachedDatabase.typeMapping.read(
data['${effectivePrefix}trigger'], DriftSqlType.string,
)!, data['${effectivePrefix}url_template'],
urlTemplate: )!,
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_template'],
)!,
group: BangTable.$convertergroup.fromSql( group: BangTable.$convertergroup.fromSql(
attachedDatabase.typeMapping.read( attachedDatabase.typeMapping.read(
DriftSqlType.int, DriftSqlType.int,
@@ -331,11 +327,10 @@ class BangSync extends Table with TableInfo<BangSync, BangSyncData> {
data['${effectivePrefix}group'], data['${effectivePrefix}group'],
)!, )!,
), ),
lastSync: lastSync: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.dateTime,
DriftSqlType.dateTime, data['${effectivePrefix}last_sync'],
data['${effectivePrefix}last_sync'], )!,
)!,
); );
} }
@@ -512,21 +507,18 @@ class BangFrequency extends Table
BangFrequencyData map(Map<String, dynamic> data, {String? tablePrefix}) { BangFrequencyData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return BangFrequencyData( return BangFrequencyData(
trigger: trigger: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}trigger'],
data['${effectivePrefix}trigger'], )!,
)!, frequency: attachedDatabase.typeMapping.read(
frequency: DriftSqlType.int,
attachedDatabase.typeMapping.read( data['${effectivePrefix}frequency'],
DriftSqlType.int, )!,
data['${effectivePrefix}frequency'], lastUsed: attachedDatabase.typeMapping.read(
)!, DriftSqlType.dateTime,
lastUsed: data['${effectivePrefix}last_used'],
attachedDatabase.typeMapping.read( )!,
DriftSqlType.dateTime,
data['${effectivePrefix}last_used'],
)!,
); );
} }
@@ -736,21 +728,18 @@ class BangHistory extends Table with TableInfo<BangHistory, BangHistoryData> {
BangHistoryData map(Map<String, dynamic> data, {String? tablePrefix}) { BangHistoryData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return BangHistoryData( return BangHistoryData(
searchQuery: searchQuery: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}search_query'],
data['${effectivePrefix}search_query'], )!,
)!, trigger: attachedDatabase.typeMapping.read(
trigger: DriftSqlType.string,
attachedDatabase.typeMapping.read( data['${effectivePrefix}trigger'],
DriftSqlType.string, )!,
data['${effectivePrefix}trigger'], searchDate: attachedDatabase.typeMapping.read(
)!, DriftSqlType.dateTime,
searchDate: data['${effectivePrefix}search_date'],
attachedDatabase.typeMapping.read( )!,
DriftSqlType.dateTime,
data['${effectivePrefix}search_date'],
)!,
); );
} }
@@ -813,11 +802,13 @@ class BangHistoryData extends DataClass implements Insertable<BangHistoryData> {
); );
BangHistoryData copyWithCompanion(BangHistoryCompanion data) { BangHistoryData copyWithCompanion(BangHistoryCompanion data) {
return BangHistoryData( return BangHistoryData(
searchQuery: searchQuery: data.searchQuery.present
data.searchQuery.present ? data.searchQuery.value : this.searchQuery, ? data.searchQuery.value
: this.searchQuery,
trigger: data.trigger.present ? data.trigger.value : this.trigger, trigger: data.trigger.present ? data.trigger.value : this.trigger,
searchDate: searchDate: data.searchDate.present
data.searchDate.present ? data.searchDate.value : this.searchDate, ? data.searchDate.value
: this.searchDate,
); );
} }
@@ -954,16 +945,14 @@ class BangFts extends Table
BangFt map(Map<String, dynamic> data, {String? tablePrefix}) { BangFt map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return BangFt( return BangFt(
trigger: trigger: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}trigger'],
data['${effectivePrefix}trigger'], )!,
)!, websiteName: attachedDatabase.typeMapping.read(
websiteName: DriftSqlType.string,
attachedDatabase.typeMapping.read( data['${effectivePrefix}website_name'],
DriftSqlType.string, )!,
data['${effectivePrefix}website_name'],
)!,
); );
} }
@@ -1017,8 +1006,9 @@ class BangFt extends DataClass implements Insertable<BangFt> {
BangFt copyWithCompanion(BangFtsCompanion data) { BangFt copyWithCompanion(BangFtsCompanion data) {
return BangFt( return BangFt(
trigger: data.trigger.present ? data.trigger.value : this.trigger, trigger: data.trigger.present ? data.trigger.value : this.trigger,
websiteName: websiteName: data.websiteName.present
data.websiteName.present ? data.websiteName.value : this.websiteName, ? data.websiteName.value
: this.websiteName,
); );
} }
@@ -1140,26 +1130,22 @@ class BangDataView extends ViewInfo<BangDataView, BangData>
BangData map(Map<String, dynamic> data, {String? tablePrefix}) { BangData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return BangData( return BangData(
websiteName: websiteName: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}website_name'],
data['${effectivePrefix}website_name'], )!,
)!, domain: attachedDatabase.typeMapping.read(
domain: DriftSqlType.string,
attachedDatabase.typeMapping.read( data['${effectivePrefix}domain'],
DriftSqlType.string, )!,
data['${effectivePrefix}domain'], trigger: attachedDatabase.typeMapping.read(
)!, DriftSqlType.string,
trigger: data['${effectivePrefix}trigger'],
attachedDatabase.typeMapping.read( )!,
DriftSqlType.string, urlTemplate: attachedDatabase.typeMapping.read(
data['${effectivePrefix}trigger'], DriftSqlType.string,
)!, data['${effectivePrefix}url_template'],
urlTemplate: )!,
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}url_template'],
)!,
category: attachedDatabase.typeMapping.read( category: attachedDatabase.typeMapping.read(
DriftSqlType.string, DriftSqlType.string,
data['${effectivePrefix}category'], data['${effectivePrefix}category'],
@@ -1735,12 +1721,12 @@ class $BangTableTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $BangTableFilterComposer($db: db, $table: table), $BangTableFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $BangTableOrderingComposer($db: db, $table: table), $BangTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $BangTableAnnotationComposer($db: db, $table: table), $BangTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> trigger = const Value.absent(), Value<String> trigger = const Value.absent(),
@@ -1785,73 +1771,66 @@ class $BangTableTableManager
format: format, format: format,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map(
p0 (e) => (e.readTable(table), $BangTableReferences(db, table, e)),
.map( )
(e) => ( .toList(),
e.readTable(table), prefetchHooksCallback:
$BangTableReferences(db, table, e), ({bangFrequencyRefs = false, bangHistoryRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (bangFrequencyRefs) db.bangFrequency,
if (bangHistoryRefs) db.bangHistory,
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (bangFrequencyRefs)
await $_getPrefetchedData<
Bang,
BangTable,
BangFrequencyData
>(
currentTable: table,
referencedTable: $BangTableReferences
._bangFrequencyRefsTable(db),
managerFromTypedResult: (p0) => $BangTableReferences(
db,
table,
p0,
).bangFrequencyRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.trigger == item.trigger,
),
typedResults: items,
), ),
) if (bangHistoryRefs)
.toList(), await $_getPrefetchedData<
prefetchHooksCallback: ({ Bang,
bangFrequencyRefs = false, BangTable,
bangHistoryRefs = false, BangHistoryData
}) { >(
return PrefetchHooks( currentTable: table,
db: db, referencedTable: $BangTableReferences
explicitlyWatchedTables: [ ._bangHistoryRefsTable(db),
if (bangFrequencyRefs) db.bangFrequency, managerFromTypedResult: (p0) => $BangTableReferences(
if (bangHistoryRefs) db.bangHistory, db,
], table,
addJoins: null, p0,
getPrefetchedDataCallback: (items) async { ).bangHistoryRefs,
return [ referencedItemsForCurrentItem:
if (bangFrequencyRefs) (item, referencedItems) => referencedItems.where(
await $_getPrefetchedData< (e) => e.trigger == item.trigger,
Bang, ),
BangTable, typedResults: items,
BangFrequencyData ),
>( ];
currentTable: table, },
referencedTable: $BangTableReferences );
._bangFrequencyRefsTable(db),
managerFromTypedResult:
(p0) =>
$BangTableReferences(
db,
table,
p0,
).bangFrequencyRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.trigger == item.trigger,
),
typedResults: items,
),
if (bangHistoryRefs)
await $_getPrefetchedData<Bang, BangTable, BangHistoryData>(
currentTable: table,
referencedTable: $BangTableReferences
._bangHistoryRefsTable(db),
managerFromTypedResult:
(p0) =>
$BangTableReferences(
db,
table,
p0,
).bangHistoryRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.trigger == item.trigger,
),
typedResults: items,
),
];
}, },
);
},
), ),
); );
} }
@@ -1958,12 +1937,12 @@ class $BangSyncTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $BangSyncFilterComposer($db: db, $table: table), $BangSyncFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $BangSyncOrderingComposer($db: db, $table: table), $BangSyncOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $BangSyncAnnotationComposer($db: db, $table: table), $BangSyncAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<BangGroup> group = const Value.absent(), Value<BangGroup> group = const Value.absent(),
@@ -1974,16 +1953,9 @@ class $BangSyncTableManager
Value<BangGroup> group = const Value.absent(), Value<BangGroup> group = const Value.absent(),
required DateTime lastSync, required DateTime lastSync,
}) => BangSyncCompanion.insert(group: group, lastSync: lastSync), }) => BangSyncCompanion.insert(group: group, lastSync: lastSync),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
p0 .toList(),
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: null, prefetchHooksCallback: null,
), ),
); );
@@ -2186,12 +2158,12 @@ class $BangFrequencyTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $BangFrequencyFilterComposer($db: db, $table: table), $BangFrequencyFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $BangFrequencyOrderingComposer($db: db, $table: table), $BangFrequencyOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $BangFrequencyAnnotationComposer($db: db, $table: table), $BangFrequencyAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> trigger = const Value.absent(), Value<String> trigger = const Value.absent(),
@@ -2216,52 +2188,50 @@ class $BangFrequencyTableManager
lastUsed: lastUsed, lastUsed: lastUsed,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map(
p0 (e) => (
.map( e.readTable(table),
(e) => ( $BangFrequencyReferences(db, table, e),
e.readTable(table), ),
$BangFrequencyReferences(db, table, e), )
), .toList(),
)
.toList(),
prefetchHooksCallback: ({trigger = false}) { prefetchHooksCallback: ({trigger = false}) {
return PrefetchHooks( return PrefetchHooks(
db: db, db: db,
explicitlyWatchedTables: [], explicitlyWatchedTables: [],
addJoins: < addJoins:
T extends TableManagerState< <
dynamic, T extends TableManagerState<
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic dynamic,
> dynamic
>(state) { >
if (trigger) { >(state) {
state = if (trigger) {
state.withJoin( state =
currentTable: table, state.withJoin(
currentColumn: table.trigger, currentTable: table,
referencedTable: $BangFrequencyReferences currentColumn: table.trigger,
._triggerTable(db), referencedTable: $BangFrequencyReferences
referencedColumn: ._triggerTable(db),
$BangFrequencyReferences referencedColumn: $BangFrequencyReferences
._triggerTable(db) ._triggerTable(db)
.trigger, .trigger,
) )
as T; as T;
} }
return state; return state;
}, },
getPrefetchedDataCallback: (items) async { getPrefetchedDataCallback: (items) async {
return []; return [];
}, },
@@ -2471,12 +2441,12 @@ class $BangHistoryTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $BangHistoryFilterComposer($db: db, $table: table), $BangHistoryFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $BangHistoryOrderingComposer($db: db, $table: table), $BangHistoryOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $BangHistoryAnnotationComposer($db: db, $table: table), $BangHistoryAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> searchQuery = const Value.absent(), Value<String> searchQuery = const Value.absent(),
@@ -2501,52 +2471,48 @@ class $BangHistoryTableManager
searchDate: searchDate, searchDate: searchDate,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map(
p0 (e) =>
.map( (e.readTable(table), $BangHistoryReferences(db, table, e)),
(e) => ( )
e.readTable(table), .toList(),
$BangHistoryReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({trigger = false}) { prefetchHooksCallback: ({trigger = false}) {
return PrefetchHooks( return PrefetchHooks(
db: db, db: db,
explicitlyWatchedTables: [], explicitlyWatchedTables: [],
addJoins: < addJoins:
T extends TableManagerState< <
dynamic, T extends TableManagerState<
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic dynamic,
> dynamic
>(state) { >
if (trigger) { >(state) {
state = if (trigger) {
state.withJoin( state =
currentTable: table, state.withJoin(
currentColumn: table.trigger, currentTable: table,
referencedTable: $BangHistoryReferences currentColumn: table.trigger,
._triggerTable(db), referencedTable: $BangHistoryReferences
referencedColumn: ._triggerTable(db),
$BangHistoryReferences referencedColumn: $BangHistoryReferences
._triggerTable(db) ._triggerTable(db)
.trigger, .trigger,
) )
as T; as T;
} }
return state; return state;
}, },
getPrefetchedDataCallback: (items) async { getPrefetchedDataCallback: (items) async {
return []; return [];
}, },
@@ -2658,12 +2624,12 @@ class $BangFtsTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $BangFtsFilterComposer($db: db, $table: table), $BangFtsFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $BangFtsOrderingComposer($db: db, $table: table), $BangFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $BangFtsAnnotationComposer($db: db, $table: table), $BangFtsAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> trigger = const Value.absent(), Value<String> trigger = const Value.absent(),
@@ -2684,16 +2650,9 @@ class $BangFtsTableManager
websiteName: websiteName, websiteName: websiteName,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
p0 .toList(),
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: null, prefetchHooksCallback: null,
), ),
); );
+6 -10
View File
@@ -65,20 +65,16 @@ class Bang with FastEquatable implements Insertable<Bang> {
return (format == null || return (format == null ||
format!.contains(BangFormat.urlEncodePlaceholder) == true) format!.contains(BangFormat.urlEncodePlaceholder) == true)
? (format == null || ? (format == null ||
format?.contains(BangFormat.urlEncodeSpaceToPlus) == true) format?.contains(BangFormat.urlEncodeSpaceToPlus) == true)
? Uri.encodeQueryComponent(input) ? Uri.encodeQueryComponent(input)
: Uri.encodeComponent(input) : Uri.encodeComponent(input)
: input; : input;
} }
Uri getTemplateUrl(String? query) { Uri getTemplateUrl(String? query) {
final url = final url = (query != null)
(query != null) ? urlTemplate.replaceAll(_templateQueryPlaceholder, formatQuery(query))
? urlTemplate.replaceAll( : urlTemplate;
_templateQueryPlaceholder,
formatQuery(query),
)
: urlTemplate;
var template = Uri.parse(url); var template = Uri.parse(url);
if (!template.hasScheme || template.origin.isEmpty) { if (!template.hasScheme || template.origin.isEmpty) {
+35 -44
View File
@@ -89,46 +89,38 @@ class _$BangCWProxyImpl implements _$BangCWProxy {
Object? format = const $CopyWithPlaceholder(), Object? format = const $CopyWithPlaceholder(),
}) { }) {
return Bang( return Bang(
websiteName: websiteName: websiteName == const $CopyWithPlaceholder()
websiteName == const $CopyWithPlaceholder() ? _value.websiteName
? _value.websiteName // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : websiteName as String,
: websiteName as String, domain: domain == const $CopyWithPlaceholder()
domain: ? _value.domain
domain == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.domain : domain as String,
// ignore: cast_nullable_to_non_nullable trigger: trigger == const $CopyWithPlaceholder()
: domain as String, ? _value.trigger
trigger: // ignore: cast_nullable_to_non_nullable
trigger == const $CopyWithPlaceholder() : trigger as String,
? _value.trigger urlTemplate: urlTemplate == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.urlTemplate
: trigger as String, // ignore: cast_nullable_to_non_nullable
urlTemplate: : urlTemplate as String,
urlTemplate == const $CopyWithPlaceholder() group: group == const $CopyWithPlaceholder()
? _value.urlTemplate ? _value.group
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: urlTemplate as String, : group as BangGroup?,
group: category: category == const $CopyWithPlaceholder()
group == const $CopyWithPlaceholder() ? _value.category
? _value.group // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : category as String?,
: group as BangGroup?, subCategory: subCategory == const $CopyWithPlaceholder()
category: ? _value.subCategory
category == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.category : subCategory as String?,
// ignore: cast_nullable_to_non_nullable format: format == const $CopyWithPlaceholder()
: category as String?, ? _value.format
subCategory: // ignore: cast_nullable_to_non_nullable
subCategory == const $CopyWithPlaceholder() : format as Set<BangFormat>?,
? _value.subCategory
// ignore: cast_nullable_to_non_nullable
: subCategory as String?,
format:
format == const $CopyWithPlaceholder()
? _value.format
// ignore: cast_nullable_to_non_nullable
: format as Set<BangFormat>?,
); );
} }
} }
@@ -150,10 +142,9 @@ Bang _$BangFromJson(Map<String, dynamic> json) => Bang(
urlTemplate: json['u'] as String, urlTemplate: json['u'] as String,
category: json['c'] as String?, category: json['c'] as String?,
subCategory: json['sc'] as String?, subCategory: json['sc'] as String?,
format: format: (json['fmt'] as List<dynamic>?)
(json['fmt'] as List<dynamic>?) ?.map((e) => $enumDecode(_$BangFormatEnumMap, e))
?.map((e) => $enumDecode(_$BangFormatEnumMap, e)) .toSet(),
.toSet(),
); );
Map<String, dynamic> _$BangToJson(Bang instance) => <String, dynamic>{ Map<String, dynamic> _$BangToJson(Bang instance) => <String, dynamic>{
@@ -103,56 +103,46 @@ class _$BangDataCWProxyImpl implements _$BangDataCWProxy {
Object? icon = const $CopyWithPlaceholder(), Object? icon = const $CopyWithPlaceholder(),
}) { }) {
return BangData( return BangData(
websiteName: websiteName: websiteName == const $CopyWithPlaceholder()
websiteName == const $CopyWithPlaceholder() ? _value.websiteName
? _value.websiteName // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : websiteName as String,
: websiteName as String, domain: domain == const $CopyWithPlaceholder()
domain: ? _value.domain
domain == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.domain : domain as String,
// ignore: cast_nullable_to_non_nullable trigger: trigger == const $CopyWithPlaceholder()
: domain as String, ? _value.trigger
trigger: // ignore: cast_nullable_to_non_nullable
trigger == const $CopyWithPlaceholder() : trigger as String,
? _value.trigger urlTemplate: urlTemplate == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.urlTemplate
: trigger as String, // ignore: cast_nullable_to_non_nullable
urlTemplate: : urlTemplate as String,
urlTemplate == const $CopyWithPlaceholder() category: category == const $CopyWithPlaceholder()
? _value.urlTemplate ? _value.category
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: urlTemplate as String, : category as String?,
category: subCategory: subCategory == const $CopyWithPlaceholder()
category == const $CopyWithPlaceholder() ? _value.subCategory
? _value.category // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : subCategory as String?,
: category as String?, format: format == const $CopyWithPlaceholder()
subCategory: ? _value.format
subCategory == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.subCategory : format as Set<BangFormat>?,
// ignore: cast_nullable_to_non_nullable frequency: frequency == const $CopyWithPlaceholder()
: subCategory as String?, ? _value.frequency
format: // ignore: cast_nullable_to_non_nullable
format == const $CopyWithPlaceholder() : frequency as int?,
? _value.format lastUsed: lastUsed == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.lastUsed
: format as Set<BangFormat>?, // ignore: cast_nullable_to_non_nullable
frequency: : lastUsed as DateTime?,
frequency == const $CopyWithPlaceholder() icon: icon == const $CopyWithPlaceholder()
? _value.frequency ? _value.icon
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: frequency as int?, : icon as BrowserIcon?,
lastUsed:
lastUsed == const $CopyWithPlaceholder()
? _value.lastUsed
// ignore: cast_nullable_to_non_nullable
: lastUsed as DateTime?,
icon:
icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as BrowserIcon?,
); );
} }
} }
+3 -2
View File
@@ -13,8 +13,9 @@ String _$bangDatabaseHash() => r'e31cf4b499300aff65174a16fb74c7dd8ec3d6f0';
final bangDatabaseProvider = Provider<BangDatabase>.internal( final bangDatabaseProvider = Provider<BangDatabase>.internal(
bangDatabase, bangDatabase,
name: r'bangDatabaseProvider', name: r'bangDatabaseProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$bangDatabaseHash, ? null
: _$bangDatabaseHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -30,16 +30,15 @@ class BangDataSourceService extends _$BangDataSourceService {
client.close(); client.close();
} }
}, [url.toString()]).then( }, [url.toString()]).then(
(json) => (json) => json.map((e) {
json.map((e) { var bang = Bang.fromJson(e as Map<String, dynamic>);
var bang = Bang.fromJson(e as Map<String, dynamic>);
if (group != null) { if (group != null) {
bang = bang.copyWith.group(group); bang = bang.copyWith.group(group);
} }
return bang; return bang;
}).toList(), }).toList(),
); );
}, exceptionHandler: handleHttpError); }, exceptionHandler: handleHttpError);
} }
@@ -15,10 +15,9 @@ final bangDataSourceServiceProvider =
AutoDisposeNotifierProvider<BangDataSourceService, void>.internal( AutoDisposeNotifierProvider<BangDataSourceService, void>.internal(
BangDataSourceService.new, BangDataSourceService.new,
name: r'bangDataSourceServiceProvider', name: r'bangDataSourceServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangDataSourceServiceHash,
: _$bangDataSourceServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -14,10 +14,9 @@ String _$defaultSearchBangDataHash() =>
final defaultSearchBangDataProvider = StreamProvider<BangData?>.internal( final defaultSearchBangDataProvider = StreamProvider<BangData?>.internal(
defaultSearchBangData, defaultSearchBangData,
name: r'defaultSearchBangDataProvider', name: r'defaultSearchBangDataProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$defaultSearchBangDataHash,
: _$defaultSearchBangDataHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,10 +32,9 @@ final bangCategoriesProvider =
AutoDisposeStreamProvider<Map<String, List<String>>>.internal( AutoDisposeStreamProvider<Map<String, List<String>>>.internal(
bangCategories, bangCategories,
name: r'bangCategoriesProvider', name: r'bangCategoriesProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangCategoriesHash,
: _$bangCategoriesHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -135,10 +133,9 @@ class BangListProvider extends AutoDisposeStreamProvider<List<BangData>> {
), ),
from: bangListProvider, from: bangListProvider,
name: r'bangListProvider', name: r'bangListProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangListHash,
: _$bangListHash,
dependencies: BangListFamily._dependencies, dependencies: BangListFamily._dependencies,
allTransitiveDependencies: BangListFamily._allTransitiveDependencies, allTransitiveDependencies: BangListFamily._allTransitiveDependencies,
groups: groups, groups: groups,
@@ -253,10 +250,9 @@ final frequentBangListProvider =
AutoDisposeStreamProvider<List<BangData>>.internal( AutoDisposeStreamProvider<List<BangData>>.internal(
frequentBangList, frequentBangList,
name: r'frequentBangListProvider', name: r'frequentBangListProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$frequentBangListHash,
: _$frequentBangListHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -272,10 +268,9 @@ final searchHistoryProvider =
AutoDisposeStreamProvider<List<SearchHistoryEntry>>.internal( AutoDisposeStreamProvider<List<SearchHistoryEntry>>.internal(
searchHistory, searchHistory,
name: r'searchHistoryProvider', name: r'searchHistoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$searchHistoryHash,
: _$searchHistoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -330,10 +325,9 @@ class LastSyncOfGroupProvider extends AutoDisposeStreamProvider<DateTime?> {
(ref) => lastSyncOfGroup(ref as LastSyncOfGroupRef, group), (ref) => lastSyncOfGroup(ref as LastSyncOfGroupRef, group),
from: lastSyncOfGroupProvider, from: lastSyncOfGroupProvider,
name: r'lastSyncOfGroupProvider', name: r'lastSyncOfGroupProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$lastSyncOfGroupHash,
: _$lastSyncOfGroupHash,
dependencies: LastSyncOfGroupFamily._dependencies, dependencies: LastSyncOfGroupFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
LastSyncOfGroupFamily._allTransitiveDependencies, LastSyncOfGroupFamily._allTransitiveDependencies,
@@ -451,10 +445,9 @@ class BangCountOfGroupProvider extends AutoDisposeStreamProvider<int> {
(ref) => bangCountOfGroup(ref as BangCountOfGroupRef, group), (ref) => bangCountOfGroup(ref as BangCountOfGroupRef, group),
from: bangCountOfGroupProvider, from: bangCountOfGroupProvider,
name: r'bangCountOfGroupProvider', name: r'bangCountOfGroupProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangCountOfGroupHash,
: _$bangCountOfGroupHash,
dependencies: BangCountOfGroupFamily._dependencies, dependencies: BangCountOfGroupFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
BangCountOfGroupFamily._allTransitiveDependencies, BangCountOfGroupFamily._allTransitiveDependencies,
@@ -14,10 +14,9 @@ final bangSearchProvider =
AutoDisposeStreamNotifierProvider<BangSearch, List<BangData>>.internal( AutoDisposeStreamNotifierProvider<BangSearch, List<BangData>>.internal(
BangSearch.new, BangSearch.new,
name: r'bangSearchProvider', name: r'bangSearchProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangSearchHash,
: _$bangSearchHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -27,17 +26,19 @@ String _$seamlessBangHash() => r'8bd7a2cbe4c302ae08f85167290666a7437f8b9b';
/// See also [SeamlessBang]. /// See also [SeamlessBang].
@ProviderFor(SeamlessBang) @ProviderFor(SeamlessBang)
final seamlessBangProvider = AutoDisposeNotifierProvider< final seamlessBangProvider =
SeamlessBang, AutoDisposeNotifierProvider<
AsyncValue<List<BangData>> SeamlessBang,
>.internal( AsyncValue<List<BangData>>
SeamlessBang.new, >.internal(
name: r'seamlessBangProvider', SeamlessBang.new,
debugGetCreateSourceHash: name: r'seamlessBangProvider',
const bool.fromEnvironment('dart.vm.product') ? null : _$seamlessBangHash, debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
dependencies: null, ? null
allTransitiveDependencies: null, : _$seamlessBangHash,
); dependencies: null,
allTransitiveDependencies: null,
);
typedef _$SeamlessBang = AutoDisposeNotifier<AsyncValue<List<BangData>>>; typedef _$SeamlessBang = AutoDisposeNotifier<AsyncValue<List<BangData>>>;
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -15,10 +15,9 @@ final bangDataRepositoryProvider =
NotifierProvider<BangDataRepository, void>.internal( NotifierProvider<BangDataRepository, void>.internal(
BangDataRepository.new, BangDataRepository.new,
name: r'bangDataRepositoryProvider', name: r'bangDataRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangDataRepositoryHash,
: _$bangDataRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -19,8 +19,9 @@ class BangSyncRepository extends _$BangSyncRepository {
required Duration? syncInterval, required Duration? syncInterval,
}) async { }) async {
if (syncInterval != null) { if (syncInterval != null) {
final lastSync = final lastSync = await db.syncDao
await db.syncDao.getLastSyncOfGroup(group).getSingleOrNull(); .getLastSyncOfGroup(group)
.getSingleOrNull();
if (lastSync != null && if (lastSync != null &&
DateTime.now().difference(lastSync) < syncInterval) { DateTime.now().difference(lastSync) < syncInterval) {
@@ -15,10 +15,9 @@ final bangSyncRepositoryProvider =
NotifierProvider<BangSyncRepository, void>.internal( NotifierProvider<BangSyncRepository, void>.internal(
BangSyncRepository.new, BangSyncRepository.new,
name: r'bangSyncRepositoryProvider', name: r'bangSyncRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bangSyncRepositoryHash,
: _$bangSyncRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -54,40 +54,35 @@ class BangCategoriesScreen extends HookConsumerWidget {
expanded.value = {...expanded.value}..remove(key); expanded.value = {...expanded.value}..remove(key);
} }
}, },
children: children: categories.entries
categories.entries .map(
.map( (category) => ExpansionPanel(
(category) => ExpansionPanel( canTapOnHeader: true,
canTapOnHeader: true, isExpanded: expanded.value.contains(category.key),
isExpanded: expanded.value.contains( headerBuilder: (context, isExpanded) =>
category.key, ListTile(title: Text(category.key)),
), body: Padding(
headerBuilder: padding: const EdgeInsets.only(left: 16.0),
(context, isExpanded) => child: Column(
ListTile(title: Text(category.key)), mainAxisSize: MainAxisSize.min,
body: Padding( children: category.value
padding: const EdgeInsets.only(left: 16.0), .map(
child: Column( (subCategory) => ListTile(
mainAxisSize: MainAxisSize.min, title: Text(subCategory),
children: onTap: () async {
category.value await BangSubCategoryRoute(
.map( category: category.key,
(subCategory) => ListTile( subCategory: subCategory,
title: Text(subCategory), ).push(context);
onTap: () async { },
await BangSubCategoryRoute( ),
category: category.key, )
subCategory: subCategory, .toList(),
).push(context);
},
),
)
.toList(),
),
),
), ),
) ),
.toList(), ),
)
.toList(),
); );
}, },
), ),
@@ -95,13 +90,12 @@ class BangCategoriesScreen extends HookConsumerWidget {
}, },
); );
}, },
error: error: (error, stackTrace) => Center(
(error, stackTrace) => Center( child: FailureWidget(
child: FailureWidget( title: 'Failed to load Bang Categories',
title: 'Failed to load Bang Categories', exception: error,
exception: error, ),
), ),
),
loading: () => const Center(child: CircularProgressIndicator()), loading: () => const Center(child: CircularProgressIndicator()),
), ),
); );
@@ -47,19 +47,17 @@ class BangListScreen extends HookConsumerWidget {
}, },
); );
}, },
error: error: (error, stackTrace) => SliverToBoxAdapter(
(error, stackTrace) => SliverToBoxAdapter( child: Center(
child: Center( child: FailureWidget(
child: FailureWidget( title: 'Failed to load Bangs',
title: 'Failed to load Bangs', exception: error,
exception: error,
),
),
),
loading:
() => const SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator()),
), ),
),
),
loading: () => const SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator()),
),
), ),
], ],
), ),
@@ -60,32 +60,27 @@ class BangSearchScreen extends HookConsumerWidget {
), ),
body: resultsAsync.when( body: resultsAsync.when(
skipLoadingOnReload: true, skipLoadingOnReload: true,
data: data: (bangs) => FadingScroll(
(bangs) => FadingScroll( fadingSize: 25,
fadingSize: 25, builder: (context, controller) {
builder: (context, controller) { return ListView.builder(
return ListView.builder( controller: controller,
controller: controller, itemCount: bangs.length,
itemCount: bangs.length, itemBuilder: (context, index) {
itemBuilder: (context, index) { final bang = bangs[index];
final bang = bangs[index]; return BangDetails(
return BangDetails( bang,
bang, onTap: () {
onTap: () { context.pop(bang.trigger);
context.pop(bang.trigger);
},
);
}, },
); );
}, },
), );
error: },
(error, stackTrace) => Center( ),
child: FailureWidget( error: (error, stackTrace) => Center(
title: 'Bang Search failed', child: FailureWidget(title: 'Bang Search failed', exception: error),
exception: error, ),
),
),
loading: () => const SizedBox.shrink(), loading: () => const SizedBox.shrink(),
), ),
); );
@@ -83,8 +83,8 @@ class SiteSearch extends HookConsumerWidget {
width: double.maxFinite, width: double.maxFinite,
child: SelectableChips( child: SelectableChips(
itemId: (bang) => bang.trigger, itemId: (bang) => bang.trigger,
itemAvatar: itemAvatar: (bang) =>
(bang) => UrlIcon([bang.getTemplateUrl('')], iconSize: 20), UrlIcon([bang.getTemplateUrl('')], iconSize: 20),
itemLabel: (bang) => Text(bang.websiteName), itemLabel: (bang) => Text(bang.websiteName),
availableItems: availableBangs, availableItems: availableBangs,
selectedItem: selectedBang, selectedItem: selectedBang,
@@ -15,10 +15,9 @@ final bottomSheetControllerProvider =
AutoDisposeNotifierProvider<BottomSheetController, Sheet?>.internal( AutoDisposeNotifierProvider<BottomSheetController, Sheet?>.internal(
BottomSheetController.new, BottomSheetController.new,
name: r'bottomSheetControllerProvider', name: r'bottomSheetControllerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bottomSheetControllerHash,
: _$bottomSheetControllerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -32,10 +31,9 @@ final bottomSheetExtendProvider =
StreamNotifierProvider<BottomSheetExtend, double>.internal( StreamNotifierProvider<BottomSheetExtend, double>.internal(
BottomSheetExtend.new, BottomSheetExtend.new,
name: r'bottomSheetExtendProvider', name: r'bottomSheetExtendProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$bottomSheetExtendHash,
: _$bottomSheetExtendHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -14,10 +14,9 @@ final overlayControllerProvider =
AutoDisposeNotifierProvider<OverlayController, Widget?>.internal( AutoDisposeNotifierProvider<OverlayController, Widget?>.internal(
OverlayController.new, OverlayController.new,
name: r'overlayControllerProvider', name: r'overlayControllerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$overlayControllerHash,
: _$overlayControllerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -129,71 +129,58 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
}) { }) {
return TabState( return TabState(
id: _value.id, id: _value.id,
contextId: contextId: contextId == const $CopyWithPlaceholder()
contextId == const $CopyWithPlaceholder() ? _value.contextId
? _value.contextId // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : contextId as String?,
: contextId as String?, url: url == const $CopyWithPlaceholder()
url: ? _value.url
url == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.url : url as Uri,
// ignore: cast_nullable_to_non_nullable title: title == const $CopyWithPlaceholder()
: url as Uri, ? _value.title
title: // ignore: cast_nullable_to_non_nullable
title == const $CopyWithPlaceholder() : title as String,
? _value.title icon: icon == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.icon
: title as String, // ignore: cast_nullable_to_non_nullable
icon: : icon as EquatableImage?,
icon == const $CopyWithPlaceholder() thumbnail: thumbnail == const $CopyWithPlaceholder()
? _value.icon ? _value.thumbnail
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: icon as EquatableImage?, : thumbnail as EquatableImage?,
thumbnail: progress: progress == const $CopyWithPlaceholder()
thumbnail == const $CopyWithPlaceholder() ? _value.progress
? _value.thumbnail // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : progress as int,
: thumbnail as EquatableImage?, isPrivate: isPrivate == const $CopyWithPlaceholder()
progress: ? _value.isPrivate
progress == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.progress : isPrivate as bool,
// ignore: cast_nullable_to_non_nullable isFullScreen: isFullScreen == const $CopyWithPlaceholder()
: progress as int, ? _value.isFullScreen
isPrivate: // ignore: cast_nullable_to_non_nullable
isPrivate == const $CopyWithPlaceholder() : isFullScreen as bool,
? _value.isPrivate isLoading: isLoading == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.isLoading
: isPrivate as bool, // ignore: cast_nullable_to_non_nullable
isFullScreen: : isLoading as bool,
isFullScreen == const $CopyWithPlaceholder() securityInfoState: securityInfoState == const $CopyWithPlaceholder()
? _value.isFullScreen ? _value.securityInfoState
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: isFullScreen as bool, : securityInfoState as SecurityState,
isLoading: historyState: historyState == const $CopyWithPlaceholder()
isLoading == const $CopyWithPlaceholder() ? _value.historyState
? _value.isLoading // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : historyState as HistoryState,
: isLoading as bool, readerableState: readerableState == const $CopyWithPlaceholder()
securityInfoState: ? _value.readerableState
securityInfoState == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.securityInfoState : readerableState as ReaderableState,
// ignore: cast_nullable_to_non_nullable findResultState: findResultState == const $CopyWithPlaceholder()
: securityInfoState as SecurityState, ? _value.findResultState
historyState: // ignore: cast_nullable_to_non_nullable
historyState == const $CopyWithPlaceholder() : findResultState as FindResultState,
? _value.historyState
// ignore: cast_nullable_to_non_nullable
: historyState as HistoryState,
readerableState:
readerableState == const $CopyWithPlaceholder()
? _value.readerableState
// ignore: cast_nullable_to_non_nullable
: readerableState as ReaderableState,
findResultState:
findResultState == const $CopyWithPlaceholder()
? _value.findResultState
// ignore: cast_nullable_to_non_nullable
: findResultState as FindResultState,
); );
} }
} }
@@ -85,41 +85,34 @@ class _$WebExtensionStateCWProxyImpl implements _$WebExtensionStateCWProxy {
Object? icon = const $CopyWithPlaceholder(), Object? icon = const $CopyWithPlaceholder(),
}) { }) {
return WebExtensionState( return WebExtensionState(
extensionId: extensionId: extensionId == const $CopyWithPlaceholder()
extensionId == const $CopyWithPlaceholder() ? _value.extensionId
? _value.extensionId // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : extensionId as String,
: extensionId as String, enabled: enabled == const $CopyWithPlaceholder()
enabled: ? _value.enabled
enabled == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.enabled : enabled as bool,
// ignore: cast_nullable_to_non_nullable title: title == const $CopyWithPlaceholder()
: enabled as bool, ? _value.title
title: // ignore: cast_nullable_to_non_nullable
title == const $CopyWithPlaceholder() : title as String?,
? _value.title badgeText: badgeText == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.badgeText
: title as String?, // ignore: cast_nullable_to_non_nullable
badgeText: : badgeText as String?,
badgeText == const $CopyWithPlaceholder() badgeTextColor: badgeTextColor == const $CopyWithPlaceholder()
? _value.badgeText ? _value.badgeTextColor
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: badgeText as String?, : badgeTextColor as Color?,
badgeTextColor: badgeBackgroundColor: badgeBackgroundColor == const $CopyWithPlaceholder()
badgeTextColor == const $CopyWithPlaceholder() ? _value.badgeBackgroundColor
? _value.badgeTextColor // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : badgeBackgroundColor as Color?,
: badgeTextColor as Color?, icon: icon == const $CopyWithPlaceholder()
badgeBackgroundColor: ? _value.icon
badgeBackgroundColor == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.badgeBackgroundColor : icon as EquatableImage?,
// ignore: cast_nullable_to_non_nullable
: badgeBackgroundColor as Color?,
icon:
icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as EquatableImage?,
); );
} }
} }
@@ -15,10 +15,9 @@ final selectionActionServiceProvider =
Provider<GeckoSelectionActionService>.internal( Provider<GeckoSelectionActionService>.internal(
selectionActionService, selectionActionService,
name: r'selectionActionServiceProvider', name: r'selectionActionServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectionActionServiceHash,
: _$selectionActionServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,8 +32,9 @@ String _$eventServiceHash() => r'166b01f636fbdd4355dbc55a18ca4f83e0006de8';
final eventServiceProvider = Provider<GeckoEventService>.internal( final eventServiceProvider = Provider<GeckoEventService>.internal(
eventService, eventService,
name: r'eventServiceProvider', name: r'eventServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$eventServiceHash, ? null
: _$eventServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -49,8 +49,9 @@ String _$addonServiceHash() => r'c7aca09b99c3810908176f3464f5f90a185aa5e7';
final addonServiceProvider = Provider<GeckoAddonService>.internal( final addonServiceProvider = Provider<GeckoAddonService>.internal(
addonService, addonService,
name: r'addonServiceProvider', name: r'addonServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$addonServiceHash, ? null
: _$addonServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -65,10 +66,9 @@ String _$tabContentServiceHash() => r'd9a991add907ecc138c62790883e59d8e9aa9266';
final tabContentServiceProvider = Provider<GeckoTabContentService>.internal( final tabContentServiceProvider = Provider<GeckoTabContentService>.internal(
tabContentService, tabContentService,
name: r'tabContentServiceProvider', name: r'tabContentServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabContentServiceHash,
: _$tabContentServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -85,10 +85,9 @@ final engineSuggestionsServiceProvider =
Provider<GeckoSuggestionsService>.internal( Provider<GeckoSuggestionsService>.internal(
engineSuggestionsService, engineSuggestionsService,
name: r'engineSuggestionsServiceProvider', name: r'engineSuggestionsServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$engineSuggestionsServiceHash,
: _$engineSuggestionsServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -104,10 +103,9 @@ final engineReadyStateProvider =
NotifierProvider<EngineReadyState, bool>.internal( NotifierProvider<EngineReadyState, bool>.internal(
EngineReadyState.new, EngineReadyState.new,
name: r'engineReadyStateProvider', name: r'engineReadyStateProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$engineReadyStateHash,
: _$engineReadyStateHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final browserExtensionServiceProvider =
Provider<GeckoBrowserExtensionService>.internal( Provider<GeckoBrowserExtensionService>.internal(
browserExtensionService, browserExtensionService,
name: r'browserExtensionServiceProvider', name: r'browserExtensionServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$browserExtensionServiceHash,
: _$browserExtensionServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,10 +32,9 @@ String _$feedRequestedHash() => r'4f179d0878072a77a87422ff6afdac53a3d57c04';
final feedRequestedProvider = AutoDisposeStreamProvider<String>.internal( final feedRequestedProvider = AutoDisposeStreamProvider<String>.internal(
feedRequested, feedRequested,
name: r'feedRequestedProvider', name: r'feedRequestedProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$feedRequestedHash,
: _$feedRequestedHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -13,8 +13,9 @@ String _$selectedTabHash() => r'12b670dd76c3416e8d62bafd63bf69a83a603e3a';
final selectedTabProvider = NotifierProvider<SelectedTab, String?>.internal( final selectedTabProvider = NotifierProvider<SelectedTab, String?>.internal(
SelectedTab.new, SelectedTab.new,
name: r'selectedTabProvider', name: r'selectedTabProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$selectedTabHash, ? null
: _$selectedTabHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -14,8 +14,9 @@ final tabListProvider =
NotifierProvider<TabList, EquatableValue<List<String>>>.internal( NotifierProvider<TabList, EquatableValue<List<String>>>.internal(
TabList.new, TabList.new,
name: r'tabListProvider', name: r'tabListProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$tabListHash, ? null
: _$tabListHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -48,10 +48,9 @@ class TabSession extends _$TabSession {
@override @override
void build({required String? tabId}) { void build({required String? tabId}) {
_sessionService = _sessionService = (tabId != null)
(tabId != null) ? GeckoSessionService(tabId: tabId)
? GeckoSessionService(tabId: tabId) : GeckoSessionService.forActiveTab();
: GeckoSessionService.forActiveTab();
} }
} }
@@ -15,10 +15,9 @@ final selectedTabSessionNotifierProvider =
AutoDisposeProvider<Raw<TabSession>>.internal( AutoDisposeProvider<Raw<TabSession>>.internal(
selectedTabSessionNotifier, selectedTabSessionNotifier,
name: r'selectedTabSessionNotifierProvider', name: r'selectedTabSessionNotifierProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedTabSessionNotifierHash,
: _$selectedTabSessionNotifierHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -100,10 +99,9 @@ class TabSessionProvider
() => TabSession()..tabId = tabId, () => TabSession()..tabId = tabId,
from: tabSessionProvider, from: tabSessionProvider,
name: r'tabSessionProvider', name: r'tabSessionProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabSessionHash,
: _$tabSessionHash,
dependencies: TabSessionFamily._dependencies, dependencies: TabSessionFamily._dependencies,
allTransitiveDependencies: TabSessionFamily._allTransitiveDependencies, allTransitiveDependencies: TabSessionFamily._allTransitiveDependencies,
tabId: tabId, tabId: tabId,
@@ -26,10 +26,9 @@ class TabStates extends _$TabStates {
..[contentState.id] = current.copyWith( ..[contentState.id] = current.copyWith(
contextId: contentState.contextId, contextId: contentState.contextId,
url: Uri.parse(contentState.url), url: Uri.parse(contentState.url),
title: title: (contentState.title.isNotEmpty)
(contentState.title.isNotEmpty) ? contentState.title
? contentState.title : current.title,
: current.title,
progress: contentState.progress, progress: contentState.progress,
isPrivate: contentState.isPrivate, isPrivate: contentState.isPrivate,
isFullScreen: contentState.isFullScreen, isFullScreen: contentState.isFullScreen,
@@ -76,15 +75,12 @@ class TabStates extends _$TabStates {
state = {...state} state = {...state}
..[tabId] = current.copyWith.historyState( ..[tabId] = current.copyWith.historyState(
HistoryState( HistoryState(
items: items: history.items.nonNulls
history.items.nonNulls .map(
.map( (item) =>
(item) => HistoryItem( HistoryItem(url: Uri.parse(item.url), title: item.title),
url: Uri.parse(item.url), )
title: item.title, .toList(),
),
)
.toList(),
currentIndex: history.currentIndex, currentIndex: history.currentIndex,
canGoBack: history.canGoBack, canGoBack: history.canGoBack,
canGoForward: history.canGoForward, canGoForward: history.canGoForward,
@@ -71,10 +71,9 @@ class TabStateProvider extends AutoDisposeProvider<TabState?> {
(ref) => tabState(ref as TabStateRef, tabId), (ref) => tabState(ref as TabStateRef, tabId),
from: tabStateProvider, from: tabStateProvider,
name: r'tabStateProvider', name: r'tabStateProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabStateHash,
: _$tabStateHash,
dependencies: TabStateFamily._dependencies, dependencies: TabStateFamily._dependencies,
allTransitiveDependencies: TabStateFamily._allTransitiveDependencies, allTransitiveDependencies: TabStateFamily._allTransitiveDependencies,
tabId: tabId, tabId: tabId,
@@ -149,10 +148,9 @@ String _$selectedTabStateHash() => r'dbd36af7af286bd9d079f30e8e11bbda23bf7728';
final selectedTabStateProvider = AutoDisposeProvider<TabState?>.internal( final selectedTabStateProvider = AutoDisposeProvider<TabState?>.internal(
selectedTabState, selectedTabState,
name: r'selectedTabStateProvider', name: r'selectedTabStateProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedTabStateHash,
: _$selectedTabStateHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -168,10 +166,9 @@ final tabStatesProvider =
NotifierProvider<TabStates, Map<String, TabState>>.internal( NotifierProvider<TabStates, Map<String, TabState>>.internal(
TabStates.new, TabStates.new,
name: r'tabStatesProvider', name: r'tabStatesProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabStatesHash,
: _$tabStatesHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -86,10 +86,9 @@ class WebExtensionsStateProvider
() => WebExtensionsState()..actionType = actionType, () => WebExtensionsState()..actionType = actionType,
from: webExtensionsStateProvider, from: webExtensionsStateProvider,
name: r'webExtensionsStateProvider', name: r'webExtensionsStateProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$webExtensionsStateHash,
: _$webExtensionsStateHash,
dependencies: WebExtensionsStateFamily._dependencies, dependencies: WebExtensionsStateFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
WebExtensionsStateFamily._allTransitiveDependencies, WebExtensionsStateFamily._allTransitiveDependencies,
@@ -49,8 +49,9 @@ class TabRepository extends _$TabRepository {
HistoryMetadataKey? historyMetadata, HistoryMetadataKey? historyMetadata,
Map<String, String>? additionalHeaders, Map<String, String>? additionalHeaders,
}) async { }) async {
final selectedContainer = final selectedContainer = await ref
await ref.read(selectedContainerProvider.notifier).fetchData(); .read(selectedContainerProvider.notifier)
.fetchData();
return ref.read(tabDatabaseProvider).tabDao.upsertContainerTabTransactional( return ref.read(tabDatabaseProvider).tabDao.upsertContainerTabTransactional(
() { () {
@@ -124,8 +125,8 @@ class TabRepository extends _$TabRepository {
} }
if (containerData.metadata.useProxy) { if (containerData.metadata.useProxy) {
final proxyPluginHealthy = final proxyPluginHealthy = await GeckoContainerProxyService()
await GeckoContainerProxyService().healthcheck(); .healthcheck();
if (!proxyPluginHealthy) { if (!proxyPluginHealthy) {
logger.w( logger.w(
@@ -170,10 +171,9 @@ class TabRepository extends _$TabRepository {
} }
//We only take containers without authentication! //We only take containers without authentication!
final availableContainers = final availableContainers = await ref
await ref .read(containerRepositoryProvider.notifier)
.read(containerRepositoryProvider.notifier) .getAllContainersWithCount();
.getAllContainersWithCount();
final nextAvailableContainerUnauthenticated = availableContainers final nextAvailableContainerUnauthenticated = availableContainers
.firstWhereOrNull( .firstWhereOrNull(
@@ -13,10 +13,9 @@ String _$tabRepositoryHash() => r'9b7ef03bec41f149b3cb456b73d7ee0e1b2804df';
final tabRepositoryProvider = NotifierProvider<TabRepository, void>.internal( final tabRepositoryProvider = NotifierProvider<TabRepository, void>.internal(
TabRepository.new, TabRepository.new,
name: r'tabRepositoryProvider', name: r'tabRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabRepositoryHash,
: _$tabRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -92,16 +92,14 @@ EquatableValue<List<String>> seamlessFilteredTabIds(
TabSearchPartition searchPartition, TabSearchPartition searchPartition,
ContainerFilter containerFilter, ContainerFilter containerFilter,
) { ) {
final tabSearchResults = final tabSearchResults = ref
ref .watch(
.watch( tabSearchRepositoryProvider(searchPartition).select(
tabSearchRepositoryProvider(searchPartition).select( (value) =>
(value) => EquatableValue( EquatableValue(value.valueOrNull?.map((tab) => tab.id).toList()),
value.valueOrNull?.map((tab) => tab.id).toList(), ),
), )
), .value;
)
.value;
final availableTabs = ref.watch(availableTabIdsProvider(containerFilter)); final availableTabs = ref.watch(availableTabIdsProvider(containerFilter));
@@ -120,14 +118,13 @@ EquatableValue<List<TabPreview>> seamlessFilteredTabPreviews(
TabSearchPartition searchPartition, TabSearchPartition searchPartition,
ContainerFilter containerFilter, ContainerFilter containerFilter,
) { ) {
final tabSearchResults = final tabSearchResults = ref
ref .watch(
.watch( tabSearchRepositoryProvider(
tabSearchRepositoryProvider( searchPartition,
searchPartition, ).select((value) => EquatableValue(value.valueOrNull)),
).select((value) => EquatableValue(value.valueOrNull)), )
) .value;
.value;
final availableTabStates = ref.watch( final availableTabStates = ref.watch(
availableTabStatesProvider(containerFilter), availableTabStatesProvider(containerFilter),
@@ -74,10 +74,9 @@ class AvailableTabIdsProvider
(ref) => availableTabIds(ref as AvailableTabIdsRef, containerFilter), (ref) => availableTabIds(ref as AvailableTabIdsRef, containerFilter),
from: availableTabIdsProvider, from: availableTabIdsProvider,
name: r'availableTabIdsProvider', name: r'availableTabIdsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$availableTabIdsHash,
: _$availableTabIdsHash,
dependencies: AvailableTabIdsFamily._dependencies, dependencies: AvailableTabIdsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
AvailableTabIdsFamily._allTransitiveDependencies, AvailableTabIdsFamily._allTransitiveDependencies,
@@ -202,10 +201,9 @@ class AvailableTabStatesProvider
availableTabStates(ref as AvailableTabStatesRef, containerFilter), availableTabStates(ref as AvailableTabStatesRef, containerFilter),
from: availableTabStatesProvider, from: availableTabStatesProvider,
name: r'availableTabStatesProvider', name: r'availableTabStatesProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$availableTabStatesHash,
: _$availableTabStatesHash,
dependencies: AvailableTabStatesFamily._dependencies, dependencies: AvailableTabStatesFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
AvailableTabStatesFamily._allTransitiveDependencies, AvailableTabStatesFamily._allTransitiveDependencies,
@@ -342,10 +340,9 @@ class SeamlessFilteredTabIdsProvider
), ),
from: seamlessFilteredTabIdsProvider, from: seamlessFilteredTabIdsProvider,
name: r'seamlessFilteredTabIdsProvider', name: r'seamlessFilteredTabIdsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$seamlessFilteredTabIdsHash,
: _$seamlessFilteredTabIdsHash,
dependencies: SeamlessFilteredTabIdsFamily._dependencies, dependencies: SeamlessFilteredTabIdsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SeamlessFilteredTabIdsFamily._allTransitiveDependencies, SeamlessFilteredTabIdsFamily._allTransitiveDependencies,
@@ -494,10 +491,9 @@ class SeamlessFilteredTabPreviewsProvider
), ),
from: seamlessFilteredTabPreviewsProvider, from: seamlessFilteredTabPreviewsProvider,
name: r'seamlessFilteredTabPreviewsProvider', name: r'seamlessFilteredTabPreviewsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$seamlessFilteredTabPreviewsHash,
: _$seamlessFilteredTabPreviewsHash,
dependencies: SeamlessFilteredTabPreviewsFamily._dependencies, dependencies: SeamlessFilteredTabPreviewsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies, SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies,
@@ -641,10 +637,9 @@ class SelectedBangTriggerProvider
() => SelectedBangTrigger()..domain = domain, () => SelectedBangTrigger()..domain = domain,
from: selectedBangTriggerProvider, from: selectedBangTriggerProvider,
name: r'selectedBangTriggerProvider', name: r'selectedBangTriggerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedBangTriggerHash,
: _$selectedBangTriggerHash,
dependencies: SelectedBangTriggerFamily._dependencies, dependencies: SelectedBangTriggerFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SelectedBangTriggerFamily._allTransitiveDependencies, SelectedBangTriggerFamily._allTransitiveDependencies,
@@ -773,10 +768,9 @@ class SelectedBangDataProvider
() => SelectedBangData()..domain = domain, () => SelectedBangData()..domain = domain,
from: selectedBangDataProvider, from: selectedBangDataProvider,
name: r'selectedBangDataProvider', name: r'selectedBangDataProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedBangDataHash,
: _$selectedBangDataHash,
dependencies: SelectedBangDataFamily._dependencies, dependencies: SelectedBangDataFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SelectedBangDataFamily._allTransitiveDependencies, SelectedBangDataFamily._allTransitiveDependencies,
@@ -11,19 +11,19 @@ String _$engineBoundIntentStreamHash() =>
/// See also [EngineBoundIntentStream]. /// See also [EngineBoundIntentStream].
@ProviderFor(EngineBoundIntentStream) @ProviderFor(EngineBoundIntentStream)
final engineBoundIntentStreamProvider = AutoDisposeStreamNotifierProvider< final engineBoundIntentStreamProvider =
EngineBoundIntentStream, AutoDisposeStreamNotifierProvider<
SharedContent EngineBoundIntentStream,
>.internal( SharedContent
EngineBoundIntentStream.new, >.internal(
name: r'engineBoundIntentStreamProvider', EngineBoundIntentStream.new,
debugGetCreateSourceHash: name: r'engineBoundIntentStreamProvider',
const bool.fromEnvironment('dart.vm.product') debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null ? null
: _$engineBoundIntentStreamHash, : _$engineBoundIntentStreamHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
typedef _$EngineBoundIntentStream = AutoDisposeStreamNotifier<SharedContent>; typedef _$EngineBoundIntentStream = AutoDisposeStreamNotifier<SharedContent>;
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -15,10 +15,9 @@ final browserViewLifecycleProvider =
NotifierProvider<BrowserViewLifecycle, AppLifecycleState?>.internal( NotifierProvider<BrowserViewLifecycle, AppLifecycleState?>.internal(
BrowserViewLifecycle.new, BrowserViewLifecycle.new,
name: r'browserViewLifecycleProvider', name: r'browserViewLifecycleProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$browserViewLifecycleHash,
: _$browserViewLifecycleHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final browserAddonServiceProvider =
AutoDisposeNotifierProvider<BrowserAddonService, void>.internal( AutoDisposeNotifierProvider<BrowserAddonService, void>.internal(
BrowserAddonService.new, BrowserAddonService.new,
name: r'browserAddonServiceProvider', name: r'browserAddonServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$browserAddonServiceHash,
: _$browserAddonServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final browserDataServiceProvider =
NotifierProvider<BrowserDataService, void>.internal( NotifierProvider<BrowserDataService, void>.internal(
BrowserDataService.new, BrowserDataService.new,
name: r'browserDataServiceProvider', name: r'browserDataServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$browserDataServiceHash,
: _$browserDataServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final engineSettingsReplicationServiceProvider =
NotifierProvider<EngineSettingsReplicationService, void>.internal( NotifierProvider<EngineSettingsReplicationService, void>.internal(
EngineSettingsReplicationService.new, EngineSettingsReplicationService.new,
name: r'engineSettingsReplicationServiceProvider', name: r'engineSettingsReplicationServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$engineSettingsReplicationServiceHash,
: _$engineSettingsReplicationServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final proxySettingsReplicationProvider =
NotifierProvider<ProxySettingsReplication, void>.internal( NotifierProvider<ProxySettingsReplication, void>.internal(
ProxySettingsReplication.new, ProxySettingsReplication.new,
name: r'proxySettingsReplicationProvider', name: r'proxySettingsReplicationProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$proxySettingsReplicationHash,
: _$proxySettingsReplicationHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -89,23 +89,21 @@ class WebPageDialog extends HookConsumerWidget {
searchInNewTab: false, searchInNewTab: false,
); );
}, },
error: error: (error, stackTrace) => FailureWidget(
(error, stackTrace) => FailureWidget( title: 'Could not load bangs',
title: 'Could not load bangs', exception: error,
exception: error, ),
), loading: () => SiteSearch(
loading: domain: url.host,
() => SiteSearch( availableBangs: const [
domain: url.host, // BangData(
availableBangs: const [ // websiteName: 'websiteName',
// BangData( // domain: 'domain',
// websiteName: 'websiteName', // trigger: 'trigger',
// domain: 'domain', // urlTemplate: 'urlTemplate',
// trigger: 'trigger', // ),
// urlTemplate: 'urlTemplate', ],
// ), ),
],
),
), ),
), ),
if (availableBangsAsync.isLoading || if (availableBangsAsync.isLoading ||
@@ -200,10 +198,9 @@ class WebPageDialog extends HookConsumerWidget {
leading: const Icon(Icons.mobile_screen_share), leading: const Icon(Icons.mobile_screen_share),
title: const Text('Share screenshot'), title: const Text('Share screenshot'),
onTap: () async { onTap: () async {
final screenshot = final screenshot = await ref
await ref .read(selectedTabSessionNotifierProvider)
.read(selectedTabSessionNotifierProvider) .requestScreenshot();
.requestScreenshot();
if (screenshot != null) { if (screenshot != null) {
ui.decodeImageFromList(screenshot, ( ui.decodeImageFromList(screenshot, (
@@ -111,14 +111,13 @@ class BrowserScreen extends HookConsumerWidget {
return displayedOverlay!; return displayedOverlay!;
}, },
child: Listener( child: Listener(
onPointerDown: onPointerDown: (displayedSheet != null)
(displayedSheet != null) ? (_) {
? (_) { ref
ref .read(bottomSheetControllerProvider.notifier)
.read(bottomSheetControllerProvider.notifier) .dismiss();
.dismiss(); }
} : null,
: null,
child: BackButtonListener( child: BackButtonListener(
onBackButtonPressed: () async { onBackButtonPressed: () async {
final tabState = ref.read(selectedTabStateProvider); final tabState = ref.read(selectedTabStateProvider);
@@ -220,36 +219,35 @@ class BrowserScreen extends HookConsumerWidget {
}, },
), ),
floatingActionButton: ReaderAppearanceButton(), floatingActionButton: ReaderAppearanceButton(),
bottomSheet: bottomSheet: (displayedSheet != null)
(displayedSheet != null) ? NotificationListener<DraggableScrollableNotification>(
? NotificationListener<DraggableScrollableNotification>( onNotification: (notification) {
onNotification: (notification) { if (notification.extent <= 0.1) {
if (notification.extent <= 0.1) { ref
ref .read(bottomSheetControllerProvider.notifier)
.read(bottomSheetControllerProvider.notifier) .dismiss();
.dismiss(); return true;
return true; } else {
} else { ref
ref .read(bottomSheetExtendProvider.notifier)
.read(bottomSheetExtendProvider.notifier) .add(notification.extent);
.add(notification.extent); }
}
return false; return false;
}, },
child: switch (displayedSheet) { child: switch (displayedSheet) {
ViewTabsSheet() => _ViewTabsSheet( ViewTabsSheet() => _ViewTabsSheet(
key: ValueKey(displayedSheet), key: ValueKey(displayedSheet),
maxChildSize: MediaQuery.of(context).relativeSafeArea(), maxChildSize: MediaQuery.of(context).relativeSafeArea(),
), ),
final TabQaChatSheet parameter => _QaSheet( final TabQaChatSheet parameter => _QaSheet(
key: ValueKey(displayedSheet), key: ValueKey(displayedSheet),
maxChildSize: MediaQuery.of(context).relativeSafeArea(), maxChildSize: MediaQuery.of(context).relativeSafeArea(),
chatId: parameter.chatId, chatId: parameter.chatId,
), ),
}, },
) )
: null, : null,
), ),
), ),
); );
@@ -304,10 +302,10 @@ class _BrowserView extends StatelessWidget {
(state) => EdgeInsets.only( (state) => EdgeInsets.only(
bottom: bottom:
(state?.isLoading == true && (state?.isLoading == true &&
state?.progress != null && state?.progress != null &&
state!.progress < 100) state!.progress < 100)
? 4.0 ? 4.0
: 0.0, : 0.0,
), ),
), ),
); );
@@ -86,14 +86,12 @@ class BrowserBottomAppBar extends HookConsumerWidget {
child: AppBar( child: AppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
titleSpacing: 8.0, titleSpacing: 8.0,
backgroundColor: backgroundColor: (isPrivateTab && displayedSheet is! ViewTabsSheet)
(isPrivateTab && displayedSheet is! ViewTabsSheet) ? const Color(0x648000D7)
? const Color(0x648000D7) : null,
: null, title: (selectedTabId != null && displayedSheet is! ViewTabsSheet)
title: ? const AppBarTitle()
(selectedTabId != null && displayedSheet is! ViewTabsSheet) : null,
? const AppBarTitle()
: null,
actions: [ actions: [
if (selectedTabId != null && displayedSheet is! ViewTabsSheet) if (selectedTabId != null && displayedSheet is! ViewTabsSheet)
ReaderButton(), ReaderButton(),
@@ -349,54 +347,50 @@ class BrowserBottomAppBar extends HookConsumerWidget {
return Row( return Row(
children: [ children: [
Expanded( Expanded(
child: child: (history?.canGoBack == true || isLoading)
(history?.canGoBack == true || isLoading) ? IconButton(
? IconButton( onPressed: () async {
onPressed: () async { final controller = ref.read(
final controller = ref.read( tabSessionProvider(
tabSessionProvider( tabId: selectedTabId,
tabId: selectedTabId, ).notifier,
).notifier, );
);
if (isLoading) { if (isLoading) {
await controller.stopLoading(); await controller.stopLoading();
} else { } else {
await controller.goBack(); await controller.goBack();
} }
trippleDotMenuController.close(); trippleDotMenuController.close();
}, },
icon: const Icon(Icons.arrow_back), icon: const Icon(Icons.arrow_back),
) )
: IconButton( : IconButton(
onPressed: () async { onPressed: () async {
await ref await ref
.read( .read(tabRepositoryProvider.notifier)
tabRepositoryProvider.notifier, .closeTab(selectedTabId);
) trippleDotMenuController.close();
.closeTab(selectedTabId); },
trippleDotMenuController.close(); icon: const Icon(Icons.close),
}, ),
icon: const Icon(Icons.close),
),
), ),
const SizedBox(height: 48, child: VerticalDivider()), const SizedBox(height: 48, child: VerticalDivider()),
Expanded( Expanded(
child: IconButton( child: IconButton(
onPressed: onPressed: (history?.canGoForward == true)
(history?.canGoForward == true) ? () async {
? () async { final controller = ref.read(
final controller = ref.read( tabSessionProvider(
tabSessionProvider( tabId: selectedTabId,
tabId: selectedTabId, ).notifier,
).notifier, );
);
await controller.goForward(); await controller.goForward();
trippleDotMenuController.close(); trippleDotMenuController.close();
} }
: null, : null,
icon: const Icon(Icons.arrow_forward), icon: const Icon(Icons.arrow_forward),
), ),
), ),
@@ -43,10 +43,9 @@ class TabPreview extends HookWidget {
borderRadius: const BorderRadius.all(Radius.circular(16.0)), borderRadius: const BorderRadius.all(Radius.circular(16.0)),
), ),
child: Material( child: Material(
color: color: tab.isPrivate
tab.isPrivate ? const Color(0xFF25003E)
? const Color(0xFF25003E) : colorScheme.surfaceContainerHighest,
: colorScheme.surfaceContainerHighest,
borderRadius: const BorderRadius.all(Radius.circular(14.0)), borderRadius: const BorderRadius.all(Radius.circular(14.0)),
child: InkWell( child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(14.0)), borderRadius: const BorderRadius.all(Radius.circular(14.0)),
@@ -63,10 +62,9 @@ class TabPreview extends HookWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
tab.title, tab.title,
maxLines: 2, maxLines: 2,
style: style: tab.isPrivate
tab.isPrivate ? const TextStyle(color: Colors.white)
? const TextStyle(color: Colors.white) : null,
: null,
), ),
), ),
), ),
@@ -34,10 +34,9 @@ class TabsActionButton extends HookConsumerWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 2.0, width: 2.0,
color: color: isActive
isActive ? theme.colorScheme.primary
? theme.colorScheme.primary : DefaultTextStyle.of(context).style.color!,
: DefaultTextStyle.of(context).style.color!,
), ),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
@@ -45,16 +45,14 @@ class _$FindInPageStateCWProxyImpl implements _$FindInPageStateCWProxy {
Object? lastSearchText = const $CopyWithPlaceholder(), Object? lastSearchText = const $CopyWithPlaceholder(),
}) { }) {
return FindInPageState( return FindInPageState(
visible: visible: visible == const $CopyWithPlaceholder()
visible == const $CopyWithPlaceholder() ? _value.visible
? _value.visible // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : visible as bool,
: visible as bool, lastSearchText: lastSearchText == const $CopyWithPlaceholder()
lastSearchText: ? _value.lastSearchText
lastSearchText == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.lastSearchText : lastSearchText as String?,
// ignore: cast_nullable_to_non_nullable
: lastSearchText as String?,
); );
} }
} }
@@ -81,10 +81,9 @@ class FindInPageRepositoryProvider
() => FindInPageRepository()..tabId = tabId, () => FindInPageRepository()..tabId = tabId,
from: findInPageRepositoryProvider, from: findInPageRepositoryProvider,
name: r'findInPageRepositoryProvider', name: r'findInPageRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$findInPageRepositoryHash,
: _$findInPageRepositoryHash,
dependencies: FindInPageRepositoryFamily._dependencies, dependencies: FindInPageRepositoryFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
FindInPageRepositoryFamily._allTransitiveDependencies, FindInPageRepositoryFamily._allTransitiveDependencies,
@@ -15,10 +15,9 @@ final findInPageControllerProvider =
AutoDisposeNotifierProvider<FindInPageController, FindInPageState>.internal( AutoDisposeNotifierProvider<FindInPageController, FindInPageState>.internal(
FindInPageController.new, FindInPageController.new,
name: r'findInPageControllerProvider', name: r'findInPageControllerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$findInPageControllerHash,
: _$findInPageControllerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -50,16 +50,14 @@ class _$PreferenceSettingGroupCWProxyImpl
Object? settings = const $CopyWithPlaceholder(), Object? settings = const $CopyWithPlaceholder(),
}) { }) {
return PreferenceSettingGroup( return PreferenceSettingGroup(
description: description: description == const $CopyWithPlaceholder()
description == const $CopyWithPlaceholder() ? _value.description
? _value.description // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : description as String?,
: description as String?, settings: settings == const $CopyWithPlaceholder()
settings: ? _value.settings
settings == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.settings : settings as Map<String, PreferenceSetting>,
// ignore: cast_nullable_to_non_nullable
: settings as Map<String, PreferenceSetting>,
); );
} }
} }
@@ -144,36 +142,30 @@ class _$PreferenceSettingCWProxyImpl implements _$PreferenceSettingCWProxy {
Object? shouldBeDefault = const $CopyWithPlaceholder(), Object? shouldBeDefault = const $CopyWithPlaceholder(),
}) { }) {
return PreferenceSetting( return PreferenceSetting(
value: value: value == const $CopyWithPlaceholder()
value == const $CopyWithPlaceholder() ? _value.value
? _value.value // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : value as Object,
: value as Object, title: title == const $CopyWithPlaceholder()
title: ? _value.title
title == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.title : title as String?,
// ignore: cast_nullable_to_non_nullable description: description == const $CopyWithPlaceholder()
: title as String?, ? _value.description
description: // ignore: cast_nullable_to_non_nullable
description == const $CopyWithPlaceholder() : description as String?,
? _value.description actualValue: actualValue == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.actualValue
: description as String?, // ignore: cast_nullable_to_non_nullable
actualValue: : actualValue as Object?,
actualValue == const $CopyWithPlaceholder() requireUserOptIn: requireUserOptIn == const $CopyWithPlaceholder()
? _value.actualValue ? _value.requireUserOptIn
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: actualValue as Object?, : requireUserOptIn as bool,
requireUserOptIn: shouldBeDefault: shouldBeDefault == const $CopyWithPlaceholder()
requireUserOptIn == const $CopyWithPlaceholder() ? _value.shouldBeDefault
? _value.requireUserOptIn // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : shouldBeDefault as bool,
: requireUserOptIn as bool,
shouldBeDefault:
shouldBeDefault == const $CopyWithPlaceholder()
? _value.shouldBeDefault
// ignore: cast_nullable_to_non_nullable
: shouldBeDefault as bool,
); );
} }
} }
@@ -107,11 +107,10 @@ class UnifiedPreferenceSettingsRepository
_preferenceSettingGroupsProvider(partition).future, _preferenceSettingGroupsProvider(partition).future,
); );
final prefs = final prefs = _statelessGroups!.values
_statelessGroups!.values .map((group) => group.settings.keys)
.map((group) => group.settings.keys) .flattened
.flattened .toList();
.toList();
await ref.read(_preferenceRepositoryProvider.notifier).resetPrefs(prefs); await ref.read(_preferenceRepositoryProvider.notifier).resetPrefs(prefs);
} }
@@ -15,10 +15,9 @@ final _preferenceSettingContentProvider =
FutureProvider<Map<String, dynamic>>.internal( FutureProvider<Map<String, dynamic>>.internal(
_preferenceSettingContent, _preferenceSettingContent,
name: r'_preferenceSettingContentProvider', name: r'_preferenceSettingContentProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$preferenceSettingContentHash,
: _$preferenceSettingContentHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -99,10 +98,9 @@ class _PreferenceSettingGroupsProvider
), ),
from: _preferenceSettingGroupsProvider, from: _preferenceSettingGroupsProvider,
name: r'_preferenceSettingGroupsProvider', name: r'_preferenceSettingGroupsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$preferenceSettingGroupsHash,
: _$preferenceSettingGroupsHash,
dependencies: _PreferenceSettingGroupsFamily._dependencies, dependencies: _PreferenceSettingGroupsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
_PreferenceSettingGroupsFamily._allTransitiveDependencies, _PreferenceSettingGroupsFamily._allTransitiveDependencies,
@@ -238,10 +236,9 @@ class _PreferenceSettingGroupProvider
), ),
from: _preferenceSettingGroupProvider, from: _preferenceSettingGroupProvider,
name: r'_preferenceSettingGroupProvider', name: r'_preferenceSettingGroupProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$preferenceSettingGroupHash,
: _$preferenceSettingGroupHash,
dependencies: _PreferenceSettingGroupFamily._dependencies, dependencies: _PreferenceSettingGroupFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
_PreferenceSettingGroupFamily._allTransitiveDependencies, _PreferenceSettingGroupFamily._allTransitiveDependencies,
@@ -334,19 +331,19 @@ String _$preferenceRepositoryHash() =>
/// See also [_PreferenceRepository]. /// See also [_PreferenceRepository].
@ProviderFor(_PreferenceRepository) @ProviderFor(_PreferenceRepository)
final _preferenceRepositoryProvider = AutoDisposeNotifierProvider< final _preferenceRepositoryProvider =
_PreferenceRepository, AutoDisposeNotifierProvider<
Raw<Stream<Map<String, Object>>> _PreferenceRepository,
>.internal( Raw<Stream<Map<String, Object>>>
_PreferenceRepository.new, >.internal(
name: r'_preferenceRepositoryProvider', _PreferenceRepository.new,
debugGetCreateSourceHash: name: r'_preferenceRepositoryProvider',
const bool.fromEnvironment('dart.vm.product') debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null ? null
: _$preferenceRepositoryHash, : _$preferenceRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
typedef _$PreferenceRepository = typedef _$PreferenceRepository =
AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>; AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>;
@@ -418,14 +415,12 @@ class UnifiedPreferenceSettingsRepositoryProvider
() => UnifiedPreferenceSettingsRepository()..partition = partition, () => UnifiedPreferenceSettingsRepository()..partition = partition,
from: unifiedPreferenceSettingsRepositoryProvider, from: unifiedPreferenceSettingsRepositoryProvider,
name: r'unifiedPreferenceSettingsRepositoryProvider', name: r'unifiedPreferenceSettingsRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$unifiedPreferenceSettingsRepositoryHash,
: _$unifiedPreferenceSettingsRepositoryHash,
dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies, dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies: UnifiedPreferenceSettingsRepositoryFamily
UnifiedPreferenceSettingsRepositoryFamily ._allTransitiveDependencies,
._allTransitiveDependencies,
partition: partition, partition: partition,
); );
@@ -580,16 +575,14 @@ class PreferenceSettingsGroupRepositoryProvider
PreferencePartition partition, PreferencePartition partition,
String groupName, String groupName,
) : this._internal( ) : this._internal(
() => () => PreferenceSettingsGroupRepository()
PreferenceSettingsGroupRepository() ..partition = partition
..partition = partition ..groupName = groupName,
..groupName = groupName,
from: preferenceSettingsGroupRepositoryProvider, from: preferenceSettingsGroupRepositoryProvider,
name: r'preferenceSettingsGroupRepositoryProvider', name: r'preferenceSettingsGroupRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$preferenceSettingsGroupRepositoryHash,
: _$preferenceSettingsGroupRepositoryHash,
dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies, dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
PreferenceSettingsGroupRepositoryFamily._allTransitiveDependencies, PreferenceSettingsGroupRepositoryFamily._allTransitiveDependencies,
@@ -623,10 +616,9 @@ class PreferenceSettingsGroupRepositoryProvider
return ProviderOverride( return ProviderOverride(
origin: this, origin: this,
override: PreferenceSettingsGroupRepositoryProvider._internal( override: PreferenceSettingsGroupRepositoryProvider._internal(
() => () => create()
create() ..partition = partition
..partition = partition ..groupName = groupName,
..groupName = groupName,
from: from, from: from,
name: null, name: null,
dependencies: null, dependencies: null,
@@ -13,10 +13,9 @@ String _$readerableServiceHash() => r'03182c8afc41f5184322a3206473cbfa96df5819';
final readerableServiceProvider = Provider<GeckoReaderableService>.internal( final readerableServiceProvider = Provider<GeckoReaderableService>.internal(
readerableService, readerableService,
name: r'readerableServiceProvider', name: r'readerableServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$readerableServiceHash,
: _$readerableServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -33,10 +32,9 @@ final appearanceButtonVisibilityProvider =
AutoDisposeStreamProvider<bool>.internal( AutoDisposeStreamProvider<bool>.internal(
appearanceButtonVisibility, appearanceButtonVisibility,
name: r'appearanceButtonVisibilityProvider', name: r'appearanceButtonVisibilityProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$appearanceButtonVisibilityHash,
: _$appearanceButtonVisibilityHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final readerableScreenControllerProvider =
AsyncNotifierProvider<ReaderableScreenController, void>.internal( AsyncNotifierProvider<ReaderableScreenController, void>.internal(
ReaderableScreenController.new, ReaderableScreenController.new,
name: r'readerableScreenControllerProvider', name: r'readerableScreenControllerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$readerableScreenControllerHash,
: _$readerableScreenControllerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -32,16 +32,12 @@ class ReaderButton extends HookConsumerWidget {
), ),
); );
final icon = final icon = readerabilityState.active
readerabilityState.active ? Icon(MdiIcons.bookOpen, color: Theme.of(context).colorScheme.primary)
? Icon( : Icon(
MdiIcons.bookOpen, MdiIcons.bookOpenOutline,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.onSurface,
) );
: Icon(
MdiIcons.bookOpenOutline,
color: Theme.of(context).colorScheme.onSurface,
);
return Visibility( return Visibility(
visible: visible:
@@ -50,46 +46,40 @@ class ReaderButton extends HookConsumerWidget {
(enforceReadability && enableReadability), (enforceReadability && enableReadability),
child: readerChanging.when( child: readerChanging.when(
skipLoadingOnReload: true, skipLoadingOnReload: true,
data: data: (_) => InkWell(
(_) => InkWell( onTap: readerChanging.isLoading
onTap: ? null
readerChanging.isLoading : () async {
? null await ref
: () async { .read(readerableScreenControllerProvider.notifier)
await ref .toggleReaderView(!readerabilityState.active);
.read(readerableScreenControllerProvider.notifier) },
.toggleReaderView(!readerabilityState.active); child: Padding(
}, padding: const EdgeInsets.symmetric(
child: Padding( vertical: 15.0,
padding: const EdgeInsets.symmetric( horizontal: 8.0,
vertical: 15.0,
horizontal: 8.0,
),
child: icon,
),
), ),
child: icon,
),
),
error: (error, stackTrace) => SizedBox.shrink(), error: (error, stackTrace) => SizedBox.shrink(),
loading: loading: () => AnimateGradientShader(
() => AnimateGradientShader( duration: const Duration(milliseconds: 500),
duration: const Duration(milliseconds: 500), primaryEnd: Alignment.bottomLeft,
primaryEnd: Alignment.bottomLeft, secondaryEnd: Alignment.topRight,
secondaryEnd: Alignment.topRight, primaryColors: [colorScheme.primary, colorScheme.primaryContainer],
primaryColors: [ secondaryColors: [
colorScheme.primary, colorScheme.secondary,
colorScheme.primaryContainer, colorScheme.secondaryContainer,
], ],
secondaryColors: [ child: Padding(
colorScheme.secondary, padding: const EdgeInsets.symmetric(
colorScheme.secondaryContainer, vertical: 15.0,
], horizontal: 8.0,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 15.0,
horizontal: 8.0,
),
child: icon,
),
), ),
child: icon,
),
),
), ),
); );
} }
@@ -37,18 +37,17 @@ AsyncValue<List<GeckoSuggestion>> engineHistorySuggestions(Ref ref) {
return ref.watch( return ref.watch(
engineSuggestionsProvider.select( engineSuggestionsProvider.select(
(suggestions) => suggestions.whenData( (suggestions) => suggestions.whenData(
(suggestions) => (suggestions) => suggestions
suggestions .where(
.where( (suggestion) =>
(suggestion) => suggestion.type == GeckoSuggestionType.history &&
suggestion.type == GeckoSuggestionType.history && (suggestion.title.isNotEmpty) &&
(suggestion.title.isNotEmpty) && (suggestion.description.mapNotNull(
(suggestion.description.mapNotNull( (url) => Uri.tryParse(url),
(url) => Uri.tryParse(url), ) !=
) != null),
null), )
) .toList(),
.toList(),
), ),
), ),
); );
@@ -15,10 +15,9 @@ final engineHistorySuggestionsProvider =
AutoDisposeProvider<AsyncValue<List<GeckoSuggestion>>>.internal( AutoDisposeProvider<AsyncValue<List<GeckoSuggestion>>>.internal(
engineHistorySuggestions, engineHistorySuggestions,
name: r'engineHistorySuggestionsProvider', name: r'engineHistorySuggestionsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$engineHistorySuggestionsHash,
: _$engineHistorySuggestionsHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -31,19 +30,19 @@ String _$engineSuggestionsHash() => r'ba2c2d7f0a5e99fd9e639acd020b8cf3016c6126';
/// See also [EngineSuggestions]. /// See also [EngineSuggestions].
@ProviderFor(EngineSuggestions) @ProviderFor(EngineSuggestions)
final engineSuggestionsProvider = AutoDisposeStreamNotifierProvider< final engineSuggestionsProvider =
EngineSuggestions, AutoDisposeStreamNotifierProvider<
List<GeckoSuggestion> EngineSuggestions,
>.internal( List<GeckoSuggestion>
EngineSuggestions.new, >.internal(
name: r'engineSuggestionsProvider', EngineSuggestions.new,
debugGetCreateSourceHash: name: r'engineSuggestionsProvider',
const bool.fromEnvironment('dart.vm.product') debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null ? null
: _$engineSuggestionsHash, : _$engineSuggestionsHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
typedef _$EngineSuggestions = AutoDisposeStreamNotifier<List<GeckoSuggestion>>; typedef _$EngineSuggestions = AutoDisposeStreamNotifier<List<GeckoSuggestion>>;
// ignore_for_file: type=lint // ignore_for_file: type=lint
@@ -22,12 +22,9 @@ class SearchSuggestions extends _$SearchSuggestions {
final defaultProvider = ref.watch(defaultSearchSuggestionsProvider); final defaultProvider = ref.watch(defaultSearchSuggestionsProvider);
final resolvedProvider = suggestionsProvider ?? defaultProvider; final resolvedProvider = suggestionsProvider ?? defaultProvider;
_addQueryBinding = _addQueryBinding = ref
ref .watch(searchSuggestionsRepositoryProvider(resolvedProvider).notifier)
.watch( .addQuery;
searchSuggestionsRepositoryProvider(resolvedProvider).notifier,
)
.addQuery;
return ref.watch(searchSuggestionsRepositoryProvider(resolvedProvider)); return ref.watch(searchSuggestionsRepositoryProvider(resolvedProvider));
} }
@@ -15,10 +15,9 @@ final defaultSearchSuggestionsProvider =
Provider<ISearchSuggestionProvider>.internal( Provider<ISearchSuggestionProvider>.internal(
defaultSearchSuggestions, defaultSearchSuggestions,
name: r'defaultSearchSuggestionsProvider', name: r'defaultSearchSuggestionsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$defaultSearchSuggestionsHash,
: _$defaultSearchSuggestionsHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -104,10 +103,9 @@ class SearchSuggestionsProvider
() => SearchSuggestions()..suggestionsProvider = suggestionsProvider, () => SearchSuggestions()..suggestionsProvider = suggestionsProvider,
from: searchSuggestionsProvider, from: searchSuggestionsProvider,
name: r'searchSuggestionsProvider', name: r'searchSuggestionsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$searchSuggestionsHash,
: _$searchSuggestionsHash,
dependencies: SearchSuggestionsFamily._dependencies, dependencies: SearchSuggestionsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SearchSuggestionsFamily._allTransitiveDependencies, SearchSuggestionsFamily._allTransitiveDependencies,
@@ -94,10 +94,9 @@ class SearchSuggestionsRepositoryProvider
..suggestionsProvider = suggestionsProvider, ..suggestionsProvider = suggestionsProvider,
from: searchSuggestionsRepositoryProvider, from: searchSuggestionsRepositoryProvider,
name: r'searchSuggestionsRepositoryProvider', name: r'searchSuggestionsRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$searchSuggestionsRepositoryHash,
: _$searchSuggestionsRepositoryHash,
dependencies: SearchSuggestionsRepositoryFamily._dependencies, dependencies: SearchSuggestionsRepositoryFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
SearchSuggestionsRepositoryFamily._allTransitiveDependencies, SearchSuggestionsRepositoryFamily._allTransitiveDependencies,
@@ -32,21 +32,20 @@ class BangChips extends HookConsumerWidget {
) { ) {
return showDialog<bool>( return showDialog<bool>(
context: context, context: context,
builder: builder: (context) => AlertDialog(
(context) => AlertDialog( title: Text('Reset usage frequency of $triggerName?'),
title: Text('Reset usage frequency of $triggerName?'), content: const Text('This will remove the Bang from quick select.'),
content: const Text('This will remove the Bang from quick select.'), actions: <Widget>[
actions: <Widget>[ TextButton(
TextButton( onPressed: () => Navigator.pop(context, false),
onPressed: () => Navigator.pop(context, false), child: const Text('Cancel'),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Reset'),
),
],
), ),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Reset'),
),
],
),
); );
} }
@@ -71,9 +70,8 @@ class BangChips extends HookConsumerWidget {
Expanded( Expanded(
child: SelectableChips( child: SelectableChips(
itemId: (bang) => bang.trigger, itemId: (bang) => bang.trigger,
itemAvatar: itemAvatar: (bang) =>
(bang) => UrlIcon([bang.getTemplateUrl('')], iconSize: 20),
UrlIcon([bang.getTemplateUrl('')], iconSize: 20),
itemLabel: (bang) => Text(bang.websiteName), itemLabel: (bang) => Text(bang.websiteName),
availableItems: availableBangs, availableItems: availableBangs,
selectedItem: activeBang, selectedItem: activeBang,
@@ -100,10 +98,9 @@ class BangChips extends HookConsumerWidget {
final searchText = searchTextController?.text.trim(); final searchText = searchTextController?.text.trim();
final trigger = await BangSearchRoute( final trigger = await BangSearchRoute(
searchText: searchText: (searchText.isEmpty)
(searchText.isEmpty) ? BangSearchRoute.emptySearchText
? BangSearchRoute.emptySearchText : searchText!,
: searchText!,
).push<String?>(context); ).push<String?>(context);
if (trigger != null) { if (trigger != null) {
@@ -77,31 +77,29 @@ class SearchField extends HookConsumerWidget {
autofocus: autofocus, autofocus: autofocus,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
prefixIcon: prefixIcon: (showBangIcon && activeBang != null)
(showBangIcon && activeBang != null) ? Padding(
? Padding( padding: const EdgeInsetsDirectional.all(12.0),
padding: const EdgeInsetsDirectional.all(12.0), child: UrlIcon([
child: UrlIcon([ activeBang!.getTemplateUrl(''),
activeBang!.getTemplateUrl(''), ], iconSize: 24.0),
], iconSize: 24.0), )
) : null,
: null,
label: label ?? const Text('Search'), label: label ?? const Text('Search'),
// hintText: 'Ask anything...', // hintText: 'Ask anything...',
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
suffixIcon: suffixIcon: hasText
hasText ? IconButton(
? IconButton( onPressed: () {
onPressed: () { textEditingController.clear();
textEditingController.clear(); },
}, icon: const Icon(Icons.clear),
icon: const Icon(Icons.clear), )
) : SpeechToTextButton(
: SpeechToTextButton( onTextReceived: (data) {
onTextReceived: (data) { textEditingController.text = data.toString();
textEditingController.text = data.toString(); },
}, ),
),
), ),
onTapOutside: (event) { onTapOutside: (event) {
safeFocusNode.unfocus(); safeFocusNode.unfocus();
@@ -64,112 +64,104 @@ class FeedSearch extends HookConsumerWidget {
SliverSkeletonizer( SliverSkeletonizer(
enabled: articlesAsync.isLoading, enabled: articlesAsync.isLoading,
child: articlesAsync.when( child: articlesAsync.when(
data: data: (articles) => SliverList.builder(
(articles) => SliverList.builder( itemCount: articles.length,
itemCount: articles.length, itemBuilder: (context, index) {
itemBuilder: (context, index) { final article = articles[index];
final article = articles[index];
final titleHighlight = switch (article) { final titleHighlight = switch (article) {
final FeedArticleQueryResult result => final FeedArticleQueryResult result =>
result.titleHighlight.whenNotEmpty, result.titleHighlight.whenNotEmpty,
_ => null, _ => null,
}; };
final searchSnippet = switch (article) { final searchSnippet = switch (article) {
final FeedArticleQueryResult result => final FeedArticleQueryResult result =>
result.summarySnippet.whenNotEmpty ?? result.summarySnippet.whenNotEmpty ??
result.contentSnippet.whenNotEmpty, result.contentSnippet.whenNotEmpty,
_ => null, _ => null,
}; };
final articleDate = article.updated ?? article.created; final articleDate = article.updated ?? article.created;
return ListTile( return ListTile(
leading: RepaintBoundary( leading: RepaintBoundary(
child: UrlIcon([ child: UrlIcon([
article.icon ?? article.icon ??
article.links article.links
?.getRelation(FeedLinkRelation.alternate) ?.getRelation(FeedLinkRelation.alternate)
?.uri ?? ?.uri ??
article.siteLink ?? article.siteLink ??
article.feedId.base, article.feedId.base,
], iconSize: 24.0), ], iconSize: 24.0),
), ),
title: title: (titleHighlight.isNotEmpty)
(titleHighlight.isNotEmpty) ? MarkdownBody(
? MarkdownBody( data: titleHighlight!,
data: titleHighlight!, styleSheet: MarkdownStyleSheet(
styleSheet: MarkdownStyleSheet( p: Theme.of(context).textTheme.titleMedium
p: Theme.of( ?.copyWith(
color: Theme.of(
context, context,
).textTheme.titleMedium?.copyWith( ).colorScheme.onSurface,
color:
Theme.of(context).colorScheme.onSurface,
),
), ),
) ),
: Text( )
article.displayTitle, : Text(
style: theme.textTheme.titleMedium, article.displayTitle,
), style: theme.textTheme.titleMedium,
subtitle: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, subtitle: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
if (searchSnippet.isNotEmpty) children: [
MarkdownBody( if (searchSnippet.isNotEmpty)
data: searchSnippet!, MarkdownBody(
styleSheet: MarkdownStyleSheet( data: searchSnippet!,
p: Theme.of( styleSheet: MarkdownStyleSheet(
context, p: Theme.of(context).textTheme.bodyMedium?.copyWith(
).textTheme.bodyMedium?.copyWith( color: Theme.of(
color: context,
Theme.of( ).colorScheme.onSurfaceVariant,
context,
).colorScheme.onSurfaceVariant,
),
a: Theme.of(
context,
).textTheme.bodyMedium?.copyWith(
color:
Theme.of(
context,
).colorScheme.onSurfaceVariant,
decoration: TextDecoration.none,
),
),
)
else
(article.summaryPlain != null)
? Text(
article.summaryPlain!,
style: theme.textTheme.bodySmall,
maxLines: 3,
overflow: TextOverflow.ellipsis,
)
: const SizedBox.shrink(),
if (articleDate != null)
Align(
alignment: Alignment.topRight,
child: Text(
ref
.read(formatProvider.notifier)
.fullDateTimeWithTimezone(articleDate),
style: theme.textTheme.bodySmall?.copyWith(
fontStyle: FontStyle.italic,
),
),
), ),
], a: Theme.of(context).textTheme.bodyMedium?.copyWith(
), color: Theme.of(
onTap: () { context,
FeedArticleRoute( ).colorScheme.onSurfaceVariant,
articleId: article.id, decoration: TextDecoration.none,
).pushReplacement(context); ),
}, ),
); )
else
(article.summaryPlain != null)
? Text(
article.summaryPlain!,
style: theme.textTheme.bodySmall,
maxLines: 3,
overflow: TextOverflow.ellipsis,
)
: const SizedBox.shrink(),
if (articleDate != null)
Align(
alignment: Alignment.topRight,
child: Text(
ref
.read(formatProvider.notifier)
.fullDateTimeWithTimezone(articleDate),
style: theme.textTheme.bodySmall?.copyWith(
fontStyle: FontStyle.italic,
),
),
),
],
),
onTap: () {
FeedArticleRoute(
articleId: article.id,
).pushReplacement(context);
}, },
), );
},
),
error: (error, stackTrace) { error: (error, stackTrace) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: FailureWidget( child: FailureWidget(
@@ -178,13 +170,12 @@ class FeedSearch extends HookConsumerWidget {
), ),
); );
}, },
loading: loading: () => SliverList.builder(
() => SliverList.builder( itemCount: articlesAsync.valueOrNull?.length ?? 3,
itemCount: articlesAsync.valueOrNull?.length ?? 3, itemBuilder: (context, index) {
itemBuilder: (context, index) { return const ListTile(title: Bone.text());
return const ListTile(title: Bone.text()); },
}, ),
),
), ),
), ),
], ],
@@ -122,13 +122,12 @@ class HistorySuggestions extends HookConsumerWidget {
), ),
); );
}, },
loading: loading: () => SliverList.builder(
() => SliverList.builder( itemCount: historySuggestionsAsync.valueOrNull?.length ?? 3,
itemCount: historySuggestionsAsync.valueOrNull?.length ?? 3, itemBuilder: (context, index) {
itemBuilder: (context, index) { return const ListTile(title: Bone.text());
return const ListTile(title: Bone.text()); },
}, ),
),
), ),
), ),
], ],
@@ -33,19 +33,16 @@ class TabSearch extends HookConsumerWidget {
), ),
); );
final tabs = final tabs = ref
ref .watch(
.watch( seamlessFilteredTabPreviewsProvider(
seamlessFilteredTabPreviewsProvider( TabSearchPartition.search,
TabSearchPartition.search, (selectedContainer.value != null)
(selectedContainer.value != null) ? ContainerFilterById(containerId: selectedContainer.value!.id)
? ContainerFilterById( : ContainerFilterDisabled(),
containerId: selectedContainer.value!.id, ),
) )
: ContainerFilterDisabled(), .value;
),
)
.value;
useListenableCallback(searchTextListenable, () async { useListenableCallback(searchTextListenable, () async {
await ref await ref
@@ -118,30 +115,26 @@ class TabSearch extends HookConsumerWidget {
), ),
), ),
), ),
subtitle: subtitle: (bodyHasMatch || urlHasMatch)
(bodyHasMatch || urlHasMatch) ? MarkdownBody(
? MarkdownBody( data: bodyHasMatch
data: ? result.content!
bodyHasMatch : result.highlightedUrl!,
? result.content! styleSheet: MarkdownStyleSheet(
: result.highlightedUrl!, p: Theme.of(context).textTheme.bodyMedium?.copyWith(
styleSheet: MarkdownStyleSheet( color: Theme.of(context).colorScheme.onSurfaceVariant,
p: Theme.of(context).textTheme.bodyMedium?.copyWith( ),
color: a: Theme.of(context).textTheme.bodyMedium?.copyWith(
Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.onSurfaceVariant,
), decoration: TextDecoration.none,
a: Theme.of(context).textTheme.bodyMedium?.copyWith(
color:
Theme.of(context).colorScheme.onSurfaceVariant,
decoration: TextDecoration.none,
),
), ),
)
: Text(
result.url.toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
), ),
)
: Text(
result.url.toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () async { onTap: () async {
await ref await ref
.read(tabRepositoryProvider.notifier) .read(tabRepositoryProvider.notifier)
@@ -42,10 +42,9 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
} }
Selectable<Color> getDistinctColors() { Selectable<Color> getDistinctColors() {
final query = final query = db.selectOnly(db.container, distinct: true)
db.selectOnly(db.container, distinct: true) ..addColumns([db.container.color])
..addColumns([db.container.color]) ..where(db.container.color.isNotNull());
..where(db.container.color.isNotNull());
return query.map( return query.map(
(row) => row.readWithConverter<Color?, int>(db.container.color)!, (row) => row.readWithConverter<Color?, int>(db.container.color)!,
@@ -53,29 +52,26 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
} }
Selectable<String> getContainerTabIds(String? containerId) { Selectable<String> getContainerTabIds(String? containerId) {
final query = final query = selectOnly(db.tab)
selectOnly(db.tab) ..addColumns([db.tab.id])
..addColumns([db.tab.id]) ..where(
..where( (containerId != null)
(containerId != null) ? db.tab.containerId.equals(containerId)
? db.tab.containerId.equals(containerId) : db.tab.containerId.isNull(),
: db.tab.containerId.isNull(), )
) ..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
return query.map((row) => row.read(db.tab.id)!); return query.map((row) => row.read(db.tab.id)!);
} }
Selectable<TabData> getContainerTabsData(String? containerId) { Selectable<TabData> getContainerTabsData(String? containerId) {
final query = final query = db.tab.select()
db.tab.select() ..where(
..where( (t) => (containerId != null)
(t) => ? t.containerId.equals(containerId)
(containerId != null) : t.containerId.isNull(),
? t.containerId.equals(containerId) )
: t.containerId.isNull(), ..orderBy([(t) => OrderingTerm.asc(t.orderKey)]);
)
..orderBy([(t) => OrderingTerm.asc(t.orderKey)]);
return query; return query;
} }
@@ -21,19 +21,17 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
db.tab.select()..where((t) => t.id.equals(id)); db.tab.select()..where((t) => t.id.equals(id));
Selectable<String> getAllTabIds() { Selectable<String> getAllTabIds() {
final query = final query = selectOnly(db.tab)
selectOnly(db.tab) ..addColumns([db.tab.id])
..addColumns([db.tab.id]) ..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
return query.map((row) => row.read(db.tab.id)!); return query.map((row) => row.read(db.tab.id)!);
} }
SingleOrNullSelectable<String?> getTabContainerId(String tabId) { SingleOrNullSelectable<String?> getTabContainerId(String tabId) {
final query = final query = selectOnly(db.tab)
selectOnly(db.tab) ..addColumns([db.tab.containerId])
..addColumns([db.tab.containerId]) ..where(db.tab.id.equals(tabId));
..where(db.tab.id.equals(tabId));
return query.map((row) => row.read(db.tab.containerId)); return query.map((row) => row.read(db.tab.containerId));
} }
@@ -154,14 +152,12 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
batch.update( batch.update(
db.tab, db.tab,
TabCompanion( TabCompanion(
url: url: (previousState?.url != state.url)
(previousState?.url != state.url) ? Value(state.url)
? Value(state.url) : const Value.absent(),
: const Value.absent(), title: (previousState?.title != state.title)
title: ? Value(state.title)
(previousState?.title != state.title) : const Value.absent(),
? Value(state.title)
: const Value.absent(),
), ),
where: (t) => t.id.equals(state.id), where: (t) => t.id.equals(state.id),
); );
@@ -174,8 +170,9 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
return db.transaction(() async { return db.transaction(() async {
await (db.tab.delete()..where((t) => t.id.isNotIn(retainTabIds))).go(); await (db.tab.delete()..where((t) => t.id.isNotIn(retainTabIds))).go();
var currentOrderKey = var currentOrderKey = await db.containerDao
await db.containerDao.generateLeadingOrderKey(null).getSingle(); .generateLeadingOrderKey(null)
.getSingle();
await db.tab.insertAll( await db.tab.insertAll(
retainTabIds.map((id) { retainTabIds.map((id) {
@@ -55,11 +55,10 @@ class Container extends Table with TableInfo<Container, ContainerData> {
ContainerData map(Map<String, dynamic> data, {String? tablePrefix}) { ContainerData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ContainerData( return ContainerData(
id: id: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}id'],
data['${effectivePrefix}id'], )!,
)!,
name: attachedDatabase.typeMapping.read( name: attachedDatabase.typeMapping.read(
DriftSqlType.string, DriftSqlType.string,
data['${effectivePrefix}name'], data['${effectivePrefix}name'],
@@ -306,20 +305,18 @@ class Tab extends Table with TableInfo<Tab, TabData> {
TabData map(Map<String, dynamic> data, {String? tablePrefix}) { TabData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabData( return TabData(
id: id: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}id'],
data['${effectivePrefix}id'], )!,
)!,
containerId: attachedDatabase.typeMapping.read( containerId: attachedDatabase.typeMapping.read(
DriftSqlType.string, DriftSqlType.string,
data['${effectivePrefix}container_id'], data['${effectivePrefix}container_id'],
), ),
orderKey: orderKey: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}order_key'],
data['${effectivePrefix}order_key'], )!,
)!,
url: Tab.$converterurln.fromSql( url: Tab.$converterurln.fromSql(
attachedDatabase.typeMapping.read( attachedDatabase.typeMapping.read(
DriftSqlType.string, DriftSqlType.string,
@@ -350,11 +347,10 @@ class Tab extends Table with TableInfo<Tab, TabData> {
DriftSqlType.string, DriftSqlType.string,
data['${effectivePrefix}full_content_plain'], data['${effectivePrefix}full_content_plain'],
), ),
timestamp: timestamp: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.dateTime,
DriftSqlType.dateTime, data['${effectivePrefix}timestamp'],
data['${effectivePrefix}timestamp'], )!,
)!,
); );
} }
@@ -499,56 +495,47 @@ class TabData extends DataClass implements Insertable<TabData> {
orderKey: orderKey ?? this.orderKey, orderKey: orderKey ?? this.orderKey,
url: url.present ? url.value : this.url, url: url.present ? url.value : this.url,
title: title.present ? title.value : this.title, title: title.present ? title.value : this.title,
isProbablyReaderable: isProbablyReaderable: isProbablyReaderable.present
isProbablyReaderable.present ? isProbablyReaderable.value
? isProbablyReaderable.value : this.isProbablyReaderable,
: this.isProbablyReaderable, extractedContentMarkdown: extractedContentMarkdown.present
extractedContentMarkdown: ? extractedContentMarkdown.value
extractedContentMarkdown.present : this.extractedContentMarkdown,
? extractedContentMarkdown.value extractedContentPlain: extractedContentPlain.present
: this.extractedContentMarkdown, ? extractedContentPlain.value
extractedContentPlain: : this.extractedContentPlain,
extractedContentPlain.present fullContentMarkdown: fullContentMarkdown.present
? extractedContentPlain.value ? fullContentMarkdown.value
: this.extractedContentPlain, : this.fullContentMarkdown,
fullContentMarkdown: fullContentPlain: fullContentPlain.present
fullContentMarkdown.present ? fullContentPlain.value
? fullContentMarkdown.value : this.fullContentPlain,
: this.fullContentMarkdown,
fullContentPlain:
fullContentPlain.present
? fullContentPlain.value
: this.fullContentPlain,
timestamp: timestamp ?? this.timestamp, timestamp: timestamp ?? this.timestamp,
); );
TabData copyWithCompanion(TabCompanion data) { TabData copyWithCompanion(TabCompanion data) {
return TabData( return TabData(
id: data.id.present ? data.id.value : this.id, id: data.id.present ? data.id.value : this.id,
containerId: containerId: data.containerId.present
data.containerId.present ? data.containerId.value : this.containerId, ? data.containerId.value
: this.containerId,
orderKey: data.orderKey.present ? data.orderKey.value : this.orderKey, orderKey: data.orderKey.present ? data.orderKey.value : this.orderKey,
url: data.url.present ? data.url.value : this.url, url: data.url.present ? data.url.value : this.url,
title: data.title.present ? data.title.value : this.title, title: data.title.present ? data.title.value : this.title,
isProbablyReaderable: isProbablyReaderable: data.isProbablyReaderable.present
data.isProbablyReaderable.present ? data.isProbablyReaderable.value
? data.isProbablyReaderable.value : this.isProbablyReaderable,
: this.isProbablyReaderable, extractedContentMarkdown: data.extractedContentMarkdown.present
extractedContentMarkdown: ? data.extractedContentMarkdown.value
data.extractedContentMarkdown.present : this.extractedContentMarkdown,
? data.extractedContentMarkdown.value extractedContentPlain: data.extractedContentPlain.present
: this.extractedContentMarkdown, ? data.extractedContentPlain.value
extractedContentPlain: : this.extractedContentPlain,
data.extractedContentPlain.present fullContentMarkdown: data.fullContentMarkdown.present
? data.extractedContentPlain.value ? data.fullContentMarkdown.value
: this.extractedContentPlain, : this.fullContentMarkdown,
fullContentMarkdown: fullContentPlain: data.fullContentPlain.present
data.fullContentMarkdown.present ? data.fullContentPlain.value
? data.fullContentMarkdown.value : this.fullContentPlain,
: this.fullContentMarkdown,
fullContentPlain:
data.fullContentPlain.present
? data.fullContentPlain.value
: this.fullContentPlain,
timestamp: data.timestamp.present ? data.timestamp.value : this.timestamp, 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}) { TabFt map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TabFt( return TabFt(
title: title: attachedDatabase.typeMapping.read(
attachedDatabase.typeMapping.read( DriftSqlType.string,
DriftSqlType.string, data['${effectivePrefix}title'],
data['${effectivePrefix}title'], )!,
)!, url: attachedDatabase.typeMapping.read(
url: DriftSqlType.string,
attachedDatabase.typeMapping.read( data['${effectivePrefix}url'],
DriftSqlType.string, )!,
data['${effectivePrefix}url'], extractedContentPlain: attachedDatabase.typeMapping.read(
)!, DriftSqlType.string,
extractedContentPlain: data['${effectivePrefix}extracted_content_plain'],
attachedDatabase.typeMapping.read( )!,
DriftSqlType.string, fullContentPlain: attachedDatabase.typeMapping.read(
data['${effectivePrefix}extracted_content_plain'], DriftSqlType.string,
)!, data['${effectivePrefix}full_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( return TabFt(
title: data.title.present ? data.title.value : this.title, title: data.title.present ? data.title.value : this.title,
url: data.url.present ? data.url.value : this.url, url: data.url.present ? data.url.value : this.url,
extractedContentPlain: extractedContentPlain: data.extractedContentPlain.present
data.extractedContentPlain.present ? data.extractedContentPlain.value
? data.extractedContentPlain.value : this.extractedContentPlain,
: this.extractedContentPlain, fullContentPlain: data.fullContentPlain.present
fullContentPlain: ? data.fullContentPlain.value
data.fullContentPlain.present : this.fullContentPlain,
? data.fullContentPlain.value
: this.fullContentPlain,
); );
} }
@@ -1431,12 +1412,12 @@ class $ContainerTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $ContainerFilterComposer($db: db, $table: table), $ContainerFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $ContainerOrderingComposer($db: db, $table: table), $ContainerOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $ContainerAnnotationComposer($db: db, $table: table), $ContainerAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> id = const Value.absent(), Value<String> id = const Value.absent(),
@@ -1465,16 +1446,11 @@ class $ContainerTableManager
metadata: metadata, metadata: metadata,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map(
p0 (e) => (e.readTable(table), $ContainerReferences(db, table, e)),
.map( )
(e) => ( .toList(),
e.readTable(table),
$ContainerReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({tabRefs = false}) { prefetchHooksCallback: ({tabRefs = false}) {
return PrefetchHooks( return PrefetchHooks(
db: db, db: db,
@@ -1490,10 +1466,10 @@ class $ContainerTableManager
>( >(
currentTable: table, currentTable: table,
referencedTable: $ContainerReferences._tabRefsTable(db), referencedTable: $ContainerReferences._tabRefsTable(db),
managerFromTypedResult: managerFromTypedResult: (p0) =>
(p0) => $ContainerReferences(db, table, p0).tabRefs, $ContainerReferences(db, table, p0).tabRefs,
referencedItemsForCurrentItem: referencedItemsForCurrentItem: (item, referencedItems) =>
(item, referencedItems) => referencedItems.where( referencedItems.where(
(e) => e.containerId == item.id, (e) => e.containerId == item.id,
), ),
typedResults: items, typedResults: items,
@@ -1829,12 +1805,12 @@ class $TabTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $TabFilterComposer($db: db, $table: table), $TabFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $TabOrderingComposer($db: db, $table: table), $TabOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $TabAnnotationComposer($db: db, $table: table), $TabAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> id = const Value.absent(), Value<String> id = const Value.absent(),
@@ -1891,51 +1867,45 @@ class $TabTableManager
timestamp: timestamp, timestamp: timestamp,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map((e) => (e.readTable(table), $TabReferences(db, table, e)))
p0 .toList(),
.map(
(e) => (
e.readTable(table),
$TabReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({containerId = false}) { prefetchHooksCallback: ({containerId = false}) {
return PrefetchHooks( return PrefetchHooks(
db: db, db: db,
explicitlyWatchedTables: [], explicitlyWatchedTables: [],
addJoins: < addJoins:
T extends TableManagerState< <
dynamic, T extends TableManagerState<
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic, dynamic,
dynamic dynamic,
> dynamic
>(state) { >
if (containerId) { >(state) {
state = if (containerId) {
state.withJoin( state =
currentTable: table, state.withJoin(
currentColumn: table.containerId, currentTable: table,
referencedTable: $TabReferences._containerIdTable( currentColumn: table.containerId,
db, referencedTable: $TabReferences
), ._containerIdTable(db),
referencedColumn: referencedColumn: $TabReferences
$TabReferences._containerIdTable(db).id, ._containerIdTable(db)
) .id,
as T; )
} as T;
}
return state; return state;
}, },
getPrefetchedDataCallback: (items) async { getPrefetchedDataCallback: (items) async {
return []; return [];
}, },
@@ -2079,12 +2049,12 @@ class $TabFtsTableManager
TableManagerState( TableManagerState(
db: db, db: db,
table: table, table: table,
createFilteringComposer: createFilteringComposer: () =>
() => $TabFtsFilterComposer($db: db, $table: table), $TabFtsFilterComposer($db: db, $table: table),
createOrderingComposer: createOrderingComposer: () =>
() => $TabFtsOrderingComposer($db: db, $table: table), $TabFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer: createComputedFieldComposer: () =>
() => $TabFtsAnnotationComposer($db: db, $table: table), $TabFtsAnnotationComposer($db: db, $table: table),
updateCompanionCallback: updateCompanionCallback:
({ ({
Value<String> title = const Value.absent(), Value<String> title = const Value.absent(),
@@ -2113,16 +2083,9 @@ class $TabFtsTableManager
fullContentPlain: fullContentPlain, fullContentPlain: fullContentPlain,
rowid: rowid, rowid: rowid,
), ),
withReferenceMapper: withReferenceMapper: (p0) => p0
(p0) => .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
p0 .toList(),
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: null, prefetchHooksCallback: null,
), ),
); );
@@ -60,19 +60,17 @@ class _$ContainerAuthSettingsCWProxyImpl
return ContainerAuthSettings( return ContainerAuthSettings(
authenticationRequired: authenticationRequired:
authenticationRequired == const $CopyWithPlaceholder() authenticationRequired == const $CopyWithPlaceholder()
? _value.authenticationRequired ? _value.authenticationRequired
// ignore: cast_nullable_to_non_nullable // ignore: cast_nullable_to_non_nullable
: authenticationRequired as bool, : authenticationRequired as bool,
lockOnAppBackground: lockOnAppBackground: lockOnAppBackground == const $CopyWithPlaceholder()
lockOnAppBackground == const $CopyWithPlaceholder() ? _value.lockOnAppBackground
? _value.lockOnAppBackground // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : lockOnAppBackground as bool,
: lockOnAppBackground as bool, lockTimeout: lockTimeout == const $CopyWithPlaceholder()
lockTimeout: ? _value.lockTimeout
lockTimeout == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.lockTimeout : lockTimeout as Duration?,
// ignore: cast_nullable_to_non_nullable
: lockTimeout as Duration?,
); );
} }
} }
@@ -141,26 +139,22 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
Object? useProxy = const $CopyWithPlaceholder(), Object? useProxy = const $CopyWithPlaceholder(),
}) { }) {
return ContainerMetadata( return ContainerMetadata(
iconData: iconData: iconData == const $CopyWithPlaceholder()
iconData == const $CopyWithPlaceholder() ? _value.iconData
? _value.iconData // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : iconData as IconData?,
: iconData as IconData?, contextualIdentity: contextualIdentity == const $CopyWithPlaceholder()
contextualIdentity: ? _value.contextualIdentity
contextualIdentity == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.contextualIdentity : contextualIdentity as String?,
// ignore: cast_nullable_to_non_nullable authSettings: authSettings == const $CopyWithPlaceholder()
: contextualIdentity as String?, ? _value.authSettings
authSettings: // ignore: cast_nullable_to_non_nullable
authSettings == const $CopyWithPlaceholder() : authSettings as ContainerAuthSettings,
? _value.authSettings useProxy: useProxy == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.useProxy
: authSettings as ContainerAuthSettings, // ignore: cast_nullable_to_non_nullable
useProxy: : useProxy as bool,
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(), Object? metadata = const $CopyWithPlaceholder(),
}) { }) {
return ContainerData( return ContainerData(
id: id: id == const $CopyWithPlaceholder()
id == const $CopyWithPlaceholder() ? _value.id
? _value.id // ignore: cast_nullable_to_non_nullable
// ignore: cast_nullable_to_non_nullable : id as String,
: id as String, name: name == const $CopyWithPlaceholder()
name: ? _value.name
name == const $CopyWithPlaceholder() // ignore: cast_nullable_to_non_nullable
? _value.name : name as String?,
// ignore: cast_nullable_to_non_nullable color: color == const $CopyWithPlaceholder()
: name as String?, ? _value.color
color: // ignore: cast_nullable_to_non_nullable
color == const $CopyWithPlaceholder() : color as Color,
? _value.color metadata: metadata == const $CopyWithPlaceholder()
// ignore: cast_nullable_to_non_nullable ? _value.metadata
: color as Color, // ignore: cast_nullable_to_non_nullable
metadata: : metadata as ContainerMetadata?,
metadata == const $CopyWithPlaceholder()
? _value.metadata
// ignore: cast_nullable_to_non_nullable
: metadata as ContainerMetadata?,
); );
} }
} }
@@ -267,10 +257,9 @@ ContainerAuthSettings _$ContainerAuthSettingsFromJson(
) => ContainerAuthSettings( ) => ContainerAuthSettings(
authenticationRequired: json['authenticationRequired'] as bool, authenticationRequired: json['authenticationRequired'] as bool,
lockOnAppBackground: json['lockOnAppBackground'] as bool, lockOnAppBackground: json['lockOnAppBackground'] as bool,
lockTimeout: lockTimeout: json['lockTimeout'] == null
json['lockTimeout'] == null ? null
? null : Duration(microseconds: (json['lockTimeout'] as num).toInt()),
: Duration(microseconds: (json['lockTimeout'] as num).toInt()),
); );
Map<String, dynamic> _$ContainerAuthSettingsToJson( Map<String, dynamic> _$ContainerAuthSettingsToJson(
@@ -288,12 +277,11 @@ ContainerMetadata _$ContainerMetadataFromJson(Map<String, dynamic> json) =>
const IconDataJsonConverter().fromJson, const IconDataJsonConverter().fromJson,
), ),
contextualIdentity: json['contextualIdentity'] as String?, contextualIdentity: json['contextualIdentity'] as String?,
authSettings: authSettings: json['authSettings'] == null
json['authSettings'] == null ? null
? null : ContainerAuthSettings.fromJson(
: ContainerAuthSettings.fromJson( json['authSettings'] as Map<String, dynamic>,
json['authSettings'] as Map<String, dynamic>, ),
),
useProxy: json['useProxy'] as bool? ?? false, useProxy: json['useProxy'] as bool? ?? false,
); );
@@ -13,8 +13,9 @@ String _$tabDatabaseHash() => r'422bd4789296dc271fabbd5906f2e2ab16bccaa3';
final tabDatabaseProvider = Provider<TabDatabase>.internal( final tabDatabaseProvider = Provider<TabDatabase>.internal(
tabDatabase, tabDatabase,
name: r'tabDatabaseProvider', name: r'tabDatabaseProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null : _$tabDatabaseHash, ? null
: _$tabDatabaseHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -26,12 +26,11 @@ AsyncValue<List<ContainerDataWithCount>> matchSortedContainersWithCount(
} }
return value.whenData( return value.whenData(
(cb) => (cb) => TokenizedFilter.sort(
TokenizedFilter.sort( items: cb,
items: cb, toString: (item) => item.name,
toString: (item) => item.name, query: searchText!,
query: searchText!, ).filtered,
).filtered,
); );
}), }),
); );
@@ -15,10 +15,9 @@ final containersWithCountProvider =
AutoDisposeStreamProvider<List<ContainerDataWithCount>>.internal( AutoDisposeStreamProvider<List<ContainerDataWithCount>>.internal(
containersWithCount, containersWithCount,
name: r'containersWithCountProvider', name: r'containersWithCountProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$containersWithCountHash,
: _$containersWithCountHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -101,10 +100,9 @@ class MatchSortedContainersWithCountProvider
), ),
from: matchSortedContainersWithCountProvider, from: matchSortedContainersWithCountProvider,
name: r'matchSortedContainersWithCountProvider', name: r'matchSortedContainersWithCountProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$matchSortedContainersWithCountHash,
: _$matchSortedContainersWithCountHash,
dependencies: MatchSortedContainersWithCountFamily._dependencies, dependencies: MatchSortedContainersWithCountFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
MatchSortedContainersWithCountFamily._allTransitiveDependencies, MatchSortedContainersWithCountFamily._allTransitiveDependencies,
@@ -229,10 +227,9 @@ class ContainerTabIdsProvider extends AutoDisposeStreamProvider<List<String>> {
(ref) => containerTabIds(ref as ContainerTabIdsRef, containerFilter), (ref) => containerTabIds(ref as ContainerTabIdsRef, containerFilter),
from: containerTabIdsProvider, from: containerTabIdsProvider,
name: r'containerTabIdsProvider', name: r'containerTabIdsProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$containerTabIdsHash,
: _$containerTabIdsHash,
dependencies: ContainerTabIdsFamily._dependencies, dependencies: ContainerTabIdsFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
ContainerTabIdsFamily._allTransitiveDependencies, ContainerTabIdsFamily._allTransitiveDependencies,
@@ -52,8 +52,8 @@ class SelectedContainer extends _$SelectedContainer {
if (passAuth) { if (passAuth) {
if (container.metadata.useProxy) { if (container.metadata.useProxy) {
final proxyPluginHealthy = final proxyPluginHealthy = await GeckoContainerProxyService()
await GeckoContainerProxyService().healthcheck(); .healthcheck();
if (proxyPluginHealthy) { if (proxyPluginHealthy) {
state = id; state = id;
@@ -15,10 +15,9 @@ final selectedContainerDataProvider =
AutoDisposeStreamProvider<ContainerData?>.internal( AutoDisposeStreamProvider<ContainerData?>.internal(
selectedContainerData, selectedContainerData,
name: r'selectedContainerDataProvider', name: r'selectedContainerDataProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedContainerDataHash,
: _$selectedContainerDataHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -34,10 +33,9 @@ final selectedContainerProvider =
NotifierProvider<SelectedContainer, String?>.internal( NotifierProvider<SelectedContainer, String?>.internal(
SelectedContainer.new, SelectedContainer.new,
name: r'selectedContainerProvider', name: r'selectedContainerProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$selectedContainerHash,
: _$selectedContainerHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -15,10 +15,9 @@ final containerRepositoryProvider =
NotifierProvider<ContainerRepository, void>.internal( NotifierProvider<ContainerRepository, void>.internal(
ContainerRepository.new, ContainerRepository.new,
name: r'containerRepositoryProvider', name: r'containerRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$containerRepositoryHash,
: _$containerRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -21,12 +21,11 @@ class TabDataRepository extends _$TabDataRepository {
} }
Future<void> closeAllTabsByContainer(String? containerId) async { Future<void> closeAllTabsByContainer(String? containerId) async {
final tabIds = final tabIds = await ref
await ref .read(tabDatabaseProvider)
.read(tabDatabaseProvider) .containerDao
.containerDao .getContainerTabIds(containerId)
.getContainerTabIds(containerId) .get();
.get();
if (tabIds.isNotEmpty) { if (tabIds.isNotEmpty) {
await ref.read(tabRepositoryProvider.notifier).closeTabs(tabIds); await ref.read(tabRepositoryProvider.notifier).closeTabs(tabIds);
@@ -34,18 +33,16 @@ class TabDataRepository extends _$TabDataRepository {
} }
Future<void> closeAllTabsByHost(String? containerId, String host) async { Future<void> closeAllTabsByHost(String? containerId, String host) async {
final tabs = final tabs = await ref
await ref .read(tabDatabaseProvider)
.read(tabDatabaseProvider) .containerDao
.containerDao .getContainerTabsData(containerId)
.getContainerTabsData(containerId) .get();
.get();
final filtered = final filtered = tabs
tabs .where((tab) => tab.url?.host == host)
.where((tab) => tab.url?.host == host) .map((tab) => tab.id)
.map((tab) => tab.id) .toList();
.toList();
if (filtered.isNotEmpty) { if (filtered.isNotEmpty) {
await ref.read(tabRepositoryProvider.notifier).closeTabs(filtered); await ref.read(tabRepositoryProvider.notifier).closeTabs(filtered);
@@ -14,10 +14,9 @@ final tabDataRepositoryProvider =
NotifierProvider<TabDataRepository, void>.internal( NotifierProvider<TabDataRepository, void>.internal(
TabDataRepository.new, TabDataRepository.new,
name: r'tabDataRepositoryProvider', name: r'tabDataRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabDataRepositoryHash,
: _$tabDataRepositoryHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -19,18 +19,17 @@ class TabSearchRepository extends _$TabSearchRepository {
}) async { }) async {
if (input.isNotEmpty) { if (input.isNotEmpty) {
state = await AsyncValue.guard( state = await AsyncValue.guard(
() => () => ref
ref .read(tabDatabaseProvider)
.read(tabDatabaseProvider) .tabDao
.tabDao .queryTabs(
.queryTabs( matchPrefix: matchPrefix,
matchPrefix: matchPrefix, matchSuffix: matchSuffix,
matchSuffix: matchSuffix, ellipsis: ellipsis,
ellipsis: ellipsis, snippetLength: snippetLength,
snippetLength: snippetLength, searchString: input,
searchString: input, )
) .get(),
.get(),
); );
} else { } else {
state = const AsyncValue.data(null); state = const AsyncValue.data(null);
@@ -87,10 +87,9 @@ class TabSearchRepositoryProvider
() => TabSearchRepository()..partition = partition, () => TabSearchRepository()..partition = partition,
from: tabSearchRepositoryProvider, from: tabSearchRepositoryProvider,
name: r'tabSearchRepositoryProvider', name: r'tabSearchRepositoryProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$tabSearchRepositoryHash,
: _$tabSearchRepositoryHash,
dependencies: TabSearchRepositoryFamily._dependencies, dependencies: TabSearchRepositoryFamily._dependencies,
allTransitiveDependencies: allTransitiveDependencies:
TabSearchRepositoryFamily._allTransitiveDependencies, TabSearchRepositoryFamily._allTransitiveDependencies,
@@ -149,9 +149,8 @@ class ContainerEditScreen extends HookConsumerWidget {
onPressed: () async { onPressed: () async {
final color = await showDialog<Color?>( final color = await showDialog<Color?>(
context: context, context: context,
builder: builder: (context) =>
(context) => ColorPickerDialog(selectedColor.value),
ColorPickerDialog(selectedColor.value),
); );
if (color != null) { if (color != null) {
@@ -164,22 +163,20 @@ class ContainerEditScreen extends HookConsumerWidget {
title: const Text('Cookie Isolation'), title: const Text('Cookie Isolation'),
secondary: const Icon(MdiIcons.cookieLock), secondary: const Icon(MdiIcons.cookieLock),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
onChanged: onChanged: (_mode == _DialogMode.create)
(_mode == _DialogMode.create) ? (value) {
? (value) { contextualIdentity.value = value
contextualIdentity.value = ? initialContainer
value .metadata
? initialContainer .contextualIdentity ??
.metadata uuid.v4()
.contextualIdentity ?? : null;
uuid.v4()
: null;
if (!value && useProxy.value) { if (!value && useProxy.value) {
useProxy.value = false; useProxy.value = false;
}
} }
: null, }
: null,
), ),
SwitchListTile.adaptive( SwitchListTile.adaptive(
value: useProxy.value, value: useProxy.value,
@@ -199,8 +196,8 @@ class ContainerEditScreen extends HookConsumerWidget {
_DialogMode.edit => _DialogMode.edit =>
(contextualIdentity.value != null) (contextualIdentity.value != null)
? (value) { ? (value) {
useProxy.value = value; useProxy.value = value;
} }
: null, : null,
}, },
), ),
@@ -230,8 +227,9 @@ class ContainerEditScreen extends HookConsumerWidget {
title: const Text('Timeout'), title: const Text('Timeout'),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
onChanged: (value) { onChanged: (value) {
final newValue = final newValue = value!
value! ? _timeoutOptions[1].value : null; ? _timeoutOptions[1].value
: null;
authSettings.value = authSettings.value.copyWith authSettings.value = authSettings.value.copyWith
.lockTimeout(newValue); .lockTimeout(newValue);
@@ -28,127 +28,109 @@ class ContainerListScreen extends HookConsumerWidget {
enabled: containersAsync.isLoading, enabled: containersAsync.isLoading,
child: containersAsync.when( child: containersAsync.when(
skipLoadingOnReload: true, skipLoadingOnReload: true,
data: data: (containers) => FadingScroll(
(containers) => FadingScroll( fadingSize: 25,
fadingSize: 25, builder: (context, controller) {
builder: (context, controller) { return ListView.builder(
return ListView.builder( controller: controller,
controller: controller, itemCount: containers.length,
itemCount: containers.length, itemBuilder: (context, index) {
itemBuilder: (context, index) { final container = containers[index];
final container = containers[index]; return Slidable(
return Slidable( key: ValueKey(container.id),
key: ValueKey(container.id), startActionPane: ActionPane(
startActionPane: ActionPane( motion: const ScrollMotion(),
motion: const ScrollMotion(), children: [
children: [ if (container.id != selectedContainer)
if (container.id != selectedContainer) SlidableAction(
SlidableAction( onPressed: (context) async {
onPressed: (context) async { final result = await ref
final result = await ref .read(selectedContainerProvider.notifier)
.read( .setContainerId(container.id);
selectedContainerProvider.notifier,
)
.setContainerId(container.id);
if (context.mounted && if (context.mounted &&
result == result ==
SetContainerResult SetContainerResult.successHasProxy) {
.successHasProxy) {
await ref
.read(
startProxyControllerProvider
.notifier,
)
.maybeStartProxy(context);
}
},
foregroundColor:
Theme.of(
context,
).colorScheme.onPrimaryContainer,
backgroundColor:
Theme.of(
context,
).colorScheme.primaryContainer,
icon: Icons.check,
label: 'Select',
)
else
SlidableAction(
onPressed: (context) {
ref
.read(
selectedContainerProvider.notifier,
)
.clearContainer();
},
foregroundColor:
Theme.of(
context,
).colorScheme.onPrimaryContainer,
backgroundColor:
Theme.of(
context,
).colorScheme.primaryContainer,
icon: Icons.close,
label: 'Unselect',
),
],
),
endActionPane: ActionPane(
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (context) async {
await ref await ref
.read( .read(
containerRepositoryProvider.notifier, startProxyControllerProvider.notifier,
) )
.deleteContainer(container.id); .maybeStartProxy(context);
}, }
backgroundColor: },
Theme.of( foregroundColor: Theme.of(
context, context,
).colorScheme.errorContainer, ).colorScheme.onPrimaryContainer,
foregroundColor: backgroundColor: Theme.of(
Theme.of( context,
context, ).colorScheme.primaryContainer,
).colorScheme.onErrorContainer, icon: Icons.check,
icon: Icons.delete, label: 'Select',
label: 'Delete', )
), else
], SlidableAction(
onPressed: (context) {
ref
.read(selectedContainerProvider.notifier)
.clearContainer();
},
foregroundColor: Theme.of(
context,
).colorScheme.onPrimaryContainer,
backgroundColor: Theme.of(
context,
).colorScheme.primaryContainer,
icon: Icons.close,
label: 'Unselect',
),
],
),
endActionPane: ActionPane(
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (context) async {
await ref
.read(containerRepositoryProvider.notifier)
.deleteContainer(container.id);
},
backgroundColor: Theme.of(
context,
).colorScheme.errorContainer,
foregroundColor: Theme.of(
context,
).colorScheme.onErrorContainer,
icon: Icons.delete,
label: 'Delete',
), ),
child: ContainerListTile( ],
container, ),
isSelected: container.id == selectedContainer, child: ContainerListTile(
), container,
); isSelected: container.id == selectedContainer,
}, ),
); );
}, },
), );
},
),
error: (error, stackTrace) => SizedBox.shrink(), error: (error, stackTrace) => SizedBox.shrink(),
loading: loading: () => ListView.builder(
() => ListView.builder( itemCount: 3,
itemCount: 3, itemBuilder: (context, index) => ContainerListTile(
itemBuilder: ContainerData(id: 'null', color: Colors.transparent),
(context, index) => ContainerListTile( isSelected: false,
ContainerData(id: 'null', color: Colors.transparent), ),
isSelected: false, ),
),
),
), ),
); );
}, },
), ),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
onPressed: () async { onPressed: () async {
final initialColor = final initialColor = await ref
await ref .read(containerRepositoryProvider.notifier)
.read(containerRepositoryProvider.notifier) .unusedRandomContainerColor();
.unusedRandomContainerColor();
if (context.mounted) { if (context.mounted) {
final result = await ContainerCreateRoute( final result = await ContainerCreateRoute(
@@ -68,17 +68,16 @@ class ContainerChips extends HookConsumerWidget {
child: SelectableChips( child: SelectableChips(
deleteIcon: false, deleteIcon: false,
itemId: (container) => container.id, itemId: (container) => container.id,
itemAvatar: itemAvatar: (container) => Container(
(container) => Container( width: 20.0,
width: 20.0, height: 20.0,
height: 20.0, decoration: BoxDecoration(
decoration: BoxDecoration( color: container.color,
color: container.color, shape: BoxShape.circle,
shape: BoxShape.circle, ),
), ),
), itemLabel: (container) =>
itemLabel: Text(container.name ?? 'New Container'),
(container) => Text(container.name ?? 'New Container'),
itemBadgeCount: (container) => container.tabCount, itemBadgeCount: (container) => container.tabCount,
itemWrap: (child, container) { itemWrap: (child, container) {
return HookBuilder( return HookBuilder(
@@ -150,17 +149,16 @@ class ContainerChips extends HookConsumerWidget {
return OverlayPortal( return OverlayPortal(
controller: overlayController, controller: overlayController,
overlayChildBuilder: overlayChildBuilder: (context) => Positioned(
(context) => Positioned( top: position.dy,
top: position.dy, left: position.dx,
left: position.dx, child: IgnorePointer(
child: IgnorePointer( child: Transform.scale(
child: Transform.scale( scale: 1.1,
scale: 1.1, child: child,
child: child,
),
),
), ),
),
),
child: HookBuilder( child: HookBuilder(
builder: (context) { builder: (context) {
final dragTabId = useValueListenable( final dragTabId = useValueListenable(
@@ -54,43 +54,38 @@ class _MaterialPickerState extends State<MaterialPicker> {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Container( child: Container(
margin: margin: isPortrait
isPortrait ? const EdgeInsets.only(right: 10)
? const EdgeInsets.only(right: 10) : const EdgeInsets.only(bottom: 10),
: const EdgeInsets.only(bottom: 10),
width: isPortrait ? 60 : null, width: isPortrait ? 60 : null,
height: isPortrait ? null : 60, height: isPortrait ? null : 60,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: color: (Theme.of(context).brightness == Brightness.light)
(Theme.of(context).brightness == Brightness.light) ? (Theme.of(context).brightness == Brightness.light)
? (Theme.of(context).brightness == Brightness.light) ? Colors.grey[300]!
? Colors.grey[300]! : Colors.black38
: Colors.black38 : Colors.black38,
: Colors.black38,
blurRadius: 10, blurRadius: 10,
), ),
], ],
border: border: isPortrait
isPortrait ? Border(
? Border( right: BorderSide(
right: BorderSide( color: (Theme.of(context).brightness == Brightness.light)
color: ? Colors.grey[300]!
(Theme.of(context).brightness == Brightness.light) : Colors.black38,
? Colors.grey[300]!
: Colors.black38,
),
)
: Border(
top: BorderSide(
color:
(Theme.of(context).brightness == Brightness.light)
? Colors.grey[300]!
: Colors.black38,
),
), ),
)
: Border(
top: BorderSide(
color: (Theme.of(context).brightness == Brightness.light)
? Colors.grey[300]!
: Colors.black38,
),
),
), ),
child: ScrollConfiguration( child: ScrollConfiguration(
behavior: ScrollConfiguration.of( behavior: ScrollConfiguration.of(
@@ -118,10 +113,9 @@ class _MaterialPickerState extends State<MaterialPicker> {
}, },
child: Container( child: Container(
color: const Color(0x00000000), color: const Color(0x00000000),
padding: padding: isPortrait
isPortrait ? const EdgeInsets.fromLTRB(0, 7, 0, 7)
? const EdgeInsets.fromLTRB(0, 7, 0, 7) : const EdgeInsets.fromLTRB(7, 0, 7, 0),
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
child: Align( child: Align(
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
@@ -130,38 +124,34 @@ class _MaterialPickerState extends State<MaterialPicker> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: colorType, color: colorType,
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: boxShadow: _currentColorType == colors
_currentColorType == colors ? [
? [ if (colorType ==
if (colorType == Theme.of(context).cardColor)
Theme.of(context).cardColor) BoxShadow(
BoxShadow( color:
color: (Theme.of(context).brightness ==
(Theme.of( Brightness.light)
context, ? Colors.grey[300]!
).brightness == : Colors.black38,
Brightness.light) blurRadius: 10,
? Colors.grey[300]! )
: Colors.black38, else
blurRadius: 10, BoxShadow(
) color: colorType,
else blurRadius: 10,
BoxShadow( ),
color: colorType, ]
blurRadius: 10, : null,
), border: colorType == Theme.of(context).cardColor
] ? Border.all(
: null, color:
border: (Theme.of(context).brightness ==
colorType == Theme.of(context).cardColor Brightness.light)
? Border.all( ? Colors.grey[300]!
color: : Colors.black38,
(Theme.of(context).brightness == )
Brightness.light) : null,
? Colors.grey[300]!
: Colors.black38,
)
: null,
), ),
), ),
), ),
@@ -208,66 +198,60 @@ class _MaterialPickerState extends State<MaterialPicker> {
}, },
child: Container( child: Container(
color: const Color(0x00000000), color: const Color(0x00000000),
margin: margin: isPortrait
isPortrait ? const EdgeInsets.only(right: 10)
? const EdgeInsets.only(right: 10) : const EdgeInsets.only(bottom: 10),
: const EdgeInsets.only(bottom: 10), padding: isPortrait
padding: ? const EdgeInsets.fromLTRB(0, 7, 0, 7)
isPortrait : const EdgeInsets.fromLTRB(7, 0, 7, 0),
? const EdgeInsets.fromLTRB(0, 7, 0, 7)
: const EdgeInsets.fromLTRB(7, 0, 7, 0),
child: Align( child: Align(
child: AnimatedContainer( child: AnimatedContainer(
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
width: width: isPortrait
isPortrait ? (_currentShading == color ? 250 : 230)
? (_currentShading == color ? 250 : 230) : (_currentShading == color ? 50 : 30),
: (_currentShading == color ? 50 : 30),
height: isPortrait ? 50 : 220, height: isPortrait ? 50 : 220,
decoration: BoxDecoration( decoration: BoxDecoration(
color: color, color: color,
boxShadow: boxShadow: _currentShading == color
_currentShading == color ? [
? [ if ((color == Colors.white) ||
if ((color == Colors.white) || (color == Colors.black))
(color == Colors.black)) BoxShadow(
BoxShadow( color:
color: (Theme.of(context).brightness ==
(Theme.of(context).brightness == Brightness.light)
Brightness.light) ? Colors.grey[300]!
? Colors.grey[300]! : Colors.black38,
: Colors.black38, blurRadius: 10,
blurRadius: 10, )
) else
else BoxShadow(color: color, blurRadius: 10),
BoxShadow(color: color, blurRadius: 10), ]
] : null,
: null,
border: border:
(color == Colors.white) || (color == Colors.white) ||
(color == Colors.black) (color == Colors.black)
? Border.all( ? Border.all(
color: color:
(Theme.of(context).brightness == (Theme.of(context).brightness ==
Brightness.light) Brightness.light)
? Colors.grey[300]! ? Colors.grey[300]!
: Colors.black38, : Colors.black38,
) )
: null, : null,
), ),
child: child: widget.enableLabel
widget.enableLabel ? isPortrait
? isPortrait ? Row(
? Row(
children: [ children: [
Text( Text(
' ${colors.values.first}', ' ${colors.values.first}',
style: TextStyle( style: TextStyle(
color: color: useWhiteForeground(color)
useWhiteForeground(color) ? Colors.white
? Colors.white : Colors.black,
: Colors.black,
), ),
), ),
Expanded( Expanded(
@@ -278,8 +262,8 @@ class _MaterialPickerState extends State<MaterialPicker> {
style: TextStyle( style: TextStyle(
color: color:
useWhiteForeground(color) useWhiteForeground(color)
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -287,12 +271,13 @@ class _MaterialPickerState extends State<MaterialPicker> {
), ),
], ],
) )
: AnimatedOpacity( : AnimatedOpacity(
duration: const Duration( duration: const Duration(
milliseconds: 300, milliseconds: 300,
), ),
opacity: opacity: _currentShading == color
_currentShading == color ? 1 : 0, ? 1
: 0,
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 16, top: 16,
@@ -301,10 +286,9 @@ class _MaterialPickerState extends State<MaterialPicker> {
child: Text( child: Text(
colors.values.first, colors.values.first,
style: TextStyle( style: TextStyle(
color: color: useWhiteForeground(color)
useWhiteForeground(color) ? Colors.white
? Colors.white : Colors.black,
: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
), ),
@@ -312,7 +296,7 @@ class _MaterialPickerState extends State<MaterialPicker> {
), ),
), ),
) )
: const SizedBox(), : const SizedBox(),
), ),
), ),
), ),
@@ -17,12 +17,11 @@ bool useWhiteForeground(Color backgroundColor, {double bias = 0.0}) {
// return 1.05 / (color.computeLuminance() + 0.05) > 4.5; // return 1.05 / (color.computeLuminance() + 0.05) > 4.5;
// New: // New:
final v = final v = sqrt(
sqrt( pow(backgroundColor.r, 2) * 0.299 +
pow(backgroundColor.r, 2) * 0.299 + pow(backgroundColor.g, 2) * 0.587 +
pow(backgroundColor.g, 2) * 0.587 + pow(backgroundColor.b, 2) * 0.114,
pow(backgroundColor.b, 2) * 0.114, ).round();
).round();
return v < (130 + bias); return v < (130 + bias);
} }
@@ -15,10 +15,9 @@ final kagiAutosuggestServiceProvider =
NotifierProvider<KagiAutosuggestService, void>.internal( NotifierProvider<KagiAutosuggestService, void>.internal(
KagiAutosuggestService.new, KagiAutosuggestService.new,
name: r'kagiAutosuggestServiceProvider', name: r'kagiAutosuggestServiceProvider',
debugGetCreateSourceHash: debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
const bool.fromEnvironment('dart.vm.product') ? null
? null : _$kagiAutosuggestServiceHash,
: _$kagiAutosuggestServiceHash,
dependencies: null, dependencies: null,
allTransitiveDependencies: null, allTransitiveDependencies: null,
); );
@@ -37,29 +37,27 @@ sealed class FtsQueryBuilder {
}) { }) {
final matches = _tokenizePattern.allMatches(input); final matches = _tokenizePattern.allMatches(input);
final barewords = final barewords = matches
matches .map((match) {
.map((match) { if (match.group(1) != null) {
if (match.group(1) != null) { return EnclosedBareword(match.group(1)!);
return EnclosedBareword(match.group(1)!); } else if (_barewordPattern.hasMatch(match.group(2)!)) {
} else if (_barewordPattern.hasMatch(match.group(2)!)) { return SimpleBareword(match.group(2)!);
return SimpleBareword(match.group(2)!); } else {
} else { return EnclosedBareword(match.group(2)!);
return EnclosedBareword(match.group(2)!); }
} })
}) .where((token) => token.word.isNotEmpty)
.where((token) => token.word.isNotEmpty) .whereNot(_isReservedBareword)
.whereNot(_isReservedBareword) .toList();
.toList();
//Merge short tokens //Merge short tokens
_mergeShortBarewords(barewords, minTokenLength); _mergeShortBarewords(barewords, minTokenLength);
_tokens = _tokens = barewords
barewords .where((bareword) => bareword.word.length >= minTokenLength)
.where((bareword) => bareword.word.length >= minTokenLength) .take(tokenLimit)
.take(tokenLimit) .toList();
.toList();
} }
static void _mergeShortBarewords( static void _mergeShortBarewords(
@@ -33,17 +33,16 @@ sealed class UnixTokenizer {
}) { }) {
final matches = _tokenizePattern.allMatches(input); final matches = _tokenizePattern.allMatches(input);
final barewords = final barewords = matches
matches .map((match) {
.map((match) { if (match.group(1) != null) {
if (match.group(1) != null) { return EnclosedBareword(match.group(1)!);
return EnclosedBareword(match.group(1)!); } else {
} else { return SimpleBareword(match.group(2)!);
return SimpleBareword(match.group(2)!); }
} })
}) .where((token) => token.word.isNotEmpty)
.where((token) => token.word.isNotEmpty) .toList();
.toList();
//Merge short tokens //Merge short tokens
_mergeShortBarewords(barewords, minTokenLength); _mergeShortBarewords(barewords, minTokenLength);
@@ -80,17 +80,16 @@ class TokenizedFilter<T> {
}) { }) {
final queryTokens = _tokenize(query); final queryTokens = _tokenize(query);
final scoredItems = final scoredItems = items.map((item) {
items.map((item) { final itemString = toString(item);
final itemString = toString(item); if (itemString == null || itemString.isEmpty) {
if (itemString == null || itemString.isEmpty) { return (item, 0.0);
return (item, 0.0); }
}
final itemTokens = _tokenize(itemString); final itemTokens = _tokenize(itemString);
final score = _calculateScore(queryTokens, itemTokens); final score = _calculateScore(queryTokens, itemTokens);
return (item, score); return (item, score);
}).toList(); }).toList();
// Sort by score in descending order // Sort by score in descending order
scoredItems.sort((a, b) => b.$2.compareTo(a.$2)); scoredItems.sort((a, b) => b.$2.compareTo(a.$2));
@@ -108,16 +107,15 @@ class TokenizedFilter<T> {
}) { }) {
final queryTokens = _tokenize(query); final queryTokens = _tokenize(query);
final filtered = final filtered = items.where((item) {
items.where((item) { final itemString = toString(item);
final itemString = toString(item); if (itemString == null || itemString.isEmpty) {
if (itemString == null || itemString.isEmpty) { return false;
return false; }
}
final itemTokens = _tokenize(itemString); final itemTokens = _tokenize(itemString);
return _matchTokens(queryTokens, itemTokens); return _matchTokens(queryTokens, itemTokens);
}).toList(); }).toList();
return TokenizedFilter._(items, filtered); return TokenizedFilter._(items, filtered);
} }

Some files were not shown because too many files have changed in this diff Show More