fix(mobile-dock): ocultar boton app movil dentro de la aplicacion movil nativa y mostrar solo en navegacion web

This commit is contained in:
AI Bot 2026-08-27 15:13:31 -05:00
parent e675ec3641
commit 0bbb358b7b
8 changed files with 156 additions and 24 deletions

View File

@ -8,7 +8,9 @@ const config: CapacitorConfig = {
url: 'https://store.almeira.com.co',
cleartext: true,
androidScheme: 'https',
appendUserAgent: 'CapacitorApp/AlmeiraStore',
},
appendUserAgent: 'CapacitorApp/AlmeiraStore',
plugins: {
SplashScreen: {
launchShowDuration: 2000,

View File

@ -23,14 +23,45 @@ export const MobileBottomDock: React.FC<MobileBottomDockProps> = ({
const [isInsideApp, setIsInsideApp] = useState(false);
useEffect(() => {
const isNativeApp =
typeof window !== 'undefined' &&
(!!(window as any).Capacitor?.isNativePlatform?.() ||
const detectApp = () => {
if (typeof window === 'undefined') return false;
// 1. Capacitor bridge object o plataforma nativa
const isCapacitor =
typeof (window as any).Capacitor !== 'undefined' ||
!!(window as any).Capacitor?.isNativePlatform?.() ||
(window as any).Capacitor?.getPlatform?.() === 'android' ||
(window as any).Capacitor?.getPlatform?.() === 'ios' ||
(window as any).Capacitor?.getPlatform?.() === 'ios';
// 2. Modo Standalone (PWA instalada o contenedor Android)
const isStandalone =
window.matchMedia?.('(display-mode: standalone)')?.matches ||
(window.navigator as any)?.standalone === true);
setIsInsideApp(isNativeApp);
(window.navigator as any)?.standalone === true ||
document.referrer.includes('android-app://');
// 3. UserAgent personalizado o WebView embebida
const ua = (navigator.userAgent || '').toLowerCase();
const isAppUA =
ua.includes('capacitor') ||
ua.includes('capacitorapp') ||
ua.includes('almeira') ||
ua.includes('; wv') ||
ua.includes('version/4.0');
return isCapacitor || isStandalone || isAppUA;
};
if (detectApp()) {
setIsInsideApp(true);
}
const timer = setTimeout(() => {
if (detectApp()) {
setIsInsideApp(true);
}
}, 300);
return () => clearTimeout(timer);
}, []);
const handleWhatsApp = () => {

View File

@ -8,7 +8,9 @@ const config: CapacitorConfig = {
url: 'https://dripzone.almeira.com.co',
cleartext: true,
androidScheme: 'https',
appendUserAgent: 'CapacitorApp/DripZone',
},
appendUserAgent: 'CapacitorApp/DripZone',
plugins: {
SplashScreen: {
launchShowDuration: 4500, // 4.5 segundos para apreciar el logo y eslogan

View File

@ -23,14 +23,45 @@ export const MobileBottomDock: React.FC<MobileBottomDockProps> = ({
const [isInsideApp, setIsInsideApp] = useState(false);
useEffect(() => {
const isNativeApp =
typeof window !== 'undefined' &&
(!!(window as any).Capacitor?.isNativePlatform?.() ||
const detectApp = () => {
if (typeof window === 'undefined') return false;
// 1. Capacitor bridge object o plataforma nativa
const isCapacitor =
typeof (window as any).Capacitor !== 'undefined' ||
!!(window as any).Capacitor?.isNativePlatform?.() ||
(window as any).Capacitor?.getPlatform?.() === 'android' ||
(window as any).Capacitor?.getPlatform?.() === 'ios' ||
(window as any).Capacitor?.getPlatform?.() === 'ios';
// 2. Modo Standalone (PWA instalada o contenedor Android)
const isStandalone =
window.matchMedia?.('(display-mode: standalone)')?.matches ||
(window.navigator as any)?.standalone === true);
setIsInsideApp(isNativeApp);
(window.navigator as any)?.standalone === true ||
document.referrer.includes('android-app://');
// 3. UserAgent personalizado o WebView embebida
const ua = (navigator.userAgent || '').toLowerCase();
const isAppUA =
ua.includes('capacitor') ||
ua.includes('capacitorapp') ||
ua.includes('dripzone') ||
ua.includes('; wv') ||
ua.includes('version/4.0');
return isCapacitor || isStandalone || isAppUA;
};
if (detectApp()) {
setIsInsideApp(true);
}
const timer = setTimeout(() => {
if (detectApp()) {
setIsInsideApp(true);
}
}, 300);
return () => clearTimeout(timer);
}, []);
const handleWhatsApp = () => {

View File

@ -8,7 +8,9 @@ const config: CapacitorConfig = {
url: 'https://sneaky.almeira.com.co',
cleartext: true,
androidScheme: 'https',
appendUserAgent: 'CapacitorApp/SneakyDrops',
},
appendUserAgent: 'CapacitorApp/SneakyDrops',
plugins: {
SplashScreen: {
launchShowDuration: 2000,

View File

@ -23,14 +23,45 @@ export const MobileBottomDock: React.FC<MobileBottomDockProps> = ({
const [isInsideApp, setIsInsideApp] = useState(false);
useEffect(() => {
const isNativeApp =
typeof window !== 'undefined' &&
(!!(window as any).Capacitor?.isNativePlatform?.() ||
const detectApp = () => {
if (typeof window === 'undefined') return false;
// 1. Capacitor bridge object o plataforma nativa
const isCapacitor =
typeof (window as any).Capacitor !== 'undefined' ||
!!(window as any).Capacitor?.isNativePlatform?.() ||
(window as any).Capacitor?.getPlatform?.() === 'android' ||
(window as any).Capacitor?.getPlatform?.() === 'ios' ||
(window as any).Capacitor?.getPlatform?.() === 'ios';
// 2. Modo Standalone (PWA instalada o contenedor Android)
const isStandalone =
window.matchMedia?.('(display-mode: standalone)')?.matches ||
(window.navigator as any)?.standalone === true);
setIsInsideApp(isNativeApp);
(window.navigator as any)?.standalone === true ||
document.referrer.includes('android-app://');
// 3. UserAgent personalizado o WebView embebida
const ua = (navigator.userAgent || '').toLowerCase();
const isAppUA =
ua.includes('capacitor') ||
ua.includes('capacitorapp') ||
ua.includes('sneaky') ||
ua.includes('; wv') ||
ua.includes('version/4.0');
return isCapacitor || isStandalone || isAppUA;
};
if (detectApp()) {
setIsInsideApp(true);
}
const timer = setTimeout(() => {
if (detectApp()) {
setIsInsideApp(true);
}
}, 300);
return () => clearTimeout(timer);
}, []);
const handleWhatsApp = () => {

View File

@ -8,7 +8,9 @@ const config: CapacitorConfig = {
url: 'https://zapply.almeira.com.co',
cleartext: true,
androidScheme: 'https',
appendUserAgent: 'CapacitorApp/Zapply',
},
appendUserAgent: 'CapacitorApp/Zapply',
plugins: {
SplashScreen: {
launchShowDuration: 2000,

View File

@ -23,14 +23,45 @@ export const MobileBottomDock: React.FC<MobileBottomDockProps> = ({
const [isInsideApp, setIsInsideApp] = useState(false);
useEffect(() => {
const isNativeApp =
typeof window !== 'undefined' &&
(!!(window as any).Capacitor?.isNativePlatform?.() ||
const detectApp = () => {
if (typeof window === 'undefined') return false;
// 1. Capacitor bridge object o plataforma nativa
const isCapacitor =
typeof (window as any).Capacitor !== 'undefined' ||
!!(window as any).Capacitor?.isNativePlatform?.() ||
(window as any).Capacitor?.getPlatform?.() === 'android' ||
(window as any).Capacitor?.getPlatform?.() === 'ios' ||
(window as any).Capacitor?.getPlatform?.() === 'ios';
// 2. Modo Standalone (PWA instalada o contenedor Android)
const isStandalone =
window.matchMedia?.('(display-mode: standalone)')?.matches ||
(window.navigator as any)?.standalone === true);
setIsInsideApp(isNativeApp);
(window.navigator as any)?.standalone === true ||
document.referrer.includes('android-app://');
// 3. UserAgent personalizado o WebView embebida
const ua = (navigator.userAgent || '').toLowerCase();
const isAppUA =
ua.includes('capacitor') ||
ua.includes('capacitorapp') ||
ua.includes('zapply') ||
ua.includes('; wv') ||
ua.includes('version/4.0');
return isCapacitor || isStandalone || isAppUA;
};
if (detectApp()) {
setIsInsideApp(true);
}
const timer = setTimeout(() => {
if (detectApp()) {
setIsInsideApp(true);
}
}, 300);
return () => clearTimeout(timer);
}, []);
const handleWhatsApp = () => {