hospitalrun-frontend icon indicating copy to clipboard operation
hospitalrun-frontend copied to clipboard

Implement PWA "Splash" Page

Open jackcmeyer opened this issue 4 years ago • 11 comments

🚀 Feature Proposal

HospitalRun can be "downloaded" as a progressive web app.

When the application loads, it displays a white screen. To provide a more native-like experience, the application should show a splash page while it is launching.

Example

https://medium.com/@applification/progressive-web-app-splash-screens-80340b45d210

We can use this logo for the splash page: https://github.com/HospitalRun/design/blob/master/logo/icon/icon-on-transparent.png

jackcmeyer avatar Jul 12 '20 23:07 jackcmeyer

Could I be assigned to work on this issue?

petreyus avatar Jul 22 '20 21:07 petreyus

Hi @jackcmeyer If no one else is looking at this I'm happy to take a look at it! 🙂

Tomastomaslol avatar Aug 10 '20 23:08 Tomastomaslol

I resized the image with a tool so I have the necessary pictures. Also, I found this: https://github.com/crazycodeboy/react-native-splash-screen

I wanted to solve it without using it though. Would appreciate some help. I am pretty new to mobile dev.

petreyus avatar Aug 11 '20 00:08 petreyus

@Tomastomaslol can you help @petreyus?

matteovivona avatar Aug 11 '20 07:08 matteovivona

Yeah sure! 🙂

@petreyus

If you haven't done so already I would recommend that you set up the application on your computer using this guide: https://github.com/HospitalRun/hospitalrun-frontend/blob/master/.github/CONTRIBUTING.md#1-check-out-the-hospitalrun-general-contributing-guide-for-how-to

So you are able to test your changes before opening your pull request.

I found this: https://github.com/crazycodeboy/react-native-splash-screen

Unfortunately, I don't think this will be of much help. This package would allow you to add a splash screen to a react-native application and I don't think it would work in a progressive web app using React.

So instead of using the react-native-splash-screen library, I would recommend you to:

  1. Look at code example in this article https://medium.com/@applification/progressive-web-app-splash-screens-80340b45d210
  2. Add the images you generated to public/splash-screen-images
  3. Add a reference to the icons you generated in the <head> tag in the applications index file. ( See: https://github.com/HospitalRun/hospitalrun-frontend/blob/master/public/index.html) Something similar to this:
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-640x1136.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-750x1294.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-1242x2148.png" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-1125x2436.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-1536x2048.png" media="(min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-1668x2224.png" media="(min-device-width: 834px) and (max-device-width: 834px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="%PUBLIC_URL%/splash-screen-images/launch-2048x2732.png" media="(min-device-width: 1024px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">

Tomastomaslol avatar Aug 11 '20 11:08 Tomastomaslol

@Tomastomaslol

I have the code base working previously (took me a little time not going to lie), and I have the images located in public as well.

So just adding that snippet into the head tag on index.html is all that's needed?

No additional onLoad logic or anything?

I figured that code snippet above covers most IOS devices with all the correct aspect ratios...

Thank you for explaining it to me really appreciate it!!

petreyus avatar Aug 11 '20 17:08 petreyus

is this already works? how to test it?

gaweki avatar Sep 09 '20 02:09 gaweki

I'm interested in working on this.

hd-genius avatar Dec 01 '20 02:12 hd-genius

I'm still interested in picking up this work if no one else is currently working on it.

hd-genius avatar Dec 04 '20 00:12 hd-genius

go for it @roy-stewart!

jackcmeyer avatar Dec 05 '20 06:12 jackcmeyer

It looks like the splash screen has already been implemented. I noticed that the logo.png, the correct apple-touch-icon link, manifest.json, and the link to manifest.json have all been previously added.

hd-genius avatar Dec 19 '20 01:12 hd-genius