1405/03/31-apk link
This commit is contained in:
+14
-1
@@ -83,11 +83,24 @@ function applyTenantThemeVars() {
|
||||
document.documentElement.style.setProperty('--App-background-color', backgroundColor)
|
||||
}
|
||||
}
|
||||
function detectTWA() {
|
||||
const fromReferrer = document.referrer.startsWith('android-app://');
|
||||
const fromParam = new URLSearchParams(window.location.search).get('source') === 'twa';
|
||||
|
||||
if (fromReferrer || fromParam) {
|
||||
sessionStorage.setItem('appMode', 'twa');
|
||||
// پاک کردن پارامتر از URL
|
||||
if (fromParam) {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.delete('source');
|
||||
window.history.replaceState({}, '', url);
|
||||
}
|
||||
}
|
||||
}
|
||||
export async function bootstrapApp() {
|
||||
try {
|
||||
detectTWA()
|
||||
const config = await withTimeout(loadAppConfig(), 20000, 'Config loading timeout')
|
||||
|
||||
setAppConfig(config)
|
||||
applyTenantThemeVars()
|
||||
startPwaManifest(config)
|
||||
|
||||
Reference in New Issue
Block a user