cordova-plugin-splashscreen icon indicating copy to clipboard operation
cordova-plugin-splashscreen copied to clipboard

Welcome message

Open mghayour opened this issue 5 years ago • 6 comments

Feature Request

I need a welcome message in splash screen, a simple text that could be changed in application logics

Motivation Behind Feature

We have about 3s to 5s time in splash screen that user waits to load app, we can show a usefull message during this time. Some example messsages could be (assume that Mahdi is name of end user):

  • Welcome Mahdi
  • Pro version licencesd to Mahdi
  • Licenced to Mahdi
  • Happy new year
  • New version is available
  • Happy birthday Mahdi 🎉 And so on ...

Feature Description

We have similar thing in other apps splash screens, for example:

intellij idea splash screen: (Licenced to user text) image

My application (Pasokhplus, licenced to user text in persian language) photo_2020-05-28_08-44-53

How it works

After app loaded completely, you can set a welcome text inside application logics, that message will save inside plugin and on the next start user will see that before application load.

Alternatives or Workarounds

Alternate solution might be generate splash images inside application code and change it dynamicly, that i think its not a good solution (and i dons know it works or not) I implement this inside my project, and i use it right now, users are happy with that. Code works correctly in android, i want to share it to community 😃

mghayour avatar May 28 '20 04:05 mghayour

I will make pull request tonight or tomorrow, let me know if you will be happy with this :)

mghayour avatar May 28 '20 04:05 mghayour

Thank you for your feature request. I'm going to explain couple of concerns I have, and then provide an alternate approach at the end.

  1. Splashscreens do launch before any app native code is launched. It's not recommended to even add text because you cannot localize it. This means you would need to start with a bare launch screen.

  2. its my understanding that launch screens are images that appear above everything. So I don't believe native text views can be overlaid on top of a splashscreen?? This would mean the app would need to generate a new image of the appropriate size to use for each time you want to change the text, like you suggested as a workaround.

  3. I think this will add a whole new level of complexity when dealing with fonts and native view behavior that would likely be confusing to most users (because majority of cordova users are really web developers, who are used to dealing with web elements via css).

Next I'll explain my alternate approach, which doesn't solve point 1 (i don't think that is solvable), but it will solve points 2 and 3.

If they want a dynamic loading screen, application developers can split chunk their application so that a loading screen can be built and executabled independently from the rest of the app. This can be done when using tools such as webpack. Https://portal.totalpave.com is an example of where i used this technique. Where I have a mini app that includes just what it needs to build a splashscreen so that it's quick to load and render, then it proceeds to load in the rest of a rather large framework. Because this would just simply be part of the webapp, you would have full control using standard html and css features over how your splashscreen looks like.

How does fit with the native splashscreen?

You can intelligently control when to hide the native splashscreen. You can disable the auto hide so that you have full control when to hide the splashscreen. Once you have the web splashscreen built with your text and everything else you want, then you can hide the native splashscreen. If the web splashscreen is built to mimic the native splashscreen, to the app user, the text would just appear.

I understand that this kind of turns this feature request back at the cordova user, but I think it would be very difficult to build this feature in a generic way to accommodate everyone needs with their choice of font families and styles, sizing, positioning, etc. And something like this can be pretty easily implemented in the webapp itself, where they get all their css features for their font styling and positioning and avoids us from "re-implementing the wheel".

breautek avatar May 28 '20 12:05 breautek

@breautek Thank you for your comment These are my anwers to your concerns

  1. Thats true, you can not localize or customize text during splash screen, but after the app launched, we can do it, so we save our message somewhere, on the next launch, saved message will show to the user. (so on the first lunch we have no any text in splash screen, and at the next lunch we have our localized text)

  2. It could happen (at least on Android layout), you can have a text field above image. so "NO" we dont need to generate images each time, a simple text field is enough

  3. I undrestand that you want to avoid complexity, a simple text field with default system font is enough! we dont need font (at least at this version) and there is no problem with font size This is how user can use this feature:

if (!proversion) {
    navigator.splashscreen.setText("",12); // (text, font size)
} else {
    navigator.splashscreen.setText("Licenced to" + userfullname, 16);
}

As you see, there is no complexity or need to css or ..

I undrestand that you want to give more freedom to developers, but it dosent need! "Simple is the best" just a text field at center bottom of splashscreen is enough, i think lunching another small app before orginal application with the exact same splash image would have more complexity than this solution!

mghayour avatar May 29 '20 00:05 mghayour

I think it would be very difficult to build this feature in a generic way to accommodate everyone needs with their choice of font families and styles, sizing, positioning, etc.

You are right, in "generic way" it could be difficult, but i think a small solution will cover 80% of needs, custom font doesn't need, font size implemented, and about positioning, it could be implemented but i think doesn't need for first version of this feature, also color could be implemented easily. (do we need other things about a text field !?)

mghayour avatar May 29 '20 00:05 mghayour

Hi @mghayour ,

I'm also interested in this. Did you find a way to add text to a splash screen?

namenotrequired avatar Jun 18 '21 08:06 namenotrequired

For android, I don't think this is possible anymore at all because we are now using Android 12 splashscreens.

The rationale of using Android's new splashscreen system is because it is basically enforced moving forward. For older android devices, we use a compatibility library provided by Android to patch in support for the Android splashscreen API.

This API is pretty limiting, where only the background color and an app icon can be supplied to the splashscreen.

A branding image, which will be placed near the bottom of the splashscreen, can be provided. So it may be possible to provide an image that contains such text, but it is still an image. Therefore it cannot be dynamic to display a "Licensed to" text, and if it should display a version, the image would need to be updated on every version release.

Additionally, the branding image is buggy inside the current cordova implementation and the branding image is not implemented in the compability library so branding images won't be shown on older devices.

None of these are really good solutions, but it's the best solution given the native APIs available to us (at least on the Android side). So my initial thoughts on the alternative solution I think still stands.

It may be possible to do such thing on iOS (Not really an iOS expert, but I believe there are opportunities to dynamically add UI on top of the splash screen), but if a feature cannot be implemented in both platforms, then from a Cordova standpoint, then I feel like we (cordova maintainers) should refrain adding the feature unless if it is critical for the function of the platform.

breautek avatar Sep 09 '22 18:09 breautek

This request is being closed as stale and not planned. Please refer to the comment above for more detailed information regarding the reasons behind the possible limitations.

erisu avatar Jun 07 '23 11:06 erisu