Fix missing webmanifest in PWA for Android (#2051)

This commit is contained in:
Alexander Zinchuk 2022-09-24 01:40:24 +02:00
parent 97a87b5b95
commit c7392c89b5
3 changed files with 7 additions and 2 deletions

View File

@ -39,7 +39,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="192x192" href="./<%= htmlWebpackPlugin.options.mainIcon %>.png">
<link rel="alternate icon" href="./favicon.ico" type="image/x-icon">
<link rel="manifest" id="the-manifest-placeholder" />
<link rel="manifest" id="the-manifest-placeholder" href="./<%= htmlWebpackPlugin.options.manifest %>" />
</head>
<body>

View File

@ -5,11 +5,15 @@ import { DEBUG } from '../config';
import { IS_MAC_OS } from './environment';
export default function updateWebmanifest() {
if (!IS_MAC_OS) {
return;
}
const manifest = document.getElementById('the-manifest-placeholder');
if (!manifest) {
return;
}
const url = `site${IS_MAC_OS ? '_apple' : ''}${DEBUG ? '_dev' : ''}.webmanifest`;
const url = `site_apple${DEBUG ? '_dev' : ''}.webmanifest`;
manifest.setAttribute('href', url);
}

View File

@ -144,6 +144,7 @@ module.exports = (_env, { mode = 'production' }) => {
appName: APP_ENV === 'production' ? 'Telegram Web' : 'Telegram Web Beta',
appleIcon: APP_ENV === 'production' ? 'apple-touch-icon' : 'apple-touch-icon-dev',
mainIcon: APP_ENV === 'production' ? 'icon-192x192' : 'icon-dev-192x192',
manifest: APP_ENV === 'production' ? 'site.webmanifest' : 'site_dev.webmanifest',
template: 'src/index.html',
}),
new MiniCssExtractPlugin({