refactor container tab repo
This commit is contained in:
@@ -15,6 +15,7 @@ import 'package:weblibre/features/geckoview/domain/entities/states/tab.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/providers.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/providers/selected_tab.dart';
|
||||
import 'package:weblibre/features/geckoview/features/find_in_page/domain/repositories/find_in_page.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/domain/providers.dart';
|
||||
import 'package:weblibre/features/geckoview/utils/image_helper.dart';
|
||||
|
||||
part 'tab_state.g.dart';
|
||||
@@ -216,3 +217,13 @@ TabType? selectedTabType(Ref ref) {
|
||||
(isCurrentPrivate) => isCurrentPrivate ? TabType.private : TabType.regular,
|
||||
);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AsyncValue<String?> selectedTabContainerId(Ref ref) {
|
||||
final tabId = ref.watch(selectedTabProvider);
|
||||
if (tabId != null) {
|
||||
return ref.watch(watchContainerTabIdProvider(tabId));
|
||||
}
|
||||
|
||||
return const AsyncData(null);
|
||||
}
|
||||
|
||||
@@ -175,6 +175,24 @@ final selectedTabTypeProvider = AutoDisposeProvider<TabType?>.internal(
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef SelectedTabTypeRef = AutoDisposeProviderRef<TabType?>;
|
||||
String _$selectedTabContainerIdHash() =>
|
||||
r'9f0246a02a069b1a66211a3924f32e9d75f0f344';
|
||||
|
||||
/// See also [selectedTabContainerId].
|
||||
@ProviderFor(selectedTabContainerId)
|
||||
final selectedTabContainerIdProvider = Provider<AsyncValue<String?>>.internal(
|
||||
selectedTabContainerId,
|
||||
name: r'selectedTabContainerIdProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$selectedTabContainerIdHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef SelectedTabContainerIdRef = ProviderRef<AsyncValue<String?>>;
|
||||
String _$tabStatesHash() => r'e4d2f2b4ddd65beac8a1fd0d22bad1e0a26b41bd';
|
||||
|
||||
/// See also [TabStates].
|
||||
|
||||
@@ -114,7 +114,7 @@ class TabRepository extends _$TabRepository {
|
||||
Future<bool> selectTab(String tabId) async {
|
||||
final containerId = await ref
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
.containerTabId(tabId);
|
||||
.getContainerTabId(tabId);
|
||||
|
||||
final containerData = await containerId.mapNotNull(
|
||||
(containerId) => ref
|
||||
@@ -156,7 +156,7 @@ class TabRepository extends _$TabRepository {
|
||||
|
||||
final currentContainerId = await ref
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
.containerTabId(tabId);
|
||||
.getContainerTabId(tabId);
|
||||
|
||||
final sameContainerTabs = await ref
|
||||
.read(containerRepositoryProvider.notifier)
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'tab.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$tabRepositoryHash() => r'94e67307d67c8873b2ebd8cfadcd71258782987a';
|
||||
String _$tabRepositoryHash() => r'4b0dc3bbfd3635398009d655d811a4a35dbfb503';
|
||||
|
||||
/// See also [TabRepository].
|
||||
@ProviderFor(TabRepository)
|
||||
|
||||
Reference in New Issue
Block a user