increase min sdk and apply new formatter
This commit is contained in:
1 parent
f7885fc829
commit
a1ee8bef35
266 files changed
+11329
-10058
No files matched your search
@@ -42,7 +42,8 @@ class BottomSheetExtend extends _$BottomSheetExtend {
|
||||
await _extentStreamController.close();
|
||||
});
|
||||
|
||||
return _extentStreamController.stream
|
||||
.sampleTime(const Duration(milliseconds: 50));
|
||||
return _extentStreamController.stream.sampleTime(
|
||||
const Duration(milliseconds: 50),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,15 @@ String _$bottomSheetControllerHash() =>
|
||||
@ProviderFor(BottomSheetController)
|
||||
final bottomSheetControllerProvider =
|
||||
AutoDisposeNotifierProvider<BottomSheetController, Sheet?>.internal(
|
||||
BottomSheetController.new,
|
||||
name: r'bottomSheetControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$bottomSheetControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
BottomSheetController.new,
|
||||
name: r'bottomSheetControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$bottomSheetControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$BottomSheetController = AutoDisposeNotifier<Sheet?>;
|
||||
String _$bottomSheetExtendHash() => r'7e11b9047c15bdeb4dfcb488a8573daadb64e25c';
|
||||
@@ -29,14 +30,15 @@ String _$bottomSheetExtendHash() => r'7e11b9047c15bdeb4dfcb488a8573daadb64e25c';
|
||||
@ProviderFor(BottomSheetExtend)
|
||||
final bottomSheetExtendProvider =
|
||||
StreamNotifierProvider<BottomSheetExtend, double>.internal(
|
||||
BottomSheetExtend.new,
|
||||
name: r'bottomSheetExtendProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$bottomSheetExtendHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
BottomSheetExtend.new,
|
||||
name: r'bottomSheetExtendProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$bottomSheetExtendHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$BottomSheetExtend = StreamNotifier<double>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$overlayDialogControllerHash() =>
|
||||
@ProviderFor(OverlayDialogController)
|
||||
final overlayDialogControllerProvider =
|
||||
AutoDisposeNotifierProvider<OverlayDialogController, Widget?>.internal(
|
||||
OverlayDialogController.new,
|
||||
name: r'overlayDialogControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$overlayDialogControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
OverlayDialogController.new,
|
||||
name: r'overlayDialogControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$overlayDialogControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$OverlayDialogController = AutoDisposeNotifier<Widget?>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -18,8 +18,9 @@ class BrowserIcon with FastEquatable {
|
||||
required Color? dominantColor,
|
||||
required IconSource source,
|
||||
}) async {
|
||||
final image =
|
||||
await tryDecodeImage(bytes).then((image) => image!.toEquatable());
|
||||
final image = await tryDecodeImage(
|
||||
bytes,
|
||||
).then((image) => image!.toEquatable());
|
||||
|
||||
return BrowserIcon(
|
||||
image: image,
|
||||
@@ -38,9 +39,5 @@ class BrowserIcon with FastEquatable {
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
image,
|
||||
dominantColor,
|
||||
source,
|
||||
];
|
||||
List<Object?> get hashParameters => [image, dominantColor, source];
|
||||
}
|
||||
@@ -12,17 +12,17 @@ class FindResultState with FastEquatable {
|
||||
});
|
||||
|
||||
factory FindResultState.$default() => FindResultState(
|
||||
activeMatchOrdinal: -1,
|
||||
numberOfMatches: 0,
|
||||
isDoneCounting: false,
|
||||
);
|
||||
activeMatchOrdinal: -1,
|
||||
numberOfMatches: 0,
|
||||
isDoneCounting: false,
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
activeMatchOrdinal,
|
||||
numberOfMatches,
|
||||
isDoneCounting,
|
||||
];
|
||||
activeMatchOrdinal,
|
||||
numberOfMatches,
|
||||
isDoneCounting,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@@ -28,16 +28,20 @@ class HistoryState with FastEquatable {
|
||||
});
|
||||
|
||||
factory HistoryState.$default() => HistoryState(
|
||||
items: const [],
|
||||
currentIndex: 0,
|
||||
canGoBack: false,
|
||||
canGoForward: false,
|
||||
);
|
||||
items: const [],
|
||||
currentIndex: 0,
|
||||
canGoBack: false,
|
||||
canGoForward: false,
|
||||
);
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters =>
|
||||
[items, currentIndex, canGoBack, canGoForward];
|
||||
List<Object?> get hashParameters => [
|
||||
items,
|
||||
currentIndex,
|
||||
canGoBack,
|
||||
canGoForward,
|
||||
];
|
||||
}
|
||||
@@ -5,15 +5,10 @@ class ReaderableState with FastEquatable {
|
||||
|
||||
final bool active;
|
||||
|
||||
ReaderableState({
|
||||
required this.readerable,
|
||||
required this.active,
|
||||
});
|
||||
ReaderableState({required this.readerable, required this.active});
|
||||
|
||||
factory ReaderableState.$default() => ReaderableState(
|
||||
readerable: false,
|
||||
active: false,
|
||||
);
|
||||
factory ReaderableState.$default() =>
|
||||
ReaderableState(readerable: false, active: false);
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@@ -11,11 +11,8 @@ class SecurityState with FastEquatable {
|
||||
required this.issuer,
|
||||
});
|
||||
|
||||
factory SecurityState.$default() => SecurityState(
|
||||
secure: false,
|
||||
host: "",
|
||||
issuer: "",
|
||||
);
|
||||
factory SecurityState.$default() =>
|
||||
SecurityState(secure: false, host: "", issuer: "");
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@@ -26,12 +26,12 @@ class TabState extends WebPageInfo with FastEquatable {
|
||||
|
||||
@override
|
||||
BrowserIcon? get favicon => icon.mapNotNull(
|
||||
(icon) => BrowserIcon(
|
||||
image: icon,
|
||||
dominantColor: null,
|
||||
source: IconSource.memory,
|
||||
),
|
||||
);
|
||||
(icon) => BrowserIcon(
|
||||
image: icon,
|
||||
dominantColor: null,
|
||||
source: IconSource.memory,
|
||||
),
|
||||
);
|
||||
|
||||
final EquatableImage? thumbnail;
|
||||
|
||||
@@ -64,40 +64,40 @@ class TabState extends WebPageInfo with FastEquatable {
|
||||
}) : super(title: title);
|
||||
|
||||
factory TabState.$default(String tabId) => TabState(
|
||||
id: tabId,
|
||||
contextId: null,
|
||||
url: Uri.parse('about:blank'),
|
||||
title: "",
|
||||
icon: null,
|
||||
thumbnail: null,
|
||||
progress: 0,
|
||||
isPrivate: false,
|
||||
isFullScreen: false,
|
||||
isLoading: false,
|
||||
securityInfoState: SecurityState.$default(),
|
||||
historyState: HistoryState.$default(),
|
||||
readerableState: ReaderableState.$default(),
|
||||
findResultState: FindResultState.$default(),
|
||||
);
|
||||
id: tabId,
|
||||
contextId: null,
|
||||
url: Uri.parse('about:blank'),
|
||||
title: "",
|
||||
icon: null,
|
||||
thumbnail: null,
|
||||
progress: 0,
|
||||
isPrivate: false,
|
||||
isFullScreen: false,
|
||||
isLoading: false,
|
||||
securityInfoState: SecurityState.$default(),
|
||||
historyState: HistoryState.$default(),
|
||||
readerableState: ReaderableState.$default(),
|
||||
findResultState: FindResultState.$default(),
|
||||
);
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
contextId,
|
||||
url,
|
||||
title,
|
||||
icon,
|
||||
thumbnail,
|
||||
progress,
|
||||
isPrivate,
|
||||
isFullScreen,
|
||||
isLoading,
|
||||
securityInfoState,
|
||||
historyState,
|
||||
readerableState,
|
||||
findResultState,
|
||||
];
|
||||
id,
|
||||
contextId,
|
||||
url,
|
||||
title,
|
||||
icon,
|
||||
thumbnail,
|
||||
progress,
|
||||
isPrivate,
|
||||
isFullScreen,
|
||||
isLoading,
|
||||
securityInfoState,
|
||||
historyState,
|
||||
readerableState,
|
||||
findResultState,
|
||||
];
|
||||
}
|
||||
@@ -106,7 +106,6 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
|
||||
this(findResultState: findResultState);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TabState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -130,58 +129,71 @@ class _$TabStateCWProxyImpl implements _$TabStateCWProxy {
|
||||
}) {
|
||||
return TabState(
|
||||
id: _value.id,
|
||||
contextId: contextId == const $CopyWithPlaceholder()
|
||||
? _value.contextId
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextId as String?,
|
||||
url: url == const $CopyWithPlaceholder()
|
||||
? _value.url
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: url as Uri,
|
||||
title: title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String,
|
||||
icon: icon == const $CopyWithPlaceholder()
|
||||
? _value.icon
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: icon as EquatableImage?,
|
||||
thumbnail: thumbnail == const $CopyWithPlaceholder()
|
||||
? _value.thumbnail
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: thumbnail as EquatableImage?,
|
||||
progress: progress == const $CopyWithPlaceholder()
|
||||
? _value.progress
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: progress as int,
|
||||
isPrivate: isPrivate == const $CopyWithPlaceholder()
|
||||
? _value.isPrivate
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isPrivate as bool,
|
||||
isFullScreen: isFullScreen == const $CopyWithPlaceholder()
|
||||
? _value.isFullScreen
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isFullScreen as bool,
|
||||
isLoading: isLoading == const $CopyWithPlaceholder()
|
||||
? _value.isLoading
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isLoading as bool,
|
||||
securityInfoState: securityInfoState == const $CopyWithPlaceholder()
|
||||
? _value.securityInfoState
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: securityInfoState as SecurityState,
|
||||
historyState: historyState == const $CopyWithPlaceholder()
|
||||
? _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,
|
||||
contextId:
|
||||
contextId == const $CopyWithPlaceholder()
|
||||
? _value.contextId
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextId as String?,
|
||||
url:
|
||||
url == const $CopyWithPlaceholder()
|
||||
? _value.url
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: url as Uri,
|
||||
title:
|
||||
title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String,
|
||||
icon:
|
||||
icon == const $CopyWithPlaceholder()
|
||||
? _value.icon
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: icon as EquatableImage?,
|
||||
thumbnail:
|
||||
thumbnail == const $CopyWithPlaceholder()
|
||||
? _value.thumbnail
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: thumbnail as EquatableImage?,
|
||||
progress:
|
||||
progress == const $CopyWithPlaceholder()
|
||||
? _value.progress
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: progress as int,
|
||||
isPrivate:
|
||||
isPrivate == const $CopyWithPlaceholder()
|
||||
? _value.isPrivate
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isPrivate as bool,
|
||||
isFullScreen:
|
||||
isFullScreen == const $CopyWithPlaceholder()
|
||||
? _value.isFullScreen
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isFullScreen as bool,
|
||||
isLoading:
|
||||
isLoading == const $CopyWithPlaceholder()
|
||||
? _value.isLoading
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: isLoading as bool,
|
||||
securityInfoState:
|
||||
securityInfoState == const $CopyWithPlaceholder()
|
||||
? _value.securityInfoState
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: securityInfoState as SecurityState,
|
||||
historyState:
|
||||
historyState == const $CopyWithPlaceholder()
|
||||
? _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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ class WebExtensionState with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
extensionId,
|
||||
title,
|
||||
enabled,
|
||||
badgeText,
|
||||
badgeTextColor,
|
||||
badgeBackgroundColor,
|
||||
icon,
|
||||
];
|
||||
extensionId,
|
||||
title,
|
||||
enabled,
|
||||
badgeText,
|
||||
badgeTextColor,
|
||||
badgeBackgroundColor,
|
||||
icon,
|
||||
];
|
||||
}
|
||||
@@ -69,7 +69,6 @@ class _$WebExtensionStateCWProxyImpl implements _$WebExtensionStateCWProxy {
|
||||
WebExtensionState icon(EquatableImage? icon) => this(icon: icon);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `WebExtensionState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -86,34 +85,41 @@ class _$WebExtensionStateCWProxyImpl implements _$WebExtensionStateCWProxy {
|
||||
Object? icon = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return WebExtensionState(
|
||||
extensionId: extensionId == const $CopyWithPlaceholder()
|
||||
? _value.extensionId
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: extensionId as String,
|
||||
enabled: enabled == const $CopyWithPlaceholder()
|
||||
? _value.enabled
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enabled as bool,
|
||||
title: title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
badgeText: badgeText == const $CopyWithPlaceholder()
|
||||
? _value.badgeText
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeText as String?,
|
||||
badgeTextColor: badgeTextColor == const $CopyWithPlaceholder()
|
||||
? _value.badgeTextColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeTextColor as Color?,
|
||||
badgeBackgroundColor: badgeBackgroundColor == const $CopyWithPlaceholder()
|
||||
? _value.badgeBackgroundColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeBackgroundColor as Color?,
|
||||
icon: icon == const $CopyWithPlaceholder()
|
||||
? _value.icon
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: icon as EquatableImage?,
|
||||
extensionId:
|
||||
extensionId == const $CopyWithPlaceholder()
|
||||
? _value.extensionId
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: extensionId as String,
|
||||
enabled:
|
||||
enabled == const $CopyWithPlaceholder()
|
||||
? _value.enabled
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enabled as bool,
|
||||
title:
|
||||
title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
badgeText:
|
||||
badgeText == const $CopyWithPlaceholder()
|
||||
? _value.badgeText
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeText as String?,
|
||||
badgeTextColor:
|
||||
badgeTextColor == const $CopyWithPlaceholder()
|
||||
? _value.badgeTextColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeTextColor as Color?,
|
||||
badgeBackgroundColor:
|
||||
badgeBackgroundColor == const $CopyWithPlaceholder()
|
||||
? _value.badgeBackgroundColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: badgeBackgroundColor as Color?,
|
||||
icon:
|
||||
icon == const $CopyWithPlaceholder()
|
||||
? _value.icon
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: icon as EquatableImage?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,15 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
part 'providers.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
GeckoSelectionActionService selectionActionService(
|
||||
Ref ref,
|
||||
) {
|
||||
GeckoSelectionActionService selectionActionService(Ref ref) {
|
||||
final service = GeckoSelectionActionService.setUp();
|
||||
|
||||
unawaited(
|
||||
service.setActions([
|
||||
SearchAction((text) async {
|
||||
final defaultSearchBang =
|
||||
await ref.read(defaultSearchBangDataProvider.future);
|
||||
final defaultSearchBang = await ref.read(
|
||||
defaultSearchBangDataProvider.future,
|
||||
);
|
||||
|
||||
if (defaultSearchBang != null) {
|
||||
await ref
|
||||
@@ -33,14 +32,14 @@ GeckoSelectionActionService selectionActionService(
|
||||
}
|
||||
}),
|
||||
PrivateSearchAction((text) async {
|
||||
final defaultSearchBang =
|
||||
await ref.read(defaultSearchBangDataProvider.future);
|
||||
final defaultSearchBang = await ref.read(
|
||||
defaultSearchBangDataProvider.future,
|
||||
);
|
||||
|
||||
if (defaultSearchBang != null) {
|
||||
await ref.read(tabRepositoryProvider.notifier).addTab(
|
||||
url: defaultSearchBang.getUrl(text),
|
||||
private: true,
|
||||
);
|
||||
await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
.addTab(url: defaultSearchBang.getUrl(text), private: true);
|
||||
} else {
|
||||
logger.e('No default search bang found');
|
||||
}
|
||||
@@ -132,12 +131,13 @@ class EngineReadyState extends _$EngineReadyState {
|
||||
eventService.engineReadyStateEvents
|
||||
.firstWhere((value) => value == true)
|
||||
.timeout(
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () {
|
||||
logger.w('Waiting for engine ready state timed out');
|
||||
return true;
|
||||
},
|
||||
).whenComplete(() => state = true),
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () {
|
||||
logger.w('Waiting for engine ready state timed out');
|
||||
return true;
|
||||
},
|
||||
)
|
||||
.whenComplete(() => state = true),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$selectionActionServiceHash() =>
|
||||
@ProviderFor(selectionActionService)
|
||||
final selectionActionServiceProvider =
|
||||
Provider<GeckoSelectionActionService>.internal(
|
||||
selectionActionService,
|
||||
name: r'selectionActionServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectionActionServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectionActionService,
|
||||
name: r'selectionActionServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectionActionServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -64,9 +65,10 @@ String _$tabContentServiceHash() => r'd9a991add907ecc138c62790883e59d8e9aa9266';
|
||||
final tabContentServiceProvider = Provider<GeckoTabContentService>.internal(
|
||||
tabContentService,
|
||||
name: r'tabContentServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabContentServiceHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabContentServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -81,14 +83,15 @@ String _$engineSuggestionsServiceHash() =>
|
||||
@ProviderFor(engineSuggestionsService)
|
||||
final engineSuggestionsServiceProvider =
|
||||
Provider<GeckoSuggestionsService>.internal(
|
||||
engineSuggestionsService,
|
||||
name: r'engineSuggestionsServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
engineSuggestionsService,
|
||||
name: r'engineSuggestionsServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -100,14 +103,15 @@ String _$selectedTabSessionNotifierHash() =>
|
||||
@ProviderFor(selectedTabSessionNotifier)
|
||||
final selectedTabSessionNotifierProvider =
|
||||
AutoDisposeProvider<Raw<TabSession>>.internal(
|
||||
selectedTabSessionNotifier,
|
||||
name: r'selectedTabSessionNotifierProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTabSessionNotifierHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectedTabSessionNotifier,
|
||||
name: r'selectedTabSessionNotifierProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTabSessionNotifierHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -118,14 +122,15 @@ String _$engineReadyStateHash() => r'c682333e2e07cf0635aa7ae793a2088ca648c950';
|
||||
@ProviderFor(EngineReadyState)
|
||||
final engineReadyStateProvider =
|
||||
NotifierProvider<EngineReadyState, bool>.internal(
|
||||
EngineReadyState.new,
|
||||
name: r'engineReadyStateProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineReadyStateHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
EngineReadyState.new,
|
||||
name: r'engineReadyStateProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineReadyStateHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$EngineReadyState = Notifier<bool>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -12,21 +12,18 @@ class SelectedTab extends _$SelectedTab {
|
||||
String? build() {
|
||||
final eventSerivce = ref.watch(eventServiceProvider);
|
||||
|
||||
ref.listen(
|
||||
fireImmediately: true,
|
||||
engineReadyStateProvider,
|
||||
(previous, next) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(onSelectedTabChange: true);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(fireImmediately: true, engineReadyStateProvider, (
|
||||
previous,
|
||||
next,
|
||||
) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(onSelectedTabChange: true);
|
||||
}
|
||||
});
|
||||
|
||||
final selectedTabSub = eventSerivce.selectedTabEvents.listen(
|
||||
(tabId) async {
|
||||
state = tabId;
|
||||
},
|
||||
);
|
||||
final selectedTabSub = eventSerivce.selectedTabEvents.listen((tabId) async {
|
||||
state = tabId;
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(selectedTabSub.cancel());
|
||||
|
||||
@@ -13,23 +13,20 @@ class TabList extends _$TabList {
|
||||
List<String> build() {
|
||||
final eventService = ref.watch(eventServiceProvider);
|
||||
|
||||
ref.listen(
|
||||
fireImmediately: true,
|
||||
engineReadyStateProvider,
|
||||
(previous, next) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(onTabListChange: true);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(fireImmediately: true, engineReadyStateProvider, (
|
||||
previous,
|
||||
next,
|
||||
) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(onTabListChange: true);
|
||||
}
|
||||
});
|
||||
|
||||
final tabListSub = eventService.tabListEvents.listen(
|
||||
(tabs) async {
|
||||
if (!const DeepCollectionEquality().equals(state, tabs)) {
|
||||
state = tabs;
|
||||
}
|
||||
},
|
||||
);
|
||||
final tabListSub = eventService.tabListEvents.listen((tabs) async {
|
||||
if (!const DeepCollectionEquality().equals(state, tabs)) {
|
||||
state = tabs;
|
||||
}
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(tabListSub.cancel());
|
||||
|
||||
@@ -43,8 +43,9 @@ class TabSession extends _$TabSession {
|
||||
|
||||
@override
|
||||
void build({required String? tabId}) {
|
||||
_sessionService = (tabId != null)
|
||||
? GeckoSessionService(tabId: tabId)
|
||||
: GeckoSessionService.forActiveTab();
|
||||
_sessionService =
|
||||
(tabId != null)
|
||||
? GeckoSessionService(tabId: tabId)
|
||||
: GeckoSessionService.forActiveTab();
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,7 @@ class _SystemHash {
|
||||
abstract class _$TabSession extends BuildlessAutoDisposeNotifier<void> {
|
||||
late final String? tabId;
|
||||
|
||||
void build({
|
||||
required String? tabId,
|
||||
});
|
||||
void build({required String? tabId});
|
||||
}
|
||||
|
||||
/// See also [TabSession].
|
||||
@@ -47,21 +45,15 @@ class TabSessionFamily extends Family<void> {
|
||||
const TabSessionFamily();
|
||||
|
||||
/// See also [TabSession].
|
||||
TabSessionProvider call({
|
||||
required String? tabId,
|
||||
}) {
|
||||
return TabSessionProvider(
|
||||
tabId: tabId,
|
||||
);
|
||||
TabSessionProvider call({required String? tabId}) {
|
||||
return TabSessionProvider(tabId: tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
TabSessionProvider getProviderOverride(
|
||||
covariant TabSessionProvider provider,
|
||||
) {
|
||||
return call(
|
||||
tabId: provider.tabId,
|
||||
);
|
||||
return call(tabId: provider.tabId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -83,21 +75,19 @@ class TabSessionFamily extends Family<void> {
|
||||
class TabSessionProvider
|
||||
extends AutoDisposeNotifierProviderImpl<TabSession, void> {
|
||||
/// See also [TabSession].
|
||||
TabSessionProvider({
|
||||
required String? tabId,
|
||||
}) : this._internal(
|
||||
() => TabSession()..tabId = tabId,
|
||||
from: tabSessionProvider,
|
||||
name: r'tabSessionProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSessionHash,
|
||||
dependencies: TabSessionFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
TabSessionFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
TabSessionProvider({required String? tabId})
|
||||
: this._internal(
|
||||
() => TabSession()..tabId = tabId,
|
||||
from: tabSessionProvider,
|
||||
name: r'tabSessionProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSessionHash,
|
||||
dependencies: TabSessionFamily._dependencies,
|
||||
allTransitiveDependencies: TabSessionFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
|
||||
TabSessionProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -112,12 +102,8 @@ class TabSessionProvider
|
||||
final String? tabId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant TabSession notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
tabId: tabId,
|
||||
);
|
||||
void runNotifierBuild(covariant TabSession notifier) {
|
||||
return notifier.build(tabId: tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -170,5 +156,6 @@ class _TabSessionProviderElement
|
||||
@override
|
||||
String? get tabId => (origin as TabSessionProvider).tabId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -24,12 +24,14 @@ class TabStates extends _$TabStates {
|
||||
void _onTabContentStateChange(TabContentState contentState) {
|
||||
final current =
|
||||
state[contentState.id] ?? TabState.$default(contentState.id);
|
||||
state = {...state}..[contentState.id] = current.copyWith(
|
||||
state = {...state}
|
||||
..[contentState.id] = current.copyWith(
|
||||
contextId: contentState.contextId,
|
||||
url: Uri.parse(contentState.url),
|
||||
title: (contentState.title.isNotEmpty)
|
||||
? contentState.title
|
||||
: current.title,
|
||||
title:
|
||||
(contentState.title.isNotEmpty)
|
||||
? contentState.title
|
||||
: current.title,
|
||||
progress: contentState.progress,
|
||||
isPrivate: contentState.isPrivate,
|
||||
isFullScreen: contentState.isFullScreen,
|
||||
@@ -65,7 +67,8 @@ class TabStates extends _$TabStates {
|
||||
final SecurityInfoEvent(:tabId, :securityInfo) = event;
|
||||
|
||||
final current = state[tabId] ?? TabState.$default(tabId);
|
||||
state = {...state}..[tabId] = current.copyWith.securityInfoState(
|
||||
state = {...state}
|
||||
..[tabId] = current.copyWith.securityInfoState(
|
||||
SecurityState(
|
||||
secure: securityInfo.secure,
|
||||
host: securityInfo.host,
|
||||
@@ -78,14 +81,18 @@ class TabStates extends _$TabStates {
|
||||
final HistoryEvent(:tabId, :history) = event;
|
||||
|
||||
final current = state[tabId] ?? TabState.$default(tabId);
|
||||
state = {...state}..[tabId] = current.copyWith.historyState(
|
||||
state = {...state}
|
||||
..[tabId] = current.copyWith.historyState(
|
||||
HistoryState(
|
||||
items: history.items.nonNulls
|
||||
.map(
|
||||
(item) =>
|
||||
HistoryItem(url: Uri.parse(item.url), title: item.title),
|
||||
)
|
||||
.toList(),
|
||||
items:
|
||||
history.items.nonNulls
|
||||
.map(
|
||||
(item) => HistoryItem(
|
||||
url: Uri.parse(item.url),
|
||||
title: item.title,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
currentIndex: history.currentIndex,
|
||||
canGoBack: history.canGoBack,
|
||||
canGoForward: history.canGoForward,
|
||||
@@ -97,7 +104,8 @@ class TabStates extends _$TabStates {
|
||||
final ReaderableEvent(:tabId, :readerable) = event;
|
||||
|
||||
final current = state[tabId] ?? TabState.$default(tabId);
|
||||
state = {...state}..[tabId] = current.copyWith.readerableState(
|
||||
state = {...state}
|
||||
..[tabId] = current.copyWith.readerableState(
|
||||
ReaderableState(
|
||||
readerable: readerable.readerable,
|
||||
active: readerable.active,
|
||||
@@ -112,7 +120,8 @@ class TabStates extends _$TabStates {
|
||||
final result = results.last;
|
||||
|
||||
final current = state[tabId] ?? TabState.$default(tabId);
|
||||
state = {...state}..[tabId] = current.copyWith.findResultState(
|
||||
state = {...state}
|
||||
..[tabId] = current.copyWith.findResultState(
|
||||
FindResultState(
|
||||
activeMatchOrdinal: result.activeMatchOrdinal,
|
||||
numberOfMatches: result.numberOfMatches,
|
||||
@@ -127,59 +136,44 @@ class TabStates extends _$TabStates {
|
||||
final eventService = ref.watch(eventServiceProvider);
|
||||
|
||||
final subscriptions = [
|
||||
eventService.tabContentEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onTabContentStateChange(event));
|
||||
},
|
||||
),
|
||||
eventService.iconChangeEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
},
|
||||
),
|
||||
eventService.thumbnailEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onThumbnailChange(event));
|
||||
},
|
||||
),
|
||||
eventService.securityInfoEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onSecurityInfoStateChange(event));
|
||||
},
|
||||
),
|
||||
eventService.historyEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onHistoryStateChange(event));
|
||||
},
|
||||
),
|
||||
eventService.readerableEvents.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onReaderableStateChange(event));
|
||||
},
|
||||
),
|
||||
eventService.findResultsEvent.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onFindResultsChange(event));
|
||||
},
|
||||
),
|
||||
eventService.tabContentEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onTabContentStateChange(event));
|
||||
}),
|
||||
eventService.iconChangeEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
}),
|
||||
eventService.thumbnailEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onThumbnailChange(event));
|
||||
}),
|
||||
eventService.securityInfoEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onSecurityInfoStateChange(event));
|
||||
}),
|
||||
eventService.historyEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onHistoryStateChange(event));
|
||||
}),
|
||||
eventService.readerableEvents.listen((event) async {
|
||||
await _lock.synchronized(() => _onReaderableStateChange(event));
|
||||
}),
|
||||
eventService.findResultsEvent.listen((event) async {
|
||||
await _lock.synchronized(() => _onFindResultsChange(event));
|
||||
}),
|
||||
];
|
||||
|
||||
ref.listen(
|
||||
fireImmediately: true,
|
||||
engineReadyStateProvider,
|
||||
(previous, next) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(
|
||||
onTabContentStateChange: true,
|
||||
onIconChange: true,
|
||||
onThumbnailChange: true,
|
||||
onSecurityInfoStateChange: true,
|
||||
onHistoryStateChange: true,
|
||||
onFindResults: true,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(fireImmediately: true, engineReadyStateProvider, (
|
||||
previous,
|
||||
next,
|
||||
) async {
|
||||
if (next) {
|
||||
await GeckoTabService().syncEvents(
|
||||
onTabContentStateChange: true,
|
||||
onIconChange: true,
|
||||
onThumbnailChange: true,
|
||||
onSecurityInfoStateChange: true,
|
||||
onHistoryStateChange: true,
|
||||
onFindResults: true,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
for (final sub in subscriptions) {
|
||||
@@ -197,9 +191,7 @@ TabState? tabState(Ref ref, String? tabId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ref.watch(
|
||||
tabStatesProvider.select((tabs) => tabs[tabId]),
|
||||
);
|
||||
return ref.watch(tabStatesProvider.select((tabs) => tabs[tabId]));
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
|
||||
@@ -39,21 +39,13 @@ class TabStateFamily extends Family<TabState?> {
|
||||
const TabStateFamily();
|
||||
|
||||
/// See also [tabState].
|
||||
TabStateProvider call(
|
||||
String? tabId,
|
||||
) {
|
||||
return TabStateProvider(
|
||||
tabId,
|
||||
);
|
||||
TabStateProvider call(String? tabId) {
|
||||
return TabStateProvider(tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
TabStateProvider getProviderOverride(
|
||||
covariant TabStateProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.tabId,
|
||||
);
|
||||
TabStateProvider getProviderOverride(covariant TabStateProvider provider) {
|
||||
return call(provider.tabId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -74,23 +66,19 @@ class TabStateFamily extends Family<TabState?> {
|
||||
/// See also [tabState].
|
||||
class TabStateProvider extends AutoDisposeProvider<TabState?> {
|
||||
/// See also [tabState].
|
||||
TabStateProvider(
|
||||
String? tabId,
|
||||
) : this._internal(
|
||||
(ref) => tabState(
|
||||
ref as TabStateRef,
|
||||
tabId,
|
||||
),
|
||||
from: tabStateProvider,
|
||||
name: r'tabStateProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabStateHash,
|
||||
dependencies: TabStateFamily._dependencies,
|
||||
allTransitiveDependencies: TabStateFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
TabStateProvider(String? tabId)
|
||||
: this._internal(
|
||||
(ref) => tabState(ref as TabStateRef, tabId),
|
||||
from: tabStateProvider,
|
||||
name: r'tabStateProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabStateHash,
|
||||
dependencies: TabStateFamily._dependencies,
|
||||
allTransitiveDependencies: TabStateFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
|
||||
TabStateProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -105,9 +93,7 @@ class TabStateProvider extends AutoDisposeProvider<TabState?> {
|
||||
final String? tabId;
|
||||
|
||||
@override
|
||||
Override overrideWith(
|
||||
TabState? Function(TabStateRef provider) create,
|
||||
) {
|
||||
Override overrideWith(TabState? Function(TabStateRef provider) create) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: TabStateProvider._internal(
|
||||
@@ -163,9 +149,10 @@ String _$selectedTabStateHash() => r'dbd36af7af286bd9d079f30e8e11bbda23bf7728';
|
||||
final selectedTabStateProvider = AutoDisposeProvider<TabState?>.internal(
|
||||
selectedTabState,
|
||||
name: r'selectedTabStateProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTabStateHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTabStateHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -179,13 +166,15 @@ String _$tabStatesHash() => r'296d85ec016b22236b5830fce6b01cda81fbc02d';
|
||||
@ProviderFor(TabStates)
|
||||
final tabStatesProvider =
|
||||
NotifierProvider<TabStates, Map<String, TabState>>.internal(
|
||||
TabStates.new,
|
||||
name: r'tabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product') ? null : _$tabStatesHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
TabStates.new,
|
||||
name: r'tabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabStatesHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$TabStates = Notifier<Map<String, TabState>>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -23,21 +23,25 @@ class WebExtensionsState extends _$WebExtensionsState {
|
||||
final ExtensionDataEvent(:extensionId, :data) = event;
|
||||
|
||||
if (data != null) {
|
||||
final current = state[extensionId] ??
|
||||
final current =
|
||||
state[extensionId] ??
|
||||
WebExtensionState(
|
||||
extensionId: extensionId,
|
||||
icon: _imageCache[extensionId],
|
||||
enabled: false,
|
||||
);
|
||||
|
||||
state = {...state}..[extensionId] = current.copyWith(
|
||||
state = {...state}
|
||||
..[extensionId] = current.copyWith(
|
||||
title: data.title,
|
||||
enabled: data.enabled ?? current.enabled,
|
||||
badgeText: data.badgeText,
|
||||
badgeTextColor:
|
||||
data.badgeTextColor.mapNotNull((color) => Color(color)),
|
||||
badgeBackgroundColor:
|
||||
data.badgeBackgroundColor.mapNotNull((color) => Color(color)),
|
||||
badgeTextColor: data.badgeTextColor.mapNotNull(
|
||||
(color) => Color(color),
|
||||
),
|
||||
badgeBackgroundColor: data.badgeBackgroundColor.mapNotNull(
|
||||
(color) => Color(color),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (state.containsKey(extensionId)) {
|
||||
@@ -49,16 +53,17 @@ class WebExtensionsState extends _$WebExtensionsState {
|
||||
Future<void> _onIconChange(ExtensionIconEvent event) async {
|
||||
final ExtensionIconEvent(:extensionId, :bytes) = event;
|
||||
|
||||
final image =
|
||||
await tryDecodeImage(bytes).then((image) async => image?.toEquatable());
|
||||
final image = await tryDecodeImage(
|
||||
bytes,
|
||||
).then((image) async => image?.toEquatable());
|
||||
|
||||
if (image != null) {
|
||||
if (_imageCache[extensionId] != image) {
|
||||
_imageCache[extensionId] = image;
|
||||
|
||||
if (state.containsKey(extensionId)) {
|
||||
state = {...state}..[extensionId] =
|
||||
state[extensionId]!.copyWith.icon(image);
|
||||
state = {...state}
|
||||
..[extensionId] = state[extensionId]!.copyWith.icon(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,29 +75,21 @@ class WebExtensionsState extends _$WebExtensionsState {
|
||||
|
||||
final subscriptions = switch (actionType) {
|
||||
WebExtensionActionType.browser => [
|
||||
addonService.browserExtensionStream.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onExtensionUpdate(event));
|
||||
},
|
||||
),
|
||||
addonService.browserIconStream.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
},
|
||||
),
|
||||
],
|
||||
addonService.browserExtensionStream.listen((event) async {
|
||||
await _lock.synchronized(() => _onExtensionUpdate(event));
|
||||
}),
|
||||
addonService.browserIconStream.listen((event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
}),
|
||||
],
|
||||
WebExtensionActionType.page => [
|
||||
addonService.pageExtensionStream.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onExtensionUpdate(event));
|
||||
},
|
||||
),
|
||||
addonService.pageIconStream.listen(
|
||||
(event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
},
|
||||
),
|
||||
],
|
||||
addonService.pageExtensionStream.listen((event) async {
|
||||
await _lock.synchronized(() => _onExtensionUpdate(event));
|
||||
}),
|
||||
addonService.pageIconStream.listen((event) async {
|
||||
await _lock.synchronized(() => _onIconChange(event));
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
ref.onDispose(() {
|
||||
|
||||
@@ -34,9 +34,7 @@ abstract class _$WebExtensionsState
|
||||
extends BuildlessNotifier<Map<String, WebExtensionState>> {
|
||||
late final WebExtensionActionType actionType;
|
||||
|
||||
Map<String, WebExtensionState> build(
|
||||
WebExtensionActionType actionType,
|
||||
);
|
||||
Map<String, WebExtensionState> build(WebExtensionActionType actionType);
|
||||
}
|
||||
|
||||
/// See also [WebExtensionsState].
|
||||
@@ -49,21 +47,15 @@ class WebExtensionsStateFamily extends Family<Map<String, WebExtensionState>> {
|
||||
const WebExtensionsStateFamily();
|
||||
|
||||
/// See also [WebExtensionsState].
|
||||
WebExtensionsStateProvider call(
|
||||
WebExtensionActionType actionType,
|
||||
) {
|
||||
return WebExtensionsStateProvider(
|
||||
actionType,
|
||||
);
|
||||
WebExtensionsStateProvider call(WebExtensionActionType actionType) {
|
||||
return WebExtensionsStateProvider(actionType);
|
||||
}
|
||||
|
||||
@override
|
||||
WebExtensionsStateProvider getProviderOverride(
|
||||
covariant WebExtensionsStateProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.actionType,
|
||||
);
|
||||
return call(provider.actionType);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -82,24 +74,27 @@ class WebExtensionsStateFamily extends Family<Map<String, WebExtensionState>> {
|
||||
}
|
||||
|
||||
/// See also [WebExtensionsState].
|
||||
class WebExtensionsStateProvider extends NotifierProviderImpl<
|
||||
WebExtensionsState, Map<String, WebExtensionState>> {
|
||||
class WebExtensionsStateProvider
|
||||
extends
|
||||
NotifierProviderImpl<
|
||||
WebExtensionsState,
|
||||
Map<String, WebExtensionState>
|
||||
> {
|
||||
/// See also [WebExtensionsState].
|
||||
WebExtensionsStateProvider(
|
||||
WebExtensionActionType actionType,
|
||||
) : this._internal(
|
||||
() => WebExtensionsState()..actionType = actionType,
|
||||
from: webExtensionsStateProvider,
|
||||
name: r'webExtensionsStateProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$webExtensionsStateHash,
|
||||
dependencies: WebExtensionsStateFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
WebExtensionsStateFamily._allTransitiveDependencies,
|
||||
actionType: actionType,
|
||||
);
|
||||
WebExtensionsStateProvider(WebExtensionActionType actionType)
|
||||
: this._internal(
|
||||
() => WebExtensionsState()..actionType = actionType,
|
||||
from: webExtensionsStateProvider,
|
||||
name: r'webExtensionsStateProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$webExtensionsStateHash,
|
||||
dependencies: WebExtensionsStateFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
WebExtensionsStateFamily._allTransitiveDependencies,
|
||||
actionType: actionType,
|
||||
);
|
||||
|
||||
WebExtensionsStateProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -117,9 +112,7 @@ class WebExtensionsStateProvider extends NotifierProviderImpl<
|
||||
Map<String, WebExtensionState> runNotifierBuild(
|
||||
covariant WebExtensionsState notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
actionType,
|
||||
);
|
||||
return notifier.build(actionType);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,7 +133,7 @@ class WebExtensionsStateProvider extends NotifierProviderImpl<
|
||||
|
||||
@override
|
||||
NotifierProviderElement<WebExtensionsState, Map<String, WebExtensionState>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _WebExtensionsStateProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -167,14 +160,19 @@ mixin WebExtensionsStateRef
|
||||
WebExtensionActionType get actionType;
|
||||
}
|
||||
|
||||
class _WebExtensionsStateProviderElement extends NotifierProviderElement<
|
||||
WebExtensionsState,
|
||||
Map<String, WebExtensionState>> with WebExtensionsStateRef {
|
||||
class _WebExtensionsStateProviderElement
|
||||
extends
|
||||
NotifierProviderElement<
|
||||
WebExtensionsState,
|
||||
Map<String, WebExtensionState>
|
||||
>
|
||||
with WebExtensionsStateRef {
|
||||
_WebExtensionsStateProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
WebExtensionActionType get actionType =>
|
||||
(origin as WebExtensionsStateProvider).actionType;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -98,16 +98,17 @@ class TabRepository extends _$TabRepository {
|
||||
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
|
||||
final tabAddedSub = eventSerivce.tabAddedStream.listen(
|
||||
(tabId) async {
|
||||
final containerId = ref.read(selectedContainerProvider);
|
||||
await db.tabDao
|
||||
.upsertUnassignedTab(tabId, containerId: Value(containerId));
|
||||
},
|
||||
);
|
||||
final tabAddedSub = eventSerivce.tabAddedStream.listen((tabId) async {
|
||||
final containerId = ref.read(selectedContainerProvider);
|
||||
await db.tabDao.upsertUnassignedTab(
|
||||
tabId,
|
||||
containerId: Value(containerId),
|
||||
);
|
||||
});
|
||||
|
||||
final tabContentSub =
|
||||
tabContentService.tabContentStream.listen((content) async {
|
||||
final tabContentSub = tabContentService.tabContentStream.listen((
|
||||
content,
|
||||
) async {
|
||||
await db.tabDao.updateTabContent(
|
||||
content.tabId,
|
||||
isProbablyReaderable: content.isProbablyReaderable,
|
||||
@@ -118,42 +119,33 @@ class TabRepository extends _$TabRepository {
|
||||
);
|
||||
});
|
||||
|
||||
ref.listen(
|
||||
selectedTabProvider,
|
||||
(previous, tabId) async {
|
||||
if (tabId != null) {
|
||||
await db.tabDao.touchTab(tabId, timestamp: DateTime.now());
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(selectedTabProvider, (previous, tabId) async {
|
||||
if (tabId != null) {
|
||||
await db.tabDao.touchTab(tabId, timestamp: DateTime.now());
|
||||
}
|
||||
});
|
||||
|
||||
ref.listen(
|
||||
tabListProvider,
|
||||
(previous, next) async {
|
||||
//Only sync tabs if there has been a previous value or is not empty
|
||||
final syncTabs = next.isNotEmpty || (previous?.isNotEmpty ?? false);
|
||||
ref.listen(tabListProvider, (previous, next) async {
|
||||
//Only sync tabs if there has been a previous value or is not empty
|
||||
final syncTabs = next.isNotEmpty || (previous?.isNotEmpty ?? false);
|
||||
|
||||
if (syncTabs) {
|
||||
await db.tabDao.syncTabs(retainTabIds: next);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (syncTabs) {
|
||||
await db.tabDao.syncTabs(retainTabIds: next);
|
||||
}
|
||||
});
|
||||
|
||||
ref.listen(
|
||||
tabStatesProvider,
|
||||
(previous, next) async {
|
||||
//Since state changes occure pretty often and our map always contains
|
||||
//the latest state, we cache the value before starting debouncing and
|
||||
//later diff to that, to avoid frequent database writes
|
||||
if (!tabStateDebouncer.isDebouncing) {
|
||||
debounceStartValue = previous;
|
||||
}
|
||||
ref.listen(tabStatesProvider, (previous, next) async {
|
||||
//Since state changes occure pretty often and our map always contains
|
||||
//the latest state, we cache the value before starting debouncing and
|
||||
//later diff to that, to avoid frequent database writes
|
||||
if (!tabStateDebouncer.isDebouncing) {
|
||||
debounceStartValue = previous;
|
||||
}
|
||||
|
||||
tabStateDebouncer.eventOccured(() async {
|
||||
await db.tabDao.updateTabs(debounceStartValue, next);
|
||||
});
|
||||
},
|
||||
);
|
||||
tabStateDebouncer.eventOccured(() async {
|
||||
await db.tabDao.updateTabs(debounceStartValue, next);
|
||||
});
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
tabStateDebouncer.dispose();
|
||||
|
||||
@@ -13,9 +13,10 @@ String _$tabRepositoryHash() => r'85af29fa18ea5a4a67fbffbb9478c801dafddac2';
|
||||
final tabRepositoryProvider = NotifierProvider<TabRepository, void>.internal(
|
||||
TabRepository.new,
|
||||
name: r'tabRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabRepositoryHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -40,15 +40,16 @@ class SelectedBangData extends _$SelectedBangData {
|
||||
@override
|
||||
BangData? build({String? domain}) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
final selectedBangTrigger =
|
||||
ref.watch(selectedBangTriggerProvider(domain: domain));
|
||||
|
||||
final subscription = repository.watchBang(selectedBangTrigger).listen(
|
||||
(value) {
|
||||
state = value;
|
||||
},
|
||||
final selectedBangTrigger = ref.watch(
|
||||
selectedBangTriggerProvider(domain: domain),
|
||||
);
|
||||
|
||||
final subscription = repository.watchBang(selectedBangTrigger).listen((
|
||||
value,
|
||||
) {
|
||||
state = value;
|
||||
});
|
||||
|
||||
ref.onDispose(() {
|
||||
unawaited(subscription.cancel());
|
||||
});
|
||||
@@ -111,8 +112,9 @@ EquatableCollection<List<String>> availableTabIds(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final containerTabs = ref.watch(
|
||||
containerTabIdsProvider(containerFilter)
|
||||
.select((value) => value.valueOrNull),
|
||||
containerTabIdsProvider(
|
||||
containerFilter,
|
||||
).select((value) => value.valueOrNull),
|
||||
);
|
||||
final tabList = ref.watch(tabListProvider);
|
||||
|
||||
@@ -130,13 +132,10 @@ EquatableCollection<Map<String, TabState>> availableTabStates(
|
||||
final availableTabs = ref.watch(availableTabIdsProvider(containerFilter));
|
||||
final tabStates = ref.watch(tabStatesProvider);
|
||||
|
||||
return EquatableCollection(
|
||||
{
|
||||
for (final tabId in availableTabs.collection)
|
||||
if (tabStates.containsKey(tabId)) tabId: tabStates[tabId]!,
|
||||
},
|
||||
immutable: true,
|
||||
);
|
||||
return EquatableCollection({
|
||||
for (final tabId in availableTabs.collection)
|
||||
if (tabStates.containsKey(tabId)) tabId: tabStates[tabId]!,
|
||||
}, immutable: true);
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
@@ -145,16 +144,17 @@ EquatableCollection<List<String>> seamlessFilteredTabIds(
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final tabSearchResults = ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull?.map((tab) => tab.id).toList(),
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final tabSearchResults =
|
||||
ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull?.map((tab) => tab.id).toList(),
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
final availableTabs = ref.watch(availableTabIdsProvider(containerFilter));
|
||||
|
||||
@@ -176,19 +176,19 @@ EquatableCollection<List<TabPreview>> seamlessFilteredTabPreviews(
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
final tabSearchResults = ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) => EquatableCollection(
|
||||
value.valueOrNull,
|
||||
immutable: true,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final tabSearchResults =
|
||||
ref
|
||||
.watch(
|
||||
tabSearchRepositoryProvider(searchPartition).select(
|
||||
(value) =>
|
||||
EquatableCollection(value.valueOrNull, immutable: true),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
final availableTabStates =
|
||||
ref.watch(availableTabStatesProvider(containerFilter));
|
||||
final availableTabStates = ref.watch(
|
||||
availableTabStatesProvider(containerFilter),
|
||||
);
|
||||
|
||||
if (tabSearchResults == null) {
|
||||
return EquatableCollection(
|
||||
@@ -216,7 +216,8 @@ EquatableCollection<List<TabPreview>> seamlessFilteredTabPreviews(
|
||||
id: tab.id,
|
||||
title: tab.title ?? availableTabStates.collection[tab.id]!.title,
|
||||
icon: null,
|
||||
url: tab.cleanUrl.mapNotNull(Uri.tryParse) ??
|
||||
url:
|
||||
tab.cleanUrl.mapNotNull(Uri.tryParse) ??
|
||||
availableTabStates.collection[tab.id]!.url,
|
||||
highlightedUrl: tab.url,
|
||||
content: tab.extractedContent ?? tab.fullContent,
|
||||
|
||||
@@ -39,21 +39,15 @@ class AvailableTabIdsFamily extends Family<EquatableCollection<List<String>>> {
|
||||
const AvailableTabIdsFamily();
|
||||
|
||||
/// See also [availableTabIds].
|
||||
AvailableTabIdsProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return AvailableTabIdsProvider(
|
||||
containerFilter,
|
||||
);
|
||||
AvailableTabIdsProvider call(ContainerFilter containerFilter) {
|
||||
return AvailableTabIdsProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
AvailableTabIdsProvider getProviderOverride(
|
||||
covariant AvailableTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -75,24 +69,20 @@ class AvailableTabIdsFamily extends Family<EquatableCollection<List<String>>> {
|
||||
class AvailableTabIdsProvider
|
||||
extends AutoDisposeProvider<EquatableCollection<List<String>>> {
|
||||
/// See also [availableTabIds].
|
||||
AvailableTabIdsProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => availableTabIds(
|
||||
ref as AvailableTabIdsRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: availableTabIdsProvider,
|
||||
name: r'availableTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabIdsHash,
|
||||
dependencies: AvailableTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
AvailableTabIdsProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) => availableTabIds(ref as AvailableTabIdsRef, containerFilter),
|
||||
from: availableTabIdsProvider,
|
||||
name: r'availableTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabIdsHash,
|
||||
dependencies: AvailableTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
AvailableTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -109,7 +99,7 @@ class AvailableTabIdsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<String>> Function(AvailableTabIdsRef provider)
|
||||
create,
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -127,7 +117,7 @@ class AvailableTabIdsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<String>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _AvailableTabIdsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -178,21 +168,15 @@ class AvailableTabStatesFamily
|
||||
const AvailableTabStatesFamily();
|
||||
|
||||
/// See also [availableTabStates].
|
||||
AvailableTabStatesProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return AvailableTabStatesProvider(
|
||||
containerFilter,
|
||||
);
|
||||
AvailableTabStatesProvider call(ContainerFilter containerFilter) {
|
||||
return AvailableTabStatesProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
AvailableTabStatesProvider getProviderOverride(
|
||||
covariant AvailableTabStatesProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -214,24 +198,21 @@ class AvailableTabStatesFamily
|
||||
class AvailableTabStatesProvider
|
||||
extends AutoDisposeProvider<EquatableCollection<Map<String, TabState>>> {
|
||||
/// See also [availableTabStates].
|
||||
AvailableTabStatesProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => availableTabStates(
|
||||
ref as AvailableTabStatesRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: availableTabStatesProvider,
|
||||
name: r'availableTabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabStatesHash,
|
||||
dependencies: AvailableTabStatesFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabStatesFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
AvailableTabStatesProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) =>
|
||||
availableTabStates(ref as AvailableTabStatesRef, containerFilter),
|
||||
from: availableTabStatesProvider,
|
||||
name: r'availableTabStatesProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$availableTabStatesHash,
|
||||
dependencies: AvailableTabStatesFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AvailableTabStatesFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
AvailableTabStatesProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -248,8 +229,9 @@ class AvailableTabStatesProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<Map<String, TabState>> Function(
|
||||
AvailableTabStatesRef provider)
|
||||
create,
|
||||
AvailableTabStatesRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -267,7 +249,7 @@ class AvailableTabStatesProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<Map<String, TabState>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _AvailableTabStatesProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -294,8 +276,10 @@ mixin AvailableTabStatesRef
|
||||
ContainerFilter get containerFilter;
|
||||
}
|
||||
|
||||
class _AvailableTabStatesProviderElement extends AutoDisposeProviderElement<
|
||||
EquatableCollection<Map<String, TabState>>> with AvailableTabStatesRef {
|
||||
class _AvailableTabStatesProviderElement
|
||||
extends
|
||||
AutoDisposeProviderElement<EquatableCollection<Map<String, TabState>>>
|
||||
with AvailableTabStatesRef {
|
||||
_AvailableTabStatesProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
@@ -321,20 +305,14 @@ class SeamlessFilteredTabIdsFamily
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return SeamlessFilteredTabIdsProvider(
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
);
|
||||
return SeamlessFilteredTabIdsProvider(searchPartition, containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
SeamlessFilteredTabIdsProvider getProviderOverride(
|
||||
covariant SeamlessFilteredTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchPartition,
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.searchPartition, provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -360,23 +338,23 @@ class SeamlessFilteredTabIdsProvider
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => seamlessFilteredTabIds(
|
||||
ref as SeamlessFilteredTabIdsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabIdsProvider,
|
||||
name: r'seamlessFilteredTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabIdsHash,
|
||||
dependencies: SeamlessFilteredTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabIdsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
(ref) => seamlessFilteredTabIds(
|
||||
ref as SeamlessFilteredTabIdsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabIdsProvider,
|
||||
name: r'seamlessFilteredTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabIdsHash,
|
||||
dependencies: SeamlessFilteredTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabIdsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
SeamlessFilteredTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -395,8 +373,9 @@ class SeamlessFilteredTabIdsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<String>> Function(
|
||||
SeamlessFilteredTabIdsRef provider)
|
||||
create,
|
||||
SeamlessFilteredTabIdsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -415,7 +394,7 @@ class SeamlessFilteredTabIdsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<String>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SeamlessFilteredTabIdsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -488,10 +467,7 @@ class SeamlessFilteredTabPreviewsFamily
|
||||
SeamlessFilteredTabPreviewsProvider getProviderOverride(
|
||||
covariant SeamlessFilteredTabPreviewsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchPartition,
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.searchPartition, provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -517,23 +493,23 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
TabSearchPartition searchPartition,
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => seamlessFilteredTabPreviews(
|
||||
ref as SeamlessFilteredTabPreviewsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabPreviewsProvider,
|
||||
name: r'seamlessFilteredTabPreviewsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabPreviewsHash,
|
||||
dependencies: SeamlessFilteredTabPreviewsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
(ref) => seamlessFilteredTabPreviews(
|
||||
ref as SeamlessFilteredTabPreviewsRef,
|
||||
searchPartition,
|
||||
containerFilter,
|
||||
),
|
||||
from: seamlessFilteredTabPreviewsProvider,
|
||||
name: r'seamlessFilteredTabPreviewsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$seamlessFilteredTabPreviewsHash,
|
||||
dependencies: SeamlessFilteredTabPreviewsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SeamlessFilteredTabPreviewsFamily._allTransitiveDependencies,
|
||||
searchPartition: searchPartition,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
SeamlessFilteredTabPreviewsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -552,8 +528,9 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
EquatableCollection<List<TabPreview>> Function(
|
||||
SeamlessFilteredTabPreviewsRef provider)
|
||||
create,
|
||||
SeamlessFilteredTabPreviewsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -572,7 +549,7 @@ class SeamlessFilteredTabPreviewsProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<EquatableCollection<List<TabPreview>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SeamlessFilteredTabPreviewsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -623,9 +600,7 @@ String _$selectedBangTriggerHash() =>
|
||||
abstract class _$SelectedBangTrigger extends BuildlessNotifier<String?> {
|
||||
late final String? domain;
|
||||
|
||||
String? build({
|
||||
String? domain,
|
||||
});
|
||||
String? build({String? domain});
|
||||
}
|
||||
|
||||
/// See also [SelectedBangTrigger].
|
||||
@@ -638,21 +613,15 @@ class SelectedBangTriggerFamily extends Family<String?> {
|
||||
const SelectedBangTriggerFamily();
|
||||
|
||||
/// See also [SelectedBangTrigger].
|
||||
SelectedBangTriggerProvider call({
|
||||
String? domain,
|
||||
}) {
|
||||
return SelectedBangTriggerProvider(
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangTriggerProvider call({String? domain}) {
|
||||
return SelectedBangTriggerProvider(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
SelectedBangTriggerProvider getProviderOverride(
|
||||
covariant SelectedBangTriggerProvider provider,
|
||||
) {
|
||||
return call(
|
||||
domain: provider.domain,
|
||||
);
|
||||
return call(domain: provider.domain);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -674,21 +643,20 @@ class SelectedBangTriggerFamily extends Family<String?> {
|
||||
class SelectedBangTriggerProvider
|
||||
extends NotifierProviderImpl<SelectedBangTrigger, String?> {
|
||||
/// See also [SelectedBangTrigger].
|
||||
SelectedBangTriggerProvider({
|
||||
String? domain,
|
||||
}) : this._internal(
|
||||
() => SelectedBangTrigger()..domain = domain,
|
||||
from: selectedBangTriggerProvider,
|
||||
name: r'selectedBangTriggerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangTriggerHash,
|
||||
dependencies: SelectedBangTriggerFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangTriggerFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangTriggerProvider({String? domain})
|
||||
: this._internal(
|
||||
() => SelectedBangTrigger()..domain = domain,
|
||||
from: selectedBangTriggerProvider,
|
||||
name: r'selectedBangTriggerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangTriggerHash,
|
||||
dependencies: SelectedBangTriggerFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangTriggerFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
|
||||
SelectedBangTriggerProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -703,12 +671,8 @@ class SelectedBangTriggerProvider
|
||||
final String? domain;
|
||||
|
||||
@override
|
||||
String? runNotifierBuild(
|
||||
covariant SelectedBangTrigger notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
domain: domain,
|
||||
);
|
||||
String? runNotifierBuild(covariant SelectedBangTrigger notifier) {
|
||||
return notifier.build(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -768,9 +732,7 @@ abstract class _$SelectedBangData
|
||||
extends BuildlessAutoDisposeNotifier<BangData?> {
|
||||
late final String? domain;
|
||||
|
||||
BangData? build({
|
||||
String? domain,
|
||||
});
|
||||
BangData? build({String? domain});
|
||||
}
|
||||
|
||||
/// See also [SelectedBangData].
|
||||
@@ -783,21 +745,15 @@ class SelectedBangDataFamily extends Family<BangData?> {
|
||||
const SelectedBangDataFamily();
|
||||
|
||||
/// See also [SelectedBangData].
|
||||
SelectedBangDataProvider call({
|
||||
String? domain,
|
||||
}) {
|
||||
return SelectedBangDataProvider(
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangDataProvider call({String? domain}) {
|
||||
return SelectedBangDataProvider(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
SelectedBangDataProvider getProviderOverride(
|
||||
covariant SelectedBangDataProvider provider,
|
||||
) {
|
||||
return call(
|
||||
domain: provider.domain,
|
||||
);
|
||||
return call(domain: provider.domain);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -819,21 +775,20 @@ class SelectedBangDataFamily extends Family<BangData?> {
|
||||
class SelectedBangDataProvider
|
||||
extends AutoDisposeNotifierProviderImpl<SelectedBangData, BangData?> {
|
||||
/// See also [SelectedBangData].
|
||||
SelectedBangDataProvider({
|
||||
String? domain,
|
||||
}) : this._internal(
|
||||
() => SelectedBangData()..domain = domain,
|
||||
from: selectedBangDataProvider,
|
||||
name: r'selectedBangDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangDataHash,
|
||||
dependencies: SelectedBangDataFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangDataFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
SelectedBangDataProvider({String? domain})
|
||||
: this._internal(
|
||||
() => SelectedBangData()..domain = domain,
|
||||
from: selectedBangDataProvider,
|
||||
name: r'selectedBangDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedBangDataHash,
|
||||
dependencies: SelectedBangDataFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SelectedBangDataFamily._allTransitiveDependencies,
|
||||
domain: domain,
|
||||
);
|
||||
|
||||
SelectedBangDataProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -848,12 +803,8 @@ class SelectedBangDataProvider
|
||||
final String? domain;
|
||||
|
||||
@override
|
||||
BangData? runNotifierBuild(
|
||||
covariant SelectedBangData notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
domain: domain,
|
||||
);
|
||||
BangData? runNotifierBuild(covariant SelectedBangData notifier) {
|
||||
return notifier.build(domain: domain);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -874,7 +825,7 @@ class SelectedBangDataProvider
|
||||
|
||||
@override
|
||||
AutoDisposeNotifierProviderElement<SelectedBangData, BangData?>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SelectedBangDataProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -915,14 +866,15 @@ String _$lastUsedAssistantModeHash() =>
|
||||
@ProviderFor(LastUsedAssistantMode)
|
||||
final lastUsedAssistantModeProvider =
|
||||
NotifierProvider<LastUsedAssistantMode, AssistantMode>.internal(
|
||||
LastUsedAssistantMode.new,
|
||||
name: r'lastUsedAssistantModeProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$lastUsedAssistantModeHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
LastUsedAssistantMode.new,
|
||||
name: r'lastUsedAssistantModeProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$lastUsedAssistantModeHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$LastUsedAssistantMode = Notifier<AssistantMode>;
|
||||
String _$activeResearchVariantHash() =>
|
||||
@@ -932,14 +884,15 @@ String _$activeResearchVariantHash() =>
|
||||
@ProviderFor(ActiveResearchVariant)
|
||||
final activeResearchVariantProvider =
|
||||
NotifierProvider<ActiveResearchVariant, ResearchVariant>.internal(
|
||||
ActiveResearchVariant.new,
|
||||
name: r'activeResearchVariantProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeResearchVariantHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ActiveResearchVariant.new,
|
||||
name: r'activeResearchVariantProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeResearchVariantHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ActiveResearchVariant = Notifier<ResearchVariant>;
|
||||
String _$activeChatModelHash() => r'675f406af8b4aa92699d59e37b5805a81d03a799';
|
||||
@@ -948,14 +901,15 @@ String _$activeChatModelHash() => r'675f406af8b4aa92699d59e37b5805a81d03a799';
|
||||
@ProviderFor(ActiveChatModel)
|
||||
final activeChatModelProvider =
|
||||
NotifierProvider<ActiveChatModel, ChatModel>.internal(
|
||||
ActiveChatModel.new,
|
||||
name: r'activeChatModelProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeChatModelHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ActiveChatModel.new,
|
||||
name: r'activeChatModelProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activeChatModelHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ActiveChatModel = Notifier<ChatModel>;
|
||||
String _$showFindInPageHash() => r'7ee5703f7d0c7e8a8dd6b0849d7b1e0a41fe24d9';
|
||||
@@ -965,9 +919,10 @@ String _$showFindInPageHash() => r'7ee5703f7d0c7e8a8dd6b0849d7b1e0a41fe24d9';
|
||||
final showFindInPageProvider = NotifierProvider<ShowFindInPage, bool>.internal(
|
||||
ShowFindInPage.new,
|
||||
name: r'showFindInPageProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$showFindInPageHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$showFindInPageHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -13,18 +13,19 @@ part 'create_tab.g.dart';
|
||||
|
||||
final _parameterToCreateTabSheetTransformer =
|
||||
StreamTransformer<ReceivedParameter, CreateTabSheet>.fromHandlers(
|
||||
handleData: (parameter, sink) {
|
||||
final createTab = CreateTabSheet(
|
||||
preferredTool: KagiTool.values
|
||||
.firstWhereOrNull((tool) => tool.name == parameter.tool),
|
||||
content: parameter.content,
|
||||
);
|
||||
handleData: (parameter, sink) {
|
||||
final createTab = CreateTabSheet(
|
||||
preferredTool: KagiTool.values.firstWhereOrNull(
|
||||
(tool) => tool.name == parameter.tool,
|
||||
),
|
||||
content: parameter.content,
|
||||
);
|
||||
|
||||
if (createTab.hasParameters) {
|
||||
sink.add(createTab);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (createTab.hasParameters) {
|
||||
sink.add(createTab);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@Riverpod()
|
||||
class CreateTabStream extends _$CreateTabStream {
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$createTabStreamHash() => r'2e802a10ecaf1862074f32b76e89c26997bdd7b2';
|
||||
@ProviderFor(CreateTabStream)
|
||||
final createTabStreamProvider =
|
||||
AutoDisposeStreamNotifierProvider<CreateTabStream, CreateTabSheet>.internal(
|
||||
CreateTabStream.new,
|
||||
name: r'createTabStreamProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$createTabStreamHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
CreateTabStream.new,
|
||||
name: r'createTabStreamProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$createTabStreamHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$CreateTabStream = AutoDisposeStreamNotifier<CreateTabSheet>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$deleteBrowserDataServiceHash() =>
|
||||
@ProviderFor(DeleteBrowserDataService)
|
||||
final deleteBrowserDataServiceProvider =
|
||||
AutoDisposeNotifierProvider<DeleteBrowserDataService, void>.internal(
|
||||
DeleteBrowserDataService.new,
|
||||
name: r'deleteBrowserDataServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$deleteBrowserDataServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
DeleteBrowserDataService.new,
|
||||
name: r'deleteBrowserDataServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$deleteBrowserDataServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$DeleteBrowserDataService = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+60
-58
@@ -16,8 +16,9 @@ class EngineSettingsReplicationService
|
||||
var initialSettingsSent = false;
|
||||
|
||||
ref.listen(
|
||||
generalSettingsRepositoryProvider
|
||||
.select((settings) => settings.themeMode),
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(settings) => settings.themeMode,
|
||||
),
|
||||
(previous, next) async {
|
||||
final theme = switch (next) {
|
||||
ThemeMode.system => ColorScheme.system,
|
||||
@@ -29,62 +30,63 @@ class EngineSettingsReplicationService
|
||||
},
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
engineSettingsRepositoryProvider,
|
||||
(previous, next) async {
|
||||
if (initialSettingsSent && previous != null) {
|
||||
if (previous.javascriptEnabled != next.javascriptEnabled) {
|
||||
await _service.javascriptEnabled(next.javascriptEnabled);
|
||||
}
|
||||
if (previous.trackingProtectionPolicy !=
|
||||
next.trackingProtectionPolicy) {
|
||||
await _service
|
||||
.trackingProtectionPolicy(next.trackingProtectionPolicy);
|
||||
}
|
||||
if (previous.httpsOnlyMode != next.httpsOnlyMode) {
|
||||
await _service.httpsOnlyMode(next.httpsOnlyMode);
|
||||
}
|
||||
if (previous.globalPrivacyControlEnabled !=
|
||||
next.globalPrivacyControlEnabled) {
|
||||
await _service
|
||||
.globalPrivacyControlEnabled(next.globalPrivacyControlEnabled);
|
||||
}
|
||||
if (previous.preferredColorScheme != next.preferredColorScheme) {
|
||||
await _service.preferredColorScheme(next.preferredColorScheme);
|
||||
}
|
||||
if (previous.cookieBannerHandlingMode !=
|
||||
next.cookieBannerHandlingMode) {
|
||||
await _service
|
||||
.cookieBannerHandlingMode(next.cookieBannerHandlingMode);
|
||||
}
|
||||
if (previous.cookieBannerHandlingModePrivateBrowsing !=
|
||||
next.cookieBannerHandlingModePrivateBrowsing) {
|
||||
await _service.cookieBannerHandlingModePrivateBrowsing(
|
||||
next.cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRules !=
|
||||
next.cookieBannerHandlingGlobalRules) {
|
||||
await _service.cookieBannerHandlingGlobalRules(
|
||||
next.cookieBannerHandlingGlobalRules,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRulesSubFrames !=
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames) {
|
||||
await _service.cookieBannerHandlingGlobalRulesSubFrames(
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
}
|
||||
if (previous.webContentIsolationStrategy !=
|
||||
next.webContentIsolationStrategy) {
|
||||
await _service
|
||||
.webContentIsolationStrategy(next.webContentIsolationStrategy);
|
||||
}
|
||||
} else {
|
||||
await _service.setDefaultSettings(next);
|
||||
initialSettingsSent = true;
|
||||
ref.listen(engineSettingsRepositoryProvider, (previous, next) async {
|
||||
if (initialSettingsSent && previous != null) {
|
||||
if (previous.javascriptEnabled != next.javascriptEnabled) {
|
||||
await _service.javascriptEnabled(next.javascriptEnabled);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (previous.trackingProtectionPolicy !=
|
||||
next.trackingProtectionPolicy) {
|
||||
await _service.trackingProtectionPolicy(
|
||||
next.trackingProtectionPolicy,
|
||||
);
|
||||
}
|
||||
if (previous.httpsOnlyMode != next.httpsOnlyMode) {
|
||||
await _service.httpsOnlyMode(next.httpsOnlyMode);
|
||||
}
|
||||
if (previous.globalPrivacyControlEnabled !=
|
||||
next.globalPrivacyControlEnabled) {
|
||||
await _service.globalPrivacyControlEnabled(
|
||||
next.globalPrivacyControlEnabled,
|
||||
);
|
||||
}
|
||||
if (previous.preferredColorScheme != next.preferredColorScheme) {
|
||||
await _service.preferredColorScheme(next.preferredColorScheme);
|
||||
}
|
||||
if (previous.cookieBannerHandlingMode !=
|
||||
next.cookieBannerHandlingMode) {
|
||||
await _service.cookieBannerHandlingMode(
|
||||
next.cookieBannerHandlingMode,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingModePrivateBrowsing !=
|
||||
next.cookieBannerHandlingModePrivateBrowsing) {
|
||||
await _service.cookieBannerHandlingModePrivateBrowsing(
|
||||
next.cookieBannerHandlingModePrivateBrowsing,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRules !=
|
||||
next.cookieBannerHandlingGlobalRules) {
|
||||
await _service.cookieBannerHandlingGlobalRules(
|
||||
next.cookieBannerHandlingGlobalRules,
|
||||
);
|
||||
}
|
||||
if (previous.cookieBannerHandlingGlobalRulesSubFrames !=
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames) {
|
||||
await _service.cookieBannerHandlingGlobalRulesSubFrames(
|
||||
next.cookieBannerHandlingGlobalRulesSubFrames,
|
||||
);
|
||||
}
|
||||
if (previous.webContentIsolationStrategy !=
|
||||
next.webContentIsolationStrategy) {
|
||||
await _service.webContentIsolationStrategy(
|
||||
next.webContentIsolationStrategy,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await _service.setDefaultSettings(next);
|
||||
initialSettingsSent = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$engineSettingsReplicationServiceHash() =>
|
||||
@ProviderFor(EngineSettingsReplicationService)
|
||||
final engineSettingsReplicationServiceProvider =
|
||||
NotifierProvider<EngineSettingsReplicationService, void>.internal(
|
||||
EngineSettingsReplicationService.new,
|
||||
name: r'engineSettingsReplicationServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsReplicationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
EngineSettingsReplicationService.new,
|
||||
name: r'engineSettingsReplicationServiceProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSettingsReplicationServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$EngineSettingsReplicationService = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+8
-8
@@ -12,14 +12,14 @@ class ProxySettingsReplucation extends _$ProxySettingsReplucation {
|
||||
|
||||
@override
|
||||
void build() {
|
||||
ref.listen(
|
||||
torProxyServiceProvider.select((data) => data.valueOrNull),
|
||||
(previous, next) async {
|
||||
if (next != null) {
|
||||
await _service.setProxyPort(next);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(torProxyServiceProvider.select((data) => data.valueOrNull), (
|
||||
previous,
|
||||
next,
|
||||
) async {
|
||||
if (next != null) {
|
||||
await _service.setProxyPort(next);
|
||||
}
|
||||
});
|
||||
|
||||
ref.listen(
|
||||
containersWithCountProvider.select(
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$proxySettingsReplucationHash() =>
|
||||
@ProviderFor(ProxySettingsReplucation)
|
||||
final proxySettingsReplucationProvider =
|
||||
NotifierProvider<ProxySettingsReplucation, void>.internal(
|
||||
ProxySettingsReplucation.new,
|
||||
name: r'proxySettingsReplucationProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$proxySettingsReplucationHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ProxySettingsReplucation.new,
|
||||
name: r'proxySettingsReplucationProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$proxySettingsReplucationHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ProxySettingsReplucation = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+62
-64
@@ -36,11 +36,7 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
final Uri url;
|
||||
final WebPageInfo? precachedInfo;
|
||||
|
||||
const WebPageDialog({
|
||||
required this.url,
|
||||
this.precachedInfo,
|
||||
super.key,
|
||||
});
|
||||
const WebPageDialog({required this.url, this.precachedInfo, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -63,8 +59,10 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
context: context,
|
||||
removeBottom: true,
|
||||
child: Dialog(
|
||||
insetPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 64.0),
|
||||
insetPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0,
|
||||
vertical: 64.0,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -79,26 +77,24 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
final addressTextController =
|
||||
useTextEditingController(text: url.toString());
|
||||
final addressTextController = useTextEditingController(
|
||||
text: url.toString(),
|
||||
);
|
||||
final addressTextFocusNode = useFocusNode();
|
||||
|
||||
final suggestion = useState<String?>(null);
|
||||
|
||||
useListenableCallback(
|
||||
addressTextController,
|
||||
() async {
|
||||
if (addressTextController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(
|
||||
addressTextController.text,
|
||||
);
|
||||
useListenableCallback(addressTextController, () async {
|
||||
if (addressTextController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(
|
||||
addressTextController.text,
|
||||
);
|
||||
|
||||
suggestion.value = result;
|
||||
}
|
||||
},
|
||||
);
|
||||
suggestion.value = result;
|
||||
}
|
||||
});
|
||||
|
||||
return AutoSuggestTextField(
|
||||
controller: addressTextController,
|
||||
@@ -121,12 +117,15 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
},
|
||||
onSubmitted: (value) async {
|
||||
if (value.isNotEmpty) {
|
||||
var newUrl =
|
||||
uri_parser.tryParseUrl(value, eagerParsing: true);
|
||||
var newUrl = uri_parser.tryParseUrl(
|
||||
value,
|
||||
eagerParsing: true,
|
||||
);
|
||||
|
||||
if (newUrl == null) {
|
||||
final defaultSearchBang = await ref
|
||||
.read(defaultSearchBangDataProvider.future);
|
||||
final defaultSearchBang = await ref.read(
|
||||
defaultSearchBangDataProvider.future,
|
||||
);
|
||||
|
||||
newUrl = defaultSearchBang?.getUrl(value);
|
||||
}
|
||||
@@ -147,9 +146,7 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Divider(),
|
||||
Flexible(
|
||||
child: FadingScroll(
|
||||
@@ -173,21 +170,23 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
availableBangs: availableBangs,
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => FailureWidget(
|
||||
title: 'Could not load bangs',
|
||||
exception: error,
|
||||
),
|
||||
loading: () => SiteSearch(
|
||||
domain: url.host,
|
||||
availableBangs: [
|
||||
BangData(
|
||||
websiteName: 'websiteName',
|
||||
domain: 'domain',
|
||||
trigger: 'trigger',
|
||||
urlTemplate: 'urlTemplate',
|
||||
error:
|
||||
(error, stackTrace) => FailureWidget(
|
||||
title: 'Could not load bangs',
|
||||
exception: error,
|
||||
),
|
||||
loading:
|
||||
() => SiteSearch(
|
||||
domain: url.host,
|
||||
availableBangs: [
|
||||
BangData(
|
||||
websiteName: 'websiteName',
|
||||
domain: 'domain',
|
||||
trigger: 'trigger',
|
||||
urlTemplate: 'urlTemplate',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (availableBangsAsync.isLoading ||
|
||||
@@ -241,31 +240,30 @@ class WebPageDialog extends HookConsumerWidget {
|
||||
leading: const Icon(Icons.mobile_screen_share),
|
||||
title: const Text('Share screenshot'),
|
||||
onTap: () async {
|
||||
final screenshot = await ref
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot();
|
||||
final screenshot =
|
||||
await ref
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot();
|
||||
|
||||
if (screenshot != null) {
|
||||
ui.decodeImageFromList(
|
||||
screenshot,
|
||||
(result) async {
|
||||
final png = await result.toByteData(
|
||||
format: ui.ImageByteFormat.png,
|
||||
ui.decodeImageFromList(screenshot, (
|
||||
result,
|
||||
) async {
|
||||
final png = await result.toByteData(
|
||||
format: ui.ImageByteFormat.png,
|
||||
);
|
||||
|
||||
if (png != null) {
|
||||
final file = XFile.fromData(
|
||||
png.buffer.asUint8List(),
|
||||
mimeType: 'image/png',
|
||||
);
|
||||
|
||||
if (png != null) {
|
||||
final file = XFile.fromData(
|
||||
png.buffer.asUint8List(),
|
||||
mimeType: 'image/png',
|
||||
);
|
||||
|
||||
await Share.shareXFiles(
|
||||
[file],
|
||||
subject: precachedInfo?.title,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
await Share.shareXFiles([
|
||||
file,
|
||||
], subject: precachedInfo?.title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (context.mounted) {
|
||||
|
||||
@@ -53,8 +53,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
final displayedSheet = ref.watch(bottomSheetControllerProvider);
|
||||
final displayedOverlayDialog = ref.watch(overlayDialogControllerProvider);
|
||||
|
||||
final selectedTabId =
|
||||
ref.watch(selectedTabStateProvider.select((value) => value?.id));
|
||||
final selectedTabId = ref.watch(
|
||||
selectedTabStateProvider.select((value) => value?.id),
|
||||
);
|
||||
|
||||
final trippleDotMenuController = useMenuController();
|
||||
final tabMenuController = useMenuController();
|
||||
@@ -65,16 +66,13 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
|
||||
final activeKagiTool = useValueNotifier<KagiTool?>(null, [displayedSheet]);
|
||||
|
||||
ref.listen(
|
||||
overlayDialogControllerProvider,
|
||||
(previous, next) {
|
||||
if (next != null) {
|
||||
overlayController.show();
|
||||
} else {
|
||||
overlayController.hide();
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(overlayDialogControllerProvider, (previous, next) {
|
||||
if (next != null) {
|
||||
overlayController.show();
|
||||
} else {
|
||||
overlayController.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// ref.listen(
|
||||
// generalSettingsRepositoryProvider
|
||||
@@ -96,8 +94,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
bottomNavigationBar: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabInFullScreen = ref.watch(
|
||||
selectedTabStateProvider
|
||||
.select((value) => value?.isFullScreen ?? false),
|
||||
selectedTabStateProvider.select(
|
||||
(value) => value?.isFullScreen ?? false,
|
||||
),
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
@@ -108,15 +107,17 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
child: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
titleSpacing: 8.0,
|
||||
title: (selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
? Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabState =
|
||||
ref.watch(tabStateProvider(selectedTabId));
|
||||
title:
|
||||
(selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
? Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final tabState = ref.watch(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
return (tabState != null)
|
||||
? AppBarTitle(
|
||||
return (tabState != null)
|
||||
? AppBarTitle(
|
||||
tab: tabState,
|
||||
onTap: () async {
|
||||
await context.push(
|
||||
@@ -129,93 +130,95 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
onDoubleTap: () async {
|
||||
final newUrl = await showDialog<Uri?>(
|
||||
context: context,
|
||||
builder: (context) => EditUrlDialog(
|
||||
initialUrl: tabState.url,
|
||||
),
|
||||
builder:
|
||||
(context) => EditUrlDialog(
|
||||
initialUrl: tabState.url,
|
||||
),
|
||||
);
|
||||
|
||||
if (newUrl != null) {
|
||||
await ref
|
||||
.read(
|
||||
tabSessionProvider(tabId: null)
|
||||
.notifier,
|
||||
tabSessionProvider(
|
||||
tabId: null,
|
||||
).notifier,
|
||||
)
|
||||
.loadUrl(url: newUrl);
|
||||
}
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
},
|
||||
)
|
||||
: HookBuilder(
|
||||
builder: (context) {
|
||||
// final activeTool = useListenableSelector(
|
||||
// activeKagiTool,
|
||||
// () {
|
||||
// if (displayedSheet is CreateTabSheetWidget) {
|
||||
// return null;
|
||||
// }
|
||||
: const SizedBox.shrink();
|
||||
},
|
||||
)
|
||||
: HookBuilder(
|
||||
builder: (context) {
|
||||
// final activeTool = useListenableSelector(
|
||||
// activeKagiTool,
|
||||
// () {
|
||||
// if (displayedSheet is CreateTabSheetWidget) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// return activeKagiTool.value;
|
||||
// },
|
||||
// );
|
||||
// return activeKagiTool.value;
|
||||
// },
|
||||
// );
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.search)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () async {
|
||||
// // ref
|
||||
// // .read(createTabStreamProvider.notifier)
|
||||
// // .createTab(
|
||||
// // CreateTabSheet(
|
||||
// // preferredTool: KagiTool.search,
|
||||
// // ),
|
||||
// // );
|
||||
// await context
|
||||
// .push(const SearchRoute().location);
|
||||
// },
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// ),
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.summarizer)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(createTabStreamProvider.notifier)
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.summarizer,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.summarizer.icon),
|
||||
// ),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.assistant)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(
|
||||
// createTabStreamProvider.notifier,
|
||||
// )
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.assistant,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
return Row(
|
||||
children: [
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.search)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () async {
|
||||
// // ref
|
||||
// // .read(createTabStreamProvider.notifier)
|
||||
// // .createTab(
|
||||
// // CreateTabSheet(
|
||||
// // preferredTool: KagiTool.search,
|
||||
// // ),
|
||||
// // );
|
||||
// await context
|
||||
// .push(const SearchRoute().location);
|
||||
// },
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// ),
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.summarizer)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(createTabStreamProvider.notifier)
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.summarizer,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.summarizer.icon),
|
||||
// ),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// IconButton(
|
||||
// color: (activeTool == KagiTool.assistant)
|
||||
// ? Theme.of(context).colorScheme.primary
|
||||
// : null,
|
||||
// onPressed: () {
|
||||
// ref
|
||||
// .read(
|
||||
// createTabStreamProvider.notifier,
|
||||
// )
|
||||
// .createTab(
|
||||
// CreateTabSheet(
|
||||
// preferredTool: KagiTool.assistant,
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
if (selectedTabId != null &&
|
||||
displayedSheet is! ViewTabsSheet)
|
||||
@@ -278,9 +281,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider.notifier,
|
||||
)
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
.closeTab(selectedTabId);
|
||||
},
|
||||
leadingIcon: const Icon(Icons.close),
|
||||
@@ -488,8 +489,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
if (selectedTabId != null)
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final tabState =
|
||||
ref.read(tabStateProvider(selectedTabId));
|
||||
final tabState = ref.read(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
if (tabState?.url case final Uri url) {
|
||||
await ui_helper.launchUrlFeedback(context, url);
|
||||
@@ -501,8 +503,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
if (selectedTabId != null)
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final tabState =
|
||||
ref.read(tabStateProvider(selectedTabId));
|
||||
final tabState = ref.read(
|
||||
tabStateProvider(selectedTabId),
|
||||
);
|
||||
|
||||
if (tabState?.url case final Uri url) {
|
||||
await Share.shareUri(url);
|
||||
@@ -530,8 +533,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(tabId: selectedTabId)
|
||||
.notifier,
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.reload();
|
||||
@@ -545,39 +549,45 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final history = ref.watch(
|
||||
tabStateProvider(selectedTabId)
|
||||
.select((value) => value?.historyState),
|
||||
tabStateProvider(
|
||||
selectedTabId,
|
||||
).select((value) => value?.historyState),
|
||||
);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: (history?.canGoBack == true)
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
child:
|
||||
(history?.canGoBack == true)
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.goBack();
|
||||
trippleDotMenuController.close();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider
|
||||
.notifier,
|
||||
)
|
||||
.closeTab(selectedTabId);
|
||||
trippleDotMenuController.close();
|
||||
},
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
await controller.goBack();
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.arrow_back,
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(
|
||||
tabRepositoryProvider
|
||||
.notifier,
|
||||
)
|
||||
.closeTab(selectedTabId);
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
},
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 48,
|
||||
@@ -585,18 +595,20 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: IconButton(
|
||||
onPressed: (history?.canGoForward == true)
|
||||
? () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
onPressed:
|
||||
(history?.canGoForward == true)
|
||||
? () async {
|
||||
final controller = ref.read(
|
||||
tabSessionProvider(
|
||||
tabId: selectedTabId,
|
||||
).notifier,
|
||||
);
|
||||
|
||||
await controller.goForward();
|
||||
trippleDotMenuController.close();
|
||||
}
|
||||
: null,
|
||||
await controller.goForward();
|
||||
trippleDotMenuController
|
||||
.close();
|
||||
}
|
||||
: null,
|
||||
icon: const Icon(Icons.arrow_forward),
|
||||
),
|
||||
),
|
||||
@@ -640,20 +652,22 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
return displayedOverlayDialog!;
|
||||
},
|
||||
child: Listener(
|
||||
onPointerDown: (displayedSheet != null)
|
||||
? (_) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
}
|
||||
: null,
|
||||
onPointerDown:
|
||||
(displayedSheet != null)
|
||||
? (_) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
}
|
||||
: null,
|
||||
child: HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
return BackButtonListener(
|
||||
onBackButtonPressed: () async {
|
||||
final tabState = (selectedTabId != null)
|
||||
? ref.read(tabStateProvider(selectedTabId))
|
||||
: null;
|
||||
final tabState =
|
||||
(selectedTabId != null)
|
||||
? ref.read(tabStateProvider(selectedTabId))
|
||||
: null;
|
||||
|
||||
final tabCount = ref.read(
|
||||
tabListProvider.select((tabs) => tabs.length),
|
||||
@@ -698,8 +712,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
if (lastBackButtonPress.value != null &&
|
||||
DateTime.now()
|
||||
.difference(lastBackButtonPress.value!) <
|
||||
DateTime.now().difference(
|
||||
lastBackButtonPress.value!,
|
||||
) <
|
||||
const Duration(seconds: 2)) {
|
||||
lastBackButtonPress.value = null;
|
||||
|
||||
@@ -718,13 +733,14 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
..clearSnackBars()
|
||||
..showSnackBar(
|
||||
SnackBar(
|
||||
content: (tabCount > 1)
|
||||
? const Text(
|
||||
'Please click BACK again to close current tab',
|
||||
)
|
||||
: const Text(
|
||||
'Please click BACK again to exit app',
|
||||
),
|
||||
content:
|
||||
(tabCount > 1)
|
||||
? const Text(
|
||||
'Please click BACK again to close current tab',
|
||||
)
|
||||
: const Text(
|
||||
'Please click BACK again to exit app',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -744,16 +760,16 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
child: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final value = ref.watch(
|
||||
selectedTabStateProvider.select(
|
||||
(state) {
|
||||
if (state?.isLoading == true) {
|
||||
return state?.progress ?? 100;
|
||||
}
|
||||
selectedTabStateProvider.select((
|
||||
state,
|
||||
) {
|
||||
if (state?.isLoading == true) {
|
||||
return state?.progress ?? 100;
|
||||
}
|
||||
|
||||
//When not loading we assumed finished
|
||||
return 100;
|
||||
},
|
||||
),
|
||||
//When not loading we assumed finished
|
||||
return 100;
|
||||
}),
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
@@ -774,11 +790,13 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
final value = ref.watch(
|
||||
selectedTabStateProvider.select(
|
||||
(state) => EdgeInsets.only(
|
||||
bottom: (state?.isLoading == true &&
|
||||
state?.progress != null &&
|
||||
state!.progress < 100)
|
||||
? 4.0
|
||||
: 0.0,
|
||||
bottom:
|
||||
(state?.isLoading == true &&
|
||||
state?.progress !=
|
||||
null &&
|
||||
state!.progress < 100)
|
||||
? 4.0
|
||||
: 0.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -794,7 +812,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
ModalBarrier(
|
||||
color:
|
||||
Theme.of(context).dialogTheme.barrierColor ??
|
||||
Colors.black54,
|
||||
Colors.black54,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -806,22 +824,25 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
floatingActionButton: ReaderAppearanceButton(),
|
||||
bottomSheet: (displayedSheet != null)
|
||||
? NotificationListener<DraggableScrollableNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.extent <= 0.1) {
|
||||
ref.read(bottomSheetControllerProvider.notifier).dismiss();
|
||||
return true;
|
||||
} else {
|
||||
ref
|
||||
.read(bottomSheetExtendProvider.notifier)
|
||||
.add(notification.extent);
|
||||
}
|
||||
bottomSheet:
|
||||
(displayedSheet != null)
|
||||
? NotificationListener<DraggableScrollableNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.extent <= 0.1) {
|
||||
ref
|
||||
.read(bottomSheetControllerProvider.notifier)
|
||||
.dismiss();
|
||||
return true;
|
||||
} else {
|
||||
ref
|
||||
.read(bottomSheetExtendProvider.notifier)
|
||||
.add(notification.extent);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
child: switch (displayedSheet) {
|
||||
ViewTabsSheet() => HookBuilder(
|
||||
return false;
|
||||
},
|
||||
child: switch (displayedSheet) {
|
||||
ViewTabsSheet() => HookBuilder(
|
||||
builder: (localContext) {
|
||||
final draggableScrollableController =
|
||||
useDraggableScrollableController();
|
||||
@@ -855,7 +876,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
final CreateTabSheet parameter => DraggableScrollableSheet(
|
||||
final CreateTabSheet parameter => DraggableScrollableSheet(
|
||||
key: ValueKey(displayedSheet),
|
||||
expand: false,
|
||||
initialChildSize: 0.8,
|
||||
@@ -883,7 +904,7 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
final TabQaChatSheet parameter => HookBuilder(
|
||||
final TabQaChatSheet parameter => HookBuilder(
|
||||
builder: (localContext) {
|
||||
final draggableScrollableController =
|
||||
useDraggableScrollableController();
|
||||
@@ -937,9 +958,9 @@ class BrowserScreen extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
: null,
|
||||
},
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+12
-26
@@ -31,15 +31,9 @@ class AppBarTitle extends StatelessWidget {
|
||||
size: 14,
|
||||
);
|
||||
} else if (!tab.isLoading) {
|
||||
return const Icon(
|
||||
MdiIcons.lock,
|
||||
size: 14,
|
||||
);
|
||||
return const Icon(MdiIcons.lock, size: 14);
|
||||
} else {
|
||||
return const Icon(
|
||||
MdiIcons.timerSand,
|
||||
size: 14,
|
||||
);
|
||||
return const Icon(MdiIcons.timerSand, size: 14);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,19 +48,11 @@ class AppBarTitle extends StatelessWidget {
|
||||
Skeletonizer(
|
||||
enabled: tab.icon == null,
|
||||
child: Skeleton.replace(
|
||||
replacement: const Bone.icon(
|
||||
size: 16,
|
||||
),
|
||||
child: RawImage(
|
||||
image: tab.icon?.value,
|
||||
height: 16,
|
||||
width: 16,
|
||||
),
|
||||
replacement: const Bone.icon(size: 16),
|
||||
child: RawImage(image: tab.icon?.value, height: 16, width: 16),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -82,8 +68,9 @@ class AppBarTitle extends StatelessWidget {
|
||||
child: TextScroll(
|
||||
key: ValueKey(tab.title),
|
||||
tab.title,
|
||||
style: theme.textTheme.bodyLarge
|
||||
?.copyWith(color: theme.colorScheme.onSurface),
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
// mode: TextScrollMode.bouncing,
|
||||
velocity: const Velocity(pixelsPerSecond: Offset(75, 0)),
|
||||
delayBefore: const Duration(milliseconds: 500),
|
||||
@@ -99,14 +86,13 @@ class AppBarTitle extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
_securityStatusIcon(context),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
tab.url.authority,
|
||||
style: theme.textTheme.bodyMedium
|
||||
?.copyWith(color: theme.colorScheme.onSurface),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+30
-38
@@ -42,17 +42,18 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
.read(selectedTabSessionNotifierProvider)
|
||||
.requestScreenshot(requireImageResult: false)
|
||||
.onError((error, stackTrace) {
|
||||
logger.e(error, stackTrace: stackTrace);
|
||||
timer.cancel();
|
||||
logger.e(error, stackTrace: stackTrace);
|
||||
timer.cancel();
|
||||
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasTab =
|
||||
ref.watch(selectedTabProvider.select((value) => value != null));
|
||||
final hasTab = ref.watch(
|
||||
selectedTabProvider.select((value) => value != null),
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
selectedTabStateProvider.select(
|
||||
@@ -68,43 +69,41 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
if (next.isLoading == false &&
|
||||
(_periodicScreenshotUpdate?.isActive ?? false) == false) {
|
||||
_timerPaused = false;
|
||||
_periodicScreenshotUpdate =
|
||||
Timer.periodic(widget.screenshotPeriod, _timerTick);
|
||||
_periodicScreenshotUpdate = Timer.periodic(
|
||||
widget.screenshotPeriod,
|
||||
_timerTick,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
visible: hasTab,
|
||||
replacement: SizedBox.expand(
|
||||
child: Container(
|
||||
color: Colors.grey[800],
|
||||
),
|
||||
),
|
||||
replacement: SizedBox.expand(child: Container(color: Colors.grey[800])),
|
||||
child: GeckoView(
|
||||
preInitializationStep: () async {
|
||||
await ref
|
||||
.read(generalSettingsRepositoryProvider.notifier)
|
||||
.fetch()
|
||||
.then((settings) {
|
||||
ref
|
||||
.read(deleteBrowserDataServiceProvider.notifier)
|
||||
.deleteData(settings.deleteBrowsingDataOnQuit);
|
||||
});
|
||||
ref
|
||||
.read(deleteBrowserDataServiceProvider.notifier)
|
||||
.deleteData(settings.deleteBrowsingDataOnQuit);
|
||||
});
|
||||
|
||||
await ref
|
||||
.read(eventServiceProvider)
|
||||
.viewReadyStateEvents
|
||||
.firstWhere((state) => state == true)
|
||||
.timeout(
|
||||
const Duration(seconds: 3),
|
||||
onTimeout: () {
|
||||
logger.e(
|
||||
'Browser fragement not reported ready, trying to intitialize anyways',
|
||||
const Duration(seconds: 3),
|
||||
onTimeout: () {
|
||||
logger.e(
|
||||
'Browser fragement not reported ready, trying to intitialize anyways',
|
||||
);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
},
|
||||
postInitializationStep: () async {
|
||||
await widget.postInitializationStep?.call();
|
||||
@@ -123,10 +122,7 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
ref.listenManual(tabRepositoryProvider, (previous, next) {});
|
||||
ref.listenManual(documentRepositoryProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
selectionActionServiceProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(selectionActionServiceProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
webExtensionsStateProvider(WebExtensionActionType.browser),
|
||||
@@ -138,20 +134,14 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
(previous, next) {},
|
||||
);
|
||||
|
||||
ref.listenManual(
|
||||
cacheRepositoryProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(cacheRepositoryProvider, (previous, next) {});
|
||||
|
||||
ref.listenManual(
|
||||
engineSettingsReplicationServiceProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
|
||||
ref.listenManual(
|
||||
proxySettingsReplucationProvider,
|
||||
(previous, next) {},
|
||||
);
|
||||
ref.listenManual(proxySettingsReplucationProvider, (previous, next) {});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -173,8 +163,10 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
.evictCacheOnBackground();
|
||||
case AppLifecycleState.resumed:
|
||||
if (_timerPaused) {
|
||||
_periodicScreenshotUpdate =
|
||||
Timer.periodic(widget.screenshotPeriod, _timerTick);
|
||||
_periodicScreenshotUpdate = Timer.periodic(
|
||||
widget.screenshotPeriod,
|
||||
_timerTick,
|
||||
);
|
||||
_timerPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-6
@@ -18,12 +18,7 @@ class DraggableScrollableHeader extends StatelessWidget {
|
||||
onVerticalDragUpdate: (details) {
|
||||
// Use the DraggableScrollableSheet's controller
|
||||
controller.jumpTo(
|
||||
min(
|
||||
1,
|
||||
controller.pixelsToSize(
|
||||
controller.pixels - details.delta.dy,
|
||||
),
|
||||
),
|
||||
min(1, controller.pixelsToSize(controller.pixels - details.delta.dy)),
|
||||
);
|
||||
},
|
||||
child: child,
|
||||
|
||||
+1
-3
@@ -20,9 +20,7 @@ class EditUrlDialog extends HookWidget {
|
||||
controller: urlController,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Enter URL',
|
||||
),
|
||||
decoration: const InputDecoration(hintText: 'Enter URL'),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter a URL';
|
||||
|
||||
+1
-3
@@ -25,9 +25,7 @@ class ErrorContainer extends StatelessWidget {
|
||||
color: theme.colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: content,
|
||||
),
|
||||
Expanded(child: content),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+1
-5
@@ -15,11 +15,7 @@ class ExtensionBadgeIcon extends StatelessWidget {
|
||||
label: hasBadge ? Text(state.badgeText!) : null,
|
||||
textColor: state.badgeTextColor,
|
||||
backgroundColor: state.badgeBackgroundColor,
|
||||
child: RawImage(
|
||||
image: state.icon?.value,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
child: RawImage(image: state.icon?.value, width: 24, height: 24),
|
||||
);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -28,7 +28,8 @@ class LandingAction extends HookConsumerWidget {
|
||||
await context.push(SettingsRoute().location);
|
||||
}
|
||||
},
|
||||
data: '## No Kagi Session Provided\n'
|
||||
data:
|
||||
'## No Kagi Session Provided\n'
|
||||
'Please navigate to [Settings](settings) and enter your Kagi Session Token.\n'
|
||||
"You must provide a valid session in order to use Kagi's features.",
|
||||
),
|
||||
|
||||
+42
-46
@@ -33,8 +33,9 @@ class LandingContent extends HookConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
'Lensai',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Padding(
|
||||
@@ -52,16 +53,17 @@ class LandingContent extends HookConsumerWidget {
|
||||
const LandingAction(),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final errors = ref
|
||||
.watch(
|
||||
appInitializationServiceProvider.select(
|
||||
(result) => EquatableCollection(
|
||||
result.valueOrNull?.errors,
|
||||
immutable: false,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
final errors =
|
||||
ref
|
||||
.watch(
|
||||
appInitializationServiceProvider.select(
|
||||
(result) => EquatableCollection(
|
||||
result.valueOrNull?.errors,
|
||||
immutable: false,
|
||||
),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
if (errors == null || errors.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -70,35 +72,31 @@ class LandingContent extends HookConsumerWidget {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
...errors.map(
|
||||
(error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
...errors.map((error) {
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: ErrorContainer(
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Error during App Initialization!',
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
error.message,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
if (error.details != null)
|
||||
Text(error.details.toString()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: SizedBox(
|
||||
@@ -138,14 +136,12 @@ class LandingContent extends HookConsumerWidget {
|
||||
),
|
||||
Text(
|
||||
'Changelog',
|
||||
style:
|
||||
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
MarkdownBody(
|
||||
data: changelogAsset.data ?? '',
|
||||
selectable: true,
|
||||
),
|
||||
MarkdownBody(data: changelogAsset.data ?? '', selectable: true),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+13
-22
@@ -25,8 +25,9 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final sharedContent = useMemoized(
|
||||
() => parameter.content
|
||||
.mapNotNull((content) => SharedContent.parse(content)),
|
||||
() => parameter.content.mapNotNull(
|
||||
(content) => SharedContent.parse(content),
|
||||
),
|
||||
[parameter],
|
||||
);
|
||||
|
||||
@@ -34,13 +35,12 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
() =>
|
||||
parameter.preferredTool?.index ??
|
||||
switch (sharedContent) {
|
||||
SharedText(text: final _) => KagiTool.search.index
|
||||
SharedText(text: final _) => KagiTool.search.index,
|
||||
// (showEarlyAccessFeatures && text.length > 25)
|
||||
// ? KagiTool.assistant.index
|
||||
// : KagiTool.search.index,
|
||||
,
|
||||
SharedUrl() => KagiTool.summarizer.index,
|
||||
null => KagiTool.search.index
|
||||
null => KagiTool.search.index,
|
||||
// showEarlyAccessFeatures
|
||||
// ? KagiTool.assistant.index
|
||||
// : KagiTool.search.index,
|
||||
@@ -62,15 +62,12 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
},
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
onActiveToolChanged?.call(KagiTool.values[initialIndex]);
|
||||
});
|
||||
return null;
|
||||
},
|
||||
[initialIndex],
|
||||
);
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
onActiveToolChanged?.call(KagiTool.values[initialIndex]);
|
||||
});
|
||||
return null;
|
||||
}, [initialIndex]);
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -82,10 +79,7 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
// icon: Icon(KagiTool.search.icon),
|
||||
// text: 'Search',
|
||||
// ),
|
||||
Tab(
|
||||
icon: Icon(KagiTool.summarizer.icon),
|
||||
text: 'Summarize',
|
||||
),
|
||||
Tab(icon: Icon(KagiTool.summarizer.icon), text: 'Summarize'),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// Tab(
|
||||
// icon: Icon(KagiTool.assistant.icon),
|
||||
@@ -102,10 +96,7 @@ class CreateTabSheetWidget extends HookConsumerWidget {
|
||||
// sharedContent: sharedContent,
|
||||
// onSubmit: onSubmit,
|
||||
// ),
|
||||
SummarizeTab(
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
SummarizeTab(sharedContent: sharedContent, onSubmit: onSubmit),
|
||||
// if (showEarlyAccessFeatures)
|
||||
// AssistantTab(
|
||||
// sharedContent: sharedContent,
|
||||
|
||||
+93
-109
@@ -91,26 +91,19 @@ class _Tab extends HookConsumerWidget {
|
||||
() => searchTextController.text.isNotEmpty,
|
||||
);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.preview).notifier,
|
||||
)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.preview).notifier,
|
||||
)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
return Material(
|
||||
//Fix layout issue https://github.com/flutter/flutter/issues/78748#issuecomment-1194680555
|
||||
child: Align(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 8.0,
|
||||
left: 8.0,
|
||||
top: 8.0,
|
||||
),
|
||||
padding: const EdgeInsets.only(right: 8.0, left: 8.0, top: 8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -175,8 +168,9 @@ class _Tab extends HookConsumerWidget {
|
||||
child: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final selectedContainer = ref.watch(
|
||||
selectedContainerDataProvider
|
||||
.select((value) => value.valueOrNull),
|
||||
selectedContainerDataProvider.select(
|
||||
(value) => value.valueOrNull,
|
||||
),
|
||||
);
|
||||
|
||||
return ContainerChips(
|
||||
@@ -280,89 +274,79 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
[MediaQuery.of(context).size.width],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
final index = filteredTabIds.collection
|
||||
.indexWhere((webView) => webView == activeTab);
|
||||
useEffect(() {
|
||||
final index = filteredTabIds.collection.indexWhere(
|
||||
(webView) => webView == activeTab,
|
||||
);
|
||||
|
||||
if (index > -1) {
|
||||
final offset = (index ~/ 2) * itemHeight;
|
||||
if (index > -1) {
|
||||
final offset = (index ~/ 2) * itemHeight;
|
||||
|
||||
if (offset != sheetScrollController.offset) {
|
||||
unawaited(
|
||||
sheetScrollController.animateTo(
|
||||
offset,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (offset != sheetScrollController.offset) {
|
||||
unawaited(
|
||||
sheetScrollController.animateTo(
|
||||
offset,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
[filteredTabIds, activeTab],
|
||||
);
|
||||
return null;
|
||||
}, [filteredTabIds, activeTab]);
|
||||
|
||||
final tabs = useMemoized(
|
||||
() {
|
||||
return filteredTabIds.collection
|
||||
.mapIndexed(
|
||||
(index, tabId) => CustomDraggable(
|
||||
key: Key(tabId),
|
||||
data: TabDragData(tabId),
|
||||
child: Consumer(
|
||||
child: _TabDraggable(
|
||||
tabId: tabId,
|
||||
activeTabId: activeTab,
|
||||
onClose: onClose,
|
||||
),
|
||||
builder: (context, ref, child) {
|
||||
final dragData = ref.watch(
|
||||
willAcceptDropProvider.select((value) {
|
||||
final dragTabId = switch (value) {
|
||||
ContainerDropData() => value.tabId,
|
||||
DeleteDropData() => value.tabId,
|
||||
null => null,
|
||||
};
|
||||
|
||||
return (dragTabId == tabId)
|
||||
? value
|
||||
: null;
|
||||
}),
|
||||
);
|
||||
|
||||
return switch (dragData) {
|
||||
ContainerDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
DeleteDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: ColorFiltered(
|
||||
colorFilter: const ColorFilter.mode(
|
||||
Colors.red,
|
||||
BlendMode.modulate,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
null => child!,
|
||||
};
|
||||
},
|
||||
final tabs = useMemoized(() {
|
||||
return filteredTabIds.collection
|
||||
.mapIndexed(
|
||||
(index, tabId) => CustomDraggable(
|
||||
key: Key(tabId),
|
||||
data: TabDragData(tabId),
|
||||
child: Consumer(
|
||||
child: _TabDraggable(
|
||||
tabId: tabId,
|
||||
activeTabId: activeTab,
|
||||
onClose: onClose,
|
||||
),
|
||||
builder: (context, ref, child) {
|
||||
final dragData = ref.watch(
|
||||
willAcceptDropProvider.select((value) {
|
||||
final dragTabId = switch (value) {
|
||||
ContainerDropData() => value.tabId,
|
||||
DeleteDropData() => value.tabId,
|
||||
null => null,
|
||||
};
|
||||
|
||||
return (dragTabId == tabId) ? value : null;
|
||||
}),
|
||||
);
|
||||
|
||||
return switch (dragData) {
|
||||
ContainerDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
DeleteDropData() => Opacity(
|
||||
opacity: 0.3,
|
||||
child: ColorFiltered(
|
||||
colorFilter: const ColorFilter.mode(
|
||||
Colors.red,
|
||||
BlendMode.modulate,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
null => child!,
|
||||
};
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
},
|
||||
[
|
||||
filteredTabIds,
|
||||
activeTab,
|
||||
],
|
||||
);
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}, [filteredTabIds, activeTab]);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
@@ -381,8 +365,9 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
final oldIndex = positions.first.oldIndex;
|
||||
final newIndex = positions.first.newIndex;
|
||||
|
||||
final containerRepository =
|
||||
ref.read(containerRepositoryProvider.notifier);
|
||||
final containerRepository = ref.read(
|
||||
containerRepositoryProvider.notifier,
|
||||
);
|
||||
|
||||
final tabId = filteredTabIds.collection[oldIndex];
|
||||
final containerId = await ref
|
||||
@@ -391,12 +376,14 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
|
||||
final String key;
|
||||
if (newIndex <= 0) {
|
||||
key = await containerRepository
|
||||
.getLeadingOrderKey(containerId);
|
||||
key = await containerRepository.getLeadingOrderKey(
|
||||
containerId,
|
||||
);
|
||||
} else if (newIndex >=
|
||||
filteredTabIds.collection.length - 1) {
|
||||
key = await containerRepository
|
||||
.getTrailingOrderKey(containerId);
|
||||
key = await containerRepository.getTrailingOrderKey(
|
||||
containerId,
|
||||
);
|
||||
} else {
|
||||
final orderAfterIndex = newIndex;
|
||||
key = await containerRepository.getOrderKeyAfterTab(
|
||||
@@ -414,12 +401,12 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
controller: sheetScrollController,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
//Sync values for itemHeight calculation _calculateItemHeight
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisSpacing: 8.0,
|
||||
crossAxisSpacing: 8.0,
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
//Sync values for itemHeight calculation _calculateItemHeight
|
||||
childAspectRatio: 0.75,
|
||||
mainAxisSpacing: 8.0,
|
||||
crossAxisSpacing: 8.0,
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
itemCount: children.length,
|
||||
itemBuilder: (context, index) => children[index],
|
||||
);
|
||||
@@ -432,10 +419,7 @@ class ViewTabsSheetWidget extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: _Tab.headerSize + 4,
|
||||
right: 4,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: _Tab.headerSize + 4, right: 4),
|
||||
child: FloatingActionButton.small(
|
||||
onPressed: () async {
|
||||
await context.push(const SearchRoute().location);
|
||||
|
||||
@@ -51,8 +51,10 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -4.0, vertical: -4.0),
|
||||
visualDensity: const VisualDensity(
|
||||
horizontal: -4.0,
|
||||
vertical: -4.0,
|
||||
),
|
||||
onPressed: onDelete,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
@@ -60,17 +62,9 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
RawImage(
|
||||
image: tab.icon?.value,
|
||||
height: 16,
|
||||
width: 16,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
const SizedBox(width: 6.0),
|
||||
RawImage(image: tab.icon?.value, height: 16, width: 16),
|
||||
const SizedBox(width: 6.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
tab.url.authority,
|
||||
@@ -79,9 +73,7 @@ class TabPreview extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
if (tab.thumbnail != null)
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
|
||||
+5
-7
@@ -24,17 +24,15 @@ class TabsActionButton extends HookConsumerWidget {
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 15.0,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 15.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2.0,
|
||||
color: isActive
|
||||
? theme.colorScheme.primary
|
||||
: DefaultTextStyle.of(context).style.color!,
|
||||
color:
|
||||
isActive
|
||||
? theme.colorScheme.primary
|
||||
: DefaultTextStyle.of(context).style.color!,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
|
||||
+4
-3
@@ -9,9 +9,10 @@ class FindInPageRepository extends _$FindInPageRepository {
|
||||
|
||||
@override
|
||||
void build(String? tabId) {
|
||||
_service = (tabId != null)
|
||||
? GeckoFindInPageService(tabId: tabId)
|
||||
: GeckoFindInPageService.forActiveTab();
|
||||
_service =
|
||||
(tabId != null)
|
||||
? GeckoFindInPageService(tabId: tabId)
|
||||
: GeckoFindInPageService.forActiveTab();
|
||||
}
|
||||
|
||||
Future<void> findAll({required String text}) {
|
||||
|
||||
+22
-34
@@ -34,9 +34,7 @@ abstract class _$FindInPageRepository
|
||||
extends BuildlessAutoDisposeNotifier<void> {
|
||||
late final String? tabId;
|
||||
|
||||
void build(
|
||||
String? tabId,
|
||||
);
|
||||
void build(String? tabId);
|
||||
}
|
||||
|
||||
/// See also [FindInPageRepository].
|
||||
@@ -49,21 +47,15 @@ class FindInPageRepositoryFamily extends Family<void> {
|
||||
const FindInPageRepositoryFamily();
|
||||
|
||||
/// See also [FindInPageRepository].
|
||||
FindInPageRepositoryProvider call(
|
||||
String? tabId,
|
||||
) {
|
||||
return FindInPageRepositoryProvider(
|
||||
tabId,
|
||||
);
|
||||
FindInPageRepositoryProvider call(String? tabId) {
|
||||
return FindInPageRepositoryProvider(tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
FindInPageRepositoryProvider getProviderOverride(
|
||||
covariant FindInPageRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.tabId,
|
||||
);
|
||||
return call(provider.tabId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -85,21 +77,20 @@ class FindInPageRepositoryFamily extends Family<void> {
|
||||
class FindInPageRepositoryProvider
|
||||
extends AutoDisposeNotifierProviderImpl<FindInPageRepository, void> {
|
||||
/// See also [FindInPageRepository].
|
||||
FindInPageRepositoryProvider(
|
||||
String? tabId,
|
||||
) : this._internal(
|
||||
() => FindInPageRepository()..tabId = tabId,
|
||||
from: findInPageRepositoryProvider,
|
||||
name: r'findInPageRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageRepositoryHash,
|
||||
dependencies: FindInPageRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
FindInPageRepositoryFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
FindInPageRepositoryProvider(String? tabId)
|
||||
: this._internal(
|
||||
() => FindInPageRepository()..tabId = tabId,
|
||||
from: findInPageRepositoryProvider,
|
||||
name: r'findInPageRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageRepositoryHash,
|
||||
dependencies: FindInPageRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
FindInPageRepositoryFamily._allTransitiveDependencies,
|
||||
tabId: tabId,
|
||||
);
|
||||
|
||||
FindInPageRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -114,12 +105,8 @@ class FindInPageRepositoryProvider
|
||||
final String? tabId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant FindInPageRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
tabId,
|
||||
);
|
||||
void runNotifierBuild(covariant FindInPageRepository notifier) {
|
||||
return notifier.build(tabId);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,7 +127,7 @@ class FindInPageRepositoryProvider
|
||||
|
||||
@override
|
||||
AutoDisposeNotifierProviderElement<FindInPageRepository, void>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _FindInPageRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -173,5 +160,6 @@ class _FindInPageRepositoryProviderElement
|
||||
@override
|
||||
String? get tabId => (origin as FindInPageRepositoryProvider).tabId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$findInPageVisibilityControllerHash() =>
|
||||
@ProviderFor(FindInPageVisibilityController)
|
||||
final findInPageVisibilityControllerProvider =
|
||||
AutoDisposeNotifierProvider<FindInPageVisibilityController, bool>.internal(
|
||||
FindInPageVisibilityController.new,
|
||||
name: r'findInPageVisibilityControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageVisibilityControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
FindInPageVisibilityController.new,
|
||||
name: r'findInPageVisibilityControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$findInPageVisibilityControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$FindInPageVisibilityController = AutoDisposeNotifier<bool>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+6
-4
@@ -13,8 +13,9 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final showFindInPage = ref.watch(findInPageVisibilityControllerProvider);
|
||||
final findInteractionController =
|
||||
ref.watch(findInPageRepositoryProvider(null).notifier);
|
||||
final findInteractionController = ref.watch(
|
||||
findInPageRepositoryProvider(null).notifier,
|
||||
);
|
||||
|
||||
final textController = useTextEditingController();
|
||||
|
||||
@@ -47,8 +48,9 @@ class FindInPageWidget extends HookConsumerWidget {
|
||||
HookConsumer(
|
||||
builder: (context, ref, child) {
|
||||
final searchResult = ref.watch(
|
||||
selectedTabStateProvider
|
||||
.select((state) => state?.findResultState),
|
||||
selectedTabStateProvider.select(
|
||||
(state) => state?.findResultState,
|
||||
),
|
||||
);
|
||||
|
||||
if (searchResult != null) {
|
||||
|
||||
+12
-17
@@ -10,24 +10,19 @@ class PreferenceSettingGroup with FastEquatable {
|
||||
|
||||
final Map<String, PreferenceSetting> settings;
|
||||
|
||||
bool get isActive => settings.values
|
||||
.every((setting) => setting.requireUserOptIn || setting.isActive);
|
||||
bool get isActive => settings.values.every(
|
||||
(setting) => setting.requireUserOptIn || setting.isActive,
|
||||
);
|
||||
|
||||
bool get isPartlyActive => settings.values.any((setting) => setting.isActive);
|
||||
|
||||
PreferenceSettingGroup({
|
||||
required this.description,
|
||||
required this.settings,
|
||||
});
|
||||
PreferenceSettingGroup({required this.description, required this.settings});
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
description,
|
||||
settings,
|
||||
];
|
||||
List<Object?> get hashParameters => [description, settings];
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
@@ -65,11 +60,11 @@ class PreferenceSetting with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
value,
|
||||
actualValue,
|
||||
title,
|
||||
description,
|
||||
requireUserOptIn,
|
||||
shouldBeDefault,
|
||||
];
|
||||
value,
|
||||
actualValue,
|
||||
title,
|
||||
description,
|
||||
requireUserOptIn,
|
||||
shouldBeDefault,
|
||||
];
|
||||
}
|
||||
+40
-34
@@ -39,7 +39,6 @@ class _$PreferenceSettingGroupCWProxyImpl
|
||||
this(settings: settings);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `PreferenceSettingGroup(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -51,14 +50,16 @@ class _$PreferenceSettingGroupCWProxyImpl
|
||||
Object? settings = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return PreferenceSettingGroup(
|
||||
description: description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
settings: settings == const $CopyWithPlaceholder()
|
||||
? _value.settings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: settings as Map<String, PreferenceSetting>,
|
||||
description:
|
||||
description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
settings:
|
||||
settings == const $CopyWithPlaceholder()
|
||||
? _value.settings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: settings as Map<String, PreferenceSetting>,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +129,6 @@ class _$PreferenceSettingCWProxyImpl implements _$PreferenceSettingCWProxy {
|
||||
this(shouldBeDefault: shouldBeDefault);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `PreferenceSetting(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -144,30 +144,36 @@ class _$PreferenceSettingCWProxyImpl implements _$PreferenceSettingCWProxy {
|
||||
Object? shouldBeDefault = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return PreferenceSetting(
|
||||
value: value == const $CopyWithPlaceholder()
|
||||
? _value.value
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: value as Object,
|
||||
title: title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
description: description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
actualValue: actualValue == const $CopyWithPlaceholder()
|
||||
? _value.actualValue
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: actualValue as Object?,
|
||||
requireUserOptIn: requireUserOptIn == const $CopyWithPlaceholder()
|
||||
? _value.requireUserOptIn
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: requireUserOptIn as bool,
|
||||
shouldBeDefault: shouldBeDefault == const $CopyWithPlaceholder()
|
||||
? _value.shouldBeDefault
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: shouldBeDefault as bool,
|
||||
value:
|
||||
value == const $CopyWithPlaceholder()
|
||||
? _value.value
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: value as Object,
|
||||
title:
|
||||
title == const $CopyWithPlaceholder()
|
||||
? _value.title
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: title as String?,
|
||||
description:
|
||||
description == const $CopyWithPlaceholder()
|
||||
? _value.description
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: description as String?,
|
||||
actualValue:
|
||||
actualValue == const $CopyWithPlaceholder()
|
||||
? _value.actualValue
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: actualValue as Object?,
|
||||
requireUserOptIn:
|
||||
requireUserOptIn == const $CopyWithPlaceholder()
|
||||
? _value.requireUserOptIn
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: requireUserOptIn as bool,
|
||||
shouldBeDefault:
|
||||
shouldBeDefault == const $CopyWithPlaceholder()
|
||||
? _value.shouldBeDefault
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: shouldBeDefault as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-18
@@ -15,8 +15,9 @@ part 'preference_settings.g.dart';
|
||||
@Riverpod(keepAlive: true)
|
||||
Future<Map<String, dynamic>> _preferenceSettingContent(Ref ref) async {
|
||||
return await rootBundle
|
||||
.loadString('assets/preferences/settings.json')
|
||||
.then(jsonDecode) as Map<String, dynamic>;
|
||||
.loadString('assets/preferences/settings.json')
|
||||
.then(jsonDecode)
|
||||
as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
@@ -85,8 +86,9 @@ class UnifiedPreferenceSettingsRepository
|
||||
Map<String, PreferenceSettingGroup>? _statelessGroups;
|
||||
|
||||
Future<void> apply() async {
|
||||
_statelessGroups =
|
||||
await ref.read(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.read(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefs = {
|
||||
for (final group in _statelessGroups!.values)
|
||||
@@ -101,13 +103,15 @@ class UnifiedPreferenceSettingsRepository
|
||||
}
|
||||
|
||||
Future<void> reset() async {
|
||||
_statelessGroups =
|
||||
await ref.read(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.read(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefs = _statelessGroups!.values
|
||||
.map((group) => group.settings.keys)
|
||||
.flattened
|
||||
.toList();
|
||||
final prefs =
|
||||
_statelessGroups!.values
|
||||
.map((group) => group.settings.keys)
|
||||
.flattened
|
||||
.toList();
|
||||
|
||||
await ref.read(_preferenceRepositoryProvider.notifier).resetPrefs(prefs);
|
||||
}
|
||||
@@ -116,8 +120,9 @@ class UnifiedPreferenceSettingsRepository
|
||||
Stream<Map<String, PreferenceSettingGroup>> build(
|
||||
PreferencePartition partition,
|
||||
) async* {
|
||||
_statelessGroups =
|
||||
await ref.watch(_preferenceSettingGroupsProvider(partition).future);
|
||||
_statelessGroups = await ref.watch(
|
||||
_preferenceSettingGroupsProvider(partition).future,
|
||||
);
|
||||
|
||||
final prefStream = ref.watch(_preferenceRepositoryProvider);
|
||||
|
||||
@@ -145,8 +150,9 @@ class PreferenceSettingsGroupRepository
|
||||
PreferenceSettingGroup? _statelessSettingGroup;
|
||||
|
||||
Future<void> apply({List<String>? filter}) async {
|
||||
_statelessSettingGroup ??= await ref
|
||||
.read(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup ??= await ref.read(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
final prefs = Map.fromEntries(
|
||||
filter?.map(
|
||||
@@ -165,8 +171,9 @@ class PreferenceSettingsGroupRepository
|
||||
}
|
||||
|
||||
Future<void> reset({List<String>? filter}) async {
|
||||
_statelessSettingGroup ??= await ref
|
||||
.read(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup ??= await ref.read(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
if (filter != null &&
|
||||
filter.any(
|
||||
@@ -185,8 +192,9 @@ class PreferenceSettingsGroupRepository
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) async* {
|
||||
_statelessSettingGroup = await ref
|
||||
.watch(_preferenceSettingGroupProvider(partition, groupName).future);
|
||||
_statelessSettingGroup = await ref.watch(
|
||||
_preferenceSettingGroupProvider(partition, groupName).future,
|
||||
);
|
||||
|
||||
final prefStream = ref.watch(_preferenceRepositoryProvider);
|
||||
|
||||
|
||||
+144
-143
@@ -13,14 +13,15 @@ String _$preferenceSettingContentHash() =>
|
||||
@ProviderFor(_preferenceSettingContent)
|
||||
final _preferenceSettingContentProvider =
|
||||
FutureProvider<Map<String, dynamic>>.internal(
|
||||
_preferenceSettingContent,
|
||||
name: r'_preferenceSettingContentProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingContentHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
_preferenceSettingContent,
|
||||
name: r'_preferenceSettingContentProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingContentHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -60,21 +61,15 @@ class _PreferenceSettingGroupsFamily
|
||||
const _PreferenceSettingGroupsFamily();
|
||||
|
||||
/// See also [_preferenceSettingGroups].
|
||||
_PreferenceSettingGroupsProvider call(
|
||||
PreferencePartition partition,
|
||||
) {
|
||||
return _PreferenceSettingGroupsProvider(
|
||||
partition,
|
||||
);
|
||||
_PreferenceSettingGroupsProvider call(PreferencePartition partition) {
|
||||
return _PreferenceSettingGroupsProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
_PreferenceSettingGroupsProvider getProviderOverride(
|
||||
covariant _PreferenceSettingGroupsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -96,24 +91,23 @@ class _PreferenceSettingGroupsFamily
|
||||
class _PreferenceSettingGroupsProvider
|
||||
extends FutureProvider<Map<String, PreferenceSettingGroup>> {
|
||||
/// See also [_preferenceSettingGroups].
|
||||
_PreferenceSettingGroupsProvider(
|
||||
PreferencePartition partition,
|
||||
) : this._internal(
|
||||
(ref) => _preferenceSettingGroups(
|
||||
ref as _PreferenceSettingGroupsRef,
|
||||
partition,
|
||||
),
|
||||
from: _preferenceSettingGroupsProvider,
|
||||
name: r'_preferenceSettingGroupsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupsHash,
|
||||
dependencies: _PreferenceSettingGroupsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupsFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
_PreferenceSettingGroupsProvider(PreferencePartition partition)
|
||||
: this._internal(
|
||||
(ref) => _preferenceSettingGroups(
|
||||
ref as _PreferenceSettingGroupsRef,
|
||||
partition,
|
||||
),
|
||||
from: _preferenceSettingGroupsProvider,
|
||||
name: r'_preferenceSettingGroupsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupsHash,
|
||||
dependencies: _PreferenceSettingGroupsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupsFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
_PreferenceSettingGroupsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -130,8 +124,9 @@ class _PreferenceSettingGroupsProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<Map<String, PreferenceSettingGroup>> Function(
|
||||
_PreferenceSettingGroupsRef provider)
|
||||
create,
|
||||
_PreferenceSettingGroupsRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -203,20 +198,14 @@ class _PreferenceSettingGroupFamily
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) {
|
||||
return _PreferenceSettingGroupProvider(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return _PreferenceSettingGroupProvider(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
_PreferenceSettingGroupProvider getProviderOverride(
|
||||
covariant _PreferenceSettingGroupProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
provider.groupName,
|
||||
);
|
||||
return call(provider.partition, provider.groupName);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -242,23 +231,23 @@ class _PreferenceSettingGroupProvider
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) : this._internal(
|
||||
(ref) => _preferenceSettingGroup(
|
||||
ref as _PreferenceSettingGroupRef,
|
||||
partition,
|
||||
groupName,
|
||||
),
|
||||
from: _preferenceSettingGroupProvider,
|
||||
name: r'_preferenceSettingGroupProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupHash,
|
||||
dependencies: _PreferenceSettingGroupFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
(ref) => _preferenceSettingGroup(
|
||||
ref as _PreferenceSettingGroupRef,
|
||||
partition,
|
||||
groupName,
|
||||
),
|
||||
from: _preferenceSettingGroupProvider,
|
||||
name: r'_preferenceSettingGroupProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingGroupHash,
|
||||
dependencies: _PreferenceSettingGroupFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
_PreferenceSettingGroupFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
|
||||
_PreferenceSettingGroupProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -277,8 +266,9 @@ class _PreferenceSettingGroupProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<PreferenceSettingGroup> Function(
|
||||
_PreferenceSettingGroupRef provider)
|
||||
create,
|
||||
_PreferenceSettingGroupRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -345,24 +335,29 @@ String _$preferenceRepositoryHash() =>
|
||||
/// See also [_PreferenceRepository].
|
||||
@ProviderFor(_PreferenceRepository)
|
||||
final _preferenceRepositoryProvider = AutoDisposeNotifierProvider<
|
||||
_PreferenceRepository, Raw<Stream<Map<String, Object>>>>.internal(
|
||||
_PreferenceRepository,
|
||||
Raw<Stream<Map<String, Object>>>
|
||||
>.internal(
|
||||
_PreferenceRepository.new,
|
||||
name: r'_preferenceRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceRepositoryHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$PreferenceRepository
|
||||
= AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>;
|
||||
typedef _$PreferenceRepository =
|
||||
AutoDisposeNotifier<Raw<Stream<Map<String, Object>>>>;
|
||||
String _$unifiedPreferenceSettingsRepositoryHash() =>
|
||||
r'35aa16ffa7aa1453c8331ed7470ef85a68d27178';
|
||||
|
||||
abstract class _$UnifiedPreferenceSettingsRepository
|
||||
extends BuildlessAutoDisposeStreamNotifier<
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
extends
|
||||
BuildlessAutoDisposeStreamNotifier<
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
late final PreferencePartition partition;
|
||||
|
||||
Stream<Map<String, PreferenceSettingGroup>> build(
|
||||
@@ -385,18 +380,14 @@ class UnifiedPreferenceSettingsRepositoryFamily
|
||||
UnifiedPreferenceSettingsRepositoryProvider call(
|
||||
PreferencePartition partition,
|
||||
) {
|
||||
return UnifiedPreferenceSettingsRepositoryProvider(
|
||||
partition,
|
||||
);
|
||||
return UnifiedPreferenceSettingsRepositoryProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
UnifiedPreferenceSettingsRepositoryProvider getProviderOverride(
|
||||
covariant UnifiedPreferenceSettingsRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -416,25 +407,27 @@ class UnifiedPreferenceSettingsRepositoryFamily
|
||||
|
||||
/// See also [UnifiedPreferenceSettingsRepository].
|
||||
class UnifiedPreferenceSettingsRepositoryProvider
|
||||
extends AutoDisposeStreamNotifierProviderImpl<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
/// See also [UnifiedPreferenceSettingsRepository].
|
||||
UnifiedPreferenceSettingsRepositoryProvider(
|
||||
PreferencePartition partition,
|
||||
) : this._internal(
|
||||
() => UnifiedPreferenceSettingsRepository()..partition = partition,
|
||||
from: unifiedPreferenceSettingsRepositoryProvider,
|
||||
name: r'unifiedPreferenceSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unifiedPreferenceSettingsRepositoryHash,
|
||||
dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies: UnifiedPreferenceSettingsRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
UnifiedPreferenceSettingsRepositoryProvider(PreferencePartition partition)
|
||||
: this._internal(
|
||||
() => UnifiedPreferenceSettingsRepository()..partition = partition,
|
||||
from: unifiedPreferenceSettingsRepositoryProvider,
|
||||
name: r'unifiedPreferenceSettingsRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unifiedPreferenceSettingsRepositoryHash,
|
||||
dependencies: UnifiedPreferenceSettingsRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
UnifiedPreferenceSettingsRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
UnifiedPreferenceSettingsRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -452,9 +445,7 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
Stream<Map<String, PreferenceSettingGroup>> runNotifierBuild(
|
||||
covariant UnifiedPreferenceSettingsRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
);
|
||||
return notifier.build(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -474,8 +465,11 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>> createElement() {
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
>
|
||||
createElement() {
|
||||
return _UnifiedPreferenceSettingsRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -497,16 +491,20 @@ class UnifiedPreferenceSettingsRepositoryProvider
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin UnifiedPreferenceSettingsRepositoryRef
|
||||
on AutoDisposeStreamNotifierProviderRef<
|
||||
Map<String, PreferenceSettingGroup>> {
|
||||
on
|
||||
AutoDisposeStreamNotifierProviderRef<
|
||||
Map<String, PreferenceSettingGroup>
|
||||
> {
|
||||
/// The parameter `partition` of this provider.
|
||||
PreferencePartition get partition;
|
||||
}
|
||||
|
||||
class _UnifiedPreferenceSettingsRepositoryProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>>
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
UnifiedPreferenceSettingsRepository,
|
||||
Map<String, PreferenceSettingGroup>
|
||||
>
|
||||
with UnifiedPreferenceSettingsRepositoryRef {
|
||||
_UnifiedPreferenceSettingsRepositoryProviderElement(super.provider);
|
||||
|
||||
@@ -545,20 +543,14 @@ class PreferenceSettingsGroupRepositoryFamily
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) {
|
||||
return PreferenceSettingsGroupRepositoryProvider(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return PreferenceSettingsGroupRepositoryProvider(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
PreferenceSettingsGroupRepositoryProvider getProviderOverride(
|
||||
covariant PreferenceSettingsGroupRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
provider.groupName,
|
||||
);
|
||||
return call(provider.partition, provider.groupName);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -578,28 +570,32 @@ class PreferenceSettingsGroupRepositoryFamily
|
||||
|
||||
/// See also [PreferenceSettingsGroupRepository].
|
||||
class PreferenceSettingsGroupRepositoryProvider
|
||||
extends AutoDisposeStreamNotifierProviderImpl<
|
||||
PreferenceSettingsGroupRepository, PreferenceSettingGroup> {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
> {
|
||||
/// See also [PreferenceSettingsGroupRepository].
|
||||
PreferenceSettingsGroupRepositoryProvider(
|
||||
PreferencePartition partition,
|
||||
String groupName,
|
||||
) : this._internal(
|
||||
() => PreferenceSettingsGroupRepository()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: preferenceSettingsGroupRepositoryProvider,
|
||||
name: r'preferenceSettingsGroupRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingsGroupRepositoryHash,
|
||||
dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies: PreferenceSettingsGroupRepositoryFamily
|
||||
._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
() =>
|
||||
PreferenceSettingsGroupRepository()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: preferenceSettingsGroupRepositoryProvider,
|
||||
name: r'preferenceSettingsGroupRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$preferenceSettingsGroupRepositoryHash,
|
||||
dependencies: PreferenceSettingsGroupRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
PreferenceSettingsGroupRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
groupName: groupName,
|
||||
);
|
||||
|
||||
PreferenceSettingsGroupRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -619,10 +615,7 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
Stream<PreferenceSettingGroup> runNotifierBuild(
|
||||
covariant PreferenceSettingsGroupRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
groupName,
|
||||
);
|
||||
return notifier.build(partition, groupName);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -630,9 +623,10 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: PreferenceSettingsGroupRepositoryProvider._internal(
|
||||
() => create()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
() =>
|
||||
create()
|
||||
..partition = partition
|
||||
..groupName = groupName,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
@@ -645,8 +639,11 @@ class PreferenceSettingsGroupRepositoryProvider
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup> createElement() {
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
>
|
||||
createElement() {
|
||||
return _PreferenceSettingsGroupRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -679,9 +676,12 @@ mixin PreferenceSettingsGroupRepositoryRef
|
||||
}
|
||||
|
||||
class _PreferenceSettingsGroupRepositoryProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup> with PreferenceSettingsGroupRepositoryRef {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
PreferenceSettingsGroupRepository,
|
||||
PreferenceSettingGroup
|
||||
>
|
||||
with PreferenceSettingsGroupRepositoryRef {
|
||||
_PreferenceSettingsGroupRepositoryProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
@@ -691,5 +691,6 @@ class _PreferenceSettingsGroupRepositoryProviderElement
|
||||
String get groupName =>
|
||||
(origin as PreferenceSettingsGroupRepositoryProvider).groupName;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -13,9 +13,10 @@ String _$readerableServiceHash() => r'03182c8afc41f5184322a3206473cbfa96df5819';
|
||||
final readerableServiceProvider = Provider<GeckoReaderableService>.internal(
|
||||
readerableService,
|
||||
name: r'readerableServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableServiceHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
@@ -30,14 +31,15 @@ String _$appearanceButtonVisibilityHash() =>
|
||||
@ProviderFor(appearanceButtonVisibility)
|
||||
final appearanceButtonVisibilityProvider =
|
||||
AutoDisposeStreamProvider<bool>.internal(
|
||||
appearanceButtonVisibility,
|
||||
name: r'appearanceButtonVisibilityProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$appearanceButtonVisibilityHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
appearanceButtonVisibility,
|
||||
name: r'appearanceButtonVisibilityProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$appearanceButtonVisibilityHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$readerableScreenControllerHash() =>
|
||||
@ProviderFor(ReaderableScreenController)
|
||||
final readerableScreenControllerProvider =
|
||||
AsyncNotifierProvider<ReaderableScreenController, void>.internal(
|
||||
ReaderableScreenController.new,
|
||||
name: r'readerableScreenControllerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableScreenControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ReaderableScreenController.new,
|
||||
name: r'readerableScreenControllerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$readerableScreenControllerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ReaderableScreenController = AsyncNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+3
-2
@@ -9,8 +9,9 @@ class ReaderAppearanceButton extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final buttonVisible = ref.watch(
|
||||
appearanceButtonVisibilityProvider
|
||||
.select((value) => value.valueOrNull ?? false),
|
||||
appearanceButtonVisibilityProvider.select(
|
||||
(value) => value.valueOrNull ?? false,
|
||||
),
|
||||
);
|
||||
|
||||
final readerabilityState = ref.watch(
|
||||
|
||||
+45
-43
@@ -16,8 +16,9 @@ class ReaderButton extends HookConsumerWidget {
|
||||
final readerChanging = ref.watch(readerableScreenControllerProvider);
|
||||
|
||||
final enableReadability = ref.watch(
|
||||
generalSettingsRepositoryProvider
|
||||
.select((value) => value.enableReadability),
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(value) => value.enableReadability,
|
||||
),
|
||||
);
|
||||
|
||||
final readerabilityState = ref.watch(
|
||||
@@ -27,55 +28,56 @@ class ReaderButton extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
final icon = useMemoized(
|
||||
() => readerabilityState.active
|
||||
? Icon(
|
||||
MdiIcons.bookOpen,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: const Icon(
|
||||
MdiIcons.bookOpenOutline,
|
||||
color: Colors.white,
|
||||
),
|
||||
() =>
|
||||
readerabilityState.active
|
||||
? Icon(
|
||||
MdiIcons.bookOpen,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: const Icon(MdiIcons.bookOpenOutline, color: Colors.white),
|
||||
[readerabilityState.active],
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
visible: readerabilityState.readerable &&
|
||||
visible:
|
||||
readerabilityState.readerable &&
|
||||
(enableReadability || readerabilityState.active),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 15.0,
|
||||
horizontal: 8.0,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 8.0),
|
||||
child: readerChanging.when(
|
||||
data: (_) => Visibility(
|
||||
visible: readerabilityState.readerable,
|
||||
child: InkWell(
|
||||
onTap: readerChanging.isLoading
|
||||
? null
|
||||
: () async {
|
||||
await ref
|
||||
.read(readerableScreenControllerProvider.notifier)
|
||||
.toggleReaderView(!readerabilityState.active);
|
||||
},
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
data:
|
||||
(_) => Visibility(
|
||||
visible: readerabilityState.readerable,
|
||||
child: InkWell(
|
||||
onTap:
|
||||
readerChanging.isLoading
|
||||
? null
|
||||
: () async {
|
||||
await ref
|
||||
.read(
|
||||
readerableScreenControllerProvider.notifier,
|
||||
)
|
||||
.toggleReaderView(!readerabilityState.active);
|
||||
},
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
error: (error, stackTrace) => SizedBox.shrink(),
|
||||
loading: () => AnimateGradientShader(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
primaryEnd: Alignment.bottomLeft,
|
||||
secondaryEnd: Alignment.topRight,
|
||||
primaryColors: [
|
||||
colorScheme.primary,
|
||||
colorScheme.primaryContainer,
|
||||
],
|
||||
secondaryColors: [
|
||||
colorScheme.secondary,
|
||||
colorScheme.secondaryContainer,
|
||||
],
|
||||
child: icon,
|
||||
),
|
||||
loading:
|
||||
() => AnimateGradientShader(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
primaryEnd: Alignment.bottomLeft,
|
||||
secondaryEnd: Alignment.topRight,
|
||||
primaryColors: [
|
||||
colorScheme.primary,
|
||||
colorScheme.primaryContainer,
|
||||
],
|
||||
secondaryColors: [
|
||||
colorScheme.secondary,
|
||||
colorScheme.secondaryContainer,
|
||||
],
|
||||
child: icon,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -23,13 +23,13 @@ class TabPreview with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
url,
|
||||
highlightedUrl,
|
||||
content,
|
||||
];
|
||||
id,
|
||||
title,
|
||||
icon,
|
||||
url,
|
||||
highlightedUrl,
|
||||
content,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
|
||||
+13
-13
@@ -18,9 +18,7 @@ class EngineSuggestions extends _$EngineSuggestions {
|
||||
|
||||
Future<void> addQuery(
|
||||
String query, {
|
||||
List<GeckoSuggestionType> providers = const [
|
||||
GeckoSuggestionType.history,
|
||||
],
|
||||
List<GeckoSuggestionType> providers = const [GeckoSuggestionType.history],
|
||||
}) {
|
||||
return ref
|
||||
.read(engineSuggestionsServiceProvider)
|
||||
@@ -39,16 +37,18 @@ AsyncValue<List<GeckoSuggestion>> engineHistorySuggestions(Ref ref) {
|
||||
return ref.watch(
|
||||
engineSuggestionsProvider.select(
|
||||
(suggestions) => suggestions.whenData(
|
||||
(suggestions) => suggestions
|
||||
.where(
|
||||
(suggestion) =>
|
||||
suggestion.type == GeckoSuggestionType.history &&
|
||||
(suggestion.title?.isNotEmpty ?? false) &&
|
||||
(suggestion.description
|
||||
.mapNotNull((url) => Uri.tryParse(url)) !=
|
||||
null),
|
||||
)
|
||||
.toList(),
|
||||
(suggestions) =>
|
||||
suggestions
|
||||
.where(
|
||||
(suggestion) =>
|
||||
suggestion.type == GeckoSuggestionType.history &&
|
||||
(suggestion.title?.isNotEmpty ?? false) &&
|
||||
(suggestion.description.mapNotNull(
|
||||
(url) => Uri.tryParse(url),
|
||||
) !=
|
||||
null),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+18
-14
@@ -13,30 +13,34 @@ String _$engineHistorySuggestionsHash() =>
|
||||
@ProviderFor(engineHistorySuggestions)
|
||||
final engineHistorySuggestionsProvider =
|
||||
AutoDisposeProvider<AsyncValue<List<GeckoSuggestion>>>.internal(
|
||||
engineHistorySuggestions,
|
||||
name: r'engineHistorySuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineHistorySuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
engineHistorySuggestions,
|
||||
name: r'engineHistorySuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineHistorySuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef EngineHistorySuggestionsRef
|
||||
= AutoDisposeProviderRef<AsyncValue<List<GeckoSuggestion>>>;
|
||||
typedef EngineHistorySuggestionsRef =
|
||||
AutoDisposeProviderRef<AsyncValue<List<GeckoSuggestion>>>;
|
||||
String _$engineSuggestionsHash() => r'ba2c2d7f0a5e99fd9e639acd020b8cf3016c6126';
|
||||
|
||||
/// See also [EngineSuggestions].
|
||||
@ProviderFor(EngineSuggestions)
|
||||
final engineSuggestionsProvider = AutoDisposeStreamNotifierProvider<
|
||||
EngineSuggestions, List<GeckoSuggestion>>.internal(
|
||||
EngineSuggestions,
|
||||
List<GeckoSuggestion>
|
||||
>.internal(
|
||||
EngineSuggestions.new,
|
||||
name: r'engineSuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$engineSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -18,18 +18,17 @@ class SearchSuggestions extends _$SearchSuggestions {
|
||||
void addQuery(String query) => _addQueryBinding(query);
|
||||
|
||||
@override
|
||||
Stream<List<String>> build({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) {
|
||||
Stream<List<String>> build({ISearchSuggestionProvider? suggestionsProvider}) {
|
||||
final defaultProvider = ref.watch(defaultSearchSuggestionsProvider);
|
||||
final resolvedProvider = suggestionsProvider ?? defaultProvider;
|
||||
|
||||
_addQueryBinding = ref
|
||||
.watch(searchSuggestionsRepositoryProvider(resolvedProvider).notifier)
|
||||
.addQuery;
|
||||
_addQueryBinding =
|
||||
ref
|
||||
.watch(
|
||||
searchSuggestionsRepositoryProvider(resolvedProvider).notifier,
|
||||
)
|
||||
.addQuery;
|
||||
|
||||
return ref.watch(
|
||||
searchSuggestionsRepositoryProvider(resolvedProvider),
|
||||
);
|
||||
return ref.watch(searchSuggestionsRepositoryProvider(resolvedProvider));
|
||||
}
|
||||
}
|
||||
+39
-43
@@ -13,14 +13,15 @@ String _$defaultSearchSuggestionsHash() =>
|
||||
@ProviderFor(defaultSearchSuggestions)
|
||||
final defaultSearchSuggestionsProvider =
|
||||
Provider<ISearchSuggestionProvider>.internal(
|
||||
defaultSearchSuggestions,
|
||||
name: r'defaultSearchSuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$defaultSearchSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
defaultSearchSuggestions,
|
||||
name: r'defaultSearchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$defaultSearchSuggestionsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -52,9 +53,7 @@ abstract class _$SearchSuggestions
|
||||
extends BuildlessAutoDisposeStreamNotifier<List<String>> {
|
||||
late final ISearchSuggestionProvider? suggestionsProvider;
|
||||
|
||||
Stream<List<String>> build({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
});
|
||||
Stream<List<String>> build({ISearchSuggestionProvider? suggestionsProvider});
|
||||
}
|
||||
|
||||
/// See also [SearchSuggestions].
|
||||
@@ -70,18 +69,14 @@ class SearchSuggestionsFamily extends Family<AsyncValue<List<String>>> {
|
||||
SearchSuggestionsProvider call({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) {
|
||||
return SearchSuggestionsProvider(
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
return SearchSuggestionsProvider(suggestionsProvider: suggestionsProvider);
|
||||
}
|
||||
|
||||
@override
|
||||
SearchSuggestionsProvider getProviderOverride(
|
||||
covariant SearchSuggestionsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
suggestionsProvider: provider.suggestionsProvider,
|
||||
);
|
||||
return call(suggestionsProvider: provider.suggestionsProvider);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -100,24 +95,24 @@ class SearchSuggestionsFamily extends Family<AsyncValue<List<String>>> {
|
||||
}
|
||||
|
||||
/// See also [SearchSuggestions].
|
||||
class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
SearchSuggestions, List<String>> {
|
||||
class SearchSuggestionsProvider
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderImpl<SearchSuggestions, List<String>> {
|
||||
/// See also [SearchSuggestions].
|
||||
SearchSuggestionsProvider({
|
||||
ISearchSuggestionProvider? suggestionsProvider,
|
||||
}) : this._internal(
|
||||
() => SearchSuggestions()..suggestionsProvider = suggestionsProvider,
|
||||
from: searchSuggestionsProvider,
|
||||
name: r'searchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$searchSuggestionsHash,
|
||||
dependencies: SearchSuggestionsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SearchSuggestionsFamily._allTransitiveDependencies,
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
SearchSuggestionsProvider({ISearchSuggestionProvider? suggestionsProvider})
|
||||
: this._internal(
|
||||
() => SearchSuggestions()..suggestionsProvider = suggestionsProvider,
|
||||
from: searchSuggestionsProvider,
|
||||
name: r'searchSuggestionsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$searchSuggestionsHash,
|
||||
dependencies: SearchSuggestionsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
SearchSuggestionsFamily._allTransitiveDependencies,
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
|
||||
SearchSuggestionsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -132,12 +127,8 @@ class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
final ISearchSuggestionProvider? suggestionsProvider;
|
||||
|
||||
@override
|
||||
Stream<List<String>> runNotifierBuild(
|
||||
covariant SearchSuggestions notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
suggestionsProvider: suggestionsProvider,
|
||||
);
|
||||
Stream<List<String>> runNotifierBuild(covariant SearchSuggestions notifier) {
|
||||
return notifier.build(suggestionsProvider: suggestionsProvider);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -158,7 +149,7 @@ class SearchSuggestionsProvider extends AutoDisposeStreamNotifierProviderImpl<
|
||||
|
||||
@override
|
||||
AutoDisposeStreamNotifierProviderElement<SearchSuggestions, List<String>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _SearchSuggestionsProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -186,13 +177,18 @@ mixin SearchSuggestionsRef
|
||||
}
|
||||
|
||||
class _SearchSuggestionsProviderElement
|
||||
extends AutoDisposeStreamNotifierProviderElement<SearchSuggestions,
|
||||
List<String>> with SearchSuggestionsRef {
|
||||
extends
|
||||
AutoDisposeStreamNotifierProviderElement<
|
||||
SearchSuggestions,
|
||||
List<String>
|
||||
>
|
||||
with SearchSuggestionsRef {
|
||||
_SearchSuggestionsProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
ISearchSuggestionProvider? get suggestionsProvider =>
|
||||
(origin as SearchSuggestionsProvider).suggestionsProvider;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -23,8 +23,9 @@ class SearchScreen extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final formKey = useMemoized(() => GlobalKey<FormState>());
|
||||
|
||||
final searchTextController =
|
||||
useTextEditingController(text: initialSearchText);
|
||||
final searchTextController = useTextEditingController(
|
||||
text: initialSearchText,
|
||||
);
|
||||
final searchFocusNode = useFocusNode();
|
||||
|
||||
final defaultSearchBang = ref.watch(
|
||||
@@ -35,16 +36,13 @@ class SearchScreen extends HookConsumerWidget {
|
||||
final activeBang = selectedBang.value ?? defaultSearchBang;
|
||||
final showBangIcon = useState(false);
|
||||
|
||||
ref.listen(
|
||||
selectedBangDataProvider(),
|
||||
(previous, next) {
|
||||
if (previous != next) {
|
||||
showBangIcon.value = true;
|
||||
}
|
||||
ref.listen(selectedBangDataProvider(), (previous, next) {
|
||||
if (previous != next) {
|
||||
showBangIcon.value = true;
|
||||
}
|
||||
|
||||
selectedBang.value = next;
|
||||
},
|
||||
);
|
||||
selectedBang.value = next;
|
||||
});
|
||||
|
||||
Future<void> submitSearch(String query) async {
|
||||
if (activeBang != null && (formKey.currentState?.validate() == true)) {
|
||||
@@ -78,12 +76,14 @@ class SearchScreen extends HookConsumerWidget {
|
||||
autofocus: true,
|
||||
onSubmitted: (value) async {
|
||||
if (value.isNotEmpty) {
|
||||
var newUrl =
|
||||
uri_parser.tryParseUrl(value, eagerParsing: true);
|
||||
var newUrl = uri_parser.tryParseUrl(
|
||||
value,
|
||||
eagerParsing: true,
|
||||
);
|
||||
|
||||
if (newUrl == null) {
|
||||
final defaultSearchBang = ref
|
||||
.read(selectedBangDataProvider()) ??
|
||||
final defaultSearchBang =
|
||||
ref.read(selectedBangDataProvider()) ??
|
||||
await ref.read(defaultSearchBangDataProvider.future);
|
||||
|
||||
newUrl = defaultSearchBang?.getUrl(value);
|
||||
@@ -108,23 +108,15 @@ class SearchScreen extends HookConsumerWidget {
|
||||
showSuggestions: true,
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
SearchTermSuggestions(
|
||||
searchTextController: searchTextController,
|
||||
activeBang: activeBang,
|
||||
submitSearch: submitSearch,
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
TabSearch(
|
||||
searchTextController: searchTextController,
|
||||
),
|
||||
HistorySuggestions(
|
||||
searchTextController: searchTextController,
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
TabSearch(searchTextController: searchTextController),
|
||||
HistorySuggestions(searchTextController: searchTextController),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -31,24 +31,21 @@ class BangChips extends HookConsumerWidget {
|
||||
) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(
|
||||
'Reset usage frequency of $triggerName?',
|
||||
),
|
||||
content: const Text(
|
||||
'This will remove the Bang from quick select.',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
title: Text('Reset usage frequency of $triggerName?'),
|
||||
content: const Text('This will remove the Bang from quick select.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Reset'),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Reset'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,14 +53,11 @@ class BangChips extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final availableBangs = ref.watch(seamlessBangProviderProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() {
|
||||
ref
|
||||
.read(seamlessBangProviderProvider.notifier)
|
||||
.search(searchTextController!.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () {
|
||||
ref
|
||||
.read(seamlessBangProviderProvider.notifier)
|
||||
.search(searchTextController!.text);
|
||||
});
|
||||
|
||||
return availableBangs.when(
|
||||
data: (availableBangs) {
|
||||
@@ -75,8 +69,8 @@ class BangChips extends HookConsumerWidget {
|
||||
Expanded(
|
||||
child: SelectableChips(
|
||||
itemId: (bang) => bang.trigger,
|
||||
itemAvatar: (bang) =>
|
||||
UrlIcon(bang.getUrl(''), iconSize: 20),
|
||||
itemAvatar:
|
||||
(bang) => UrlIcon(bang.getUrl(''), iconSize: 20),
|
||||
itemLabel: (bang) => Text(bang.websiteName),
|
||||
availableItems: availableBangs,
|
||||
selectedItem: activeBang,
|
||||
@@ -104,9 +98,10 @@ class BangChips extends HookConsumerWidget {
|
||||
|
||||
await context.push(
|
||||
BangSearchRoute(
|
||||
searchText: (searchText?.isEmpty ?? true)
|
||||
? BangSearchRoute.emptySearchText
|
||||
: searchText!,
|
||||
searchText:
|
||||
(searchText?.isEmpty ?? true)
|
||||
? BangSearchRoute.emptySearchText
|
||||
: searchText!,
|
||||
).location,
|
||||
);
|
||||
},
|
||||
@@ -117,10 +112,7 @@ class BangChips extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
error: (error, stackTrace) => const SizedBox.shrink(),
|
||||
loading: () => const SizedBox(
|
||||
height: 48,
|
||||
width: double.infinity,
|
||||
),
|
||||
loading: () => const SizedBox(height: 48, width: double.infinity),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -44,18 +44,15 @@ class SearchField extends HookConsumerWidget {
|
||||
final suggestion = useState<String?>(null);
|
||||
|
||||
if (showSuggestions) {
|
||||
useListenableCallback(
|
||||
textEditingController,
|
||||
() async {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(textEditingController.text);
|
||||
useListenableCallback(textEditingController, () async {
|
||||
if (textEditingController.text.isNotEmpty) {
|
||||
final result = await ref
|
||||
.read(engineSuggestionsProvider.notifier)
|
||||
.getAutocompleteSuggestion(textEditingController.text);
|
||||
|
||||
suggestion.value = result;
|
||||
}
|
||||
},
|
||||
);
|
||||
suggestion.value = result;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return AutoSuggestTextField(
|
||||
@@ -66,33 +63,36 @@ class SearchField extends HookConsumerWidget {
|
||||
autofocus: autofocus,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
prefixIcon: (showBangIcon && activeBang != null)
|
||||
? Padding(
|
||||
padding: const EdgeInsetsDirectional.all(12.0),
|
||||
child: UrlIcon(activeBang!.getUrl(''), iconSize: 24.0),
|
||||
)
|
||||
: null,
|
||||
prefixIcon:
|
||||
(showBangIcon && activeBang != null)
|
||||
? Padding(
|
||||
padding: const EdgeInsetsDirectional.all(12.0),
|
||||
child: UrlIcon(activeBang!.getUrl(''), iconSize: 24.0),
|
||||
)
|
||||
: null,
|
||||
label: label ?? const Text('Search'),
|
||||
// hintText: 'Ask anything...',
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
suffixIcon: hasText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
textEditingController.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear),
|
||||
)
|
||||
: SpeechToTextButton(
|
||||
onTextReceived: (data) {
|
||||
textEditingController.text = data.toString();
|
||||
},
|
||||
),
|
||||
suffixIcon:
|
||||
hasText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
textEditingController.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear),
|
||||
)
|
||||
: SpeechToTextButton(
|
||||
onTextReceived: (data) {
|
||||
textEditingController.text = data.toString();
|
||||
},
|
||||
),
|
||||
),
|
||||
onTapOutside: (focusNode != null)
|
||||
? (event) {
|
||||
focusNode!.unfocus();
|
||||
}
|
||||
: null,
|
||||
onTapOutside:
|
||||
(focusNode != null)
|
||||
? (event) {
|
||||
focusNode!.unfocus();
|
||||
}
|
||||
: null,
|
||||
onSubmitted: onSubmitted,
|
||||
);
|
||||
}
|
||||
|
||||
+16
-21
@@ -22,14 +22,11 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final historySuggestions = ref.watch(engineHistorySuggestionsProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.watch(engineSuggestionsProvider.notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.watch(engineSuggestionsProvider.notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
if (historySuggestions.hasValue &&
|
||||
(historySuggestions.valueOrNull?.isEmpty ?? true)) {
|
||||
@@ -38,9 +35,7 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
|
||||
return MultiSliver(
|
||||
children: [
|
||||
const SliverToBoxAdapter(
|
||||
child: Divider(),
|
||||
),
|
||||
const SliverToBoxAdapter(child: Divider()),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
@@ -76,8 +71,9 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
width: 24,
|
||||
),
|
||||
),
|
||||
title:
|
||||
suggestion.title.mapNotNull((title) => Text(title)),
|
||||
title: suggestion.title.mapNotNull(
|
||||
(title) => Text(title),
|
||||
),
|
||||
subtitle: suggestion.description.mapNotNull(
|
||||
(description) => Text(
|
||||
description,
|
||||
@@ -117,14 +113,13 @@ class HistorySuggestions extends HookConsumerWidget {
|
||||
exception: error,
|
||||
);
|
||||
},
|
||||
loading: () => SliverList.builder(
|
||||
itemCount: historySuggestions.valueOrNull?.length ?? 3,
|
||||
itemBuilder: (context, index) {
|
||||
return const ListTile(
|
||||
title: Bone.text(),
|
||||
);
|
||||
},
|
||||
),
|
||||
loading:
|
||||
() => SliverList.builder(
|
||||
itemCount: historySuggestions.valueOrNull?.length ?? 3,
|
||||
itemBuilder: (context, index) {
|
||||
return const ListTile(title: Bone.text());
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+7
-14
@@ -40,14 +40,11 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
|
||||
final searchHistory = ref.watch(searchHistoryProvider);
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
ref
|
||||
.read(searchSuggestionsProvider().notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
},
|
||||
);
|
||||
useListenableCallback(searchTextController, () async {
|
||||
ref
|
||||
.read(searchSuggestionsProvider().notifier)
|
||||
.addQuery(searchTextController.text);
|
||||
});
|
||||
|
||||
final Widget listSliver;
|
||||
|
||||
@@ -135,9 +132,7 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
if (ref.read(selectedBangTriggerProvider()) ==
|
||||
bang.trigger) {
|
||||
ref
|
||||
.read(
|
||||
selectedBangTriggerProvider().notifier,
|
||||
)
|
||||
.read(selectedBangTriggerProvider().notifier)
|
||||
.clearTrigger();
|
||||
} else {
|
||||
final dialogResult = await BangChips.resetBangDialog(
|
||||
@@ -167,9 +162,7 @@ class SearchTermSuggestions extends HookConsumerWidget {
|
||||
return CustomScrollView(
|
||||
shrinkWrap: true,
|
||||
controller: controller,
|
||||
slivers: [
|
||||
listSliver,
|
||||
],
|
||||
slivers: [listSliver],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+58
-62
@@ -32,33 +32,31 @@ class TabSearch extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
final tabs = ref
|
||||
.watch(
|
||||
seamlessFilteredTabPreviewsProvider(
|
||||
TabSearchPartition.search,
|
||||
(selectedContainer.value != null)
|
||||
? ContainerFilterById(containerId: selectedContainer.value!.id)
|
||||
: ContainerFilterDisabled(),
|
||||
),
|
||||
)
|
||||
.collection;
|
||||
|
||||
useListenableCallback(
|
||||
searchTextController,
|
||||
() async {
|
||||
await ref
|
||||
.read(
|
||||
tabSearchRepositoryProvider(TabSearchPartition.search).notifier,
|
||||
final tabs =
|
||||
ref
|
||||
.watch(
|
||||
seamlessFilteredTabPreviewsProvider(
|
||||
TabSearchPartition.search,
|
||||
(selectedContainer.value != null)
|
||||
? ContainerFilterById(
|
||||
containerId: selectedContainer.value!.id,
|
||||
)
|
||||
: ContainerFilterDisabled(),
|
||||
),
|
||||
)
|
||||
.addQuery(
|
||||
searchTextController.text,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchPrefix: _matchPrefix,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchSuffix: _matchSuffix,
|
||||
);
|
||||
},
|
||||
);
|
||||
.collection;
|
||||
|
||||
useListenableCallback(searchTextController, () async {
|
||||
await ref
|
||||
.read(tabSearchRepositoryProvider(TabSearchPartition.search).notifier)
|
||||
.addQuery(
|
||||
searchTextController.text,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchPrefix: _matchPrefix,
|
||||
// ignore: avoid_redundant_argument_values
|
||||
matchSuffix: _matchSuffix,
|
||||
);
|
||||
});
|
||||
|
||||
return MultiSliver(
|
||||
children: [
|
||||
@@ -68,10 +66,7 @@ class TabSearch extends HookConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Tabs',
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
Text('Tabs', style: Theme.of(context).textTheme.labelSmall),
|
||||
ContainerChips(
|
||||
displayMenu: false,
|
||||
selectedContainer: selectedContainer.value,
|
||||
@@ -100,48 +95,49 @@ class TabSearch extends HookConsumerWidget {
|
||||
|
||||
return ListTile(
|
||||
leading: RepaintBoundary(
|
||||
child: (result.icon != null)
|
||||
? RawImage(
|
||||
image: result.icon?.value,
|
||||
height: 24,
|
||||
width: 24,
|
||||
)
|
||||
: UrlIcon(result.url, iconSize: 24),
|
||||
child:
|
||||
(result.icon != null)
|
||||
? RawImage(
|
||||
image: result.icon?.value,
|
||||
height: 24,
|
||||
width: 24,
|
||||
)
|
||||
: UrlIcon(result.url, iconSize: 24),
|
||||
),
|
||||
title: result.title.mapNotNull(
|
||||
(title) => MarkdownBody(
|
||||
data: title,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: (bodyHasMatch || urlHasMatch)
|
||||
? MarkdownBody(
|
||||
data: bodyHasMatch
|
||||
? result.content!
|
||||
: result.highlightedUrl!,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
a: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
subtitle:
|
||||
(bodyHasMatch || urlHasMatch)
|
||||
? MarkdownBody(
|
||||
data:
|
||||
bodyHasMatch
|
||||
? result.content!
|
||||
: result.highlightedUrl!,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
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 {
|
||||
await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
|
||||
@@ -42,12 +42,14 @@ class ContainerDao extends DatabaseAccessor<TabDatabase>
|
||||
}
|
||||
|
||||
Selectable<Color> getDistinctColors() {
|
||||
final query = db.selectOnly(db.container, distinct: true)
|
||||
..addColumns([db.container.color])
|
||||
..where(db.container.color.isNotNull());
|
||||
final query =
|
||||
db.selectOnly(db.container, distinct: true)
|
||||
..addColumns([db.container.color])
|
||||
..where(db.container.color.isNotNull());
|
||||
|
||||
return query
|
||||
.map((row) => row.readWithConverter<Color?, int>(db.container.color)!);
|
||||
return query.map(
|
||||
(row) => row.readWithConverter<Color?, int>(db.container.color)!,
|
||||
);
|
||||
}
|
||||
|
||||
SingleSelectable<String> generateLeadingOrderKey(
|
||||
|
||||
@@ -21,30 +21,33 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
db.tab.select()..where((t) => t.id.equals(id));
|
||||
|
||||
Selectable<String> containerTabIds(String? containerId) {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..where(
|
||||
(containerId != null)
|
||||
? db.tab.containerId.equals(containerId)
|
||||
: db.tab.containerId.isNull(),
|
||||
)
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..where(
|
||||
(containerId != null)
|
||||
? db.tab.containerId.equals(containerId)
|
||||
: db.tab.containerId.isNull(),
|
||||
)
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
|
||||
return query.map((row) => row.read(db.tab.id)!);
|
||||
}
|
||||
|
||||
Selectable<String> allTabIds() {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.id])
|
||||
..orderBy([OrderingTerm.asc(db.tab.orderKey)]);
|
||||
|
||||
return query.map((row) => row.read(db.tab.id)!);
|
||||
}
|
||||
|
||||
SingleOrNullSelectable<String?> tabContainerId(String tabId) {
|
||||
final query = selectOnly(db.tab)
|
||||
..addColumns([db.tab.containerId])
|
||||
..where(db.tab.id.equals(tabId));
|
||||
final query =
|
||||
selectOnly(db.tab)
|
||||
..addColumns([db.tab.containerId])
|
||||
..where(db.tab.id.equals(tabId));
|
||||
|
||||
return query.map((row) => row.read(db.tab.containerId));
|
||||
}
|
||||
@@ -57,7 +60,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
return db.transaction(() async {
|
||||
final tabId = await createTab();
|
||||
|
||||
final currentOrderKey = orderKey.value ??
|
||||
final currentOrderKey =
|
||||
orderKey.value ??
|
||||
await db.containerDao
|
||||
.generateLeadingOrderKey(containerId.value)
|
||||
.getSingle();
|
||||
@@ -89,7 +93,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
Value<String?> orderKey = const Value.absent(),
|
||||
}) {
|
||||
return db.transaction(() async {
|
||||
final currentOrderKey = orderKey.value ??
|
||||
final currentOrderKey =
|
||||
orderKey.value ??
|
||||
await db.containerDao
|
||||
.generateLeadingOrderKey(containerId.value)
|
||||
.getSingle();
|
||||
@@ -115,34 +120,19 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> assignContainer(
|
||||
String id, {
|
||||
required String? containerId,
|
||||
}) {
|
||||
Future<void> assignContainer(String id, {required String? containerId}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(containerId: Value(containerId)),
|
||||
);
|
||||
return statement.write(TabCompanion(containerId: Value(containerId)));
|
||||
}
|
||||
|
||||
Future<void> assignOrderKey(
|
||||
String id, {
|
||||
required String orderKey,
|
||||
}) {
|
||||
Future<void> assignOrderKey(String id, {required String orderKey}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(orderKey: Value(orderKey)),
|
||||
);
|
||||
return statement.write(TabCompanion(orderKey: Value(orderKey)));
|
||||
}
|
||||
|
||||
Future<void> touchTab(
|
||||
String id, {
|
||||
required DateTime timestamp,
|
||||
}) {
|
||||
Future<void> touchTab(String id, {required DateTime timestamp}) {
|
||||
final statement = _updateByIdStatement(id);
|
||||
return statement.write(
|
||||
TabCompanion(timestamp: Value(timestamp)),
|
||||
);
|
||||
return statement.write(TabCompanion(timestamp: Value(timestamp)));
|
||||
}
|
||||
|
||||
Future<void> updateTabContent(
|
||||
@@ -180,12 +170,14 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
batch.update(
|
||||
db.tab,
|
||||
TabCompanion(
|
||||
url: (previousState?.url != state.url)
|
||||
? Value(state.url.toString())
|
||||
: const Value.absent(),
|
||||
title: (previousState?.title != state.title)
|
||||
? Value(state.title)
|
||||
: const Value.absent(),
|
||||
url:
|
||||
(previousState?.url != state.url)
|
||||
? Value(state.url.toString())
|
||||
: const Value.absent(),
|
||||
title:
|
||||
(previousState?.title != state.title)
|
||||
? Value(state.title)
|
||||
: const Value.absent(),
|
||||
),
|
||||
where: (t) => t.id.equals(state.id),
|
||||
);
|
||||
@@ -202,19 +194,17 @@ class TabDao extends DatabaseAccessor<TabDatabase> with _$TabDaoMixin {
|
||||
await db.containerDao.generateLeadingOrderKey(null).getSingle();
|
||||
|
||||
await db.tab.insertAll(
|
||||
retainTabIds.map(
|
||||
(id) {
|
||||
final insertable = TabCompanion.insert(
|
||||
id: id,
|
||||
orderKey: currentOrderKey,
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
retainTabIds.map((id) {
|
||||
final insertable = TabCompanion.insert(
|
||||
id: id,
|
||||
orderKey: currentOrderKey,
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
|
||||
currentOrderKey = LexoRank.parse(currentOrderKey).genPrev().value;
|
||||
currentOrderKey = LexoRank.parse(currentOrderKey).genPrev().value;
|
||||
|
||||
return insertable;
|
||||
},
|
||||
),
|
||||
return insertable;
|
||||
}),
|
||||
mode: InsertMode.insertOrIgnore,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -30,23 +30,23 @@ class TabDatabase extends _$TabDatabase with TrigramQueryBuilderMixin {
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
onCreate: (m) async {
|
||||
final migrator =
|
||||
VectorDatabaseMigrator(dimensions: embeddingDimensions);
|
||||
onCreate: (m) async {
|
||||
final migrator = VectorDatabaseMigrator(dimensions: embeddingDimensions);
|
||||
|
||||
await m.database.customStatement(migrator.vectorTableDefinition);
|
||||
await m.database.customStatement(migrator.vectorTableDefinition);
|
||||
|
||||
//instead of m.createAll(); we igoner vec0 table
|
||||
for (final entity
|
||||
in allSchemaEntities.where((entity) => entity is! DocumentVec)) {
|
||||
await m.create(entity);
|
||||
}
|
||||
},
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
await optimizeFtsIndex();
|
||||
},
|
||||
);
|
||||
//instead of m.createAll(); we igoner vec0 table
|
||||
for (final entity in allSchemaEntities.where(
|
||||
(entity) => entity is! DocumentVec,
|
||||
)) {
|
||||
await m.create(entity);
|
||||
}
|
||||
},
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON;');
|
||||
await optimizeFtsIndex();
|
||||
},
|
||||
);
|
||||
|
||||
TabDatabase(super.e, {required this.embeddingDimensions});
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -24,10 +24,10 @@ class ContainerAuthSettings with FastEquatable {
|
||||
bool? lockOnAppBackground,
|
||||
Duration? lockTimeout,
|
||||
}) : this(
|
||||
authenticationRequired: authenticationRequired ?? false,
|
||||
lockOnAppBackground: lockOnAppBackground ?? false,
|
||||
lockTimeout: lockTimeout,
|
||||
);
|
||||
authenticationRequired: authenticationRequired ?? false,
|
||||
lockOnAppBackground: lockOnAppBackground ?? false,
|
||||
lockTimeout: lockTimeout,
|
||||
);
|
||||
|
||||
factory ContainerAuthSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContainerAuthSettingsFromJson(json);
|
||||
@@ -36,10 +36,10 @@ class ContainerAuthSettings with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
authenticationRequired,
|
||||
lockOnAppBackground,
|
||||
lockTimeout,
|
||||
];
|
||||
authenticationRequired,
|
||||
lockOnAppBackground,
|
||||
lockTimeout,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
@@ -69,11 +69,11 @@ class ContainerMetadata with FastEquatable {
|
||||
ContainerAuthSettings? authSettings,
|
||||
bool? useProxy,
|
||||
}) : this(
|
||||
iconData: iconData,
|
||||
contextualIdentity: contextualIdentity,
|
||||
authSettings: authSettings ?? ContainerAuthSettings.withDefaults(),
|
||||
useProxy: useProxy ?? false,
|
||||
);
|
||||
iconData: iconData,
|
||||
contextualIdentity: contextualIdentity,
|
||||
authSettings: authSettings ?? ContainerAuthSettings.withDefaults(),
|
||||
useProxy: useProxy ?? false,
|
||||
);
|
||||
|
||||
factory ContainerMetadata.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContainerMetadataFromJson(json);
|
||||
@@ -82,11 +82,11 @@ class ContainerMetadata with FastEquatable {
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
iconData,
|
||||
contextualIdentity,
|
||||
authSettings,
|
||||
useProxy,
|
||||
];
|
||||
iconData,
|
||||
contextualIdentity,
|
||||
authSettings,
|
||||
useProxy,
|
||||
];
|
||||
|
||||
@override
|
||||
bool get cacheHash => true;
|
||||
@@ -110,12 +110,7 @@ class ContainerData with FastEquatable {
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
id,
|
||||
name,
|
||||
color,
|
||||
metadata,
|
||||
];
|
||||
List<Object?> get hashParameters => [id, name, color, metadata];
|
||||
}
|
||||
|
||||
class ContainerDataWithCount extends ContainerData {
|
||||
@@ -133,8 +128,5 @@ class ContainerDataWithCount extends ContainerData {
|
||||
bool get cacheHash => true;
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters => [
|
||||
...super.hashParameters,
|
||||
tabCount,
|
||||
];
|
||||
List<Object?> get hashParameters => [...super.hashParameters, tabCount];
|
||||
}
|
||||
@@ -46,7 +46,6 @@ class _$ContainerAuthSettingsCWProxyImpl
|
||||
this(lockTimeout: lockTimeout);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerAuthSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -64,14 +63,16 @@ class _$ContainerAuthSettingsCWProxyImpl
|
||||
? _value.authenticationRequired
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authenticationRequired as bool,
|
||||
lockOnAppBackground: lockOnAppBackground == const $CopyWithPlaceholder()
|
||||
? _value.lockOnAppBackground
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockOnAppBackground as bool,
|
||||
lockTimeout: lockTimeout == const $CopyWithPlaceholder()
|
||||
? _value.lockTimeout
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockTimeout as Duration?,
|
||||
lockOnAppBackground:
|
||||
lockOnAppBackground == const $CopyWithPlaceholder()
|
||||
? _value.lockOnAppBackground
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockOnAppBackground as bool,
|
||||
lockTimeout:
|
||||
lockTimeout == const $CopyWithPlaceholder()
|
||||
? _value.lockTimeout
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: lockTimeout as Duration?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +128,6 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
|
||||
ContainerMetadata useProxy(bool useProxy) => this(useProxy: useProxy);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerMetadata(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -141,22 +141,26 @@ class _$ContainerMetadataCWProxyImpl implements _$ContainerMetadataCWProxy {
|
||||
Object? useProxy = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return ContainerMetadata(
|
||||
iconData: iconData == const $CopyWithPlaceholder()
|
||||
? _value.iconData
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: iconData as IconData?,
|
||||
contextualIdentity: contextualIdentity == const $CopyWithPlaceholder()
|
||||
? _value.contextualIdentity
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextualIdentity as String?,
|
||||
authSettings: authSettings == const $CopyWithPlaceholder()
|
||||
? _value.authSettings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authSettings as ContainerAuthSettings,
|
||||
useProxy: useProxy == const $CopyWithPlaceholder()
|
||||
? _value.useProxy
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: useProxy as bool,
|
||||
iconData:
|
||||
iconData == const $CopyWithPlaceholder()
|
||||
? _value.iconData
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: iconData as IconData?,
|
||||
contextualIdentity:
|
||||
contextualIdentity == const $CopyWithPlaceholder()
|
||||
? _value.contextualIdentity
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: contextualIdentity as String?,
|
||||
authSettings:
|
||||
authSettings == const $CopyWithPlaceholder()
|
||||
? _value.authSettings
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: authSettings as ContainerAuthSettings,
|
||||
useProxy:
|
||||
useProxy == const $CopyWithPlaceholder()
|
||||
? _value.useProxy
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: useProxy as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -211,7 +215,6 @@ class _$ContainerDataCWProxyImpl implements _$ContainerDataCWProxy {
|
||||
this(metadata: metadata);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ContainerData(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -225,22 +228,26 @@ class _$ContainerDataCWProxyImpl implements _$ContainerDataCWProxy {
|
||||
Object? metadata = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return ContainerData(
|
||||
id: id == const $CopyWithPlaceholder()
|
||||
? _value.id
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: id as String,
|
||||
name: name == const $CopyWithPlaceholder()
|
||||
? _value.name
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: name as String?,
|
||||
color: color == const $CopyWithPlaceholder()
|
||||
? _value.color
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: color as Color,
|
||||
metadata: metadata == const $CopyWithPlaceholder()
|
||||
? _value.metadata
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: metadata as ContainerMetadata?,
|
||||
id:
|
||||
id == const $CopyWithPlaceholder()
|
||||
? _value.id
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: id as String,
|
||||
name:
|
||||
name == const $CopyWithPlaceholder()
|
||||
? _value.name
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: name as String?,
|
||||
color:
|
||||
color == const $CopyWithPlaceholder()
|
||||
? _value.color
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: color as Color,
|
||||
metadata:
|
||||
metadata == const $CopyWithPlaceholder()
|
||||
? _value.metadata
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: metadata as ContainerMetadata?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -256,39 +263,46 @@ extension $ContainerDataCopyWith on ContainerData {
|
||||
// **************************************************************************
|
||||
|
||||
ContainerAuthSettings _$ContainerAuthSettingsFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
ContainerAuthSettings(
|
||||
authenticationRequired: json['authenticationRequired'] as bool,
|
||||
lockOnAppBackground: json['lockOnAppBackground'] as bool,
|
||||
lockTimeout: json['lockTimeout'] == null
|
||||
Map<String, dynamic> json,
|
||||
) => ContainerAuthSettings(
|
||||
authenticationRequired: json['authenticationRequired'] as bool,
|
||||
lockOnAppBackground: json['lockOnAppBackground'] as bool,
|
||||
lockTimeout:
|
||||
json['lockTimeout'] == null
|
||||
? null
|
||||
: Duration(microseconds: (json['lockTimeout'] as num).toInt()),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ContainerAuthSettingsToJson(
|
||||
ContainerAuthSettings instance) =>
|
||||
<String, dynamic>{
|
||||
'authenticationRequired': instance.authenticationRequired,
|
||||
'lockOnAppBackground': instance.lockOnAppBackground,
|
||||
'lockTimeout': instance.lockTimeout?.inMicroseconds,
|
||||
};
|
||||
ContainerAuthSettings instance,
|
||||
) => <String, dynamic>{
|
||||
'authenticationRequired': instance.authenticationRequired,
|
||||
'lockOnAppBackground': instance.lockOnAppBackground,
|
||||
'lockTimeout': instance.lockTimeout?.inMicroseconds,
|
||||
};
|
||||
|
||||
ContainerMetadata _$ContainerMetadataFromJson(Map<String, dynamic> json) =>
|
||||
ContainerMetadata.withDefaults(
|
||||
iconData: _$JsonConverterFromJson<Map<String, dynamic>, IconData>(
|
||||
json['iconData'], const IconDataJsonConverter().fromJson),
|
||||
json['iconData'],
|
||||
const IconDataJsonConverter().fromJson,
|
||||
),
|
||||
contextualIdentity: json['contextualIdentity'] as String?,
|
||||
authSettings: json['authSettings'] == null
|
||||
? null
|
||||
: ContainerAuthSettings.fromJson(
|
||||
json['authSettings'] as Map<String, dynamic>),
|
||||
authSettings:
|
||||
json['authSettings'] == null
|
||||
? null
|
||||
: ContainerAuthSettings.fromJson(
|
||||
json['authSettings'] as Map<String, dynamic>,
|
||||
),
|
||||
useProxy: json['useProxy'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ContainerMetadataToJson(ContainerMetadata instance) =>
|
||||
<String, dynamic>{
|
||||
'iconData': _$JsonConverterToJson<Map<String, dynamic>, IconData>(
|
||||
instance.iconData, const IconDataJsonConverter().toJson),
|
||||
instance.iconData,
|
||||
const IconDataJsonConverter().toJson,
|
||||
),
|
||||
'contextualIdentity': instance.contextualIdentity,
|
||||
'authSettings': instance.authSettings,
|
||||
'useProxy': instance.useProxy,
|
||||
@@ -297,11 +311,9 @@ Map<String, dynamic> _$ContainerMetadataToJson(ContainerMetadata instance) =>
|
||||
Value? _$JsonConverterFromJson<Json, Value>(
|
||||
Object? json,
|
||||
Value? Function(Json json) fromJson,
|
||||
) =>
|
||||
json == null ? null : fromJson(json as Json);
|
||||
) => json == null ? null : fromJson(json as Json);
|
||||
|
||||
Json? _$JsonConverterToJson<Json, Value>(
|
||||
Value? value,
|
||||
Json? Function(Value value) toJson,
|
||||
) =>
|
||||
value == null ? null : toJson(value);
|
||||
) => value == null ? null : toJson(value);
|
||||
@@ -13,9 +13,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'providers.g.dart';
|
||||
|
||||
@Riverpod()
|
||||
Future<Color> unusedRandomContainerColor(
|
||||
Ref ref,
|
||||
) async {
|
||||
Future<Color> unusedRandomContainerColor(Ref ref) async {
|
||||
final repository = ref.watch(containerRepositoryProvider.notifier);
|
||||
|
||||
final allColors = colorTypes.flattened.toList();
|
||||
@@ -30,9 +28,7 @@ Future<Color> unusedRandomContainerColor(
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<ContainerDataWithCount>> containersWithCount(
|
||||
Ref ref,
|
||||
) {
|
||||
Stream<List<ContainerDataWithCount>> containersWithCount(Ref ref) {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
return db.containersWithCount().watch();
|
||||
}
|
||||
@@ -49,21 +45,19 @@ AsyncValue<List<ContainerDataWithCount>> matchSortedContainersWithCount(
|
||||
}
|
||||
|
||||
return value.whenData(
|
||||
(cb) => TokenizedFilter.sort(
|
||||
items: cb,
|
||||
toString: (item) => item.name,
|
||||
query: searchText!,
|
||||
).filtered,
|
||||
(cb) =>
|
||||
TokenizedFilter.sort(
|
||||
items: cb,
|
||||
toString: (item) => item.name,
|
||||
query: searchText!,
|
||||
).filtered,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<String>> containerTabIds(
|
||||
Ref ref,
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
Stream<List<String>> containerTabIds(Ref ref, ContainerFilter containerFilter) {
|
||||
final db = ref.watch(tabDatabaseProvider);
|
||||
|
||||
switch (containerFilter) {
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$unusedRandomContainerColorHash() =>
|
||||
@ProviderFor(unusedRandomContainerColor)
|
||||
final unusedRandomContainerColorProvider =
|
||||
AutoDisposeFutureProvider<Color>.internal(
|
||||
unusedRandomContainerColor,
|
||||
name: r'unusedRandomContainerColorProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unusedRandomContainerColorHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
unusedRandomContainerColor,
|
||||
name: r'unusedRandomContainerColorProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$unusedRandomContainerColorHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -32,19 +33,20 @@ String _$containersWithCountHash() =>
|
||||
@ProviderFor(containersWithCount)
|
||||
final containersWithCountProvider =
|
||||
AutoDisposeStreamProvider<List<ContainerDataWithCount>>.internal(
|
||||
containersWithCount,
|
||||
name: r'containersWithCountProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containersWithCountHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
containersWithCount,
|
||||
name: r'containersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containersWithCountHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ContainersWithCountRef
|
||||
= AutoDisposeStreamProviderRef<List<ContainerDataWithCount>>;
|
||||
typedef ContainersWithCountRef =
|
||||
AutoDisposeStreamProviderRef<List<ContainerDataWithCount>>;
|
||||
String _$matchSortedContainersWithCountHash() =>
|
||||
r'0ed555f0cb72f4990a2841114d72f57d8178d5c3';
|
||||
|
||||
@@ -81,21 +83,15 @@ class MatchSortedContainersWithCountFamily
|
||||
const MatchSortedContainersWithCountFamily();
|
||||
|
||||
/// See also [matchSortedContainersWithCount].
|
||||
MatchSortedContainersWithCountProvider call(
|
||||
String? searchText,
|
||||
) {
|
||||
return MatchSortedContainersWithCountProvider(
|
||||
searchText,
|
||||
);
|
||||
MatchSortedContainersWithCountProvider call(String? searchText) {
|
||||
return MatchSortedContainersWithCountProvider(searchText);
|
||||
}
|
||||
|
||||
@override
|
||||
MatchSortedContainersWithCountProvider getProviderOverride(
|
||||
covariant MatchSortedContainersWithCountProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.searchText,
|
||||
);
|
||||
return call(provider.searchText);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -117,24 +113,23 @@ class MatchSortedContainersWithCountFamily
|
||||
class MatchSortedContainersWithCountProvider
|
||||
extends AutoDisposeProvider<AsyncValue<List<ContainerDataWithCount>>> {
|
||||
/// See also [matchSortedContainersWithCount].
|
||||
MatchSortedContainersWithCountProvider(
|
||||
String? searchText,
|
||||
) : this._internal(
|
||||
(ref) => matchSortedContainersWithCount(
|
||||
ref as MatchSortedContainersWithCountRef,
|
||||
searchText,
|
||||
),
|
||||
from: matchSortedContainersWithCountProvider,
|
||||
name: r'matchSortedContainersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$matchSortedContainersWithCountHash,
|
||||
dependencies: MatchSortedContainersWithCountFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MatchSortedContainersWithCountFamily._allTransitiveDependencies,
|
||||
searchText: searchText,
|
||||
);
|
||||
MatchSortedContainersWithCountProvider(String? searchText)
|
||||
: this._internal(
|
||||
(ref) => matchSortedContainersWithCount(
|
||||
ref as MatchSortedContainersWithCountRef,
|
||||
searchText,
|
||||
),
|
||||
from: matchSortedContainersWithCountProvider,
|
||||
name: r'matchSortedContainersWithCountProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$matchSortedContainersWithCountHash,
|
||||
dependencies: MatchSortedContainersWithCountFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
MatchSortedContainersWithCountFamily._allTransitiveDependencies,
|
||||
searchText: searchText,
|
||||
);
|
||||
|
||||
MatchSortedContainersWithCountProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -151,8 +146,9 @@ class MatchSortedContainersWithCountProvider
|
||||
@override
|
||||
Override overrideWith(
|
||||
AsyncValue<List<ContainerDataWithCount>> Function(
|
||||
MatchSortedContainersWithCountRef provider)
|
||||
create,
|
||||
MatchSortedContainersWithCountRef provider,
|
||||
)
|
||||
create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
@@ -170,7 +166,7 @@ class MatchSortedContainersWithCountProvider
|
||||
|
||||
@override
|
||||
AutoDisposeProviderElement<AsyncValue<List<ContainerDataWithCount>>>
|
||||
createElement() {
|
||||
createElement() {
|
||||
return _MatchSortedContainersWithCountProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -219,21 +215,15 @@ class ContainerTabIdsFamily extends Family<AsyncValue<List<String>>> {
|
||||
const ContainerTabIdsFamily();
|
||||
|
||||
/// See also [containerTabIds].
|
||||
ContainerTabIdsProvider call(
|
||||
ContainerFilter containerFilter,
|
||||
) {
|
||||
return ContainerTabIdsProvider(
|
||||
containerFilter,
|
||||
);
|
||||
ContainerTabIdsProvider call(ContainerFilter containerFilter) {
|
||||
return ContainerTabIdsProvider(containerFilter);
|
||||
}
|
||||
|
||||
@override
|
||||
ContainerTabIdsProvider getProviderOverride(
|
||||
covariant ContainerTabIdsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.containerFilter,
|
||||
);
|
||||
return call(provider.containerFilter);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -254,24 +244,20 @@ class ContainerTabIdsFamily extends Family<AsyncValue<List<String>>> {
|
||||
/// See also [containerTabIds].
|
||||
class ContainerTabIdsProvider extends AutoDisposeStreamProvider<List<String>> {
|
||||
/// See also [containerTabIds].
|
||||
ContainerTabIdsProvider(
|
||||
ContainerFilter containerFilter,
|
||||
) : this._internal(
|
||||
(ref) => containerTabIds(
|
||||
ref as ContainerTabIdsRef,
|
||||
containerFilter,
|
||||
),
|
||||
from: containerTabIdsProvider,
|
||||
name: r'containerTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerTabIdsHash,
|
||||
dependencies: ContainerTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ContainerTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
ContainerTabIdsProvider(ContainerFilter containerFilter)
|
||||
: this._internal(
|
||||
(ref) => containerTabIds(ref as ContainerTabIdsRef, containerFilter),
|
||||
from: containerTabIdsProvider,
|
||||
name: r'containerTabIdsProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerTabIdsHash,
|
||||
dependencies: ContainerTabIdsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ContainerTabIdsFamily._allTransitiveDependencies,
|
||||
containerFilter: containerFilter,
|
||||
);
|
||||
|
||||
ContainerTabIdsProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -339,5 +325,6 @@ class _ContainerTabIdsProviderElement
|
||||
ContainerFilter get containerFilter =>
|
||||
(origin as ContainerTabIdsProvider).containerFilter;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -8,11 +8,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'selected_container.g.dart';
|
||||
|
||||
enum SetContainerResult {
|
||||
failed,
|
||||
success,
|
||||
successHasProxy,
|
||||
}
|
||||
enum SetContainerResult { failed, success, successHasProxy }
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class SelectedContainer extends _$SelectedContainer {
|
||||
@@ -71,16 +67,13 @@ class SelectedContainer extends _$SelectedContainer {
|
||||
|
||||
@override
|
||||
String? build() {
|
||||
ref.listen(
|
||||
containersWithCountProvider,
|
||||
(previous, next) {
|
||||
if (state != null && next.valueOrNull != null) {
|
||||
if (!next.value!.any((container) => container.id == state)) {
|
||||
clearContainer();
|
||||
}
|
||||
ref.listen(containersWithCountProvider, (previous, next) {
|
||||
if (state != null && next.valueOrNull != null) {
|
||||
if (!next.value!.any((container) => container.id == state)) {
|
||||
clearContainer();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
+18
-16
@@ -13,14 +13,15 @@ String _$selectedContainerDataHash() =>
|
||||
@ProviderFor(selectedContainerData)
|
||||
final selectedContainerDataProvider =
|
||||
AutoDisposeStreamProvider<ContainerData?>.internal(
|
||||
selectedContainerData,
|
||||
name: r'selectedContainerDataProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectedContainerData,
|
||||
name: r'selectedContainerDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
@@ -31,14 +32,15 @@ String _$selectedContainerHash() => r'f3dab491337396b8d56daed37a0d85c85aa8d64a';
|
||||
@ProviderFor(SelectedContainer)
|
||||
final selectedContainerProvider =
|
||||
NotifierProvider<SelectedContainer, String?>.internal(
|
||||
SelectedContainer.new,
|
||||
name: r'selectedContainerProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
SelectedContainer.new,
|
||||
name: r'selectedContainerProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedContainerHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$SelectedContainer = Notifier<String?>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$selectedTopicDataHash() => r'fa450784052498014f592c356bde4ff5ec675281';
|
||||
@ProviderFor(selectedTopicData)
|
||||
final selectedTopicDataProvider =
|
||||
AutoDisposeStreamProvider<TopicData?>.internal(
|
||||
selectedTopicData,
|
||||
name: r'selectedTopicDataProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
selectedTopicData,
|
||||
name: r'selectedTopicDataProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicDataHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef SelectedTopicDataRef = AutoDisposeStreamProviderRef<TopicData?>;
|
||||
String _$selectedTopicHash() => r'f4e1c0620971a0b7501ee9aff0d5b41da3130ba0';
|
||||
@@ -29,9 +30,10 @@ String _$selectedTopicHash() => r'f4e1c0620971a0b7501ee9aff0d5b41da3130ba0';
|
||||
final selectedTopicProvider = NotifierProvider<SelectedTopic, String?>.internal(
|
||||
SelectedTopic.new,
|
||||
name: r'selectedTopicProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicHash,
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTopicHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@@ -13,14 +13,15 @@ String _$containerRepositoryHash() =>
|
||||
@ProviderFor(ContainerRepository)
|
||||
final containerRepositoryProvider =
|
||||
NotifierProvider<ContainerRepository, void>.internal(
|
||||
ContainerRepository.new,
|
||||
name: r'containerRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
ContainerRepository.new,
|
||||
name: r'containerRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$containerRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$ContainerRepository = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -10,25 +10,26 @@ class TabDataRepository extends _$TabDataRepository {
|
||||
void build() {}
|
||||
|
||||
Future<void> assignContainer(String tabId, String? containerId) {
|
||||
return ref.read(tabDatabaseProvider).tabDao.assignContainer(
|
||||
tabId,
|
||||
containerId: containerId,
|
||||
);
|
||||
return ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.assignContainer(tabId, containerId: containerId);
|
||||
}
|
||||
|
||||
Future<void> assignOrderKey(String tabId, String orderKey) {
|
||||
return ref.read(tabDatabaseProvider).tabDao.assignOrderKey(
|
||||
tabId,
|
||||
orderKey: orderKey,
|
||||
);
|
||||
return ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.assignOrderKey(tabId, orderKey: orderKey);
|
||||
}
|
||||
|
||||
Future<void> closeAllTabs(String? containerId) async {
|
||||
final tabIds = await ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.containerTabIds(containerId)
|
||||
.get();
|
||||
final tabIds =
|
||||
await ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.containerTabIds(containerId)
|
||||
.get();
|
||||
|
||||
if (tabIds.isNotEmpty) {
|
||||
await ref.read(tabRepositoryProvider.notifier).closeTabs(tabIds);
|
||||
|
||||
@@ -12,14 +12,15 @@ String _$tabDataRepositoryHash() => r'30ae87fbcb37facd565cb28de605814cd7db4ce8';
|
||||
@ProviderFor(TabDataRepository)
|
||||
final tabDataRepositoryProvider =
|
||||
NotifierProvider<TabDataRepository, void>.internal(
|
||||
TabDataRepository.new,
|
||||
name: r'tabDataRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabDataRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
TabDataRepository.new,
|
||||
name: r'tabDataRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabDataRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$TabDataRepository = Notifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
@@ -19,17 +19,18 @@ class TabSearchRepository extends _$TabSearchRepository {
|
||||
}) async {
|
||||
if (input.isNotEmpty) {
|
||||
state = await AsyncValue.guard(
|
||||
() => ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.queryTabs(
|
||||
matchPrefix: matchPrefix,
|
||||
matchSuffix: matchSuffix,
|
||||
ellipsis: ellipsis,
|
||||
snippetLength: snippetLength,
|
||||
searchString: input,
|
||||
)
|
||||
.get(),
|
||||
() =>
|
||||
ref
|
||||
.read(tabDatabaseProvider)
|
||||
.tabDao
|
||||
.queryTabs(
|
||||
matchPrefix: matchPrefix,
|
||||
matchSuffix: matchSuffix,
|
||||
ellipsis: ellipsis,
|
||||
snippetLength: snippetLength,
|
||||
searchString: input,
|
||||
)
|
||||
.get(),
|
||||
);
|
||||
} else {
|
||||
state = const AsyncValue.data(null);
|
||||
|
||||
@@ -34,9 +34,7 @@ abstract class _$TabSearchRepository
|
||||
extends BuildlessAutoDisposeAsyncNotifier<List<TabQueryResult>?> {
|
||||
late final TabSearchPartition partition;
|
||||
|
||||
FutureOr<List<TabQueryResult>?> build(
|
||||
TabSearchPartition partition,
|
||||
);
|
||||
FutureOr<List<TabQueryResult>?> build(TabSearchPartition partition);
|
||||
}
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
@@ -50,21 +48,15 @@ class TabSearchRepositoryFamily
|
||||
const TabSearchRepositoryFamily();
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
TabSearchRepositoryProvider call(
|
||||
TabSearchPartition partition,
|
||||
) {
|
||||
return TabSearchRepositoryProvider(
|
||||
partition,
|
||||
);
|
||||
TabSearchRepositoryProvider call(TabSearchPartition partition) {
|
||||
return TabSearchRepositoryProvider(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
TabSearchRepositoryProvider getProviderOverride(
|
||||
covariant TabSearchRepositoryProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.partition,
|
||||
);
|
||||
return call(provider.partition);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -83,24 +75,27 @@ class TabSearchRepositoryFamily
|
||||
}
|
||||
|
||||
/// See also [TabSearchRepository].
|
||||
class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
TabSearchRepository, List<TabQueryResult>?> {
|
||||
class TabSearchRepositoryProvider
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderImpl<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
> {
|
||||
/// See also [TabSearchRepository].
|
||||
TabSearchRepositoryProvider(
|
||||
TabSearchPartition partition,
|
||||
) : this._internal(
|
||||
() => TabSearchRepository()..partition = partition,
|
||||
from: tabSearchRepositoryProvider,
|
||||
name: r'tabSearchRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSearchRepositoryHash,
|
||||
dependencies: TabSearchRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
TabSearchRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
TabSearchRepositoryProvider(TabSearchPartition partition)
|
||||
: this._internal(
|
||||
() => TabSearchRepository()..partition = partition,
|
||||
from: tabSearchRepositoryProvider,
|
||||
name: r'tabSearchRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$tabSearchRepositoryHash,
|
||||
dependencies: TabSearchRepositoryFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
TabSearchRepositoryFamily._allTransitiveDependencies,
|
||||
partition: partition,
|
||||
);
|
||||
|
||||
TabSearchRepositoryProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -118,9 +113,7 @@ class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
FutureOr<List<TabQueryResult>?> runNotifierBuild(
|
||||
covariant TabSearchRepository notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
partition,
|
||||
);
|
||||
return notifier.build(partition);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -140,8 +133,11 @@ class TabSearchRepositoryProvider extends AutoDisposeAsyncNotifierProviderImpl<
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeAsyncNotifierProviderElement<TabSearchRepository,
|
||||
List<TabQueryResult>?> createElement() {
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
>
|
||||
createElement() {
|
||||
return _TabSearchRepositoryProviderElement(this);
|
||||
}
|
||||
|
||||
@@ -168,13 +164,18 @@ mixin TabSearchRepositoryRef
|
||||
}
|
||||
|
||||
class _TabSearchRepositoryProviderElement
|
||||
extends AutoDisposeAsyncNotifierProviderElement<TabSearchRepository,
|
||||
List<TabQueryResult>?> with TabSearchRepositoryRef {
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderElement<
|
||||
TabSearchRepository,
|
||||
List<TabQueryResult>?
|
||||
>
|
||||
with TabSearchRepositoryRef {
|
||||
_TabSearchRepositoryProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
TabSearchPartition get partition =>
|
||||
(origin as TabSearchRepositoryProvider).partition;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -25,11 +25,12 @@ class ChatBackend extends _$ChatBackend {
|
||||
return _embeddingsUpdate!;
|
||||
}
|
||||
|
||||
_embeddingsUpdate =
|
||||
ref.read(documentRepositoryProvider.notifier).updateEmbeddings(
|
||||
mainDocumentId: _metadata?.mainDocumentId,
|
||||
contextId: _metadata?.contextId,
|
||||
);
|
||||
_embeddingsUpdate = ref
|
||||
.read(documentRepositoryProvider.notifier)
|
||||
.updateEmbeddings(
|
||||
mainDocumentId: _metadata?.mainDocumentId,
|
||||
contextId: _metadata?.contextId,
|
||||
);
|
||||
|
||||
_embeddingsUpdate!.whenComplete(() => _embeddingsUpdate = null);
|
||||
|
||||
@@ -47,16 +48,10 @@ class ChatBackend extends _$ChatBackend {
|
||||
await prepareEmbeddings();
|
||||
|
||||
return humanMessageResult.flatMapAsync((humanMessage) async {
|
||||
await _chatRepository.setTyping(
|
||||
author: MessageAuthor.ai,
|
||||
typing: true,
|
||||
);
|
||||
await _chatRepository.setTyping(author: MessageAuthor.ai, typing: true);
|
||||
|
||||
final result = await _qaMemoryChain.processQuestion(humanMessage.text);
|
||||
await _chatRepository.setTyping(
|
||||
author: MessageAuthor.ai,
|
||||
typing: false,
|
||||
);
|
||||
await _chatRepository.setTyping(author: MessageAuthor.ai, typing: false);
|
||||
|
||||
await _chatRepository.insertTextMessage(
|
||||
author: MessageAuthor.ai,
|
||||
|
||||
@@ -32,9 +32,7 @@ class _SystemHash {
|
||||
abstract class _$ChatBackend extends BuildlessAutoDisposeNotifier<void> {
|
||||
late final String chatId;
|
||||
|
||||
void build(
|
||||
String chatId,
|
||||
);
|
||||
void build(String chatId);
|
||||
}
|
||||
|
||||
/// See also [ChatBackend].
|
||||
@@ -47,21 +45,15 @@ class ChatBackendFamily extends Family<void> {
|
||||
const ChatBackendFamily();
|
||||
|
||||
/// See also [ChatBackend].
|
||||
ChatBackendProvider call(
|
||||
String chatId,
|
||||
) {
|
||||
return ChatBackendProvider(
|
||||
chatId,
|
||||
);
|
||||
ChatBackendProvider call(String chatId) {
|
||||
return ChatBackendProvider(chatId);
|
||||
}
|
||||
|
||||
@override
|
||||
ChatBackendProvider getProviderOverride(
|
||||
covariant ChatBackendProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.chatId,
|
||||
);
|
||||
return call(provider.chatId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
@@ -83,21 +75,19 @@ class ChatBackendFamily extends Family<void> {
|
||||
class ChatBackendProvider
|
||||
extends AutoDisposeNotifierProviderImpl<ChatBackend, void> {
|
||||
/// See also [ChatBackend].
|
||||
ChatBackendProvider(
|
||||
String chatId,
|
||||
) : this._internal(
|
||||
() => ChatBackend()..chatId = chatId,
|
||||
from: chatBackendProvider,
|
||||
name: r'chatBackendProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$chatBackendHash,
|
||||
dependencies: ChatBackendFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ChatBackendFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
);
|
||||
ChatBackendProvider(String chatId)
|
||||
: this._internal(
|
||||
() => ChatBackend()..chatId = chatId,
|
||||
from: chatBackendProvider,
|
||||
name: r'chatBackendProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$chatBackendHash,
|
||||
dependencies: ChatBackendFamily._dependencies,
|
||||
allTransitiveDependencies: ChatBackendFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
);
|
||||
|
||||
ChatBackendProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -112,12 +102,8 @@ class ChatBackendProvider
|
||||
final String chatId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant ChatBackend notifier,
|
||||
) {
|
||||
return notifier.build(
|
||||
chatId,
|
||||
);
|
||||
void runNotifierBuild(covariant ChatBackend notifier) {
|
||||
return notifier.build(chatId);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -170,5 +156,6 @@ class _ChatBackendProviderElement
|
||||
@override
|
||||
String get chatId => (origin as ChatBackendProvider).chatId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+22
-20
@@ -14,40 +14,42 @@ class ChatTextMessage extends StatelessWidget {
|
||||
super.key,
|
||||
required this.message,
|
||||
required this.index,
|
||||
this.padding = const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
this.borderRadius = const BorderRadius.all(Radius.circular(12)),
|
||||
this.onlyEmojiFontSize = 48,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final textMessageTheme =
|
||||
context.select((ChatTheme theme) => theme.textMessageTheme);
|
||||
final textMessageTheme = context.select(
|
||||
(ChatTheme theme) => theme.textMessageTheme,
|
||||
);
|
||||
final isSentByMe = context.watch<String>() == message.authorId;
|
||||
final paragraphStyle = isSentByMe
|
||||
? textMessageTheme.sentTextStyle
|
||||
: textMessageTheme.receivedTextStyle;
|
||||
final paragraphStyle =
|
||||
isSentByMe
|
||||
? textMessageTheme.sentTextStyle
|
||||
: textMessageTheme.receivedTextStyle;
|
||||
|
||||
return Container(
|
||||
padding: padding,
|
||||
decoration: message.isOnlyEmoji == true
|
||||
? null
|
||||
: BoxDecoration(
|
||||
color: isSentByMe
|
||||
? textMessageTheme.sentBackgroundColor
|
||||
: textMessageTheme.receivedBackgroundColor,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
decoration:
|
||||
message.isOnlyEmoji == true
|
||||
? null
|
||||
: BoxDecoration(
|
||||
color:
|
||||
isSentByMe
|
||||
? textMessageTheme.sentBackgroundColor
|
||||
: textMessageTheme.receivedBackgroundColor,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
child: MarkdownBody(
|
||||
data: message.text,
|
||||
selectable: true,
|
||||
styleSheet: MarkdownStyleSheet(
|
||||
p: message.isOnlyEmoji == true
|
||||
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
|
||||
: paragraphStyle,
|
||||
p:
|
||||
message.isOnlyEmoji == true
|
||||
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
|
||||
: paragraphStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+16
-13
@@ -75,9 +75,10 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bottomSafeArea = widget.handleSafeArea == true
|
||||
? MediaQuery.of(context).padding.bottom
|
||||
: 0.0;
|
||||
final bottomSafeArea =
|
||||
widget.handleSafeArea == true
|
||||
? MediaQuery.of(context).padding.bottom
|
||||
: 0.0;
|
||||
final inputTheme = context.select((ChatTheme theme) => theme.inputTheme);
|
||||
final onAttachmentTap = context.read<OnAttachmentTapCallback?>();
|
||||
|
||||
@@ -100,11 +101,13 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
children: [
|
||||
if (widget.topWidget != null) widget.topWidget!,
|
||||
Padding(
|
||||
padding: widget.handleSafeArea == true
|
||||
? (widget.padding
|
||||
?.add(EdgeInsets.only(bottom: bottomSafeArea)) ??
|
||||
EdgeInsets.only(bottom: bottomSafeArea))
|
||||
: (widget.padding ?? EdgeInsets.zero),
|
||||
padding:
|
||||
widget.handleSafeArea == true
|
||||
? (widget.padding?.add(
|
||||
EdgeInsets.only(bottom: bottomSafeArea),
|
||||
) ??
|
||||
EdgeInsets.only(bottom: bottomSafeArea))
|
||||
: (widget.padding ?? EdgeInsets.zero),
|
||||
child: Row(
|
||||
children: [
|
||||
if (widget.attachmentIcon != null)
|
||||
@@ -142,8 +145,8 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
IconButton(
|
||||
icon: widget.sendIcon!,
|
||||
color: inputTheme.hintStyle?.color,
|
||||
onPressed: () =>
|
||||
_handleSubmitted(_textController.text),
|
||||
onPressed:
|
||||
() => _handleSubmitted(_textController.text),
|
||||
)
|
||||
else
|
||||
const SizedBox.shrink(),
|
||||
@@ -168,9 +171,9 @@ class _QaChatInputState extends State<QaChatInput> {
|
||||
final bottomSafeArea = MediaQuery.of(context).padding.bottom;
|
||||
|
||||
context.read<ChatInputHeightNotifier>().updateHeight(
|
||||
// only set real height of the input, ignoring safe area
|
||||
widget.handleSafeArea == true ? height - bottomSafeArea : height,
|
||||
);
|
||||
// only set real height of the input, ignoring safe area
|
||||
widget.handleSafeArea == true ? height - bottomSafeArea : height,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-21
@@ -40,22 +40,19 @@ class TabQaChat extends HookConsumerWidget {
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
builders: Builders(
|
||||
textMessageBuilder: (context, message, index) =>
|
||||
ChatTextMessage(message: message, index: index),
|
||||
customMessageBuilder: (context, message, index) => Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF0F0F0),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: const IsTypingIndicator(),
|
||||
),
|
||||
inputBuilder: (context) => const QaChatInput(
|
||||
attachmentIcon: null,
|
||||
),
|
||||
textMessageBuilder:
|
||||
(context, message, index) =>
|
||||
ChatTextMessage(message: message, index: index),
|
||||
customMessageBuilder:
|
||||
(context, message, index) => Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFF0F0F0),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child: const IsTypingIndicator(),
|
||||
),
|
||||
inputBuilder: (context) => const QaChatInput(attachmentIcon: null),
|
||||
),
|
||||
chatController: chatController,
|
||||
// crossCache: crossCache,
|
||||
@@ -64,11 +61,12 @@ class TabQaChat extends HookConsumerWidget {
|
||||
await chatBackend.processQAMessage(text);
|
||||
},
|
||||
currentUserId: MessageAuthor.human.user.id,
|
||||
resolveUser: (id) => Future.value(
|
||||
MessageAuthor.values
|
||||
.firstWhereOrNull((user) => user.user.id == id)
|
||||
?.user,
|
||||
),
|
||||
resolveUser:
|
||||
(id) => Future.value(
|
||||
MessageAuthor.values
|
||||
.firstWhereOrNull((user) => user.user.id == id)
|
||||
?.user,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+25
-24
@@ -98,23 +98,24 @@ class QAMemoryChainProvider
|
||||
String? mainDocumentId,
|
||||
String? contextId,
|
||||
}) : this._internal(
|
||||
() => QAMemoryChain()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: qAMemoryChainProvider,
|
||||
name: r'qAMemoryChainProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$qAMemoryChainHash,
|
||||
dependencies: QAMemoryChainFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
QAMemoryChainFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
);
|
||||
() =>
|
||||
QAMemoryChain()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: qAMemoryChainProvider,
|
||||
name: r'qAMemoryChainProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$qAMemoryChainHash,
|
||||
dependencies: QAMemoryChainFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
QAMemoryChainFamily._allTransitiveDependencies,
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
);
|
||||
|
||||
QAMemoryChainProvider._internal(
|
||||
super._createNotifier, {
|
||||
@@ -133,9 +134,7 @@ class QAMemoryChainProvider
|
||||
final String? contextId;
|
||||
|
||||
@override
|
||||
void runNotifierBuild(
|
||||
covariant QAMemoryChain notifier,
|
||||
) {
|
||||
void runNotifierBuild(covariant QAMemoryChain notifier) {
|
||||
return notifier.build(
|
||||
chatId: chatId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
@@ -148,10 +147,11 @@ class QAMemoryChainProvider
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: QAMemoryChainProvider._internal(
|
||||
() => create()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
() =>
|
||||
create()
|
||||
..chatId = chatId
|
||||
..mainDocumentId = mainDocumentId
|
||||
..contextId = contextId,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
@@ -214,5 +214,6 @@ class _QAMemoryChainProviderElement
|
||||
@override
|
||||
String? get contextId => (origin as QAMemoryChainProvider).contextId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
+21
-20
@@ -19,8 +19,9 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
}
|
||||
|
||||
Future<int> deleteDocumentsByMainDocumentId(String mainDocumentId) {
|
||||
return db.document
|
||||
.deleteWhere((doc) => doc.mainDocumentId.equals(mainDocumentId));
|
||||
return db.document.deleteWhere(
|
||||
(doc) => doc.mainDocumentId.equals(mainDocumentId),
|
||||
);
|
||||
}
|
||||
|
||||
SingleOrNullSelectable<DocumentData> getDocumentById(String documentId) {
|
||||
@@ -70,9 +71,10 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
mainDocumentId: Value.absentIfNull(mainDocumentId),
|
||||
contextId: Value.absentIfNull(contextId),
|
||||
content: document.pageContent,
|
||||
metadata: (document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
metadata:
|
||||
(document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
contentHash: contentHash,
|
||||
);
|
||||
}),
|
||||
@@ -82,19 +84,17 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
|
||||
Future<void> insertEmbeddings(List<(DocumentData, List<double>)> documents) {
|
||||
return db.documentVec.insertAll(
|
||||
documents.map(
|
||||
(doc) {
|
||||
final (document, vector) = doc;
|
||||
documents.map((doc) {
|
||||
final (document, vector) = doc;
|
||||
|
||||
return DocumentVecCompanion.insert(
|
||||
id: document.documentId,
|
||||
embedding: serializeVector(vector),
|
||||
mainDocumentId: Value.absentIfNull(document.mainDocumentId),
|
||||
contextId: Value.absentIfNull(document.contextId),
|
||||
contentHash: document.contentHash,
|
||||
);
|
||||
},
|
||||
),
|
||||
return DocumentVecCompanion.insert(
|
||||
id: document.documentId,
|
||||
embedding: serializeVector(vector),
|
||||
mainDocumentId: Value.absentIfNull(document.mainDocumentId),
|
||||
contextId: Value.absentIfNull(document.contextId),
|
||||
contentHash: document.contentHash,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,9 +121,10 @@ class VectorDao extends DatabaseAccessor<TabDatabase> with _$VectorDaoMixin {
|
||||
mainDocumentId: Value.absentIfNull(mainDocumentId),
|
||||
contextId: Value.absentIfNull(contextId),
|
||||
content: document.pageContent,
|
||||
metadata: (document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
metadata:
|
||||
(document.metadata.isNotEmpty)
|
||||
? Value(jsonEncode(document.metadata))
|
||||
: const Value.absent(),
|
||||
contentHash: contentHash,
|
||||
),
|
||||
);
|
||||
|
||||
+6
-9
@@ -17,16 +17,13 @@ class VectorResult {
|
||||
required this.content,
|
||||
required String? metadata,
|
||||
required double? distance,
|
||||
}) : metadata = (metadata != null)
|
||||
? jsonDecode(metadata) as Map<String, dynamic>
|
||||
: const {},
|
||||
distance = distance!;
|
||||
}) : metadata =
|
||||
(metadata != null)
|
||||
? jsonDecode(metadata) as Map<String, dynamic>
|
||||
: const {},
|
||||
distance = distance!;
|
||||
|
||||
Document toDocument() {
|
||||
return Document(
|
||||
id: id,
|
||||
pageContent: content,
|
||||
metadata: metadata,
|
||||
);
|
||||
return Document(id: id, pageContent: content, metadata: metadata);
|
||||
}
|
||||
}
|
||||
+26
-28
@@ -45,16 +45,14 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
final splittedWithSource = splitted.mapNotNull(
|
||||
(splitted) => (
|
||||
mainDocumentId: splitted.mainDocumentId,
|
||||
parts: splitted.parts
|
||||
.map(
|
||||
(part) => part.copyWith(
|
||||
metadata: {
|
||||
...part.metadata,
|
||||
'source': part.id,
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList()
|
||||
parts:
|
||||
splitted.parts
|
||||
.map(
|
||||
(part) => part.copyWith(
|
||||
metadata: {...part.metadata, 'source': part.id},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -66,17 +64,15 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Result> updateEmbeddings({
|
||||
String? mainDocumentId,
|
||||
String? contextId,
|
||||
}) {
|
||||
Future<Result> updateEmbeddings({String? mainDocumentId, String? contextId}) {
|
||||
return Result.fromAsync(() async {
|
||||
final missing = await _vectorDao
|
||||
.getDocumentsWithMissingEmbeddings(
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
)
|
||||
.get();
|
||||
final missing =
|
||||
await _vectorDao
|
||||
.getDocumentsWithMissingEmbeddings(
|
||||
mainDocumentId: mainDocumentId,
|
||||
contextId: contextId,
|
||||
)
|
||||
.get();
|
||||
|
||||
final documentEmbeddings = await _embeddings.embedDocuments(
|
||||
missing
|
||||
@@ -97,16 +93,18 @@ class DocumentRepository extends _$DocumentRepository {
|
||||
|
||||
final tabContentService = ref.watch(tabContentServiceProvider);
|
||||
|
||||
final tabContentSub =
|
||||
tabContentService.tabContentStream.listen((content) async {
|
||||
final bestContent = content.isProbablyReaderable
|
||||
? content.extractedContentMarkdown
|
||||
: content.fullContentMarkdown;
|
||||
final tabContentSub = tabContentService.tabContentStream.listen((
|
||||
content,
|
||||
) async {
|
||||
final bestContent =
|
||||
content.isProbablyReaderable
|
||||
? content.extractedContentMarkdown
|
||||
: content.fullContentMarkdown;
|
||||
|
||||
if (bestContent != null) {
|
||||
await _insertMarkdownDocumentsSplitted(
|
||||
[Document(id: content.tabId, pageContent: bestContent)],
|
||||
);
|
||||
await _insertMarkdownDocumentsSplitted([
|
||||
Document(id: content.tabId, pageContent: bestContent),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+9
-8
@@ -13,14 +13,15 @@ String _$documentRepositoryHash() =>
|
||||
@ProviderFor(DocumentRepository)
|
||||
final documentRepositoryProvider =
|
||||
AutoDisposeNotifierProvider<DocumentRepository, void>.internal(
|
||||
DocumentRepository.new,
|
||||
name: r'documentRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$documentRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
DocumentRepository.new,
|
||||
name: r'documentRepositoryProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$documentRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$DocumentRepository = AutoDisposeNotifier<void>;
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
+9
-8
@@ -38,14 +38,15 @@ class SqliteVectorStore extends VectorStore {
|
||||
required List<double> embedding,
|
||||
VectorStoreSimilaritySearch config = const VectorStoreSimilaritySearch(),
|
||||
}) async {
|
||||
Iterable<VectorResult> results = await _dao
|
||||
.vectorSearch(
|
||||
config: config,
|
||||
searchVectors: embedding,
|
||||
contextId: contextId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
)
|
||||
.get();
|
||||
Iterable<VectorResult> results =
|
||||
await _dao
|
||||
.vectorSearch(
|
||||
config: config,
|
||||
searchVectors: embedding,
|
||||
contextId: contextId,
|
||||
mainDocumentId: mainDocumentId,
|
||||
)
|
||||
.get();
|
||||
|
||||
if (config.scoreThreshold != null) {
|
||||
results = results.where(
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class DocumentUuid {
|
||||
final Uint8List _baseBytes;
|
||||
|
||||
DocumentUuid([Uint8List? baseBytes])
|
||||
: _baseBytes = baseBytes ?? _rng.generate();
|
||||
: _baseBytes = baseBytes ?? _rng.generate();
|
||||
|
||||
factory DocumentUuid.fromUuid(String uuid) {
|
||||
return DocumentUuid(UuidParsing.parseAsByteList(uuid));
|
||||
|
||||
+19
-16
@@ -39,7 +39,7 @@ List<String> _headerValueList(dynamic value) {
|
||||
return switch (value) {
|
||||
String _ => [value],
|
||||
List<String> _ => value,
|
||||
_ => throw Exception('Unsupported type')
|
||||
_ => throw Exception('Unsupported type'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,8 +59,9 @@ DocumentParts? splitMarkdownDocument(
|
||||
chunkOverlap: chunkOverlap,
|
||||
);
|
||||
|
||||
final headerChunks =
|
||||
markdownHeaderSplitter.splitText(originalDoc.pageContent);
|
||||
final headerChunks = markdownHeaderSplitter.splitText(
|
||||
originalDoc.pageContent,
|
||||
);
|
||||
final docChunks = markdownTextSplitter.splitDocuments(headerChunks);
|
||||
|
||||
if (docChunks.length == 1) {
|
||||
@@ -85,10 +86,11 @@ DocumentParts? splitMarkdownDocument(
|
||||
...a.metadata,
|
||||
...b.metadata,
|
||||
for (final header in intersectingHeaders)
|
||||
header: {
|
||||
..._headerValueList(a.metadata[header]),
|
||||
..._headerValueList(b.metadata[header]),
|
||||
}.toList(),
|
||||
header:
|
||||
{
|
||||
..._headerValueList(a.metadata[header]),
|
||||
..._headerValueList(b.metadata[header]),
|
||||
}.toList(),
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -99,14 +101,15 @@ DocumentParts? splitMarkdownDocument(
|
||||
|
||||
return (
|
||||
mainDocumentId: mainDocumentId,
|
||||
parts: mergedDocChunks
|
||||
.mapIndexed(
|
||||
(i, doc) => Document(
|
||||
id: documentIdFactory.getDocumentPartUuid(i),
|
||||
pageContent: doc.pageContent,
|
||||
metadata: mergeMaps(originalDoc.metadata, doc.metadata),
|
||||
),
|
||||
)
|
||||
.toList()
|
||||
parts:
|
||||
mergedDocChunks
|
||||
.mapIndexed(
|
||||
(i, doc) => Document(
|
||||
id: documentIdFactory.getDocumentPartUuid(i),
|
||||
pageContent: doc.pageContent,
|
||||
metadata: mergeMaps(originalDoc.metadata, doc.metadata),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
@@ -13,25 +13,11 @@ import 'package:lensai/presentation/icons/tor_icons.dart';
|
||||
enum _DialogMode { create, edit }
|
||||
|
||||
const _timeoutOptions = <DropdownMenuItem<Duration?>>[
|
||||
DropdownMenuItem(
|
||||
child: Text('Immediately'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 1),
|
||||
child: Text('1 minute'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 5),
|
||||
child: Text('5 minutes'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(minutes: 15),
|
||||
child: Text('15 minutes'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: Duration(hours: 1),
|
||||
child: Text('1 hour'),
|
||||
),
|
||||
DropdownMenuItem(child: Text('Immediately')),
|
||||
DropdownMenuItem(value: Duration(minutes: 1), child: Text('1 minute')),
|
||||
DropdownMenuItem(value: Duration(minutes: 5), child: Text('5 minutes')),
|
||||
DropdownMenuItem(value: Duration(minutes: 15), child: Text('15 minutes')),
|
||||
DropdownMenuItem(value: Duration(hours: 1), child: Text('1 hour')),
|
||||
];
|
||||
|
||||
class ContainerEditScreen extends HookConsumerWidget {
|
||||
@@ -63,22 +49,22 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selectedColor = useState(initialContainer.color);
|
||||
final contextualIdentity =
|
||||
useState(initialContainer.metadata.contextualIdentity);
|
||||
final contextualIdentity = useState(
|
||||
initialContainer.metadata.contextualIdentity,
|
||||
);
|
||||
final authSettings = useState(initialContainer.metadata.authSettings);
|
||||
final useProxy = useState(initialContainer.metadata.useProxy);
|
||||
|
||||
final textController =
|
||||
useTextEditingController(text: initialContainer.name);
|
||||
final textController = useTextEditingController(
|
||||
text: initialContainer.name,
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
switch (_mode) {
|
||||
_DialogMode.create => 'New Container',
|
||||
_DialogMode.edit => 'Edit Container',
|
||||
},
|
||||
),
|
||||
title: Text(switch (_mode) {
|
||||
_DialogMode.create => 'New Container',
|
||||
_DialogMode.edit => 'Edit Container',
|
||||
}),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
@@ -95,7 +81,9 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
|
||||
//Check for permissions, when auth is set or getting set
|
||||
if (initialContainer
|
||||
.metadata.authSettings.authenticationRequired ||
|
||||
.metadata
|
||||
.authSettings
|
||||
.authenticationRequired ||
|
||||
container.metadata.authSettings.authenticationRequired) {
|
||||
final authResult = await ref
|
||||
.read(localAuthenticationServiceProvider.notifier)
|
||||
@@ -161,8 +149,9 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
onPressed: () async {
|
||||
final color = await showDialog<Color?>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
ColorPickerDialog(selectedColor.value),
|
||||
builder:
|
||||
(context) =>
|
||||
ColorPickerDialog(selectedColor.value),
|
||||
);
|
||||
|
||||
if (color != null) {
|
||||
@@ -175,19 +164,22 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
title: const Text('Cookie Isolation'),
|
||||
secondary: const Icon(MdiIcons.cookieLock),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onChanged: (_mode == _DialogMode.create)
|
||||
? (value) {
|
||||
contextualIdentity.value = value
|
||||
? initialContainer
|
||||
.metadata.contextualIdentity ??
|
||||
uuid.v4()
|
||||
: null;
|
||||
onChanged:
|
||||
(_mode == _DialogMode.create)
|
||||
? (value) {
|
||||
contextualIdentity.value =
|
||||
value
|
||||
? initialContainer
|
||||
.metadata
|
||||
.contextualIdentity ??
|
||||
uuid.v4()
|
||||
: null;
|
||||
|
||||
if (!value && useProxy.value) {
|
||||
useProxy.value = false;
|
||||
if (!value && useProxy.value) {
|
||||
useProxy.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
: null,
|
||||
: null,
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
value: useProxy.value,
|
||||
@@ -196,19 +188,20 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onChanged: switch (_mode) {
|
||||
_DialogMode.create => (value) {
|
||||
if (value && contextualIdentity.value == null) {
|
||||
contextualIdentity.value = initialContainer
|
||||
.metadata.contextualIdentity ??
|
||||
uuid.v4();
|
||||
}
|
||||
if (value && contextualIdentity.value == null) {
|
||||
contextualIdentity.value =
|
||||
initialContainer.metadata.contextualIdentity ??
|
||||
uuid.v4();
|
||||
}
|
||||
|
||||
useProxy.value = value;
|
||||
},
|
||||
_DialogMode.edit => (contextualIdentity.value != null)
|
||||
? (value) {
|
||||
useProxy.value = value;
|
||||
},
|
||||
_DialogMode.edit =>
|
||||
(contextualIdentity.value != null)
|
||||
? (value) {
|
||||
useProxy.value = value;
|
||||
}
|
||||
: null,
|
||||
: null,
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
@@ -224,9 +217,7 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
if (authSettings.value.authenticationRequired)
|
||||
CheckboxListTile.adaptive(
|
||||
value: authSettings.value.lockOnAppBackground,
|
||||
title: const Text(
|
||||
'Auto-lock on background',
|
||||
),
|
||||
title: const Text('Auto-lock on background'),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
onChanged: (value) {
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
@@ -236,23 +227,21 @@ class ContainerEditScreen extends HookConsumerWidget {
|
||||
if (authSettings.value.authenticationRequired)
|
||||
CheckboxListTile.adaptive(
|
||||
value: authSettings.value.lockTimeout != null,
|
||||
title: const Text(
|
||||
'Timeout',
|
||||
),
|
||||
title: const Text('Timeout'),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
onChanged: (value) {
|
||||
final newValue =
|
||||
value! ? _timeoutOptions[1].value : null;
|
||||
|
||||
authSettings.value =
|
||||
authSettings.value.copyWith.lockTimeout(newValue);
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
.lockTimeout(newValue);
|
||||
},
|
||||
secondary: DropdownButton(
|
||||
value: authSettings.value.lockTimeout,
|
||||
items: _timeoutOptions,
|
||||
onChanged: (value) {
|
||||
authSettings.value =
|
||||
authSettings.value.copyWith.lockTimeout(value);
|
||||
authSettings.value = authSettings.value.copyWith
|
||||
.lockTimeout(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user