vojo/src/app/plugins/launchSplash.ts

22 lines
521 B
TypeScript

import { registerPlugin } from '@capacitor/core';
import { isAndroidPlatform } from '../utils/capacitor';
interface LaunchSplashPlugin {
ready(): Promise<void>;
}
const plugin = registerPlugin<LaunchSplashPlugin>('LaunchSplash', {
web: {
ready: async () => undefined,
},
});
let didRelease = false;
export const launchSplash = {
ready(): Promise<void> {
if (didRelease || !isAndroidPlatform()) return Promise.resolve();
didRelease = true;
return plugin.ready().catch(() => undefined);
},
};