double tap previous tab
This commit is contained in:
@@ -27,6 +27,8 @@ part 'tab.g.dart';
|
||||
class TabRepository extends _$TabRepository {
|
||||
final _tabsService = GeckoTabService();
|
||||
|
||||
String? _previousTabId;
|
||||
|
||||
Future<String> addTab({
|
||||
Uri? url,
|
||||
bool selectTab = true,
|
||||
@@ -83,6 +85,14 @@ class TabRepository extends _$TabRepository {
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> selectPreviousTab() async {
|
||||
if (_previousTabId != null) {
|
||||
return selectTab(_previousTabId!);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> selectTab(String tabId) async {
|
||||
final containerId = await ref
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
@@ -227,6 +237,7 @@ class TabRepository extends _$TabRepository {
|
||||
|
||||
ref.listen(selectedTabProvider, (previous, tabId) async {
|
||||
if (tabId != null) {
|
||||
_previousTabId = previous;
|
||||
await db.tabDao.touchTab(tabId, timestamp: DateTime.now());
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user