Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support API_Embed setting #6070

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 },
OtavioStasiak marked this conversation as resolved.
Show resolved Hide resolved
...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
Loading