From 2b9e0d0760793a28fcc3f2720c91b428527988b4 Mon Sep 17 00:00:00 2001 From: Alexander Harding Date: Fri, 15 Nov 2024 23:15:45 -0600 Subject: [PATCH] feat: splash screen hiding is synchronized with app setup (#1727) --- capacitor.config.ts | 3 +++ ios/App/Podfile | 1 + ios/App/Podfile.lock | 8 +++++++- package.json | 1 + pnpm-lock.yaml | 12 ++++++++++++ src/routes/TabbedRoutes.tsx | 7 +++++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/capacitor.config.ts b/capacitor.config.ts index 06829c605f..1c318d2930 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -13,6 +13,9 @@ const config: CapacitorConfig = { resize: KeyboardResize.Ionic, resizeOnFullScreen: true, }, + SplashScreen: { + launchShowDuration: 3_000, + }, }, }; diff --git a/ios/App/Podfile b/ios/App/Podfile index d62b38e0dd..6267933afb 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -19,6 +19,7 @@ def capacitor_pods pod 'CapacitorKeyboard', :path => '../../node_modules/.pnpm/@capacitor+keyboard@6.0.2_patch_hash=2ihcxo2fu55l7b6g5u7feswwlm_@capacitor+core@6.1.2/node_modules/@capacitor/keyboard' pod 'CapacitorNetwork', :path => '../../node_modules/.pnpm/@capacitor+network@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/network' pod 'CapacitorShare', :path => '../../node_modules/.pnpm/@capacitor+share@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/share' + pod 'CapacitorSplashScreen', :path => '../../node_modules/.pnpm/@capacitor+splash-screen@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/splash-screen' pod 'CapacitorStatusBar', :path => '../../node_modules/.pnpm/@capacitor+status-bar@6.0.1_@capacitor+core@6.1.2/node_modules/@capacitor/status-bar' pod 'CapacitorAndroidNavMode', :path => '../../node_modules/.pnpm/capacitor-android-nav-mode@1.0.0_@capacitor+core@6.1.2/node_modules/capacitor-android-nav-mode' pod 'CapacitorApplicationContext', :path => '../../node_modules/.pnpm/capacitor-application-context@1.0.0_@capacitor+core@6.1.2/node_modules/capacitor-application-context' diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index 38a43e1a20..ce5057bb22 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -30,6 +30,8 @@ PODS: - Capacitor - CapacitorShare (6.0.2): - Capacitor + - CapacitorSplashScreen (6.0.2): + - Capacitor - CapacitorStashMedia (2.0.1): - Capacitor - SDWebImage @@ -58,6 +60,7 @@ DEPENDENCIES: - "CapacitorNetwork (from `../../node_modules/.pnpm/@capacitor+network@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/network`)" - "CapacitorPluginSafeArea (from `../../node_modules/.pnpm/capacitor-plugin-safe-area@3.0.3_@capacitor+core@6.1.2/node_modules/capacitor-plugin-safe-area`)" - "CapacitorShare (from `../../node_modules/.pnpm/@capacitor+share@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/share`)" + - "CapacitorSplashScreen (from `../../node_modules/.pnpm/@capacitor+splash-screen@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/splash-screen`)" - "CapacitorStashMedia (from `../../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.1.2/node_modules/capacitor-stash-media`)" - "CapacitorStatusBar (from `../../node_modules/.pnpm/@capacitor+status-bar@6.0.1_@capacitor+core@6.1.2/node_modules/@capacitor/status-bar`)" - "CapacitorTips (from `../../node_modules/.pnpm/capacitor-tips@1.0.0_@capacitor+core@6.1.2/node_modules/capacitor-tips`)" @@ -99,6 +102,8 @@ EXTERNAL SOURCES: :path: "../../node_modules/.pnpm/capacitor-plugin-safe-area@3.0.3_@capacitor+core@6.1.2/node_modules/capacitor-plugin-safe-area" CapacitorShare: :path: "../../node_modules/.pnpm/@capacitor+share@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/share" + CapacitorSplashScreen: + :path: "../../node_modules/.pnpm/@capacitor+splash-screen@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/splash-screen" CapacitorStashMedia: :path: "../../node_modules/.pnpm/capacitor-stash-media@2.0.1_@capacitor+core@6.1.2/node_modules/capacitor-stash-media" CapacitorStatusBar: @@ -123,11 +128,12 @@ SPEC CHECKSUMS: CapacitorNetwork: 8796cf1f1104a00b289957b6150b7c60e1c2a8d3 CapacitorPluginSafeArea: e1eca7f70974f0e270d96f70cd0a5f51523164b1 CapacitorShare: 591ae4693d85686ceb590db8e8b44aa014ec6490 + CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624 CapacitorStashMedia: 10aa96dc5f874c4c27642528a4c327c46792abf2 CapacitorStatusBar: b81d4fb5d4e0064c712018071b3ab4b810b39a63 CapacitorTips: 2087733aea06ec041b210085395ca934c8554907 SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9 -PODFILE CHECKSUM: 4bb941cdad3a08d4337f1a3589da9a7a0f40fd60 +PODFILE CHECKSUM: 4c9660cfea3867fdae44143cfbe378717ec31aa0 COCOAPODS: 1.16.2 diff --git a/package.json b/package.json index 5e63f3070b..393e142fba 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "@capacitor/keyboard": "^6.0.2", "@capacitor/network": "^6.0.2", "@capacitor/share": "^6.0.2", + "@capacitor/splash-screen": "^6.0.2", "@capacitor/status-bar": "^6.0.1", "@github/markdown-toolbar-element": "^2.2.3", "@ionic/core": "npm:voyager-ionic-core@8.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8896c9b0d8..29be2b85b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,6 +58,9 @@ importers: '@capacitor/share': specifier: ^6.0.2 version: 6.0.2(@capacitor/core@6.1.2) + '@capacitor/splash-screen': + specifier: ^6.0.2 + version: 6.0.2(@capacitor/core@6.1.2) '@capacitor/status-bar': specifier: ^6.0.1 version: 6.0.1(@capacitor/core@6.1.2) @@ -995,6 +998,11 @@ packages: peerDependencies: '@capacitor/core': ^6.0.0 + '@capacitor/splash-screen@6.0.2': + resolution: {integrity: sha512-WC0KYZ+ev15up03xs4fTnoTKwBVUSxXsKKQr/8XAncvi/nAG8qrpanW8OlavSC5zF5e1IZZDLsI2GSv0SkZ7VQ==} + peerDependencies: + '@capacitor/core': ^6.0.0 + '@capacitor/status-bar@6.0.1': resolution: {integrity: sha512-Usd9hZZQVAqy+jJfL7jRcYI7dcsxN09Na1yttwdl+F1bk3Ztoukk7CGPDm5VgKUSs53ihQBOy1+sczCACxhNiw==} peerDependencies: @@ -7121,6 +7129,10 @@ snapshots: dependencies: '@capacitor/core': 6.1.2 + '@capacitor/splash-screen@6.0.2(@capacitor/core@6.1.2)': + dependencies: + '@capacitor/core': 6.1.2 + '@capacitor/status-bar@6.0.1(@capacitor/core@6.1.2)': dependencies: '@capacitor/core': 6.1.2 diff --git a/src/routes/TabbedRoutes.tsx b/src/routes/TabbedRoutes.tsx index d69b8844ba..3d0e95afac 100644 --- a/src/routes/TabbedRoutes.tsx +++ b/src/routes/TabbedRoutes.tsx @@ -1,3 +1,4 @@ +import { SplashScreen } from "@capacitor/splash-screen"; import { IonRouterOutletCustomEvent } from "@ionic/core"; import { IonRouterOutlet, IonTabs } from "@ionic/react"; import { useContext, useEffect, useMemo, useRef } from "react"; @@ -36,6 +37,12 @@ export default function TabbedRoutes({ children }: React.PropsWithChildren) { const pageContextValue = useMemo(() => ({ pageRef }), []); + useEffect(() => { + if (!ready) return; + + SplashScreen.hide(); + }, [ready]); + if (!ready) return; return (