isolated tab type default handling

This commit is contained in:
Fabian Freund
2026-05-02 06:20:11 +02:00
parent e4853281f1
commit 94b9b9cceb
7 changed files with 66 additions and 26 deletions
@@ -88,9 +88,7 @@ TabViewReorderResult? buildTabViewReorderResult({
? withoutMovingItem[insertIndex].tabId ? withoutMovingItem[insertIndex].tabId
: null; : null;
if (targetBeforeId != null && moveBlockIds.contains(targetBeforeId)) { if (targetBeforeId != null && moveBlockIds.contains(targetBeforeId)) {
logger.t( logger.t('reorder refused: drop target is inside the moving subtree');
'reorder refused: drop target is inside the moving subtree',
);
return null; return null;
} }
@@ -392,30 +392,37 @@ class _BrowserViewState extends ConsumerState<BrowserView>
next.whenData((sharedContent) async { next.whenData((sharedContent) async {
final settings = ref.read(generalSettingsWithDefaultsProvider); final settings = ref.read(generalSettingsWithDefaultsProvider);
switch (settings.tabIntentOpenSetting) { switch (settings.effectiveTabIntentOpenSetting) {
case TabIntentOpenSetting.regular: case TabIntentOpenSetting.regular:
case TabIntentOpenSetting.private: case TabIntentOpenSetting.private:
case TabIntentOpenSetting.isolated:
await ref await ref
.read(engineReadyStateProvider.notifier) .read(engineReadyStateProvider.notifier)
.waitUntilReady(); .waitUntilReady();
final tabMode = switch (settings.effectiveTabIntentOpenSetting) {
TabIntentOpenSetting.private => TabMode.private,
TabIntentOpenSetting.isolated => TabMode.newIsolated(),
_ => TabMode.regular,
};
switch (sharedContent) { switch (sharedContent) {
case SharedUrl(): case SharedUrl():
final containerSelection = await _resolveContainerSelection( final containerSelection =
ref, settings.effectiveTabIntentOpenSetting ==
sharedContent.contextId, TabIntentOpenSetting.isolated
sharedContent.containerMode, ? const TabContainerSelection.unassigned()
); : await _resolveContainerSelection(
ref,
sharedContent.contextId,
sharedContent.containerMode,
);
await ref await ref
.read(tabRepositoryProvider.notifier) .read(tabRepositoryProvider.notifier)
.addTab( .addTab(
url: sharedContent.url, url: sharedContent.url,
tabMode: tabMode: tabMode,
settings.tabIntentOpenSetting ==
TabIntentOpenSetting.private
? TabMode.private
: TabMode.regular,
launchedFromIntent: true, launchedFromIntent: true,
selectTab: true, selectTab: true,
containerSelection: containerSelection, containerSelection: containerSelection,
@@ -429,11 +436,7 @@ class _BrowserViewState extends ConsumerState<BrowserView>
.read(tabRepositoryProvider.notifier) .read(tabRepositoryProvider.notifier)
.addTab( .addTab(
url: bang?.getTemplateUrl(sharedContent.text), url: bang?.getTemplateUrl(sharedContent.text),
tabMode: tabMode: tabMode,
settings.tabIntentOpenSetting ==
TabIntentOpenSetting.private
? TabMode.private
: TabMode.regular,
launchedFromIntent: true, launchedFromIntent: true,
selectTab: true, selectTab: true,
); );
@@ -198,7 +198,7 @@ class _SmallWebTabDefaultSection extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final appColors = AppColors.of(context); final appColors = AppColors.of(context);
final settings = ref.watch(generalSettingsWithDefaultsProvider); final settings = ref.watch(generalSettingsWithDefaultsProvider);
final smallWebTabType = settings.smallWebTabType; final smallWebTabType = settings.effectiveSmallWebTabType;
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8), padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
@@ -276,9 +276,8 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final appColors = AppColors.of(context); final appColors = AppColors.of(context);
final tabIntentOpenSetting = ref.watch( final settings = ref.watch(generalSettingsWithDefaultsProvider);
generalSettingsWithDefaultsProvider.select((s) => s.tabIntentOpenSetting), final tabIntentOpenSetting = settings.tabIntentOpenSetting;
);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8), padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
@@ -316,6 +315,18 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
: appColors.privateTabPurple, : appColors.privateTabPurple,
), ),
), ),
if (settings.showIsolatedTabUi)
ButtonSegment(
value: TabIntentOpenSetting.isolated,
label: const Text('Isolated'),
icon: Icon(
MdiIcons.snowflake,
color:
tabIntentOpenSetting == TabIntentOpenSetting.isolated
? null
: appColors.isolatedTabTeal,
),
),
], ],
selected: {tabIntentOpenSetting}, selected: {tabIntentOpenSetting},
onSelectionChanged: (value) async { onSelectionChanged: (value) async {
@@ -331,6 +342,9 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
TabIntentOpenSetting.private => SegmentedButton.styleFrom( TabIntentOpenSetting.private => SegmentedButton.styleFrom(
selectedBackgroundColor: appColors.privateSelectionOverlay, selectedBackgroundColor: appColors.privateSelectionOverlay,
), ),
TabIntentOpenSetting.isolated => SegmentedButton.styleFrom(
selectedBackgroundColor: appColors.isolatedSelectionOverlay,
),
TabIntentOpenSetting.ask => null, TabIntentOpenSetting.ask => null,
}, },
), ),
@@ -546,6 +560,15 @@ class _ShowIsolatedTabUiTile extends HookConsumerWidget {
TabType.regular, TabType.regular,
); );
} }
if (!value &&
updated.tabIntentOpenSetting == TabIntentOpenSetting.isolated) {
updated = updated.copyWith.tabIntentOpenSetting(
TabIntentOpenSetting.ask,
);
}
if (!value && updated.smallWebTabType == TabType.isolated) {
updated = updated.copyWith.smallWebTabType(TabType.private);
}
return updated; return updated;
}); });
}, },
@@ -65,7 +65,7 @@ class SmallWebModeController extends _$SmallWebModeController {
} }
final settings = ref.read(generalSettingsWithDefaultsProvider); final settings = ref.read(generalSettingsWithDefaultsProvider);
final tabMode = TabMode.fromTabType(settings.smallWebTabType); final tabMode = TabMode.fromTabType(settings.effectiveSmallWebTabType);
final newTabId = await ref final newTabId = await ref
.read(tabRepositoryProvider.notifier) .read(tabRepositoryProvider.notifier)
@@ -42,7 +42,7 @@ final class SmallWebModeControllerProvider
} }
String _$smallWebModeControllerHash() => String _$smallWebModeControllerHash() =>
r'26fb84c9ce60562738f7d9523f74aebfb19ad84b'; r'a012c3735309e0ace448369e2bf41e2671b7d9b9';
abstract class _$SmallWebModeController extends $Notifier<String?> { abstract class _$SmallWebModeController extends $Notifier<String?> {
String? build(); String? build();
@@ -44,7 +44,7 @@ enum TabBarSwipeAction { switchLastOpened, navigateOrderedTabs }
enum QuickTabSwitcherMode { lastUsedTabs, containerTabs } enum QuickTabSwitcherMode { lastUsedTabs, containerTabs }
enum TabIntentOpenSetting { regular, private, ask } enum TabIntentOpenSetting { regular, private, isolated, ask }
enum TabListDirection { newestFirst, oldestFirst } enum TabListDirection { newestFirst, oldestFirst }
@@ -328,6 +328,21 @@ class GeneralSettings with FastEquatable {
return storedDefaultCreateTabType; return storedDefaultCreateTabType;
} }
TabType get effectiveSmallWebTabType {
if (!showIsolatedTabUi && smallWebTabType == TabType.isolated) {
return TabType.private;
}
return smallWebTabType;
}
TabIntentOpenSetting get effectiveTabIntentOpenSetting {
if (!showIsolatedTabUi &&
tabIntentOpenSetting == TabIntentOpenSetting.isolated) {
return TabIntentOpenSetting.ask;
}
return tabIntentOpenSetting;
}
QuickTabSwitcherMode effectiveUiQuickTabSwitcherMode() { QuickTabSwitcherMode effectiveUiQuickTabSwitcherMode() {
if (!showContainerUi && if (!showContainerUi &&
quickTabSwitcherMode == QuickTabSwitcherMode.containerTabs) { quickTabSwitcherMode == QuickTabSwitcherMode.containerTabs) {
@@ -1044,6 +1044,7 @@ const _$TabBarDirectionEnumMap = {
const _$TabIntentOpenSettingEnumMap = { const _$TabIntentOpenSettingEnumMap = {
TabIntentOpenSetting.regular: 'regular', TabIntentOpenSetting.regular: 'regular',
TabIntentOpenSetting.private: 'private', TabIntentOpenSetting.private: 'private',
TabIntentOpenSetting.isolated: 'isolated',
TabIntentOpenSetting.ask: 'ask', TabIntentOpenSetting.ask: 'ask',
}; };