Message / Location: Fix layout flickering, ask before opening Google Maps (#2170)

This commit is contained in:
Alexander Zinchuk 2022-12-06 13:29:39 +01:00
parent d216688757
commit 8e37f81ed6
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import React, {
memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState,
} from '../../../lib/teact/teact';
import { getActions } from '../../../global';
import type { FC } from '../../../lib/teact/teact';
import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types';
@ -66,6 +67,7 @@ const Location: FC<OwnProps> = ({
theme,
serverTimeOffset,
}) => {
const { openUrl } = getActions();
// eslint-disable-next-line no-null/no-null
const ref = useRef<HTMLDivElement>(null);
// eslint-disable-next-line no-null/no-null
@ -110,7 +112,7 @@ const Location: FC<OwnProps> = ({
const handleClick = () => {
const url = prepareMapUrl(point.lat, point.long, zoom);
window.open(url, '_blank', 'noopener')?.focus();
openUrl({ url });
};
const updateCountdown = useCallback((countdownEl: HTMLDivElement) => {
@ -224,8 +226,7 @@ const Location: FC<OwnProps> = ({
className="full-media map"
src={mapBlobUrl}
alt="Location on a map"
width={DEFAULT_MAP_CONFIG.width}
height={DEFAULT_MAP_CONFIG.height}
style={`width: ${DEFAULT_MAP_CONFIG.width}px; height: ${DEFAULT_MAP_CONFIG.height}px;`}
/>
);
}

View File

@ -1,4 +1,4 @@
const PROVIDER = 'http://maps.google.com/maps';
const PROVIDER = 'https://maps.google.com/maps';
// eslint-disable-next-line max-len
// https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L82