diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json index a70c0f6b..04d6eaad 100644 --- a/assets/i18n/en-US.json +++ b/assets/i18n/en-US.json @@ -1534,5 +1534,8 @@ "chatRoomPinned": "Chat room pinned successfully.", "chatRoomUnpinned": "Chat room unpinned successfully.", "pinnedChatRoom": "Pinned Rooms", - "settingsGroupedChatList": "Grouped Chat List" + "settingsGroupedChatList": "Grouped Chat List", + "settingsNotifyWithHaptic": "Notification with Haptic Feedback", + "settingsDashSearchEngine": "Search Engine for web", + "settingsDashSearchEngineHelper": "Use %s as the placeholder for the query." } diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 694ae1b2..8861c5f6 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -846,7 +846,7 @@ class SettingsScreen extends HookConsumerWidget { child: TextField( controller: TextEditingController(text: settings.dashSearchEngine), decoration: InputDecoration( - hintText: 'https://duckduckgo.com/?q=%s', + hintText: 'https://google.com/?q=%s', helperText: 'settingsDashSearchEngineHelper'.tr(), suffixIcon: IconButton( icon: const Icon(Symbols.restart_alt), diff --git a/lib/widgets/cmp/pattle.dart b/lib/widgets/cmp/pattle.dart index 99136c28..57c141be 100644 --- a/lib/widgets/cmp/pattle.dart +++ b/lib/widgets/cmp/pattle.dart @@ -11,6 +11,7 @@ import 'package:island/models/chat.dart'; import 'package:island/models/route_item.dart'; import 'package:island/pods/chat/chat_room.dart'; import 'package:island/pods/chat/chat_summary.dart'; +import 'package:island/pods/config.dart'; import 'package:island/pods/userinfo.dart'; import 'package:island/route.dart'; import 'package:island/services/responsive.dart'; @@ -150,7 +151,7 @@ class CommandPattleWidget extends HookConsumerWidget { filteredChats.isEmpty && filteredSpecialActions.isEmpty && filteredRoutes.isEmpty - ? _getFallbackActions(context, searchQuery.value) + ? _getFallbackActions(ref, context, searchQuery.value) : []; // Combine results: fallbacks first, then chats, special actions, routes @@ -402,9 +403,12 @@ class CommandPattleWidget extends HookConsumerWidget { } static List _getFallbackActions( + WidgetRef ref, BuildContext context, String query, ) { + final settings = ref.watch(appSettingsProvider); + final List actions = []; // Check if query is a URL @@ -448,12 +452,14 @@ class CommandPattleWidget extends HookConsumerWidget { actions.add( FallbackAction( name: 'Search the web', - description: 'Search "$query" on Google', + description: 'Search "$query" on the Internet', icon: Symbols.search, action: () async { - final searchUri = Uri.https('www.google.com', '/search', { - 'q': query, - }); + final searchUri = Uri.parse( + settings.dashSearchEngine != null + ? settings.dashSearchEngine!.replaceFirst('%s', query) + : 'https://www.google.com/search?q=$query', + ); if (await canLaunchUrl(searchUri)) { await launchUrl(searchUri, mode: LaunchMode.externalApplication); }