Skip to content

Commit

Permalink
Support API_Embed
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello committed Dec 17, 2024
1 parent c67e02d commit e2e20b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/containers/message/Urls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Clipboard from '@react-native-clipboard/clipboard';
import FastImage from 'react-native-fast-image';
import { dequal } from 'dequal';

import { useAppSelector } from '../../lib/hooks';
import Touchable from './Touchable';
import openLink from '../../lib/methods/helpers/openLink';
import sharedStyles from '../../views/Styles';
Expand Down Expand Up @@ -96,8 +97,8 @@ const UrlImage = ({ image, hasContent }: { image: string; hasContent: boolean })
overflow: 'hidden',
alignItems: 'center',
justifyContent: 'center',
...(imageDimensions.width <= 64 && { width: 64 }),
...(imageDimensions.height <= 64 && { height: 64 })
...imageDimensions.width <= 64 && { width: 64 },
...imageDimensions.height <= 64 && { height: 64 }
};
if (!hasContent) {
containerStyle = {
Expand Down Expand Up @@ -128,6 +129,7 @@ type TImageLoadedState = 'loading' | 'done' | 'error';
const Url = ({ url }: { url: IUrl }) => {
const { colors, theme } = useTheme();
const { baseUrl, user } = useContext(MessageContext);
const API_Embed = useAppSelector(state => state.settings.API_Embed);
const getImageUrl = () => {
const imageUrl = url.image || url.url;

Expand All @@ -146,7 +148,7 @@ const Url = ({ url }: { url: IUrl }) => {

const hasContent = !!(url.title || url.description);

if (!url || url?.ignoreParse) {
if (!url || url?.ignoreParse || !API_Embed) {
return null;
}

Expand Down
3 changes: 3 additions & 0 deletions app/lib/constants/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export const defaultSettings = {
Accounts_Iframe_api_method: {
type: 'valueAsString'
},
API_Embed: {
type: 'valueAsBoolean'
},
CROWD_Enable: {
type: 'valueAsBoolean'
},
Expand Down

0 comments on commit e2e20b4

Please sign in to comment.