forked from qegj567-cloud/SullyOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
52 lines (47 loc) · 1.73 KB
/
Copy pathApp.tsx
File metadata and controls
52 lines (47 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import { OSProvider } from './context/OSContext';
import { MusicProvider } from './context/MusicContext';
import PhoneShell from './components/PhoneShell';
import BuildBadge from './components/BuildBadge';
import DevDebugPanel from './components/DevDebugPanel';
import VRBroadcast from './components/VRBroadcast';
import WorldBroadcast from './components/WorldBroadcast';
import { isIOSStandaloneWebApp } from './utils/iosStandalone';
import { installDevDebugLifecycleCapture } from './utils/devDebug';
const App: React.FC = () => {
React.useEffect(() => {
// 常驻监听前后台 / 焦点 / 网络事件;抓不抓由 devDebug 的 lifecycle 类勾选决定
installDevDebugLifecycleCapture();
}, []);
const useAbsoluteShell = typeof window !== 'undefined' && isIOSStandaloneWebApp();
const shellClassName = useAbsoluteShell
? 'fixed inset-0 w-full h-full bg-transparent overflow-hidden'
: 'relative w-full bg-transparent overflow-hidden';
const shellStyle = useAbsoluteShell
? { height: 'var(--app-height, 100lvh)', minHeight: 'var(--app-height, 100lvh)' }
: { height: 'var(--app-height, 100lvh)', minHeight: 'var(--app-height, 100lvh)' };
return (
<>
<div
className={shellClassName}
style={shellStyle}
>
<div
className={`${useAbsoluteShell ? 'absolute' : 'fixed'} inset-0 w-full h-full z-0 bg-transparent`}
style={{ transform: 'translateZ(0)' }}
>
<OSProvider>
<MusicProvider>
<PhoneShell />
</MusicProvider>
</OSProvider>
</div>
</div>
<BuildBadge />
<DevDebugPanel />
<VRBroadcast />
<WorldBroadcast />
</>
);
};
export default App;