Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/LoadingWrapper/index.tsx
| // Copyright (c) 2025 The Bitcoin developers | // Copyright (c) 2025 The Bitcoin developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| import React, { useState, useEffect } from 'react'; | import React, { useState, useEffect } from 'react'; | ||||
| import { Capacitor } from '@capacitor/core'; | |||||
| import { HashRouter as Router } from 'react-router'; | import { HashRouter as Router } from 'react-router'; | ||||
| import { ChronikClient, ConnectionStrategy } from 'chronik-client'; | import { ChronikClient, ConnectionStrategy } from 'chronik-client'; | ||||
| import { chronik as chronikConfig } from 'config/chronik'; | import { chronik as chronikConfig } from 'config/chronik'; | ||||
| import { Agora } from 'ecash-agora'; | import { Agora } from 'ecash-agora'; | ||||
| import { Ecc } from 'ecash-lib'; | import { Ecc } from 'ecash-lib'; | ||||
| import Cashtab from 'assets/cashtab_xec.png'; | import Cashtab from 'assets/cashtab_xec.png'; | ||||
| import { WalletProvider } from 'wallet/context'; | import { WalletProvider } from 'wallet/context'; | ||||
| import GA from 'components/Common/GoogleAnalytics'; | import GA from 'components/Common/GoogleAnalytics'; | ||||
| import App from 'components/App/App'; | import App from 'components/App/App'; | ||||
| import { SplashScreen, SplashLogo } from './styled'; | import { SplashScreen, SplashLogo } from './styled'; | ||||
| import { ExtensionFrame } from 'components/App/styles'; | import { ExtensionFrame } from 'components/App/styles'; | ||||
| interface LoadingWrapperProps { | interface LoadingWrapperProps { | ||||
| ecc: Ecc; | ecc: Ecc; | ||||
| } | } | ||||
| const LoadingWrapper: React.FC<LoadingWrapperProps> = ({ ecc }) => { | const LoadingWrapper: React.FC<LoadingWrapperProps> = ({ ecc }) => { | ||||
| const [chronik, setChronik] = useState<null | ChronikClient>(null); | const [chronik, setChronik] = useState<null | ChronikClient>(null); | ||||
| const [agora, setAgora] = useState<null | Agora>(null); | const [agora, setAgora] = useState<null | Agora>(null); | ||||
| const [error, setError] = useState<null | string>(null); | const [error, setError] = useState<null | string>(null); | ||||
| const [gaEnabled, setGaEnabled] = useState(false); | const [gaEnabled, setGaEnabled] = useState(false); | ||||
| // Set platform for CSS (skip body safe-area on native - MainActivity handles insets) | |||||
| useEffect(() => { | |||||
| if (Capacitor.isNativePlatform()) { | |||||
| document.body.setAttribute( | |||||
| 'data-platform', | |||||
| Capacitor.getPlatform(), | |||||
| ); | |||||
| } | |||||
| }, []); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| // Initialize Google Analytics | // Initialize Google Analytics | ||||
| GA.init().then(enabled => { | GA.init().then(enabled => { | ||||
| setGaEnabled(enabled); | setGaEnabled(enabled); | ||||
| }); | }); | ||||
| // Detect if we're in transaction mode (URL has parameters) | // Detect if we're in transaction mode (URL has parameters) | ||||
| const hasUrlParameters = window.location.hash.includes('?'); | const hasUrlParameters = window.location.hash.includes('?'); | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||