- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스) - Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포 - 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
2.5 KiB
TypeScript
83 lines
2.5 KiB
TypeScript
import { requireOptionalNativeModule } from 'expo-modules-core';
|
|
|
|
const SplashModule = requireOptionalNativeModule('ExpoSplashScreen') as {
|
|
preventAutoHideAsync: () => Promise<boolean>;
|
|
hideAsync: () => Promise<boolean>;
|
|
} | null;
|
|
|
|
let _userControlledAutoHideEnabled = false;
|
|
let _preventAutoHideAsyncInvoked = false;
|
|
|
|
/**
|
|
* Expo Router uses this internal method to ensure that we can detect if the user
|
|
* has explicitly opted into preventing the splash screen from hiding. This means
|
|
* they will also explicitly hide it. If they don't, we will hide it for them after
|
|
* the navigation render completes.
|
|
*
|
|
* @private
|
|
*/
|
|
export async function _internal_preventAutoHideAsync(): Promise<boolean> {
|
|
if (!SplashModule) {
|
|
return false;
|
|
}
|
|
|
|
// Memoize, this should only be called once.
|
|
if (_preventAutoHideAsyncInvoked) {
|
|
return false;
|
|
}
|
|
_preventAutoHideAsyncInvoked = true;
|
|
|
|
// Append error handling to ensure any uncaught exceptions result in the splash screen being hidden.
|
|
// This prevents the splash screen from floating over error screens.
|
|
if (ErrorUtils?.getGlobalHandler) {
|
|
const originalHandler = ErrorUtils.getGlobalHandler();
|
|
ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
hideAsync();
|
|
originalHandler(error, isFatal);
|
|
});
|
|
}
|
|
|
|
return SplashModule.preventAutoHideAsync();
|
|
}
|
|
|
|
/**
|
|
* Used for Expo libraries to attempt hiding the splash screen after they've completed their work.
|
|
* If the user has explicitly opted into preventing the splash screen from hiding, we should not
|
|
* hide it for them. This is often used for animated splash screens.
|
|
*
|
|
* @private
|
|
*/
|
|
export const _internal_maybeHideAsync = () => {
|
|
// If the user has explicitly opted into preventing the splash screen from hiding,
|
|
// we should not hide it for them. This is often used for animated splash screens.
|
|
if (_userControlledAutoHideEnabled) {
|
|
return;
|
|
}
|
|
hideAsync();
|
|
};
|
|
|
|
export function hideAsync() {
|
|
if (!SplashModule) {
|
|
return Promise.resolve(false);
|
|
}
|
|
|
|
return SplashModule.hideAsync().catch((error: any) => {
|
|
// Hide this very unfortunate error.
|
|
if (
|
|
// Only throw the error is something unexpected happened.
|
|
_preventAutoHideAsyncInvoked &&
|
|
error.message.includes('No native splash screen registered for ')
|
|
) {
|
|
return;
|
|
}
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
export const preventAutoHideAsync = () => {
|
|
// Indicate that the user is controlling the auto hide behavior.
|
|
_userControlledAutoHideEnabled = true;
|
|
// Prevent as usual...
|
|
return _internal_preventAutoHideAsync();
|
|
};
|