Skip to content

Commit

Permalink
modify handler to use new flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lendihop committed Apr 11, 2024
1 parent 4ff2036 commit d93f674
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/screens/d-apps/others/others.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { TruncatedText } from 'src/components/truncated-text';
import { CustomDAppInfo } from 'src/interfaces/custom-dapps-info.interface';
import { TestIdProps } from 'src/interfaces/test-id.props';
import { formatSize } from 'src/styles/format-size';
import { useOpenUrlInAppBrowser } from 'src/utils/linking';
import { openUrl, useOpenUrlInAppBrowser } from 'src/utils/linking';

import { useIsInAppBrowserEnabledSelector } from '../../../store/settings/settings-selectors';

import { useOthersDAppStyles } from './others.styles';

Expand All @@ -24,9 +26,13 @@ export const OthersDApp: FC<Props> = ({ item, itemWidth, testID }) => {
const [imageLoadError, setImageLoadError] = useState(false);

const styles = useOthersDAppStyles();
const openUrl = useOpenUrlInAppBrowser();
const openUrlInAppBrowser = useOpenUrlInAppBrowser();
const isInAppBrowserEnabled = useIsInAppBrowserEnabledSelector();

const onPress = useCallback(() => openUrl(dappUrl), [openUrl, dappUrl]);
const onPress = useCallback(
() => (isInAppBrowserEnabled ? openUrlInAppBrowser(dappUrl) : openUrl(dappUrl)),
[isInAppBrowserEnabled, openUrlInAppBrowser, dappUrl]
);

return (
<TouchableWithAnalytics
Expand Down

0 comments on commit d93f674

Please sign in to comment.