setting to disable early access tools
This commit is contained in:
@@ -34,6 +34,12 @@ class KagiScreen extends HookConsumerWidget {
|
||||
final displayedSheet = ref.watch(bottomSheetProvider);
|
||||
final displayedOverlayDialog = ref.watch(overlayDialogProvider);
|
||||
|
||||
final showEarlyAccessFeatures = ref.watch(
|
||||
settingsRepositoryProvider.select(
|
||||
(value) => value.valueOrNull?.showEarlyAccessFeatures ?? true,
|
||||
),
|
||||
);
|
||||
|
||||
final lastBackButtonPress = useRef<DateTime?>(null);
|
||||
final webViewController = useRef<InAppWebViewController?>(null);
|
||||
|
||||
@@ -188,15 +194,6 @@ class KagiScreen extends HookConsumerWidget {
|
||||
leadingIcon: const Icon(MdiIcons.searchWeb),
|
||||
child: const Text('Search'),
|
||||
),
|
||||
MenuItemButton(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
CreateTab(preferredTool: KagiTool.assistant),
|
||||
);
|
||||
},
|
||||
leadingIcon: const Icon(MdiIcons.brain),
|
||||
child: const Text('Assistant'),
|
||||
),
|
||||
MenuItemButton(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
@@ -206,15 +203,26 @@ class KagiScreen extends HookConsumerWidget {
|
||||
leadingIcon: const Icon(MdiIcons.text),
|
||||
child: const Text('Summarizer'),
|
||||
),
|
||||
if (showEarlyAccessFeatures)
|
||||
MenuItemButton(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
CreateTab(preferredTool: KagiTool.assistant),
|
||||
);
|
||||
},
|
||||
leadingIcon: const Icon(MdiIcons.brain),
|
||||
child: const Text('Assistant'),
|
||||
),
|
||||
const Divider(),
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
await context.push(ChatArchiveListRoute().location);
|
||||
},
|
||||
leadingIcon: const Icon(MdiIcons.archive),
|
||||
child: const Text('Chat Archive'),
|
||||
),
|
||||
const Divider(),
|
||||
if (showEarlyAccessFeatures)
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
await context.push(ChatArchiveListRoute().location);
|
||||
},
|
||||
leadingIcon: const Icon(MdiIcons.archive),
|
||||
child: const Text('Chat Archive'),
|
||||
),
|
||||
if (showEarlyAccessFeatures) const Divider(),
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
await context.push(AboutRoute().location);
|
||||
|
||||
@@ -21,6 +21,12 @@ class LandingAction extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
final showEarlyAccessFeatures = ref.watch(
|
||||
settingsRepositoryProvider.select(
|
||||
(value) => value.valueOrNull?.showEarlyAccessFeatures ?? true,
|
||||
),
|
||||
);
|
||||
|
||||
return Visibility(
|
||||
visible: sessionTokenAvailable,
|
||||
replacement: Container(
|
||||
@@ -68,15 +74,6 @@ class LandingAction extends HookConsumerWidget {
|
||||
icon: const Icon(MdiIcons.searchWeb),
|
||||
label: const Text('Search'),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
CreateTab(preferredTool: KagiTool.assistant),
|
||||
);
|
||||
},
|
||||
icon: const Icon(MdiIcons.brain),
|
||||
label: const Text('Assistant'),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
@@ -86,6 +83,16 @@ class LandingAction extends HookConsumerWidget {
|
||||
icon: const Icon(MdiIcons.text),
|
||||
label: const Text('Summarizer'),
|
||||
),
|
||||
if (showEarlyAccessFeatures)
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(createTabStreamProvider.notifier).createTab(
|
||||
CreateTab(preferredTool: KagiTool.assistant),
|
||||
);
|
||||
},
|
||||
icon: const Icon(MdiIcons.brain),
|
||||
label: const Text('Assistant'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+27
-15
@@ -3,6 +3,7 @@ import 'package:bang_navigator/features/search_browser/domain/entities/sheet.dar
|
||||
import 'package:bang_navigator/features/search_browser/presentation/widgets/tabs/assistant_tab.dart';
|
||||
import 'package:bang_navigator/features/search_browser/presentation/widgets/tabs/search_tab.dart';
|
||||
import 'package:bang_navigator/features/search_browser/presentation/widgets/tabs/summarize_tab.dart';
|
||||
import 'package:bang_navigator/features/settings/data/repositories/settings_repository.dart';
|
||||
import 'package:bang_navigator/features/share_intent/domain/entities/shared_content.dart';
|
||||
import 'package:bang_navigator/presentation/hooks/sync_page_tab.dart';
|
||||
import 'package:expandable_page_view/expandable_page_view.dart';
|
||||
@@ -24,6 +25,12 @@ class SharedContentSheet extends HookConsumerWidget {
|
||||
});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final showEarlyAccessFeatures = ref.watch(
|
||||
settingsRepositoryProvider.select(
|
||||
(value) => value.valueOrNull?.showEarlyAccessFeatures ?? true,
|
||||
),
|
||||
);
|
||||
|
||||
final sharedContent = useMemoized(
|
||||
() => (parameter.content != null)
|
||||
? SharedContent.parse(parameter.content!)
|
||||
@@ -31,14 +38,17 @@ class SharedContentSheet extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
final tabController = useTabController(
|
||||
initialLength: KagiTool.values.length,
|
||||
initialLength: KagiTool.values.length - (showEarlyAccessFeatures ? 0 : 1),
|
||||
initialIndex: parameter.preferredTool?.index ??
|
||||
switch (sharedContent) {
|
||||
SharedText(text: final text) => (text.length > 25)
|
||||
SharedText(text: final text) =>
|
||||
(showEarlyAccessFeatures && text.length > 25)
|
||||
? KagiTool.assistant.index
|
||||
: KagiTool.search.index,
|
||||
SharedUrl() => KagiTool.summarizer.index,
|
||||
null => showEarlyAccessFeatures
|
||||
? KagiTool.assistant.index
|
||||
: KagiTool.search.index,
|
||||
SharedUrl() => KagiTool.summarizer.index,
|
||||
null => KagiTool.assistant.index,
|
||||
},
|
||||
);
|
||||
final pageController = usePageController(initialPage: tabController.index);
|
||||
@@ -50,19 +60,20 @@ class SharedContentSheet extends HookConsumerWidget {
|
||||
children: [
|
||||
TabBar(
|
||||
controller: tabController,
|
||||
tabs: const [
|
||||
Tab(
|
||||
tabs: [
|
||||
const Tab(
|
||||
icon: Icon(MdiIcons.searchWeb),
|
||||
text: 'Search',
|
||||
),
|
||||
Tab(
|
||||
icon: Icon(MdiIcons.brain),
|
||||
text: 'Assistant',
|
||||
),
|
||||
Tab(
|
||||
const Tab(
|
||||
icon: Icon(MdiIcons.text),
|
||||
text: 'Summarize',
|
||||
),
|
||||
if (showEarlyAccessFeatures)
|
||||
const Tab(
|
||||
icon: Icon(MdiIcons.brain),
|
||||
text: 'Assistant',
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
@@ -74,14 +85,15 @@ class SharedContentSheet extends HookConsumerWidget {
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
AssistantTab(
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
SummarizeTab(
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
if (showEarlyAccessFeatures)
|
||||
AssistantTab(
|
||||
sharedContent: sharedContent,
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user