Compare commits
No commits in common. "b01e5bbdf949a05807ae28f7dcffa6fd35c72419" and "3a5ddee97afa53990f9bb1dd06ed736b5ce7465e" have entirely different histories.
b01e5bbdf9
...
3a5ddee97a
11
src/App.tsx
11
src/App.tsx
|
|
@ -675,18 +675,9 @@ export default function App() {
|
||||||
message: verifyRes.data.message || 'Payment verified successfully and module entitlements unlocked!'
|
message: verifyRes.data.message || 'Payment verified successfully and module entitlements unlocked!'
|
||||||
});
|
});
|
||||||
|
|
||||||
// If on mobile browser, automatically attempt to redirect to mobile app after successful payment
|
|
||||||
if (/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
if (/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (/Android/i.test(navigator.userAgent)) {
|
window.location.href = 'acupedia://';
|
||||||
// Use Android Intent format to avoid blocked navigation in Android Chrome
|
|
||||||
window.location.href = 'intent://#Intent;scheme=acupedia;package=com.anonymous.acupedia;end';
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.href = 'acupedia://';
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
window.location.href = 'acupedia://';
|
|
||||||
}
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { XCircle, CheckCircle, Check, Download, RefreshCw, Smartphone } from 'lucide-react';
|
import { XCircle, CheckCircle, Check, Download, RefreshCw, Smartphone } from 'lucide-react';
|
||||||
import type { VerificationResult, UserProfile } from '../../types';
|
import type { VerificationResult, UserProfile } from '../../types';
|
||||||
|
|
||||||
|
|
@ -17,42 +17,6 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
|
||||||
onDownloadInvoice,
|
onDownloadInvoice,
|
||||||
downloadingInvoice,
|
downloadingInvoice,
|
||||||
}) => {
|
}) => {
|
||||||
const [desktopNotice, setDesktopNotice] = useState(false);
|
|
||||||
|
|
||||||
// Handler to reliably launch the Acupedia Mobile App across platforms (Android, iOS, and Desktop)
|
|
||||||
const handleOpenApp = (e: React.MouseEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const userAgent = navigator.userAgent || '';
|
|
||||||
const isAndroid = /Android/i.test(userAgent);
|
|
||||||
const isIOS = /iPhone|iPad|iPod/i.test(userAgent);
|
|
||||||
|
|
||||||
if (isAndroid) {
|
|
||||||
// Android Chrome requires an Intent URI format to launch apps by package and scheme reliably
|
|
||||||
const intentUrl = 'intent://#Intent;scheme=acupedia;package=com.anonymous.acupedia;end';
|
|
||||||
window.location.href = intentUrl;
|
|
||||||
|
|
||||||
// Fallback to custom URI schemes in case intent fails or Expo uses alternate scheme
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.href = 'acupedia://';
|
|
||||||
}, 500);
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.href = 'myapp://';
|
|
||||||
}, 1000);
|
|
||||||
} else if (isIOS) {
|
|
||||||
// iOS Safari and Chrome handle custom URI schemes directly
|
|
||||||
window.location.href = 'acupedia://';
|
|
||||||
|
|
||||||
// Fallback in case Expo uses default 'myapp://' scheme
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.href = 'myapp://';
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
// On desktop browsers, try opening the registered custom scheme
|
|
||||||
window.location.href = 'acupedia://';
|
|
||||||
// Show helpful desktop feedback informing the user how to access content on mobile
|
|
||||||
setDesktopNotice(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-slate-950/75 backdrop-blur-md transition-all duration-300">
|
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-slate-950/75 backdrop-blur-md transition-all duration-300">
|
||||||
<div className="relative w-full max-w-xl bg-slate-900 border border-slate-800 rounded-2xl p-5 md:p-6 space-y-4 shadow-2xl text-slate-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
|
<div className="relative w-full max-w-xl bg-slate-900 border border-slate-800 rounded-2xl p-5 md:p-6 space-y-4 shadow-2xl text-slate-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
|
||||||
|
|
@ -211,25 +175,14 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Open in App Button */}
|
|
||||||
<a
|
<a
|
||||||
href="acupedia://"
|
href="acupedia://"
|
||||||
id="open-in-app-btn"
|
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0"
|
||||||
onClick={handleOpenApp}
|
|
||||||
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0 cursor-pointer"
|
|
||||||
>
|
>
|
||||||
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
|
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
|
||||||
Open in App
|
Open Acupedia Mobile App
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{desktopNotice && (
|
|
||||||
<div className="p-2.5 bg-slate-950 border border-emerald-900/40 rounded-lg text-center animate-in fade-in duration-200">
|
|
||||||
<p className="text-[11px] text-emerald-400 font-medium">
|
|
||||||
📱 Attempted to launch Acupedia App. If you are on desktop, please open the Acupedia App on your mobile device to view your unlocked content.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className="w-full h-9 bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-indigo-600/10"
|
className="w-full h-9 bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-indigo-600/10"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue