Skip to content

Commit

Permalink
Merge pull request #1359 from tonwhales/develop
Browse files Browse the repository at this point in the history
Develop sync
  • Loading branch information
vzhovnitsky authored Feb 11, 2025
2 parents 889a475 + 1ddebf2 commit e4e4b02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
11 changes: 9 additions & 2 deletions app/components/browser/BrowserSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export const BrowserSearch = memo(({

if (!url) {
toaster.show({ type: 'error', message: t('browser.search.invalidUrl'), marginBottom: Platform.select({ ios: bottomBarHeight + 16, android: 16 }) });
setLockSelection(false);
return;
}

Expand All @@ -239,7 +240,7 @@ export const BrowserSearch = memo(({
if (currentSuggestions.length !== 0) {
url = currentSuggestions[0].url;
} else {
setLockSelection(false)
setLockSelection(false);
toaster.show({
type: 'error', message: t('browser.search.urlNotReachable'), marginBottom: Platform.select({ ios: bottomBarHeight + 16, android: 16 })
});
Expand Down Expand Up @@ -287,6 +288,12 @@ export const BrowserSearch = memo(({
};
});

const onSubmit = useCallback(() => {
const encodedQuery = encodeURIComponent(search);
const baseUrl = searchEngine === 'google' ? 'https://www.google.com/search?q=' : 'https://duckduckgo.com/?q=';
onSearch(`${baseUrl}${encodedQuery}`);
}, [search, searchEngine]);

return (
<View style={{ marginBottom: 16 }}>
<Animated.View style={[{
Expand All @@ -308,7 +315,7 @@ export const BrowserSearch = memo(({
style={{ marginHorizontal: 16, flex: 1 }}
onValueChange={onSetSearch}
editable={!lockSelection}
onSubmit={() => onSearch(search)}
onSubmit={onSubmit}
keyboardType={'web-search'}
inputMode={'search'}
textContentType={'URL'}
Expand Down
3 changes: 1 addition & 2 deletions app/components/webview/DAppWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ export const DAppWebView = memo(forwardRef((props: DAppWebViewProps, ref: Forwar
}
);



const safelyOpenUrl = useCallback((url: string) => {
try {
const scheme = new URL(url).protocol.replace(':', '');
Expand Down Expand Up @@ -578,6 +576,7 @@ export const DAppWebView = memo(forwardRef((props: DAppWebViewProps, ref: Forwar
/>
)
}}
setSupportMultipleWindows={false}
/>
<KeyboardAvoidingView
style={{ position: 'absolute', bottom: safeArea.bottom, left: 0, right: 0 }}
Expand Down
2 changes: 1 addition & 1 deletion app/engine/hooks/dapps/useWebSearchSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BrowserSearchSuggestion } from "./useDAppsSuggestions";

export function useWebSearchSuggestions(query: string) {
const dappsSuggestions = useDAppsSuggestions(query);
const [searchEngine,] = useSearchEngine();
const [searchEngine] = useSearchEngine();
const webSuggestions = useBrowserWebSearchSuggestions(query, searchEngine);

const resRef = useRef<BrowserSearchSuggestion[]>([]);
Expand Down

0 comments on commit e4e4b02

Please sign in to comment.