Files
ghatreh_user/src/utils/config.ts
T

24 lines
656 B
TypeScript

export function getConfigApp(key: string) {
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user : {}
if (config) {
return config[key]
}
return null
}
export function isBoursecuProject() {
const name = String(getConfigApp('name') || '').toLowerCase()
return name === 'boursecu' || name === 'boursemes'
}
export function isTWA() {
if (typeof sessionStorage === 'undefined') return false
if (sessionStorage.getItem('appMode') === 'twa') return true
if (typeof document !== 'undefined' && document.referrer.startsWith('android-app://')) {
sessionStorage.setItem('appMode', 'twa')
return true
}
return false
}