Skip to content

fix(splash): stop the web splash from showing a second time inside the Android app - #3

Merged
PDFly-source merged 2 commits into
mainfrom
fix/brand-splash-native-suppression
Nov 12, 2026
Merged

PDFly-source merged 2 commits into
mainfrom
fix/brand-splash-native-suppression

Conversation

@PDFly-source

Copy link
Copy Markdown
Owner

Why

The owner-recorded 2.3.0 startup (167200.mp4, ~5.2–6.1 s) shows a second splash after the native NiramaySplashView retires: a blank cream screen with two broken-image icons, which then fades before the real welcome.

Traced to this repository, not the APK. The WebView loads https://pdfly-source.github.io/niramay/symptoms/, and app/layout.tsx:131 mounts this site's own BrandSplash. Two things made it a defect inside the app:

  1. It ran again after the native splash, so the app showed two splash sequences.
  2. Its images were hard-coded root-absolute (/brand/splash/mark.jpg), which 404s under the /niramay base path. naturalWidth is 0 for both, so the overlay rendered as an empty canvas with two broken-image placeholders.

Reproduced on live production before the change: 404 /brand/splash/mark.jpg, 404 /brand/splash/wordmark.jpg, splash mounted with both images at naturalWidth 0.

What changed

  • components/brand/BrandSplash.tsx
    • New isNativeShell() reads the wrapper's AppMintlyNative.isNativeApp() bridge. The wrapper injects it with addJavascriptInterface() before any URL loads, so the check runs at module load and again during the first render: BrandSplashMount returns null in the app, so BrandSplash is never mounted, never rendered, never faded. No CSS/opacity hiding.
    • Fail-open: a missing, partial or throwing bridge falls back to showing the web splash, so browsers and the PWA are unaffected.
    • Artwork now resolves through NEXT_PUBLIC_BASE_PATH (/niramay/brand/splash/...), matching how NiramayLogo already builds URLs. Dev (empty base path) still resolves to /brand/splash/....
    • BrandSplash's own design, timing, animation and reduced-motion CSS are untouched.
  • app/layout.tsx — mounts BrandSplashMount instead of the raw component (one import, one element).
  • scripts/test-brand-splash.ts + npm run test:splash — new regression test.

Verification

Component/unit test: 21/21 (npm run test:splash), including a real renderToStaticMarkup of the mount point with a stubbed bridge (suppressed) and without it (unchanged).

Headless Chromium against the built preview (NEXT_PUBLIC_BASE_PATH=/niramay, served under /niramay): 15/15

Check Result
native: no web splash at first paint / at 800 ms / at 3 500 ms 0 elements
native: no splash <img> in the DOM none
native: real app content renders immediately "Welcome to Niramay…"
native: no broken /brand/ requests none
native: no web splash on warm relaunch 0 elements
browser: splash still renders, both images decoded mark 420×358, wordmark ok
browser: images resolve under /niramay, zero 4xx pass
browser: dismisses after its window, no second splash on same-tab reload pass

tsc --noEmit clean, eslint clean on touched files, npm run build static export succeeds, npm run test:branding 17/17.

Scope

Website only. No APK rebuild, no catalog change, no release artifact touched. Other apps untouched. The native splash, its artwork bytes, package id and signing identity are unchanged.

Post-merge expectation

Existing Niramay 2.3.0 installs pick this up without reinstalling: GitHub Pages serves the page HTML with cache-control: max-age=600, and the version-based clearCache(true) purge exists only in the AppMintly native-updates build path, so no APK-side action would change the outcome.

AppMintly Agent added 2 commits November 12, 2026 11:36
The app's WebView page ships its own BrandSplash and mounts it in the root
layout. Inside the AppMintly wrapper that produced a second splash after the
native NiramaySplashView retired: the component's images pointed at
/brand/splash/*.jpg, which 404 under the /niramay base path, so it rendered as a
blank cream screen with two broken-image icons before DisclaimerModal showed.

BrandSplashMount consults the AppMintlyNative bridge synchronously during the
first client render (the bridge is injected before any URL loads, so the check
runs before BrandSplash is created) and returns null in the app. The web splash
still ships unchanged for browser and PWA visitors, and its artwork now resolves
against the deployed base path instead of the domain root.
scripts/test-brand-splash.ts renders the real mount point against a stub
AppMintlyNative bridge (21 checks): suppressed in the app, unchanged in a
browser, artwork URLs follow NEXT_PUBLIC_BASE_PATH, and a throwing or partial
bridge fails open to the web splash instead of breaking the page.
@PDFly-source
PDFly-source merged commit cfddef0 into main Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant