Message / Location: Fix layout flickering, ask before opening Google Maps (#2170)
This commit is contained in:
parent
d216688757
commit
8e37f81ed6
@ -1,6 +1,7 @@
|
|||||||
import React, {
|
import React, {
|
||||||
memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,
|
memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,
|
||||||
} from '../../../lib/teact/teact';
|
} from '../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../global';
|
||||||
|
|
||||||
import type { FC } from '../../../lib/teact/teact';
|
import type { FC } from '../../../lib/teact/teact';
|
||||||
import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types';
|
import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types';
|
||||||
@ -66,6 +67,7 @@ const Location: FC<OwnProps> = ({
|
|||||||
theme,
|
theme,
|
||||||
serverTimeOffset,
|
serverTimeOffset,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { openUrl } = getActions();
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
@ -110,7 +112,7 @@ const Location: FC<OwnProps> = ({
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
const url = prepareMapUrl(point.lat, point.long, zoom);
|
const url = prepareMapUrl(point.lat, point.long, zoom);
|
||||||
window.open(url, '_blank', 'noopener')?.focus();
|
openUrl({ url });
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCountdown = useCallback((countdownEl: HTMLDivElement) => {
|
const updateCountdown = useCallback((countdownEl: HTMLDivElement) => {
|
||||||
@ -224,8 +226,7 @@ const Location: FC<OwnProps> = ({
|
|||||||
className="full-media map"
|
className="full-media map"
|
||||||
src={mapBlobUrl}
|
src={mapBlobUrl}
|
||||||
alt="Location on a map"
|
alt="Location on a map"
|
||||||
width={DEFAULT_MAP_CONFIG.width}
|
style={`width: ${DEFAULT_MAP_CONFIG.width}px; height: ${DEFAULT_MAP_CONFIG.height}px;`}
|
||||||
height={DEFAULT_MAP_CONFIG.height}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const PROVIDER = 'http://maps.google.com/maps';
|
const PROVIDER = 'https://maps.google.com/maps';
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
// https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L82
|
// https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L82
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user