isolated tab type default handling
This commit is contained in:
+1
-3
@@ -88,9 +88,7 @@ TabViewReorderResult? buildTabViewReorderResult({
|
||||
? withoutMovingItem[insertIndex].tabId
|
||||
: null;
|
||||
if (targetBeforeId != null && moveBlockIds.contains(targetBeforeId)) {
|
||||
logger.t(
|
||||
'reorder refused: drop target is inside the moving subtree',
|
||||
);
|
||||
logger.t('reorder refused: drop target is inside the moving subtree');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+19
-16
@@ -392,30 +392,37 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
next.whenData((sharedContent) async {
|
||||
final settings = ref.read(generalSettingsWithDefaultsProvider);
|
||||
|
||||
switch (settings.tabIntentOpenSetting) {
|
||||
switch (settings.effectiveTabIntentOpenSetting) {
|
||||
case TabIntentOpenSetting.regular:
|
||||
case TabIntentOpenSetting.private:
|
||||
case TabIntentOpenSetting.isolated:
|
||||
await ref
|
||||
.read(engineReadyStateProvider.notifier)
|
||||
.waitUntilReady();
|
||||
|
||||
final tabMode = switch (settings.effectiveTabIntentOpenSetting) {
|
||||
TabIntentOpenSetting.private => TabMode.private,
|
||||
TabIntentOpenSetting.isolated => TabMode.newIsolated(),
|
||||
_ => TabMode.regular,
|
||||
};
|
||||
|
||||
switch (sharedContent) {
|
||||
case SharedUrl():
|
||||
final containerSelection = await _resolveContainerSelection(
|
||||
ref,
|
||||
sharedContent.contextId,
|
||||
sharedContent.containerMode,
|
||||
);
|
||||
final containerSelection =
|
||||
settings.effectiveTabIntentOpenSetting ==
|
||||
TabIntentOpenSetting.isolated
|
||||
? const TabContainerSelection.unassigned()
|
||||
: await _resolveContainerSelection(
|
||||
ref,
|
||||
sharedContent.contextId,
|
||||
sharedContent.containerMode,
|
||||
);
|
||||
|
||||
await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
.addTab(
|
||||
url: sharedContent.url,
|
||||
tabMode:
|
||||
settings.tabIntentOpenSetting ==
|
||||
TabIntentOpenSetting.private
|
||||
? TabMode.private
|
||||
: TabMode.regular,
|
||||
tabMode: tabMode,
|
||||
launchedFromIntent: true,
|
||||
selectTab: true,
|
||||
containerSelection: containerSelection,
|
||||
@@ -429,11 +436,7 @@ class _BrowserViewState extends ConsumerState<BrowserView>
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
.addTab(
|
||||
url: bang?.getTemplateUrl(sharedContent.text),
|
||||
tabMode:
|
||||
settings.tabIntentOpenSetting ==
|
||||
TabIntentOpenSetting.private
|
||||
? TabMode.private
|
||||
: TabMode.regular,
|
||||
tabMode: tabMode,
|
||||
launchedFromIntent: true,
|
||||
selectTab: true,
|
||||
);
|
||||
|
||||
@@ -198,7 +198,7 @@ class _SmallWebTabDefaultSection extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final appColors = AppColors.of(context);
|
||||
final settings = ref.watch(generalSettingsWithDefaultsProvider);
|
||||
final smallWebTabType = settings.smallWebTabType;
|
||||
final smallWebTabType = settings.effectiveSmallWebTabType;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
|
||||
@@ -276,9 +276,8 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final appColors = AppColors.of(context);
|
||||
final tabIntentOpenSetting = ref.watch(
|
||||
generalSettingsWithDefaultsProvider.select((s) => s.tabIntentOpenSetting),
|
||||
);
|
||||
final settings = ref.watch(generalSettingsWithDefaultsProvider);
|
||||
final tabIntentOpenSetting = settings.tabIntentOpenSetting;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
|
||||
@@ -316,6 +315,18 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
|
||||
: 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},
|
||||
onSelectionChanged: (value) async {
|
||||
@@ -331,6 +342,9 @@ class _ExternalLinkHandlingSection extends HookConsumerWidget {
|
||||
TabIntentOpenSetting.private => SegmentedButton.styleFrom(
|
||||
selectedBackgroundColor: appColors.privateSelectionOverlay,
|
||||
),
|
||||
TabIntentOpenSetting.isolated => SegmentedButton.styleFrom(
|
||||
selectedBackgroundColor: appColors.isolatedSelectionOverlay,
|
||||
),
|
||||
TabIntentOpenSetting.ask => null,
|
||||
},
|
||||
),
|
||||
@@ -546,6 +560,15 @@ class _ShowIsolatedTabUiTile extends HookConsumerWidget {
|
||||
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;
|
||||
});
|
||||
},
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class SmallWebModeController extends _$SmallWebModeController {
|
||||
}
|
||||
|
||||
final settings = ref.read(generalSettingsWithDefaultsProvider);
|
||||
final tabMode = TabMode.fromTabType(settings.smallWebTabType);
|
||||
final tabMode = TabMode.fromTabType(settings.effectiveSmallWebTabType);
|
||||
|
||||
final newTabId = await ref
|
||||
.read(tabRepositoryProvider.notifier)
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class SmallWebModeControllerProvider
|
||||
}
|
||||
|
||||
String _$smallWebModeControllerHash() =>
|
||||
r'26fb84c9ce60562738f7d9523f74aebfb19ad84b';
|
||||
r'a012c3735309e0ace448369e2bf41e2671b7d9b9';
|
||||
|
||||
abstract class _$SmallWebModeController extends $Notifier<String?> {
|
||||
String? build();
|
||||
|
||||
@@ -44,7 +44,7 @@ enum TabBarSwipeAction { switchLastOpened, navigateOrderedTabs }
|
||||
|
||||
enum QuickTabSwitcherMode { lastUsedTabs, containerTabs }
|
||||
|
||||
enum TabIntentOpenSetting { regular, private, ask }
|
||||
enum TabIntentOpenSetting { regular, private, isolated, ask }
|
||||
|
||||
enum TabListDirection { newestFirst, oldestFirst }
|
||||
|
||||
@@ -328,6 +328,21 @@ class GeneralSettings with FastEquatable {
|
||||
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() {
|
||||
if (!showContainerUi &&
|
||||
quickTabSwitcherMode == QuickTabSwitcherMode.containerTabs) {
|
||||
|
||||
@@ -1044,6 +1044,7 @@ const _$TabBarDirectionEnumMap = {
|
||||
const _$TabIntentOpenSettingEnumMap = {
|
||||
TabIntentOpenSetting.regular: 'regular',
|
||||
TabIntentOpenSetting.private: 'private',
|
||||
TabIntentOpenSetting.isolated: 'isolated',
|
||||
TabIntentOpenSetting.ask: 'ask',
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user